Variability and Subtyping


The variability of an expression governs the degree of freedom with which the expression may vary during simulation. Variability is a specific property but has clear connections with the notion of data type. The example classes below illustrates the subtyping and variability rules for declaration equations and normal equations.


1 Constants

This is not allowed, since p1 + 2 is not a constant expression



2 Simulation of Constants

Below the error message is shown, after trying to simulate the Constants model.



3 ConstantsCorrect

This is correct, since p1 + 2 has the same variability as p1.



4 Simulation of ConstantsCorrect


5 TestEquations


The equation in
TestEquations is not correct, since b is a discrete time and noEvent(x > 1) is a continuous time expression.



6 Simulation of TestEquations

Below the error message is shown, after trying to simulate the TestEquations model.