Equation vs. Rule vs. Function
‘What is the difference between an
Equation, aRuleand aFunction?’
All three are algebraic expressions, however:
- An
Equationis 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
Ruleis 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
Functionis a parametric function definition that is calclulated whenever used (usingsymbol()notation). For convenience, parameter-free functions are also accessible in plainsymbolnotation.
| 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. |