← All exercises

Hysteresis

medium

Set the output true at the high setpoint and false at the low setpoint to avoid chatter.

What it teaches

Use two different thresholds — one to turn on, a lower one to turn off — so the output doesn't flicker when the input wobbles near a single value. The thermostat pattern: heat kicks on at 18 °C and stays off until it cools to 20 °C.

Inputs and outputs

TagTypeDefaultDescription
In_ValueREAL
Cfg_HighLimitREAL20
Cfg_LowLimitREAL18
Out_ActiveBOOL

Required behavior

  • Out_Active is set to 1 when In_Value is greater than or equal to Cfg_HighLimit.
  • Out_Active is set to 0 when In_Value is less than or equal to Cfg_LowLimit.
  • Out_Active remains unchanged when In_Value is strictly between Cfg_LowLimit and Cfg_HighLimit.