Opened 12 years ago
Last modified 4 years ago
#2152 assigned enhancement
Handle time events efficiently
Reported by: | Martin Sjölund | Owned by: | Karim Adbdelhak |
---|---|---|---|
Priority: | blocker | Milestone: | 2.0.0 |
Component: | Run-time | Version: | trunk |
Keywords: | Cc: | Andreas Heuermann |
Description (last modified by )
The relations
time >= <discrete_expr> time < <discrete_expr>
can be handled as time events without resorting to crossing functions, thus leading to more efficient simulation code (see Modelica Specification 3.2 rev1, sect. 8.5).
We can look for expressions containing only pre(discrete), constant, or parameter expressions. Then it is always possible to calculate the next exact time of this event indicator, by replacing >= (or <) with == and solving for time.
If time is <= current time, no more events occur, otherwise schedule next time event and deal with it as with sample()
Change History (17)
comment:1 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 12 years ago
Priority: | high → blocker |
---|
comment:4 by , 12 years ago
Owner: | changed from | to
---|
comment:5 by , 12 years ago
Description: | modified (diff) |
---|---|
Summary: | Find exact times of time events → Handle time events efficiently |
Changed description to reflect contents more accurately
Merged text with closed duplicate #2224
comment:6 by , 12 years ago
Milestone: | 1.9.0 → 2.0.0 |
---|
comment:8 by , 9 years ago
Priority: | blocker → critical |
---|
comment:12 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:13 by , 7 years ago
Milestone: | 1.12.0 → 1.13.0 |
---|
@lochel, do you think you can take care of this for 1.13.0? It is particularly important to handle the simulation of systems with clocked variables efficiently
comment:14 by , 7 years ago
Cc: | added; removed |
---|
A good test case is reported in #2226
model Test1 discrete Real next_t; discrete Real next_t2; equation when time >= pre(next_t) then next_t = pre(next_t)+1; end when; when sample(0.5, 1.0) then next_t2 = pre(next_t2)+1; end when; initial equation next_t = 1; annotation (experiment(StopTime=10)); end Test1;
Time events are generated by the sample()
operator, but in fact time events could also be generated for the when time >= pre(next_t)
conditions.
This would be very useful to handle delayed transitions in state machine models efficiently.
comment:16 by , 6 years ago
Milestone: | 1.14.0 → 2.0.0 |
---|---|
Priority: | critical → blocker |
I think this definitely needs to be addressed, but not in 1.14.0
comment:17 by , 4 years ago
Cc: | added; removed |
---|---|
Owner: | changed from | to
@Karim, @AnHeuermann, please decide among yourselves who wants to take care of this
Would be good to fix this as soon as possible so we can the new tables implementation. I do believe it is working, but it needs better event detection to work properly.