Opened 12 years ago

Closed 12 years ago

Last modified 7 years ago

#2176 closed enhancement (fixed)

Better error message for missing else in if-equation

Reported by: Per Östlund Owned by: probably noone
Priority: normal Milestone: 1.9.4
Component: Backend Version: trunk
Keywords: Cc:

Description (last modified by Per Östlund)

If-equations with variable conditions must have an else-clause. We detect this, but for a model such as

model VarConditionNoElse
  Real x(start = 0.0), y(start = 2.0);
equation
  if x < 1.0 then
    x = time;
    y = y + x;
  elseif x >= 1.0 then
    x = 1.0;
    y = der(y);
  end if;
end VarConditionNoElse;

we print out an error message like

If-equation with conditions that are not parameter expressions must have the same number of equations in each branch, equation count is {2,2,0} for each respective branch

So it's not very clear that the real error is a missing else-clause. We could improve this by simply printing out a different error for the case where the else-clause is missing.

Change History (4)

comment:1 by Per Östlund, 12 years ago

Description: modified (diff)

comment:2 by Per Östlund, 12 years ago

Resolution: fixed
Status: newclosed

Fixed in r16054.

comment:3 by Dietmar Winkler, 9 years ago

Milestone: Futurepre1.9.4

It doesn't make sense to keep closed ticket in the "Future" milestone that were simply forgotten to assign to the correct milestone in the past.

comment:4 by Martin Sjölund, 7 years ago

Milestone: pre1.9.41.9.4

Removing the pre1.9.4 milestone in favor of 1.9.4.

Note: See TracTickets for help on using tickets.