LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to synchronize the Acquization part and control part?

I have about 20 analog input channels, I need do the
data acquization and dump it to the file. At the same
time, I need check the validity of the data, make sure
no data is out of range, if so, need shut down or open
some components or give alarm information. The thing is
how to sychronize them. I use two parallel while loops,one is for data acquization, one is for regularly
check the inputs. But sometimes, it does not act correctly. The data maybe are too complicated to use
the queue. I am not sure. Any suggestion?
0 Kudos
Message 1 of 23
(3,659 Views)
Hello chenchen,

how is the dataflow in your application and how are the timerelated coherences?
How can acquisition and data-check be done in parallel?
Maybe you should give an example of your app. (attachment)

Lorand
Message 2 of 23
(3,659 Views)
Such like we need measure one temperature channel.
if expected temperature is 120. the upper limit
is 130, the lower limit is 110. If the actual temperature is above the 130, turn off the heater,
if the actual temperature is lower than 110, turn on
the heater.

This is one sample channel, we got aound 20 such
channels and some serial control part(motor). So, I wish can seperate the DAQ part and the control part.
0 Kudos
Message 3 of 23
(3,659 Views)
Chenchen

It's not quite clear to my why you think the data are too complicated for a queue. You can easily send the data to the queue as an array and read the appropriate array elements for further processing since the data that you are sending is just data retrieved from a data acquisition. There are certainly other ways to do this as well, but it would be beneficial to see the code that you have in order to give a more specific answer to your question.

John
Message 4 of 23
(3,534 Views)
Good morning,
take a look at the attachment. This solution with queue and notifier works fine, even with more complicated data.
The benefit is, that in this "multithreading"-app. every loop can be a seperate VI.
The top-control-loop should create the queue/notifier and abort the "wait on data"-functions.

Lorand
0 Kudos
Message 5 of 23
(3,661 Views)
Thanks, Lorand. I use the standard version of
labview 7, so no event structure there. I saw your
idea there using the interrupt. I am still kind of
hesitate to synchronize the acquiziation and control
part. For my purpose, the system is kind of slow, around 20HZ at most, so if I make the control part slower(long wait ) than the acquiztion part, it will be fine, I guess.
0 Kudos
Message 6 of 23
(3,661 Views)
You can set the priority-level or the execution-system for the VIs of a multithreading app. to prefer the data-acquisition.
But only change one setting at a time.
These settings are located in the VI-properties/Execution. Look at LV-help for description.

Lorand
0 Kudos
Message 7 of 23
(3,661 Views)
If you make the control portion (i.e., the data processing portion)of your program slower than the acquisition part of the program then your acquisition will get way ahead of the processing. Depending on the manner in which you are passing data between the portions of the program this will result in either lost data or a buildup of data resulting in a memory leak. I highly suggest the utilization of some type of synchronization for any DAQ process.
0 Kudos
Message 8 of 23
(3,661 Views)
Yes, thats right. But after all I think it will work, if you seperate the analysis- from the control-part and run the analysis-routine as fast as the DAQ-routine (same priority, same thread). Because the serial control (motor) seems to be the crux in this app.
0 Kudos
Message 9 of 23
(3,661 Views)
I wrote a simple program,which inplemented a
simple state machine. In each state, it will stay
there around 5 seconds. In this 5 seconds, it will
check the data once/0.5 second. Please give some
suggestion to synchronize the daq and control(check)
parts. Thanks a lot.
Download All
0 Kudos
Message 10 of 23
(3,661 Views)