Opened 11 years ago

Last modified 11 years ago

#2667 closed defect

Integration with a non-zero initial value plummets at the beginning of the simulation — at Initial Version

Reported by: tmtuomas Owned by: probably noone
Priority: critical Milestone: 1.9.1
Component: Run-time Version: trunk
Keywords: Cc: Lennart Ochel

Description

There's a problem simulating a model which has variables with if then else, ramping values, and integration with initial value != 0. The model attached. The problem is that the value of a variable which integrates zero and has the initial value of != 0, e.g., start=1000 plummets at the beginning of the simulation. When I run the model in OpenModelica-1.9.0-revision-17628, I get correctly:

C:\Data\Desktop\omc190test>C:\OpenModelica1.9.0\bin\omc Model.mos
true
{"C:/Data/Desktop/omc190test/Model","Model_init.xml"}

C:\Data\Desktop\omc190test>Model.exe -output=static_stock
time=10,static_stock=1000

However, when I run the latest nightly (OpenModelica-revision-20160), I get:

C:\Data\Desktop\omc191test>C:\OpenModelica1.9.1Nightly\bin\omc Model.mos
true
{"C:/Data/Desktop/omc191test/Model","Model_init.xml"}

C:\Data\Desktop\omc191test>Model.exe -output=static_stock
time=10,static_stock=2.9802322387695313e-005

Model.mo:

model Model

Real ramp(start=0, fixed=true);
Real out;
Real static_stock(start=1000, fixed=true);

equation

der(ramp) = 1;
out = if ramp > 0 then ramp else 0;
der(static_stock) = 0;

end Model;

Model.mos:

loadFile("Model.mo");
buildModel(Model,startTime=0.0,stopTime=10.0,method="euler",outputFormat="mat",cflags="-O0",variableFilter=".*");

Change History (2)

by tmtuomas, 11 years ago

Attachment: Model.mo added

by tmtuomas, 11 years ago

Attachment: Model.mos added
Note: See TracTickets for help on using tickets.