#1972 closed defect (fixed)
Reinit in when equations with condition initial() should report an error
Reported by: | Adrian Pop | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | high | Milestone: | 1.9.0 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: | Lennart Ochel, Jens Frenkel, Willi Braun |
Description
From Lennart (lochel) comment on bug #1688:
reinit used in a when initial() clause:
when initial() then reinit(x, u); end when;
That makes no sense and is not valid.
Perhaps, that should be caught in the Frontend?
Change History (6)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
in such y case you can with
when initial() then
x = u;
end when;
The problem is that inital() does not generate an event.
comment:4 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:5 by , 12 years ago
Incredible how many occurrences of this when initial() then reinit we had in the testsuite :)
The same model several times with some differences.
comment:6 by , 12 years ago
Here goes something wrong. It is not possible to replace or even convert a reinit into an assignment. If that were possible, there were no reinit at all.
If you would like to assign some value to a state, use an initial equation/algorithm or binding. In facts, when initial() is not the same as an initial equation/algorithm.
However, good to see that we can already caught these fals statements in the frontend.
The question is if this really makes no sense.
Say you load "u" from a file table in an initial
equation or algorithm and then in when initial()
you set "x" to it.