Finn's LabVIEW Goldmine:

On-off controller with hysteresis

LabVIEW file (subVI):

SubVI_on_off_with_hysteresis.vi

What is it?

The subVI implements a feedback controller in the form of an on-off controller with hysteresis. It can be used as an alternative to a PID controller.

Inputs to the function:

  • y_sp is the setpoint.

  • y_meas is the process measurement.

  • u_on is the value of the controller output, u, when the controller is in the On state.
  • u_off is the value of the controller output, u, when the controller is in the Off state.
  • h is the amplitude of the hysteresis. The state of the controller switches from Off to On when the control error, e, becomes larger than h. The state of the controller switches from On to Off when the control error, e, becomes smaller than -h.

Output from the function:

  • u which is the controller output (control signal).

How to include this subVI in your block-diagram?

  1. Save the subVI LabVIEW file to any folder (do not open it directly in LabVIEW).

  2. Add the subVI to the block-diagram of your VI via Functions Palette / Select a VI etc. Then connect its inputs and its output to the proper signals (wires) in the block-diagram. (It is not necessary to copy the block-diagram code of the subVI explicitly into your program.)

Why this subVI?
The reason why I have developed this subVI, is that the only On-off controller with hysteresis in LabVIEW assumes you implement your controller in a Simulation loop. This is an unfortunate restriction (at least for me), since I prefer implementation in While loops rather than in Simulation loops, due to some experiences with crashes and block diagrams that can not be opened when using the latter. Also, the computational overhead ("administration") is relatively large with Simulation loop.

[Finn 's LabVIEW Page]


Updated 30 August 2016 by Finn Aakre Haugen