On-off controller
True while the measurement is below the reference minus half the bandwidth; false above plus half.
- signal
- Boolean
- Modelica Standard Library
- 3 ports
- 1 parameter
onOffControllerLibraryLogicDescription
A bang-bang controller with a band around a reference. The output turns true when the measurement falls below reference − bandwidth/2 and turns false when it reaches reference + bandwidth/2. Inside the band it keeps its previous value.
The output starts false. Use it for heaters, pumps, and other on/off actuators.
Example
Thermostat An on-off controller switches a 100 W heater to hold a room at 50 °C.
Also in this example:ConstantHeat capacitorThermal conductorFixed temperatureHeat flow sourceTemperature sensorBoolean to real
Ports
Inputs 2
-
ref
referenceSetpoint.
-
meas
uMeasured value, in the same units as the reference.
Outputs 1
-
y
Actuator command: true means on.
Parameters
-
Bandwidth
bandwidth0.1≥ 0
Total width of the band around the reference, 0 or more. 0 gives a plain comparison, u < reference.
Equations
y = (y⁻ ∧ u < reference + bandwidth/2) ∨ (u < reference − bandwidth/2) y⁻ is the value just before the current event; y⁻ = false at t = 0.
Implementation
Modelica.Blocks.Logical.OnOffControllerAssumptions and limitations
- The output is true when the measurement is low, so it suits heating-type actuators. For cooling, invert it with NOT.
Tips
- Convert the output with Boolean to real to drive a Real-valued actuator.
See also
Select a block in Gradara and press F1 to open its page offline.