MORECHEMISTRY.COM::MORE CHEMISTRY ON THE WEB    
Home Member Area Links Events Publications Promotions
 

LabVIEW programming topics - Daemon for alarm indicator


Introduction

Suppose an existing program must be expanded with a number of alarm indicators. These indicators should start to blink when their respective alarm conditions occur and should stay highlighted if the alarm conditions have ceased. A mouse-click on a highlighted indicator, as acknowledgement, should set the indicator to normal.

This functionality can easily be added to an existing program. However, this may introduce an additional loop in an allready heavily coded blockdiagram. One way to avoid an additional loop is to put the loop in a separate VI and lauch it as a daemon (program). The code to lauch a deamon can be placed in a separate VI which can be used as follows:

Theory

In the context of LabVIEW a daemon can be defined as follows: A daemon is a background program that performs some task that may or may not influence a foreground program but which in both cases is supporting that foreground program. Where a foreground program has a user-interface and a background program doesn't have to have a user-interface.

An example of a program that supports another program but that doesn't influence it: Suppose the foreground program measures some physical property and writes the measured data to disk. A background program could make a back-up each time a file has been created and closed by the foreground program. That doesn't influence the foreground program, but it does add some functionality.

An example of a program that supports another program and that does influence it: Suppose the foreground program measures some physical property and writes the measured data to disk after a button has been pressed. A background program could periodically simulate a button press. That obviously influences the foreground program.

In the abovementioned examples the foreground program isn't aware of the background program. Yet a foreground program may even rely on a background program. An example of a program that relies on another program: Suppose a background program controls some physical property. A foreground program could periodically request the background program to change the setpoint of the controlled physical property.

Launching a daemon

Launching a daemon can be as simple as running a normal program. Since a daemon commonly is a background program the front panel should be closed using the following code:

It is more complicated to start a daemon from another program and it's even more complicated to start a daemon with a set of parameters. Starting a daemon can be done using the following code:

The reference shouldn't be closed since that will remove the daemon from memory!

Passing on parameters can be done in several ways. The method described here uses the names of the controls on the front panel of the daemon. The values that can be passed on can be anything, such as an array of references, as shown in the following code:

Obviously this has to be done before the daemon is lauched.

The entire code can be placed in a separate vi which will act as daemon launcher.

Downloads

daemon sample.zip

which includes

  • alarm situation check notify.vi
  • alarm situation daemon launcher.vi
  • alarm situation daemon.vi

Remarks

  • The presented VIs were created with LabVIEW 8.5.1.
  • The caller (or launcher) can close the reference to the daemon after the daemon has created a reference to itself.
  • The path in the daemon lancher has to be adapted to the actual position of the daemon.
  • View the VI hierarchy (Show All VIs) and run the alarm situation check notify VI to check the functionality of the daemon launcher.

Acknowledgement

I thank Paul Rijkers for his tips on implementing the daemon concept.

 


Bart Boshuizen, 2011/03/02

© copyright 2000-2014, morechemistry.com
design by Bb.