Finn's LabVIEW Goldmine:

Integrator

LabVIEW file (subVI):

SubVI_Integrator.vi

What is it?

The subVI implements an integrator based on the Explicit Euler, or Forward, method of discretization. A typical use is shown in Figure 1 (from inside a While loop).


Figure 1

Inputs to the function:

  • u is the input signal that is to be integrated (with time as integration variable).

  • T_step [s] is the time-step of the integration. For integration in real time in a While loop, T_step must be set equal to the cycle time of the While loop.

  • y_max is maximum, or upper limit, of y (the integrator output).
  • y_min is minimum, or lower limit, of y. 
  • y_init is the initial value of y.

Outputs from the function:

  • y which is the output of the integrator, i.e. the value of the time-integral.

How to include the integrator 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.)

Recommendation

When you include the Integrator in a closed loop of functions in the block diagram, LabVIEW may identify the loop as an algebraic loop and therefore insert, automatically, a Feedback node in the loop to break the algebraic loop. I recommend that you place the Feedback node just before the input (u) to the integrator, which is actually the time-derivative of y. The Initializer terminal of the Feedback node can be left unwired (hence the initial value of the time-derivatie is zero, which should be fine). Figure 1 (above) illustrates this.

Why this subVI?
The reason why I have developed this subVI, is that the inbuilt integrators in LabVIEW do not have sufficient functionality for dynamic simulators, or can not be used, or are complicated to use, in ordinary While loops.

[Finn 's LabVIEW Page]


Updated 30 August 2016 by Finn Aakre Haugen