Opened 14 years ago
Last modified 14 years ago
#1359 closed defect (fixed)
OMC doesnot set the initianl values correctly
Reported by: | mohsen | Owned by: | mohsen |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Version: | ||
Keywords: | Cc: | mohsen, |
Description
Consider the below code:
{{{model Tank
Modelica.Blocks.Continuous.TransferFunction G(b={1/A}, a={1,1/T}); Modelica 3.1, y_start = 1/A
parameter Real T = 15; Time constant
parameter Real A = 5;
Real weight_analyt = 1/A*exp(-1/T*time);
initial equation initial equation is not yet supported in OpenModelica
G.y = 1/A;
equation
G.u= if time > 0 then 0 else 1e6;
/*if time <= 0 then
G.y = 1/A;
else
G.u = 0;
end if;*/
end Tank;}}}
The weight_analyt and G.y should be the same. Dymola works fine but omc sets the G.y to zero and does ignoe the if statement.
neither initial equation or the if statement works.
Regards
Mohsen
Suggested workaround:
But the initial equation is handled correctly. The uncommented "if statement" is structural variable and is not supported yet by OpenModelica.