20.6.6.8. Relay
The Relay block switch the output signal between two values specified in the Output at Switch-on and off point values. If the input signal is greater than the Switch-on threshold value, the relay is on. If the input signal is less than the Switch-off threshold value, the relay is off. When the relay is on, the output signal is maintained to the Switch-on value until the relay is off. Similarly, when the relay is off, the output signal is maintained to the Switch-off value until the relay is on. The Switch-on value must be greater than or equal to the Switch-off value.
Dialog box
![../_images/image1781.png](../_images/image1781.png)
Figure 20.112 Relay dialog box
Parameter(s) |
Description |
Switch on point |
Enter the threshold value for switch-on. |
Switch off point |
Enter the threshold value for switch-off. |
Output when on |
The output when the relay is on. |
Output when off |
The output when the relay is off. |
Sample time |
Enter the time interval between samples. |
20.6.6.8.1. Example
We can test the Relay block with the CoLink model shown in the below figure The Sine block is configured to a frequency of 1rad/sec and an amplitude of 1. The Relay block Switch on point is set to 0.001 and Switch off point is set to -0.001. Output when on is set to 1 and Output when off is set to -1. Set solver type to Fixed-Step, discrete (no continuous states), and let End time be 1.
![../_images/image1792.png](../_images/image1792.png)
Figure 20.113 CoLink model
![../_images/image1802.png](../_images/image1802.png)
Figure 20.114 A result from scope