Skip to content

Precise execution order of multiple discrete affect #2745

@baggepinnen

Description

@baggepinnen

When two clocked partitions execute on the same time instant, their respective order of execution matters.
Consider the simple test case in #2744, where an operator that changes clock base for a variable is implemented. An equation like

x(k1) ~ x(k1 - 1) + ClockChange(from = c2, to = c1)(y(k2))

implies that x depends on y, and y should thus be treated as known in this equation. However, the current implementation does not appear to guarantee that the affect of clock c2 which y is associated with runs before that of clock c1.

The equivalent modelica model

model supersample
  Real x, y;
  equation 
  x = previous(x) + superSample(y, 2);
  y = previous(y) + 1;
end supersample;

correctly updates y before x

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions