Gated model

Requirements.Examples.Elementary.Margin.Gated  ยท source

Icon of Gated

WithinBand and GreaterEqual behind a pulsed condition and a delay: the margins in closed form while active, Undefined otherwise

Extends Modelica.Icons.Example

u = sin(2πt / 10 s) against WithinBand (|u| ≤ 0.8, tolerance 0.2) and GreaterEqual (u ≥ −0.5, tolerance 0.5), both behind a condition that is true for the first 5 s of every 10 s and a delay of 1 s: the checks apply on [1, 5) s and [11, 15) s. Asserted at every output point:

  • while the checks apply, the margins are min(u + 0.8, 0.8 − u)/0.2 and (u + 0.5)/0.5 in closed form, and the sign of WithinBand's margin is its verdict; GreaterEqual is satisfied (u is positive on (0, 5) s);
  • while the condition is false and during the delay, both are Undefined, with the margin of the inactive check: the middle of the band for WithinBand (4 tolerances), 0 for GreaterEqual;
  • a ViolationStatistics counts one violation of WithinBand per active phase, u > 0.8 from t1 = asin(0.8)/(0.2π) = 1.476 s to 5 − t1 within the period, a violated fraction of the 8 s in which the check applies (the inactive time does not count), and the worst margin −1 at the peak u = 1.

Copyright © 2026 Model Based Innovation LLC. All rights reserved.

Components and variables

NameTypeDescription
uModelica.Blocks.Sources.Sineu = sin(2 pi t / 10 s)
lowerModelica.Blocks.Sources.Constant-0.5
conditionModelica.Blocks.Sources.BooleanPulsetrue on [0, 5) s of every 10 s
withinBand1Requirements.ChecksInFixedWindow.WithinBand|u| <= 0.8 from 1 s after the condition rises, tolerance 0.2
greaterEqual1Requirements.ChecksInFixedWindow.GreaterEqualu >= -0.5 from 1 s after the condition rises, tolerance 0.5
statisticsRequirements.Verify.ViolationStatisticsStatistics of withinBand1