Finn's LabVIEW Goldmine:
Time-delay
LabVIEW
file (subVI):
SubVI_Timedelay.vi
What
is it?
The
subVI
implements a time-delay. The time-delay can be adjusted during
run-time. 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 delayed.
-
timestep
[s] is the time-step.
For real time time-delay implemented in a While loop, timestep
must
be set equal
to the cycle time of the While loop.
- init_output
is
the value of y, the initial output of the function, that is: the value
of y until the simulation time has passed the time-delay. If you want
the init_output to be equal to the present input (u), you wire
init_output to u.
- timedelay
[s] is
the
time-delay. It can be adjusted by the user during the simulation.
- timedelay_max
[s]
is the assumed maximum value of the (adjustable) time-delay.
timedelay_max is used to set the size of the internal array used to
implement the time-delay in this subVI. It should not be changed during
the simulation.
-
Init
(boolean) can be used in
the
following alternative ways (the first of these can be used in most
applications)
- By connecting a First
Call? function
to the Init
input, y gets value
y_init when the VI starts.
- By
connecting a boolean
terminal (which typically stems from a button on the Front
panel)
to the the Init
input, y can be reset
to init_output at any time by giving the boolean terminal a
True
value
(typically by clicking a button).
Outputs
from the function:
How
to include the Time-delay in your block-diagram?
-
Save
the subVI LabVIEW file to any folder (do
not open it directly in LabVIEW).
-
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 inbuilt time-delay functions 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
|