Conditional Equations with if-Equations

Modelica can be used for expressing hybrid models, i.e. models with mixed continuous and discrete parts. if-equations or if-expressions are used for conditional models with different behavior in different operating regions. The conditional equations may contain continuous-time expressions. The elseif-part is optional and can occur zero or more times. The else-part is also optional and can occur at most once. There is a constraint regarding the number of equations in each part of an if-equation: If-equations for which the conditions have higher variability than constant or parameter must include an else-part. Each branch (then-, elseif-, and else-parts) must have the same number of equations.

The model
Cardinality Resistor contains a conditional if-equation with a condition that is a parameter expression (the built-in function cardinality has parameter variability), i.e. the condition does not change during simulation.

1 IfEquation

The if-equation below specifies different equations for the variable y in three different operating regions, limiting values of y such that: uMin <= y <= uMax.

2 Simulation of IfEquation

Here the simulation of IfEquation is shown.