﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2667	Integration with a non-zero initial value plummets at the beginning of the simulation	tmtuomas	probably noone	"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="".*"");

"	defect	new	normal	1.9.1	Backend	trunk			
