Using the Check Static Gap block, you can check if an input signal enters an unchanging gap of values.
In this example, the Check Static Gap block compares the value of a Sine Wave block to the values entered in the Upper bound and Lower bound parameters, which are
0. The Constant blocks, labeled Upper Bound and Lower Bound, illustrate these parameters in the Scope block but do not affect the parameter values. The Check Static Gap block checks if the value of the input signal is less than the Lower bound value or greater than the Upper bound value. If it is, the block asserts
true (1). Because the Output assertion signal parameter of the block is selected, the block outputs the assertion value. Run the simulation to observe the model output.
At the start of the simulation, the Check Static Gap block outputs
0 because the value of the Sine Wave block is less than the Upper bound value. At a time of
0.52, the sine wave exceeds
0.5. The Check Static Gap block recognizes this change and outputs
1. When the time reaches
2.62, the sine wave falls below the Upper bound value and the assertion is
false. When the time reaches
3.14, the sine wave falls below the Lower bound value. The Check Static Gap block recognizes this change and outputs
1. The output stays at
1 until the time is
6.28, when the sine wave then exceeds the Lower bound value. This pattern repeats until the simulation end time.