LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Data acquisition in a state machine

I've recently learned how to implement state machines, but I have a question that I haven't been able to find an aswer to.

 

Question:

How do I record uninterupted data (presently i'm using the DAQ assistant to record a single channel at 10kS/s at 1kS intervals) without interfering with my state machine?  

 

Background:

I have a time sensitive test setup (measuring pressure in a rocket chamber), and I'm using labview to both record a single pressure transducer as well as operate the valves (O2, N2, igniter, etc).  I'm using a state machine Labview architecture (just learned how).  Presently, the DAQ assistant sits in the "Idle" state, and timers (valves need to be turned on at specific times) and manual buttons control when the other states are activated.  I have a 10ms timer controlling how often each state is run, and this is the root of my concern.  

 

Main concerns:

I'm worried that:

1)  I'm forced to change my data recording to 10ms intervals to match the 10ms timer, and

2)  The 10ms timer will interrupt my data recording when it's in another state.  

It's very important that the pressure data is recorded without interruption but that I have high time resolution in controlling my valves as well.

 

Thoughts:

1)  Maybe I put the 10ms timer in the "Idle" state only, and this way the other states won't interrupt the data acqusition

2)  Maybe there is a way to completely isolate the state machine for controlling the valves and the data acqusition.  I'm not sure how to do this.

3)  People on the forums have been talking about Queuing their data acqusition, but I'm not sure how this would benefit my situation.  

 

Thanks to everyone for their feedback!

0 Kudos
Message 1 of 4
(2,885 Views)

Data recording and Data aquisition should be done in seperate loop so that you both operations will be independent.

Use 2 loops one for data aquisition and one for Data recording and use queues to transfer data from aquisition loop to recording loop.

0 Kudos
Message 2 of 4
(2,883 Views)

Does the data acquistion time (samples/rate) need to be equal to the state machine timer?  And if so, what happens when I'm in a state that's not acquiring my data?  Do I just not record for that stretch of time?  Thanks.  

0 Kudos
Message 3 of 4
(2,846 Views)

The data acquisition and state machine timer do not have to be equal, you should however have the same data write rate as you have data read rate, otherwise over the course of long running programs you can build up a large buffer of data to be written using a lot of memory, or lose data.

 

Your data acquisition should be continuous, the most common way of doing this is every time you receive data write it to a queue, then when you are in other states except your data write stage you simply build up data in the queue that is to be written when you enter the write state again.

Think of it as traffic reaching a set of lights:

The traffic represents the data acquisition, there is a constant flow of it always coming through, the state of your state machine is the lights, green is the data write state clearing the queue, red is when in any other state, letting the traffic build up behind the lights.

It is just important that the light is green long enough to let the traffic not build up too much, otherwise you have a jam.

 

EDIT: For the basics of how queues work, look at the Queue basics example from the example finder. 

0 Kudos
Message 4 of 4
(2,823 Views)