Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Error with BooleanPulse

Error with BooleanPulse

I've just started learning Modelica and OpenModelica. I simulated the following code:

Code:


model TestSignal
  Modelica.Blocks.Sources.BooleanPulse mySrc(period=1,startTime=1.5,width=75);
  Boolean y = mySrc.y;
end TestSignal;

It worked in OpenModelica but the output (y, or equivalently mySrc.y) was incorrect. I expected that at the beginning y = false until 1.5 secs at which time y = true and starts the first pulse period: y = false from 0 to 1.5, then y = true from 1.5 to 2.25, then y = false from 2.25 to 2.5, and so on.  However, OpenModelica gave a result where y = true from 0 to 0.75, then false from 0.75 to 1.5, i.e. the first pulse started from 0, not 1.5.

When I used Pulse instead of BooleanPulse, it worked correctly. I checked the source code of the component BooleanPulse and it seems correct. So I think this is either a bug of OpenModelica or an intended behavior that I misinterpreted (but I doubt this second case). I don't have any commercial Modelica tool so I couldn't check.

Re: Error with BooleanPulse

Yes, this is a bug, y and mySrc.y should be false until 1.5.
It might be a problem with initialization. I'll add a bug in our bug tracker so we can fix it.

Cheers,
Adrian Pop/

There are 0 guests and 0 other users also viewing this topic
You are here: