Opened 18 years ago

Last modified 18 years ago

#109 closed defect (fixed)

Sorting not done in When Equations

Reported by: petfr Owned by: petfr
Priority: critical Milestone:
Component: Version:
Keywords: Cc: petfr, haklu

Description


Change History (1)

comment:1 Changed 18 years ago by petfr

Dear Peter:


From Francois Cellier:
I wish to bring the following OpenModelica error to your attention. Ernesto
Kofman simulated the following trivial model in Dymola and OpenModelica:

name: WhenSemantics1

keywords: when semantics

status: correct


Simple when


model timeev

Real x,y,z;

equation

when {sample(1,1)} then

x = time;
z = y - pre(x);
y = pre(x);

end when;

end timeev;

Dymola simulates the model correctly. The variable z always assumes a value of

  1. OpenModelica doesn’t simulate the model correctly. Here, z always assumes

a value of -1. The reason is that the equations inside the WHEN loop ought to
be sorted. Variable y needs to be computed before z. Dymola sorts these
equations, whereas OpenModelica keeps the equations in their original sequence.

Note: See TracTickets for help on using tickets.