MaxRisingFrequency block

Requirements.ChecksInSlidingWindow.MaxRisingFrequency  ยท source

Icon of MaxRisingFrequency

In every sliding time window, the mean frequency of the check rising edges is limited

Extends Interfaces.PartialCheckInSlidingWindowWithBooleanOutput

Syntax

freqLimited = MaxRisingFrequency(check=..., window=..., freqHzMeanMax=...).y;

Description

In any (sliding) time window of length window, the mean frequency of the rising edges of Boolean input check is limited by freqHzMeanMax. Therefore, in any sliding window the following constraint shall hold:

if nRising > 1 then
  freqHzMean = 1/(window/(nRising-1));
else
  freqHzMean = 0
end if;

freqHzMean ≤ freqHzMax

where nRising is the number of rising edges of check in the last time window of length window. The mean frequency over the sliding time window is also provided as additional output signal freqHzMean. If the mean frequency is not larger as freqHzMeanMax, output y is set to true, otherwise to y = false.

Example

The property is demonstrated with the following example calling the block as:

results in

simulation result

Margin

Output margin (present if computeMargin = true, the default) is the signed distance of the check to its limit, freqHzMeanMax - freqHzMean, divided by parameter scale: margin ≥ 0 exactly when the check holds, margin = 1 is one scale of headroom, margin < 0 a violation by that many. Set scale to the requirement's tolerance so that margins of different requirements compare; with the default scale = 1 the margin is the raw robustness in the quantity's unit. The block computes the instantaneous value only; the worst value over a run and the instant it occurs are taken from the stored trajectory. Before the end of the first window the margin is provisional; a consumer takes the worst value over the decided points only. The sliding buffer holds 20 elements, so a margin over a busier window is approximate, as the property is.

Parameters

NameTypeDescription
freqHzMeanMax parameterSI.FrequencyMaximum allowed mean frequency of rising edges in sliding time window

Components and variables

NameTypeDescription
freqHzMeanModelica.Blocks.Interfaces.RealOutputMean frequency of the rising edges in sliding time window