Opened 12 years ago

Last modified 7 years ago

#2176 closed enhancement

Better error message for missing else in if-equation — at Initial Version

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

Description

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 (0)

Note: See TracTickets for help on using tickets.