LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System Exec VI + DAQmx Read VI Synchronization

Hello:

 

I have an old mass spectrometer that can be remotely controlled in LabView by using the System Exec VI. I do this successfully using a BAT file and it creates an XML file which I am then able to read in LabView with a SubVI I created. There is also a thermocouple in the device from which I want to measure a temperature (in volts). The thermocouple is much more modern and I can use the DAQmx VIs successfully. This is all well and good. However, as you might guess, I want to take measurements from the mass spectrometer and the thermocouple simultaneously and continuosly. This is where the problems arise. I don't know how to time both executions together.

 

Below (and attached) is an image of what I have:

image.png

 

Outside of the While Loop I initialize the acquisition for the thermocouple and zero the value of preexisting fields. In the While Loop, I start to execute the System Exec VI and the DAQmx Read VI.  After they are executed, a subVI reads the XML file and displays it on a graph. I have added a 1 second delay afterward. This seems to help but, I know that the System Exec and DAQmx Read VIs are not well timed. They seem to run independently of each other.

 

What I need is to obtain one (1) measurement of temperature in volts while acquiring a spectrum from the mass spectrometer at the same time. The temperature measurement can be an average of the voltage during the acquisition time of the mass spectrometer or a single measurement. Currently, each measurements seem to be taken independently. The measurement from the mass spectrometer takes much longer than the temperature measurement. The mass spectrometer measurements are or one the order of a few seconds while those of the thermocouple are in mS.

 

Please advise on how to synchronize these events. Is there a way to tell DAQmx Read to take one measurement immediately after System Exec VI has finished? Or, is there a way to average the measurements while System Exec VI is executing?

 

Thank you in advance!

Alfredo
Download All
0 Kudos
Message 1 of 3
(2,320 Views)

Several things come to mind:

To read after the system exec is the easiest, just wire the error from system exec to read analog.

There's no need to start and stop the task each loop, do it outside the loop so you'll only do it once.

To get more samples, change read mode to Read array instead of single sample and you can average that array.

For the XML file you could e.g. use a ramdisk to improve performance (with a 1 sec loop it shouldn't be needed).

The sequence frame shouldn't be needed, you have good error wiring to control execution. (Removing the frame would also change the program to attempt to read once a second instead of one second after the other commands.

If you change to read an array you can set it to 1000 and it'll be your clock, no wait needed. 🙂

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 3
(2,285 Views)

Please check out our shipping examples 'Analog Input Synchronization' and  'Analog Input - Voltage and Thermocouple in a Single Task'. This will show how to properly synchronize analog reads. These can be found under Help>>Find Examples >> DAQmx>>Synchronization.

Applications/Systems/Test
National Instruments | AWR Group
0 Kudos
Message 3 of 3
(2,266 Views)