Relay¶
- class pathsim.blocks.relay.Relay(threshold_up=1.0, threshold_down=0.0, value_up=1.0, value_down=0.0)[source]¶
Bases:
BlockRelay block with hysteresis (Schmitt trigger).
Switches output between two values based on input crossing upper and lower thresholds. The hysteresis prevents rapid switching when input is noisy.
When input rises above threshold_up, output switches to value_up. When input falls below threshold_down, output switches to value_down.
Examples
Basic thermostat that turns heater on below 19°C, off above 21°C:
from pathsim.blocks import Relay thermostat = Relay( threshold_up=21.0, threshold_down=19.0, value_up=0.0, value_down=1.0 )
- Parameters:
threshold_up (float) – threshold for transitioning to upper relay state value_up (default: 1.0)
threshold_down (float) – threshold for transitioning to lower relay state value_down (default: 0.0)
value_up (float) – value for upper relay state (default: 1.0)
value_down (float) – value for lower relay state (default: 0.0)
- events¶
internal zero crossing events for relay state transitions
- Type: