Equation vs. Rule vs. Function
‘What is the difference between an
Equation
, aRule
and aFunction
?’
All three are algebraic expressions, however:
- An
Equation
is an equality relation the simulator is expected to keep throughout simulation time. Thus whenever dependent symbols change the referred symbol (symbol-ref
) is recalculated. - A
Rule
is a recurrance relation rule available inSystem
, i.e. the expression may depend on the output symbol. All rules in a system are executed synchronously. The time-step of the system controls the frequency of the execution of the rule. - A
Function
is a parametric function definition that is calclulated whenever used (usingsymbol()
notation). For convenience, parameter-free functions are also accessible in plainsymbol
notation.
Attribute | Evaluation | |
---|---|---|
Equation |
symbol-ref |
Evaluated whenever input symbols change and assigned to the referred symbol (e.g. Property ). |
Rule |
symbol-ref |
Evaluated with the time-step of the enclosing System and assigned to referred symbol. |
Function |
symbol |
Evaluated when symbol / function is used. |