LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to save data received from two parallel asynchronous loops

Hi

I have a JKI State Machine that sends messages through queues to two loops that record data. These two loops take different times to read the data to the main JKI State Machine, I can not predict which is going to end first.

I want to save the data gathered from the two loops in the same file.

How can I do this in a good way (easy to change later) ?

0 Kudos
Message 1 of 3
(922 Views)

I'm currently doing this with data that are not only asynchronous, but "irregularly spaced in time", i.e., not "sampled" data.  An example might be a behavioral study where a red or green light comes on, the subject might raise his/her hand to push a button, and a tone might play (that's really 5 or 6 events: Red Light, Green Light, Lift Hand, Push Button, Play Tone 1, Play Tone 2).  I make what I call an "Event" file that has stores a Cluster (called an "Event Cluster", obviously) of two elements:  the Event (Red On, Green On, Hand Off, Button Press, Tone 1, Tone 2) and a millisecond timer, started when the study begins.  

 

Several loops are looking at the various sensors and actuators that generate or record these events.  Each is equipped with an Asynchronous Channel (I use Messenger Channel Wires, but a Queue would also work) that goes to an Asynchronous Loop recording each Event in the order they are generated (and since each includes its own timestamp, it is easy to verify that the order is correct) and written to a single file (that I call, you guessed it, the "Event File").

 

Analysis consists of reading this file and handling the data as appropriate.  All the data in the file have their own time-stamp, so they can easily be parsed into separate streams when and if appropriate.

 

Bob Schor

0 Kudos
Message 2 of 3
(900 Views)

thanks, I will think about this. My problem is that the user may decide to cancel one or both readings of the independent loops (and I don't want to record its own timestamp)

Regards

0 Kudos
Message 3 of 3
(882 Views)