WithinBand model
Requirements.Examples.Elementary.ChecksInFixedWindow.WithinBand
ยท source
Example for WithinBand (a sine and three constants against a band, always, never and sometimes active)
Extends Modelica.Icons.Example
Check block WithinBand with the band [−0.5, 0.5], each check feeding a Verify.Requirement with violation statistics and margin:
witBan,witBan1andwitBan2check sin(2πt) with the condition always true, always false and true in the first half of every 0.25 s. The first is violated; the second is Undefined throughout, so its requirement is untested; the third is violated in the active windows that the sine spends outside the band.con1,con2andcon3check the constants 0, 0.5 and −0.5, always active: all three are satisfied (both limits are part of the band), the last two with margin 0.
This is the validation model Buildings_Requirements.Validation.WithinBand of
modelica-buildings-requirements
(M. Wetter, LBNL), ported with the block in version 0.13.0. The verdicts are the original's, except that an
inactive check is Undefined (4) where the original reported Undecided (2).
Copyright (c) 1998-2024 The Regents of the University of California, through Lawrence Berkeley National Laboratory,
and contributors; see UsersGuide.BuildingsLicense.
Copyright © 2026 Model Based Innovation LLC (the port). All rights reserved.
Components and variables
| Name | Type | Description |
|---|---|---|
sin | Modelica.Blocks.Sources.Sine | u = sin(2 pi t / 1 s) |
zer | Modelica.Blocks.Sources.Constant | u = 0, inside the band |
zer1 | Modelica.Blocks.Sources.Constant | u = 0.5, on the upper limit |
zer2 | Modelica.Blocks.Sources.Constant | u = -0.5, on the lower limit |
on | Requirements.Sources.BooleanConstant | Always active |
off | Requirements.Sources.BooleanConstant | Never active |
booPul | Modelica.Blocks.Sources.BooleanPulse | Active in the first half of every 0.25 s |
witBan | Requirements.ChecksInFixedWindow.WithinBand | Always active: violated |
witBan1 | Requirements.ChecksInFixedWindow.WithinBand | Never active: Undefined, untested |
witBan2 | Requirements.ChecksInFixedWindow.WithinBand | Sometimes active: violated |
con1 | Requirements.ChecksInFixedWindow.WithinBand | Constant inside the band: satisfied |
con2 | Requirements.ChecksInFixedWindow.WithinBand | Constant on the upper limit: satisfied, margin 0 |
con3 | Requirements.ChecksInFixedWindow.WithinBand | Constant on the lower limit: satisfied, margin 0 |
reqWitBan | Requirements.Verify.Requirement | Requirement on witBan, with statistics and margin |
reqWitBan1 | Requirements.Verify.Requirement | Requirement on witBan1, with statistics and margin |
reqWitBan2 | Requirements.Verify.Requirement | Requirement on witBan2, with statistics and margin |
reqCon1 | Requirements.Verify.Requirement | Requirement on con1, with statistics and margin |
reqCon2 | Requirements.Verify.Requirement | Requirement on con2, with statistics and margin |
reqCon3 | Requirements.Verify.Requirement | Requirement on con3, with statistics and margin |
printViolations inner | Requirements.Verify.PrintViolations | Prints the requirement summary at 1 s |