Opened 12 years ago

Closed 12 years ago

#1960 closed defect (fixed)

Modelica.blocks.sources.pulse wrong simulation results

Reported by: Bruno Scaglioni Owned by: Willi Braun
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 Scaglioni 12 years ago.
Simple model with wrong behaviour

Download all attachments as: .zip

Change History (6)

by Bruno Scaglioni, 12 years ago

Attachment: SourceTest.mo added

Simple model with wrong behaviour

comment:1 by Christian Schubert, 12 years ago

Owner: changed from probably noone to Willi Braun
Status: newassigned

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 by Adrian Pop, 12 years ago

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

comment:3 by Willi Braun, 12 years ago

Keywords: event handling added
Status: assignedaccepted

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 by Willi Braun, 12 years ago

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

comment:5 by Willi Braun, 12 years ago

Resolution: fixed
Status: acceptedclosed

fixed in r14197.

Note: See TracTickets for help on using tickets.