Opened 8 years ago
Last modified 7 years ago
#4301 accepted enhancement
Feature to break the simulation when the steady state has been reached
Reported by: | Adrian Pop | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Backend | Version: | |
Keywords: | Cc: |
Description (last modified by )
Proposed here:
http://stackoverflow.com/questions/42673420/global-measure-to-test-when-steady-state-of-system-is-reached
The first point sounds like a good to have feature and doesn't seem that hard to implement, basically a terminate when all the ders are 0 (within an epsilon) for a number of steps.
For the second point we would need a global operator (that returns true when all ders are within an epsilon interval) that one can use in equations to enable / disable parts of the system.
Attachments (2)
Change History (18)
comment:1 by , 8 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:2 by , 8 years ago
For the second point we could propose an extension of the Modelica Specification with an operator called steadyState(epsilon)
which would return true if each of the ders are < epsilon.
The only issues to think about is what to return during initialization when the ders are zero, etc. I guess we can safely return false for any other phase than simulation.
comment:3 by , 8 years ago
Description: | modified (diff) |
---|
comment:4 by , 8 years ago
Description: | modified (diff) |
---|
comment:5 by , 8 years ago
Component: | *unknown* → Backend |
---|
This is back-end for the first point and front-end and back-end for the second point.
follow-up: 8 comment:7 by , 8 years ago
Somehow this feature is invalidated by sources adding perturbations after derivatives are all zero.
Should this feature check also sources?
follow-ups: 9 10 comment:8 by , 8 years ago
Replying to anonymous:
Should this feature check also sources?
I don't think that this is possible (or necessary). Anyway, can you provide an example to emphasise your point?
comment:9 by , 8 years ago
Replying to lochel:
Replying to anonymous:
Should this feature check also sources?
I don't think that this is possible (or necessary). Anyway, can you provide an example to emphasise your point?
It is possible I guess if you have time events and the event comes after the steady state has been reached. Maybe we could check if there is a time event in the queue and give a warning about it when terminating the simulation.
follow-up: 13 comment:10 by , 8 years ago
Replying to lochel:
Replying to anonymous:
Should this feature check also sources?
I don't think that this is possible (or necessary). Anyway, can you provide an example to emphasise your point?
Consider RL.mo: everything is constant between 4.5 and 5s; But starting from t=5s current starts to change again.
In this case there is a time event in the queue (inside step block)
by , 8 years ago
follow-up: 12 comment:11 by , 8 years ago
When detecting the steady state, do you not also have to make sure that all derivatives *stay* below the threshold? Otherwise, if you have a simple oscillation, would the simple logic not interrupt the simulation as soon as the first maximum of the only state is reached (as there the der
is 0)?
follow-up: 15 comment:12 by , 8 years ago
Replying to Christoph Buchner <buchner@…>:
When detecting the steady state, do you not also have to make sure that all derivatives *stay* below the threshold? Otherwise, if you have a simple oscillation, would the simple logic not interrupt the simulation as soon as the first maximum of the only state is reached (as there the
der
is 0)?
This is a good point. So I could introduce a (user defined) time interval in which all derivatives have to be zero. Would that be a good idea?
comment:13 by , 8 years ago
Replying to anonymous:
Replying to lochel:
Replying to anonymous:
Should this feature check also sources?
I don't think that this is possible (or necessary). Anyway, can you provide an example to emphasise your point?
Consider RL.mo: everything is constant between 4.5 and 5s; But starting from t=5s current starts to change again.
In this case there is a time event in the queue (inside step block)
I see. However, I'm not sure if we should include a check for time events, because it is not possible to do the same for state events, which would make things confusing.
comment:14 by , 8 years ago
Furthermore, it is possible to create systems in which the simulation suddenly "fires-up", without events.
An example (a bit tricky, indeed) is in RL2.mo.
by , 8 years ago
comment:15 by , 8 years ago
AFAIK it is impossible to have oscillations system with a single state and non-oscillating source.
So if all derivatives are zero, they will stay as such, except for cases in which the sources change their values.
Replying to lochel:
Replying to Christoph Buchner <buchner@…>:
When detecting the steady state, do you not also have to make sure that all derivatives *stay* below the threshold? Otherwise, if you have a simple oscillation, would the simple logic not interrupt the simulation as soon as the first maximum of the only state is reached (as there the
der
is 0)?
This is a good point. So I could introduce a (user defined) time interval in which all derivatives have to be zero. Would that be a good idea?
I can take care of the first point.