Check Signal Value with Check Dynamic Gap Block
This example shows how to check if an input signal falls inside a dynamic upper and lower bound using the Check Dynamic Gap block. In this example, the Check Dynamic Gap block compares the value of a tested input signal from a Sine Wave block at the u port to a Ramp block at the max port and a Step block at the min port.
The Check Dynamic Gap block checks if the value of the signal at the max port is less than the value of the test sigal, and if the value of the signal at the min port is greater than the value of the test signal. If it is, the block asserts
true (1). Because the Output assertion signal parameter of the Check Dynamic Gap 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 Dynamic Gap block output is
1. The output stays at
1 until the simulation time is
2.47, when the sine wave falls below the value of the Ramp block. The block output stays at
0 until the simulation time reaches
3.14, when the sine wave falls below the value of the Step block. The Step block activates when the simulation time reaches
3.5, placing the sine wave between the bounds. The Check Dynamic Gap block recognizes this change and sets the output to