PLECS 3.7 Online Help

Assertions

Assertions allow you to monitor arbitrary signals during a simulation and raise a warning or error message if they fail to meet a given condition. For instance, imagine you want to ensure that a certain component operates within a safe temperature range. Once the temperature leaves the defined operating range, you would like to receive a notification. In PLECS, this can be achieved using assertions.

Assertions are conditions that are assumed to hold during the entire simulation of a model. When a condition becomes invalid, i.e. when an assertion fails, PLECS executes a predefined action. The possible actions are:

There is a global model parameter that allows you to override the actions defined locally in the individual assertions (see Simulation Parameters).


Note  In PLECS Standalone, assertions are partially disabled during analyses (see Analysis Tools) and simulation scripts (see Simulation Scripts). In a Steady-State Analysis, assertions are only enabled during the final period shown at the end of the analysis. Assertions are not allowed to pause the Steady-State analysis, but it may be aborted if an assertion triggers an error message. In all other analyses, assertions are entirely disabled. Assertions are not allowed to pause a simulation script, but a script may be aborted if an assertion raises an error message.
PLECS provides two kinds of assertions: built-in assertion blocks and assertions that can be established on components based on their probe signals.

Assertion Blocks

There is one basic Assertion block that interprets its input signal as a boolean value. While the value is non-zero, the assertion holds; whenever the input becomes zero, the assertion fails.

Because assertions are often used to ensure that a signal is within a certain range or below or above a certain limit, PLECS provides additional assertion blocks to directly do this. These blocks are:

Component Assertions

PLECS also provides the possibility to add assertions directly to components. This can be used to define a valid range for any probe signal of a component. To add assertions to a component, open its parameter dialog and click on the Assertions tab. If the parameter dialog of a component does not provide this tab, it is not possible to add assertions.

[Picture]

Use the "+" and "-" buttons to add or remove assertions. In the different columns, the parameters for the assertions can be provided: the probe signal that is limited by the assertion, the lower and upper limits, whether the limits should be inclusive, and the action executed when the assertion fails (see above). If the limits are included (by setting a check mark in that column), the limits themselves are considered part of the valid range, otherwise the signal has to be strictly within the limits. The values -inf and inf may be used to disable the lower or upper limit, respectively.

Locating Assertions

To quickly get an overview of all assertions that are defined in a model, open the Circuit Browser and set the filter option to Show assertions. The Circuit Browser will then list only assertion blocks and components, for which assertions have been defined.