Opened 10 years ago

Last modified 5 years ago

#2664 reopened defect

Probelm with handling "when statement" in an FMU

Reported by: uzahsan@… Owned by: wbraun
Priority: high Milestone: Future
Component: FMI Version: trunk
Keywords: Cc: lochel, Karim.Abdelhak, AnHeuermann

Description

There has been a problem with models involving "when statements". The modelica code of these models work fine but the problem manifests itself once the model is exported as an FMU and then re-imported for simulation.
Running simulations after re-importing the FMU show that when conditions in the model never get fired at all.

Attachments (5)

SimpleTest.mo (1.1 KB) - added by adeas31 10 years ago.
test.mo (835 bytes) - added by adeas31 10 years ago.
script.mos (362 bytes) - added by adeas31 10 years ago.
test_res.png (16.2 KB) - added by Karim.Abdelhak 5 years ago.
test_res.mat (22.5 KB) - added by Karim.Abdelhak 5 years ago.

Download all attachments as: .zip

Change History (24)

Changed 10 years ago by adeas31

Changed 10 years ago by adeas31

Changed 10 years ago by adeas31

comment:1 Changed 10 years ago by adeas31

  • Cc wbraun added

I have attached a test case.

comment:2 Changed 10 years ago by wbraun

  • Owner changed from adeas31 to wbraun
  • Status changed from new to accepted

The fmi-export doesn't work well at all i.e. testsuite/openmodelica/fmi/ModelExchange/testInOutTest.mos is totally wrong. We can't use the ringbuffer for the exported model, since we can't assure the correct handling by the calling programs.

But the issue here is mostly fmi-import, since the function fmiEventUpdate needs a call every time a discrete variable is changing.
Further there are serious problem, with the compile-time and simulation-time with our fmi-import.

comment:3 Changed 10 years ago by wbraun

in r20190 fixed some fmi export issues e.g. testsuite/openmodelica/fmi/ModelExchange/testInOutTest.mos works correctly again.

comment:4 Changed 10 years ago by wbraun

Some of the performance issue are owed by ticket #2669.

comment:5 Changed 10 years ago by sjoelund.se

  • Milestone changed from 1.9.1 to 1.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:6 Changed 10 years ago by sjoelund.se

  • Milestone changed from 1.9.2 to 1.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:7 Changed 9 years ago by sjoelund.se

  • Milestone changed from 1.9.3 to 1.9.4

Moved to new milestone 1.9.4

comment:8 Changed 9 years ago by sjoelund.se

  • Milestone changed from 1.9.4 to 1.9.5

Milestone pushed to 1.9.5

comment:9 Changed 9 years ago by sjoelund.se

  • Milestone changed from 1.9.5 to 1.10.0

Milestone renamed

comment:10 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.10.0 to 1.11.0

Ticket retargeted after milestone closed

comment:11 Changed 8 years ago by sjoelund.se

  • Milestone changed from 1.11.0 to 1.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:12 Changed 7 years ago by casella

  • Milestone changed from 1.12.0 to Future

The milestone of this ticket has been reassigned to "Future".

If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.

If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".

In both cases, a short informative comment would be welcome.

comment:13 Changed 7 years ago by wbraun

  • Milestone changed from Future to 1.13.0
  • Resolution set to fixed
  • Status changed from accepted to closed

This seems to be fixed in the meanwhile.

comment:14 Changed 5 years ago by yahooprimkins@…

This problem seems not fixed. The problem can be seen in the 1.14 official release version.

Changed 5 years ago by Karim.Abdelhak

Changed 5 years ago by Karim.Abdelhak

comment:15 Changed 5 years ago by Karim.Abdelhak

Tested it with 1.16.0~dev-95-g92c3b53 (nightly) and it seems to work fine (see attached files test_res.mat and test_res.png). At it least it does what i expected. Could you attach your results?

I downloaded the three files and just run it from terminal on ubuntu.

EDIT: Ah no ... i looked at the wrong line in the plot, you are right it seems wrong!

Last edited 5 years ago by Karim.Abdelhak (previous) (diff)

comment:16 Changed 5 years ago by Karim.Abdelhak

  • Cc lochel Karim.Abdelhak AnHeuermann added; wbraun removed
  • Milestone changed from 1.13.0 to Future
  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:17 Changed 5 years ago by Karim.Abdelhak

@lochel, @AnHeuermann, could you have a look at this?

comment:18 follow-up: Changed 5 years ago by AnHeuermann

The FMI import is deprecated, use OMSimulator instead.
We should add a warning for this, since it simply doesn't work.
But I am not completely sure how to do this with OMSimulator scripting and OMEdit keeps crashing when I try to use it (see #5785).

Replacing when change(u) then with when u > pre(u) or u < pre(u) then or when u>pre(u) then doesn't help here.

So it is probably no problem regarding the change key-word, or the combination of two condition literals.

Last edited 5 years ago by AnHeuermann (previous) (diff)

comment:19 in reply to: ↑ 18 Changed 5 years ago by casella

Replying to AnHeuermann:

The FMI import is deprecated, use OMSimulator instead.
We should add a warning for this, since it simply doesn't work.

Absolutely!

However, please see the discussion starting in ticket:5621#comment:20

I don't think that banning FMI import is a good idea.

Note: See TracTickets for help on using tickets.