Sine model

Requirements.Examples.Elementary.ViolationStatistics.Sine  ยท source

Icon of Sine

A sine against a limit: four episodes of 10/3 s each, the worst margin -2 between two output points

Extends Modelica.Icons.Example

u = sin(2π t / 10 s) against u shall stay below 0.5 with a tolerance of 0.25: During(check = u < 0.5, rho = 0.5 − u, scale = 0.25), into two ViolationStatistics, one per worst-margin method. The sine exceeds 0.5 from 10/12 s to 50/12 s in every period: four episodes of 10/3 s each in 35 s, 40/3 s in total; which of the four equally long ones is reported as the longest is decided by the last digits of the event times. The worst margin is (0.5 − 1)/0.25 = −2 at every maximum, t = 2.5 s + k·10 s; the continuous method reports it T = 0.01 s late (2.51 s), off by 8·10−5.

The output interval is 1 s on purpose. The stored result has no point at a maximum of the sine, so the least margin over the stored points is (0.5 − sin(0.4π))/0.25 = −1.80 (at 2 s and 3 s); the block finds −2. The ratchet method is within its resolution of 0.01.

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

Components and variables

NameTypeDescription
uModelica.Blocks.Sources.Sineu = sin(2 pi t / 10 s)
alwaysRequirements.Sources.BooleanConstantCondition, always true
during1Requirements.ChecksInFixedWindow.Duringu shall stay below 0.5, tolerance 0.25
continuousRequirements.Verify.ViolationStatisticsWorst margin at the local extrema of the margin (default)
ratchetRequirements.Verify.ViolationStatisticsWorst margin at every new low by more than 0.01