StableSignal model
Requirements.Examples.Elementary.ChecksInFixedWindow.StableSignal
ยท source
Example for StableSignal (a slow and a fast sine, always and sometimes active)
Extends Modelica.Icons.Example
Check block StableSignal with the default limit of 0.01 s-1 on the moving average of |du/dt|, each check feeding a Verify.Requirement with violation statistics and margin:
staSigOnandstaSigPulcheck a slow sine, 0.5 + 0.5 sin(2πt/1200 s), over a 120 s window, always active and active in the first half of every 600 s. Its average speed is at most 0.5·2π/1200 s = 0.0026 s-1: satisfied, after an Undecided first window of each phase.staSigOn1andstaSigPul1check a fast sine, 0.5 + 0.5 sin(2πt/120 s), over the default 360 s window, always active and active in the first half of every 1200 s. Its average speed is (2/π)·0.5·2π/120 s = 0.0167 s-1: violated once the first window is complete.
Every check sets Td = 1 s, the derivative filter's time constant (the default is 0.1 s since version 0.18.0):
the rule of the block's Choosing Td -- at most a hundredth of the window and a tenth of the fastest movement --
gives about 1 s for windows of 120 s and 360 s and sines of 120 s and 1200 s. A smaller Td measures nothing more here
and costs accuracy over the hour: at 100 times the rtol, the fast sine's final average moves by 0.26 % with Td = 0.1 s
and by 0.01 % with Td = 1 s (Modelon Impact, 2026-11-19).
This is the validation model Buildings_Requirements.Validation.StableContinuousSignal 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), and the original's hysteresis of
upperLimit/20 is not set (default h = 0); neither signal comes near the limit, so the verdicts do not depend on it.
The requirements' statistics use method = WorstMarginMethod.Ratchet: the fast sine's window holds a whole
number of periods, so its average and margin are constant up to numerical noise, and the default continuous search
for the margin's extrema would fire an event at every sign change of that noise (35,000 events in this hour).
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 | Slow: a period of 1200 s |
sin1 | Modelica.Blocks.Sources.Sine | Fast: a period of 120 s |
on | Requirements.Sources.BooleanConstant | Always active |
booPul | Modelica.Blocks.Sources.BooleanPulse | Active in the first half of every 600 s |
booPul1 | Modelica.Blocks.Sources.BooleanPulse | Active in the first half of every 1200 s |
staSigOn | Requirements.ChecksInFixedWindow.StableSignal | Slow sine, always active: satisfied |
staSigPul | Requirements.ChecksInFixedWindow.StableSignal | Slow sine, sometimes active: satisfied |
staSigOn1 | Requirements.ChecksInFixedWindow.StableSignal | Fast sine, always active: violated |
staSigPul1 | Requirements.ChecksInFixedWindow.StableSignal | Fast sine, sometimes active: violated |
reqStaSigOn | Requirements.Verify.Requirement | Requirement on staSigOn, ratchet worst margin |
reqStaSigPul | Requirements.Verify.Requirement | Requirement on staSigPul, ratchet worst margin |
reqStaSigOn1 | Requirements.Verify.Requirement | Requirement on staSigOn1, ratchet worst margin |
reqStaSigPul1 | Requirements.Verify.Requirement | Requirement on staSigPul1, ratchet worst margin |
printViolations inner | Requirements.Verify.PrintViolations | Prints the requirement summary at 3600 s |