Opened 8 years ago

Closed 6 years ago

#4158 closed defect (fixed)

OMC does not detect illegal use of pre() in when clause conditions

Reported by: Francesco Casella Owned by: somebody
Priority: critical Milestone: 2.0.0
Component: New Instantiation Version:
Keywords: Cc:

Description

Consider the following test case:

model TestPre
  Real x;
  Boolean b(start = false, fixed = true);
equation
  der(x) = 1;
  when pre(x) > 0.5 then
    b = true;
  end when;
end TestPre;

The model is illegal, because x in the when clause condition is not a discrete-time expression (see Modelica 3.3v1, section 3.8.3), as it appears outside the body of a when clause.

OMC instead accepts the code and, incidentally, does not trigger any event at time = 0.5.

Change History (1)

comment:1 by Francesco Casella, 6 years ago

Component: FrontendNew Instantiation
Resolution: fixed
Status: newclosed

The new front-end now issues the following error message:

[1] 23:27:41 Translation Error
[M: 6:3-8:11]: Argument 1 of pre must be a discrete expression, but x is continuous.

which is the expected behaviour.

Note: See TracTickets for help on using tickets.