Opened 7 years ago
Closed 7 years ago
#4525 closed defect (fixed)
Wrong handling and unclear reporting of redundant initial equations
Reported by: | Francesco Casella | Owned by: | Patrick Täuber |
---|---|---|---|
Priority: | high | Milestone: | 1.13.0 |
Component: | Backend | Version: | v1.13.0-dev-nightly |
Keywords: | Cc: |
Description
Consider the following test case:
model Test Real p1, p2, p3; Real q1, q2, q3; equation der(p1) = q1 + q2; der(p2) = -q2; der(p3) = q3; q2 = 3*(p2 - p1 +1); p1 = 0; p3 = if time > 1 then 1 else 0; initial equation der(p1) = 0; der(p2) = 0; der(p3) = 0; end Test;
The system has three potential states, but due to the algebraic constraints on p1 and p3 it has index 2. Two states will be removed by index reduction, so only one initial equation is necessary. The other two happen to be redundant and consistent.
OMC can figure this out and obtain the correct result. However, the output of the compiler is confusing:
[1] 15:14:55 Translation Notification The following equation is consistent and got removed from the initialization problem: $DER.p3 = 0.0
In fact, two initial equations needs to be removed, why is only one mentioned?
[2] 15:14:55 Translation Warning Assuming redundant initial conditions for the following 2 initial equations: 0.0 = 0.0 $DER.p3 = 0.0
This message is totally obscure. First of all, what does "Assuming redundant initial conditions for the following X initial equations" mean? There is no assumption here, the initial conditions *are* indeed redundant and consistent. Do you mean
"The following initial equations are redundant and consistent, so they will be removed from the initialization problem" ?
In this case, can you please change the message accordingly?
Furthermore, it is not at all clear where 0.0 = 0.0 comes from. I guess we should give some more information about this (e.g. by using the debugging information).
Last but not least, the original problem from which we derived the test case reported here (which we cannot post for confidentiality reasons) also gives out this message:
[1] 14:44:01 Translation Notification It was not possible to analyze the given system symbolically, because the relevant equations are part of an algebraic loop. This is not supported yet.
In fact, the code is generated and the simulation is initialized correctly, so we wonder what this message actually means: what analysis is referred to here, what is the algebraic loop, and more in general whether this is something to be worried about or not.
Change History (3)
comment:1 by , 7 years ago
comment:3 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I now read the following messages upon translating this model:
[1] 14:01:25 Translation Notification The following initial equation is redundant and consistent due to simplifications in RemoveSimpleEquations and therefore removed from the initialization problem: der(p1) = 0.0 -> 0.0 = 0.0 [2] 14:01:25 Translation Warning The initial conditions are over specified. The following 1 initial equations are redundant, so they are removed from the initialization sytem: $DER.p3 = 0.0.
This is now clear and consistent with what I would expect.
Replying to casella:
This is because the second initial equation is simplified by RemoveSimpleEquations to
0.0=0.0
before creating the initial system. So this equation is not removed by the actual initialization method.After partitioning, the
0.0=0.0
equation is one separate partition and the initialization does not know where this equation came from. As there are no variables in the system, it is "assumed" that the equation is redundant.You could influence this behaviour by deactivating RemoveSimpleEquations or ClockPartitioning for both, the general DAE and the initialization DAE. Then the second equation is removed during the initialization process as well.
In OMCompiler/215f1b1 I added a redundancy check after the simplification of the initial equations. If there is a redundant equation, a notification/warning is printed and the consistency is checked. Then the equation is removed and does not appear again while creating the initial system. Furthermore, the removed equations are now only printed with
-d=initialization
activated, otherwise there is just the hint that the system is overdetermined. So there is no more redundant output.The message is indeed weird. What is meant with this message is that the process of analysing the consistency of the initialization system failed because of a loop. I changed the notification, accordingly.