Opened 12 years ago

Closed 12 years ago

#2241 closed defect (invalid)

Problem detecting discontinuity

Reported by: fedebergero@… Owned by: somebody
Priority: high Milestone: 1.9.0
Component: Run-time Version: trunk
Keywords: Cc:

Description

I have the following model

model test
  discrete Real z(start = 0);
algorithm
  when time >= 0 then
      z:=1;  
  end when;
end test;

If I simulate it, variable z does not get assigned 1 when the simulation starts (when time=0).

If I write it like:

model test
  discrete Real z(start = 0);
algorithm
  when time > 0 then
      z:=1;  
  end when;
end test;

(changing Greater equal for greater) it works (z get assigned at the begging of the simulation).

I think both models should behave the same, right?
Regards
Fede

Change History (1)

comment:1 by Willi Braun, 12 years ago

Resolution: invalid
Status: newclosed

No, an event for a when statement is *only* triggered when the condition b changes from false to true. In your first case the condition is true, since startTime=0 => time>=0 => true. So the condition never changes and the variable z is never assigned. That's correct!

Note: See TracTickets for help on using tickets.