Opened 12 years ago
Last modified 7 years ago
#1869 new enhancement
detect completely constant parts
Reported by: | Willi Braun | Owned by: | Willi Braun |
---|---|---|---|
Priority: | normal | Milestone: | Future |
Component: | Backend | Version: | trunk |
Keywords: | Cc: |
Description
We evaluate completely constant parts again an again, this should be avoided by detecting part that are independent on time, states or events. In particular we should avoid that for bigger non-linear loops. For example the non-linear loop below will solved 10000!
model M Real x,y; equation x = sin(y); y = cos(x); annotation (experiment(StopTime=10, NumberOfIntervals=10000)); end M;
Change History (11)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
No, it's not that complicated, but just to check for states and events is not enough.
You need too check the dependencies for all variables that are involved in the system
If all of them are independent of time and states the system should be constant.
comment:4 by , 10 years ago
Milestone: | 1.9.1 → 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:5 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:10 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:11 by , 7 years ago
Milestone: | 1.12.0 → Future |
---|
I tried this with v1.13.0-dev-155-g68350e9
model M Real x,y; function f_sin input Real x; output Real y; algorithm y:=sin(x); Modelica.Utilities.Streams.print("computed f_sin"); //annotation(Inline = false); end f_sin; equation x = f_sin(y); y = cos(x); annotation (experiment(StopTime=10, NumberOfIntervals=100)); end M;
and in fact the string is still written to the output 100 times during simulation.
The detection of the time-invariant variables should be improved.
This should not be too complicated. The systems are seperated by partition independent blocks. If there is a equation system with no state or event it could be solved before starting the integration. Maybe it could also solved during compilation time but therefore code generation or an interpreter is needed.