Opened 7 years ago
Last modified 7 years ago
#4432 new defect
unbalanced if-eqns are not detected
Reported by: | anonymous | Owned by: | somebody |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | *unknown* | Version: | v1.12.0 |
Keywords: | Cc: |
Description
Following model is accepted even it is not really balanced. Also the result is really odd.
model ifeqns Real x(start=-1); Real y1,y2; equation der(x) = sin(time); if x > 0 then y1 = x; y2 = 2*y1*x; elseif x > 0.75 then y2 = 2.0; else y2 = 2*x; y1 = 3*x; end if; end ifeqns;
Change History (4)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
The compilation continuous because of badly nested matchcontinue
statements …
comment:3 by , 7 years ago
PR1957 moves this check to the BackendDAECreate part of the compiler, but I am unsure if there might be some models with parameter conditions that are evaluated in the backend at a later stage that would stop working with this change (in that case, there would need to be a check just before code generation).
comment:4 by , 7 years ago
@lochel - it seems my fears are true. Should we move the check for unbalanced if-equations to the simcode or should we evaluate the conditions during/before BackendDAECreate?
Well, this model is not really accepted. It just passes the frontend, however the issue is detected later on and even the error message is quite helpful:
There are two issues to fix: