# SystemInvariant

This block receives the system invariant equations and transmits them to the numerical solver (CPODES).

The invariant equations provide additional system equations, making the system over-determined.

Models, in particular models representing physical systems, may contain invariants such as energy (conservation of energy).

Signals corresponding to invariants are often monitored to validate the model (if the energy is supposed to be constant and its corresponding signal does not look constant, then the model is not correct).

Other examples are invariants are momentum or the center of mass of a multi-body system in absence of external force.

Usually the invariants are ignored by the system dynamics and the numerical solver.

But the CPODE solver can take advantage of the invariants to improve simulation accuracy and provide improved respect of the invariants.

This feature is used internally in particular for Modelica models, but its usage is not available to the user.

In a general Activate model, an invariant signal can be designated and made available for the usage by CPODE solver by using the SystemInvariant block where the invariant signal is an input.

The CPODES solver receives the signal and adjust the states at each integration step to satisfy the invariant equations.

The invariant equations can have either zero variable , i.e., signa==0, or have a constant value (the value evaluated at the beginning of the simulation.

If the constant invariant value is chosen, the invariant checking can be enabled or disabled during the simulation using the two input activation ports of the block.

## Library

Dynamical

## Parameters

Name | Label | Description | Data Type | Valid Values |
---|---|---|---|---|

| Invariant Choice | The type of invariant value can be chosen, the Invariant signal can be set either to zero or a piecewise constant value. | Structure | |

| Piecewise constant | The invariant signal is required to stay constant during the simulation. The initial value of the invariant signal is taken as the constant value. | Number | 0 |

| Zero value | The invariant signal is required to stay zero during the simulation. | Number | 0 |

| Enable/disable Activation | If the Piecewise constant value is chosen for the invariant type, it is possible to enable or disable the invariant checking. Enable and Disable input activation ports are used for this purpose. If an event activates the Disable port of the block, the invariants are inhibited and they are no longer checked by the solver. If an event activates the Enable port of the block, the invariant checking is resumed by the solver. | Number | 0 |

## Ports

Name | Type | Description | IO Type | Number |
---|---|---|---|---|

| explicit | input | 1 | |

| activation | input | 2*ExplicitActivation |