Opened 12 years ago

Closed 12 years ago

#1960 closed defect (fixed)

Modelica.blocks.sources.pulse wrong simulation results

Reported by: bruno Owned by: wbraun
Priority: high Milestone: 1.9.0
Component: Backend Version: trunk
Keywords: event handling Cc:

Description

In some cases the Modelica.blocks.sources.pulse model has wrong output, the square wave stops evolving after two periods and the output keeps stuck to zero.
See the output "pulse.y" of attached model, the signal should be a square vawe until the end of simulation

Attachments (1)

SourceTest.mo (479 bytes) - added by bruno 12 years ago.
Simple model with wrong behaviour

Download all attachments as: .zip

Change History (6)

Changed 12 years ago by bruno

Simple model with wrong behaviour

comment:1 Changed 12 years ago by cschubert

  • Owner changed from probably noone to wbraun
  • Status changed from new to assigned

It seems to be connected to event handling. Internally the pulse relies on the following when statement

when integer((time - startTime)/period) > pre(count) then
  count = pre(count)+1;
  T_start = time;
end when;

According to -lv LOG_EVENTS the when condition becomes true but never changes back to false. Thus the when is not fired again.
However, the when condition should become false immediately afterwards, since the variable count is modified inside the when equation.

comment:2 Changed 12 years ago by adrpo

This might also be connected with #1959 where it said that "Yesterday the sawtooth block worked, today it runs amok".

comment:3 Changed 12 years ago by wbraun

  • Keywords event handling added
  • Status changed from assigned to accepted

Yes, #1959 and #1960 belongs together. Both relies on same when equation as Christian has pointed out, which generates an events only one time.

comment:4 Changed 12 years ago by wbraun

and both models stopped working with MSL3.2.1, because the models changed from a sample when equation to the one above.

comment:5 Changed 12 years ago by wbraun

  • Resolution set to fixed
  • Status changed from accepted to closed

fixed in r14197.

Note: See TracTickets for help on using tickets.