WhenChanging block

Requirements.ChecksInFixedWindow.WhenChanging  ยท source

Icon of WhenChanging

When condition input has a changing edge, check must be true

Extends Requirements.Interfaces.PartialCheck, Requirements.Interfaces.PartialUncertaintyBand

Syntax

property = WhenChanging(condition=..., check=...).y;

Description

At the time instants where condition has a changing edge, property is set to "BooleanToProperty(check)" (so either Satisfied or Violated) and keeps this value until the next changing edge. At initialization, property = Undefined (not applicable), independently of the value of condition.

Violated, Undecided, and Satisfied are elements of enumeration Property.

Uncertainty band

With useUncertainty = true (version 0.19.0), inputs rhoLow and rhoHigh are rho at the pessimistic and the optimistic end of the checked value's uncertainty interval; output inBand is sampled at each changing edge of condition with y and kept with it until the next: true when rhoLow < 0 ≤ rhoHigh there, the decision could flip inside the interval. See PartialUncertaintyBand.

Example

The property is demonstrated with the following example:

results in

simulation result

Margin

Output margin (present if computeMargin = true, the default) is the signed distance of the check to its limit, the input rho sampled at the edge that decides the property and held with it (the caller writes rho from the check's expression; the default ±1 carries the sign only), divided by parameter scale: margin ≥ 0 exactly when the check holds, margin = 1 is one scale of headroom, margin < 0 a violation by that many. Set scale to the requirement's tolerance so that margins of different requirements compare; with the default scale = 1 the margin is the raw robustness in the quantity's unit. The block computes the instantaneous value only; the worst value over a run and the instant it occurs are taken from the stored trajectory.

Inputs

NameTypeDescription
rho inputRealSigned distance of check to its limit in the quantity's unit, >= 0 exactly when check is true (u - limit for check = u > limit); the default +-1 is uninformative