Opened 10 years ago

Closed 6 years ago

#3101 closed defect (fixed)

Flattening of models using Modelica.Media is very slow

Reported by: Francesco Casella Owned by: Adrian Pop
Priority: critical Milestone: 2.0.0
Component: Frontend Version: trunk
Keywords: Cc: andrea.bartolini@…, dersh@…

Description

The front-end speed performance is now quite good for all models in the testsuite, except for models involving the Modelica.Media library. The most demanding examples of the MultiBody library, namely the EngineV6 and the fullRobot (which used to be very slow in the old days) now only need 10 and 5 seconds to flatten, respectively.

In comparison, an apparently trivial test case such as Modelica.Media.Examples.Tests.MediaTestModels.LinearFluid.LinearWater_pT takes 20 seconds to flatten, which is quite long and four times as much as Dymola. Incidentally, it is quite weird that Modelica.Media.Examples.Tests.MediaTestModels.LinearFluid.LinearColdWater takes only one fifth of that time, as the medium model is basically the same (also Dymola handles this model much faster, for some reason).

The slowest model to flatten in the MSL is Modelica.Fluid.Examples.AST_BatchPlant.BatchPlant_StandardWater, one minute with OMC, 6 seconds with Dymola, 1:10 ratio.

Another interesting test case is ThermoPower.PowerPlants.Simulators.SteamPlant_Sim1, which takes 2 minutes in OMC and 6 seconds with Dymola, 1:20 ratio.

I would suggest to investigate these cases a bit to see if there is some critical path in the way they are currently handled by the front-end.

Change History (8)

comment:1 by Adam Dershowitz <dersh@…>, 10 years ago

Cc: dersh@… added

comment:2 by Per Östlund, 10 years ago

I ran the models through callgrind, and found some small things to optimize (see r24411) which shaved off about 10% on BatchPlant_StandardWater, but didn't do much for the other models. There's not really much that stands out in the profile logs now, the front-end is more of a critical tangle than a critical path.

So the issue is probably just that the front-end isn't very efficient, particularly regarding redeclares.
The front-end needs some major redesigning if we want to make it a lot faster. Unfortunately the Modelica specification doesn't say how flattening should be done, and the Modelica Association seems reluctant to remedy that, so that work is currently on hold.

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

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:4 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:5 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:6 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:7 by Francesco Casella, 8 years ago

Milestone: 1.10.02.0.0
Priority: highcritical

We should check if this problem is solved with the new front-end.

comment:8 by Francesco Casella, 6 years ago

Resolution: fixed
Status: newclosed

For those models that already work with the new front end, the performance improvement is more than tenfold, see e.g. the SteamPipe models with the old and new FE that use the quite involved IF97 water/steam medium model.

Many models using Modelica.Media still do not work with the new front-end, see e.g.#4837, #5019, because of some final pending issue, but there is no reason to believe that also they will benefit by a substantial performance increase.

Note: See TracTickets for help on using tickets.