LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Master Slave, 3 dependent loops

Hey guys,

At first merry Christmas to all!!

 

My concern: (LV 8.2)

 

I want to run 3 dependent, parallel loops!

 

1st Loop: gets data from a bus (I cannot use a delay, otherwise I will miss frames - loop period is about 750ms)

 

2nd Loop: has to get the data from loop 1 and additionally it acquires data from a GPIB and USB interface. Some of data is being displayed on chart. The big condition for this loop is that it has to run synchronic (once a second!). Otherwise the timing on the chart won’t fit with the elapsed test time!

 

3rd Loop: gets all the acquired data (from all interfaces) from the 2nd loop via notification (Master/Slave) in to a buffer and creates a log file (Excel).

(Creating the log file in the 2nd loop needs too long, so the timing of chart delays)

 

-----------------------

 

- I tried Master Slave/Master Slave: 2nd loop is Slave of the 1st and at the same time Master of the 3rd loop.

And I forced the 2nd loop to 1000ms loop period.

According to the LV Basics II book [p. 2-35] it should not work: Both loops are synchronized to the master loop.

But it goes not bad. The end time on the chart and elapsed test time are at the end of the test the same!!

But the chart does not go synchronic, it is "jolty, unsteady", which is an effect from the 1st loop! But the good thing is that the loops are all dependent. No start/stop problems!

 

-If I use local variables to transfer the data from the 1st to the 2nd loop, I get some other bugs about the order of starting the loops, which is an effect on the chart!

I would need a way to start the 1st loop at first and then I can provide the data with a local variable in to 2nd loop.

(Sequences in an additional loop: 1st sequence with the 1st loop; 2nd sequence with the 2nd and 3rd loops as Master/Slave won't work. Total loop time woul be 1,75 seconds) 

Stopping the 1st loop and the others won’t be a problem, I think.

 

Thank you all and a happy, successful new year

Ugur

0 Kudos
Message 1 of 4
(3,715 Views)
Use a graph instead of a chart. In a graph, you plot the entire array of points (both X and Y values) each time, so that you don't have to plot exactly when the data arrives. This way, you can get rid of the third loop and update the UI only every two or three seconds. Here's a very quick example of how to use a graph to simulate a chart.

As an aside, if you really need to use three loops, the correct way is probably to use another queue for the logging loop. You should probably only dequeue when the queue exceeds a certain size.

___________________
Try to take over the world!
0 Kudos
Message 2 of 4
(3,709 Views)

hi,

This XY Graph is awesome... on this way I don't need to care about the timing anymore. thanks a lot.

but I have problems to extend the graph to six plots plus the timebase. I'm doing something wrong, so my array does not fit to the graph. Probably something in the graph's properties has to be changed. Could you pls tell me or modify it for me.

Thank you very much!

0 Kudos
Message 3 of 4
(3,669 Views)
I can't look at your code, but here's a quick example of how it can be done. The context help for the XY graph shows the data type for a multiple plot graph. Additionally, there is an example in the example finder (Help>>Find Examples) which shows how to build several types.

___________________
Try to take over the world!
0 Kudos
Message 4 of 4
(3,632 Views)