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)
Change History (6)
by , 12 years ago
Attachment: | SourceTest.mo added |
---|
comment:1 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → 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 by , 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 , 12 years ago
Keywords: | event handling added |
---|---|
Status: | assigned → accepted |
comment:4 by , 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.
Simple model with wrong behaviour