Opened 14 years ago
Closed 12 years ago
#1489 closed defect (worksforme)
if equation with initial() as condition causes rightless error
Reported by: | Jens Frenkel | Owned by: | Jens Frenkel |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Backend | Version: | |
Keywords: | Cc: | Frenkel, TUD, Adrian Pop, Per Östlund |
Description
The following model causes an rightless IF_EQUATION_UNBALANCED_2 error.
model A
Real x;
Real y;
parameter Real a=3;
equation
der(x) + x = y;
y = time;
if initial() then
x = a;
x = 1;
end if;
end A;
Error: If-equation with conditions that are not parameter expressions must have the same number of equations in
each branch, equation count is {2,0} for each respective branch.
Change History (4)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
No, Modelica has special rules for if initial(), which changes the equation into an initial equation (I believe).
comment:3 by , 12 years ago
Cc: | added; removed |
---|---|
Component: | → Backend |
Owner: | changed from | to
Status: | accepted → assigned |
comment:4 by , 12 years ago
Status: | assigned → closed |
---|
It works now (if you remove one of the equations as it said x=a=3=1...)
But initial() is not constant while the simulation time, so that model is invalid and error is correct.