openmodelicainterest  

Re: start != start

Martin Sjölund
Fri, 05 Feb 2010 03:02:21 -0800

Hi,

I thought someone fixed that bug ages ago. I guess I was wrong. The issue is that OpenModelica will generate events for sample(start,i) at all times start+i*n, for all integers n (including negative numbers!).

The fix is obviously to check that time >= start [-eps]. I have commited the fix and added a testcase for it.

--
Martin Sjölund

Tukaram wrote:
Dear Sirs,

I have this simple model:

--------------

class Building
  parameter Real  offer=1000;
  Real   storage(start=0);
equation
  when sample(1,1) then
      storage=pre(storage)+offer;
  end when;
end  Building;

--------------

It will be simulated with the following commands:

-------------

simulate( Building, startTime=0, stopTime=8 );
plot({storage})

-------------

The Plot shows me plus 1000 on the storage per second (fine) but the
storage starts with a value of 1000 (not fine). I would expect a start
value 0.

What is going wrong? Has someone with more Modelica experience a hint for
me? :-)

Kindly Regards