Ansys Learning Forum Forums Discuss Simulation Embedded Software Understanding causality errors when using `pre` and `last` in a Scade program. Reply To: Understanding causality errors when using `pre` and `last` in a Scade program.

Benjamin Descorps
Ansys Employee

Hello,

Actually, in your model, the activate block compute the output y. But activation of the activate block also depends on the variable y. This leads to a causality error.

If you want to resolve this error, you should add a delay. Example:

type T = enum {a, b, c};
node WhenBlkSample(x: T) returns (y: T last = b)
let
  activate when last 'y match
  | a: y = a -> pre(y);
  | b: y = x;
  | c: -- empty
  returns ..;
tel