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
  • Index
  • » Users
  • » nxtruong
  • » Profile

Posts

Posts

Oct-16-11 20:56:54
An error with the standard BooleanPulse
Category: Programming

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.

  • Index
  • » Users
  • » nxtruong
  • » Profile
You are here: