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 , 10 years ago
Cc: | added |
---|
comment:2 by , 10 years ago
comment:3 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:7 by , 8 years ago
Milestone: | 1.10.0 → 2.0.0 |
---|---|
Priority: | high → critical |
We should check if this problem is solved with the new front-end.
comment:8 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
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.
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.