Opened 7 years ago

Last modified 3 years ago

#4641 new defect

FMU exported from OpenModelica 1.13.0 does not integrate correctly until end of integration interval (time event missing)

Reported by: Andreas Nicolai (andreas.nicolai@… Owned by: Lennart Ochel
Priority: high Milestone:
Component: FMI Version:
Keywords: Cc:

Description

A model has a time event defined at t=1, resulting in a step change of variable x1 from 0 to 1.

The FMU generated from OpenModelica is integrated from 0.99 to 1.00.
The output of x1 remains 0 also at the end of the integration interval, whereas a result of 1 is expected.

See attached modelica model and exported FMU (Linux64).

Attachments (1)

Part1.fmu (1.2 MB ) - added by Andreas Nicolai <andreas.nicolai@…> 7 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by anonymous, 7 years ago

The modelica model causing the problem, see definition of variable x1.


within ;
model Part1

output Real x2;
output Real x1;

equation

x1 = if ((time < 1) or (time < 5 and time > 2)) then 0 else 1;
x2 = if ((time < 3) or (time < 6 and time > 4)) then 0 else 1;

end Part1;`


by Andreas Nicolai <andreas.nicolai@…>, 7 years ago

Attachment: Part1.fmu added

comment:2 by Lennart Ochel, 7 years ago

OpenModelica isn't treating that expression as a time event. I am also not sure if one can expect that x1 changes in the given case from 0 to 1.

comment:3 by Martin Sjölund, 7 years ago

I would agree with @lochel. If noEvent() was used, the output should be 1; otherwise the value is both 0 and 1, and outputting 0 is fine. You can't really detect the zero-crossing if you only integrate until time 1.0.

Using the following could use time-events (but OM does not):

output Real x1(start=0.0, fixed=true);
equation
 when time >= 1 then
   x1 = 1.0;
  elsewhen time >= 2 then
    x1 = 0.0;
  elsewhen time >= 5 then
    x1 = 1.0;
  end when;

In the case that time-events were supported, one could possibly expect that they were triggered (but still not necessarily).

comment:4 by Francesco Casella, 6 years ago

Milestone: 1.13.01.14.0

Rescheduled to 1.14.0 after 1.13.0 releasee

comment:5 by Francesco Casella, 5 years ago

Milestone: 1.14.01.16.0

Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0

comment:6 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:7 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:8 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.