Skip to content

Event generation inside if-statements and use of delay #3722

@henrikt-ma

Description

@henrikt-ma

During test implementation of event-generating delay, I noticed that there should be similar restrictions for delay (event-generating or not) as for event-generating expressions. That is, I think we should extend some of the restrictions we currently have for event-generating expressions, introduced in #3360, to also cover the use of delay (and spatialDistribution), and that we should do this without waiting for delay and spatialDistribution to become event-generating.

Also did we forget about if-statements in #3360? Consider this:

model RelationInsideIfStatement
  Real x;
  Boolean b;
algorithm
  if time > 1.0 then
    x := 2.0;
    b := x > 1.5;
  else
    x := 1.0;
    b := false;
  end if;
end RelationInsideIfStatement;

I don't see a need to add restrictions for if-expressions and if-equations, since it is easy to rewrite such cases using a helper variable.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions