LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multiple timed loop question

I am currently in the planning stage of a medium sized labview application and I need some help figuring out the best approach as application of this size is still new territory for me.

 

I have a daq device monitoring 4 channels, a couple of motor controls, and the goal is to update the GUI with the information from the 4 channels, and also calculations performed on that information, all while letting the user control the motors in real time. All actions and data will be logged and written to disc preferrably in real time.

 

The plan so far is of course to beak them up into subVI's, with the motor controls in 1 subVI, and the monitoring in 1 subVI, calculation performed on the data in another subVI, and a main driver VI that controls the timing of the loops and updates the GUI.

 

I initially thought about using action engines for the data acquisitions, but I realized that using action engines might "freeze" the program when data acquisition is happening, and the user will lose control of the motors. Another approach is the producer/consumer pattern, where the incoming data from the DAQ is consumed to perform calculations and the data logged onto disc. This is the approach that I think I will take, but how do I implement the real time motor controls into this pattern?

 

The idea that I have is to have a main program state machine that handles all user input, and parallel loops that implement the producer/consumer model, and another parallel loop that will update the motor information when it is changing. Is this a suitable approach for an application of this type? Would a queue help the timing aspect in between the parallel loops? As calculations must be performed on each iteration and updated to the gui before the next data point is acquired, at the speed of 100hz. I am having trouble visualizing how to implement multiple loops in separate subVI's and synchronizing the data in between each other.

 

Please advice if there are other better patterns/approach for something like this.

 

Thank you.

0 Kudos
Message 1 of 2
(2,295 Views)

Producer consumer would fit here well. You will also need to use a state machine system for flow control. I would also look into event structures and firing events. If you put all of this together it will make a nice simple upgradable program. This is a system that I helped somone else start.

 

 

Tim
GHSP
0 Kudos
Message 2 of 2
(2,264 Views)