WithinBand model

Requirements.Examples.Elementary.ChecksInFixedWindow.WithinBand  ยท source

Icon of WithinBand

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, witBan1 and witBan2 check 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, con2 and con3 check 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

NameTypeDescription
sinModelica.Blocks.Sources.Sineu = sin(2 pi t / 1 s)
zerModelica.Blocks.Sources.Constantu = 0, inside the band
zer1Modelica.Blocks.Sources.Constantu = 0.5, on the upper limit
zer2Modelica.Blocks.Sources.Constantu = -0.5, on the lower limit
onRequirements.Sources.BooleanConstantAlways active
offRequirements.Sources.BooleanConstantNever active
booPulModelica.Blocks.Sources.BooleanPulseActive in the first half of every 0.25 s
witBanRequirements.ChecksInFixedWindow.WithinBandAlways active: violated
witBan1Requirements.ChecksInFixedWindow.WithinBandNever active: Undefined, untested
witBan2Requirements.ChecksInFixedWindow.WithinBandSometimes active: violated
con1Requirements.ChecksInFixedWindow.WithinBandConstant inside the band: satisfied
con2Requirements.ChecksInFixedWindow.WithinBandConstant on the upper limit: satisfied, margin 0
con3Requirements.ChecksInFixedWindow.WithinBandConstant on the lower limit: satisfied, margin 0
reqWitBanRequirements.Verify.RequirementRequirement on witBan, with statistics and margin
reqWitBan1Requirements.Verify.RequirementRequirement on witBan1, with statistics and margin
reqWitBan2Requirements.Verify.RequirementRequirement on witBan2, with statistics and margin
reqCon1Requirements.Verify.RequirementRequirement on con1, with statistics and margin
reqCon2Requirements.Verify.RequirementRequirement on con2, with statistics and margin
reqCon3Requirements.Verify.RequirementRequirement on con3, with statistics and margin
printViolations innerRequirements.Verify.PrintViolationsPrints the requirement summary at 1 s