Understanding causality errors when using `pre` and `last` in a Scade program.
-
-
November 10, 2024 at 1:27 amfdtsaidSubscriberIn
Scade language referece
, these is a code sample illustrate the causality error for variable y:type T = enum {a, b, c};node WhenBlkSample(x: T) returns (y: T last = b)letactivate when y match| a: y = a -> pre(y);| b: y = x;| c: -- emptyreturns ..;telThe output of the scade compiler (kcg) is as the following*** Causality Error (ERR_400): Causality errorat file ..., line 5, character 7at path whenBlkSample/_:a:y=the definition of shared flow y depends on flow y via the control context ;at file ..., line 2, character 34at path whenBlkSample/y/the definition of flow y depends on shared flow y via a control block ;I still have trouble to understand it. Could anyone give some insight? -
November 12, 2024 at 9:49 amBenjamin DescorpsAnsys 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
-
November 12, 2024 at 10:42 amfdtsaidSubscriber
Hi Benjamn, thank you for your clear illustration!
-
Viewing 2 reply threads
- You must be logged in to reply to this topic.
Ansys Innovation Space
Trending discussions
Top Contributors
-
1216
-
543
-
523
-
225
-
209
Top Rated Tags
© 2024 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.