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
BlockOn-off controllerKindonOffControllerLibraryLogic

Description

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.

Set point 50 °CThermostatHeater 100 WHeaterRoomWalls 2 W/KOutside 20 °CRoom temperature
In Gradara, select a On-off controller block and press F1, then choose Open example. It opens as a new model in My models, ready to run.

Also in this example:ConstantHeat capacitorThermal conductorFixed temperatureHeat flow sourceTemperature sensorBoolean to real

Ports

Inputs 2

  • refreference

    Setpoint.

  • measu

    Measured value, in the same units as the reference.

Outputs 1

  • y

    Actuator command: true means on.

Parameters

  • Bandwidthbandwidth0.1

    ≥ 0

    Total width of the band around the reference, 0 or more. 0 gives a plain comparison, u < reference.

Equations

Modelica
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 Standard Library 4.1.0Modelica.Blocks.Logical.OnOffController
MSL documentation

Assumptions 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.