Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed loop, Synchronization, GPIB, Excel

Hi everybody,

 

I have a problem with my timed loop and synchronization of my data acquisition.

process of my VIs:    the purpose of this program is to monitor an oven using DBusII bus system for communication. A GPIB power meter from Yokogawa (WT200) and two additional Thermocouples with NI cRIO-9211

 I am usind a Master/Slave architecture with notification. Master loop gets the results of the bus. Max possible speed is approx. 245ms but I am slowing down to 750ms to relax the bus commutation.

 

Some of the values are transferred to the Slave loop for wave chart graph and Excel sheet.

Slave has to be a timed loop with 1second. This loop graphs a wave chart with temperatures etc and all the information about the oven, timestamps, stopwatch and the information from GPIB are documented in Excel. All in all 14 columns on a time based Excel table. And I am automatically creating a copy file every minute. (This will be later changed to every 10 min)

 

Problem:  The Slave loop needs about 790ms for one period on the normal way, which is perfect. But for my time based documentation I need to slow it down to 1000ms to get one timestamp per second. Everything sound good, right..:-)

As soon as I select 1000ms for my timed Slave loop the period time goes up to 1800ms. Best value was around 1,0346ms. And after running this program for about 3hours to monitor the oven there is no synchronized result.

(see screenshots in word file pls.)

 

I got this problem after putting the Excel data saving into my Slave loop, to save permanently and to be able to create copy file while running time. Before that I was indexing on my Slaveloop and created an Excel sheet after stopping the VI. On these sheets my timing was perfect (see screenshots in word file pls.)

So the problem has anything to do with creating data in the Loop and the timing....

 

It must be possible to create this data in this 1000ms timed loop without delays because it needs 790ms if it is not timed.

If I choose 965ms for the timed loop it looks okay, but not good enough. I still get sometimes the same timestamp the two times.

 

If someone is interested I can upload a .llb but it won’t run, because of the missing devices etc.

 

I appreciate any help!

0 Kudos
Message 1 of 6
(4,405 Views)
Hi

reading the data and in a parallel loop writing is fast enough.
reading the data and in the same loop writing it should be changed into reading the data and writing the previous data in the same loop.
In that way you use the waiting time for the data to write to excel !

good luck

greetings from the Netherlands
0 Kudos
Message 2 of 6
(4,394 Views)
thanks for your quick reply,
but can you explain it a bit clearly pls?
my conclusion of your suggestion is:
save the data before getting the new data into arrays, which means easily to move the build array part to the left side registers
I ll try!
 
what about this:
Loop A (gets data from bus)
timed Loop B writes the data of Loop A (and gets data from GPIB, Thermorcouples and creates the timer values)
Loop C writes the data of Loop B
 
or do you think a third paralel loop, which is only reponsible to write the whole data in to Excel, which is passed also per notification would be enough??
 
thx a lot
0 Kudos
Message 3 of 6
(4,390 Views)
You are probably right to put excel in a third loop and don't let any MS program interfere with timing.

A small explanation is that in LabVIEw you can use parallel programming also inside a loop.
e.g. a bottom part connected with errorin/out does the Io and put the results into a right side of a shiftregister.
This result comes out the left part of the shift register in the next loop of the while and is then send to another part of the program
in the upper half of the while that also can be using error in/out
the only thing you have to be carefull that the error in/out is not connected to each other except just before the right end of the while by a subvi like merge errors.

if necessary I can draw a small example
greetings from the Netherlands
0 Kudos
Message 4 of 6
(4,382 Views)

Yes I understood the way how you are thinking... but if you don't mind a draw would be very nice to make sure about the error in/out

ok, what I have found out is, the Master loop has to be slowed down (or a timed loop) in my case. In Labview Basics II it says "Use a master/slave architecture only if you are certain that each slave task takes less time to execute than master loop"

but running three loops with timed master loop is better... 8sec difference after 60min but still not synchron. But it is not a good way, because I am using the second loop as a Slave and as Master for the third loop.

but even I slow the master loop down to 1000ms the period time of two slaves are also around 1000ms and always a bit slower than the master loop... (the minimum period times in plain loops are 250ms, 380ms, 380ms for my program)

I think you are right about MS interruptions. Everytime when Excel sheet pops up the loop periods slows down a little bit. But what is the reason that a timed loop is not stable??? Is it MS the interruptions only, which makes it instable???

for synchronization of the elapsed test time and wave chart time I will put the chart into the master loop... (That has to work!!!??? What would you say?)

And what do you think about Producer/Consumer architecture?? have you ever used this? is synchronisation possible? Labview book says: "The producer/consumer design pattern is based on the master/slave design pattern and enhances data sharing among multiple loops running at different rates."

thx a lot!

0 Kudos
Message 5 of 6
(4,367 Views)
Hi

a very simple vi to show the merge.
I agree that the producer consumer is nicer.

The details you ask for I don't know by heart, I should have to try and I'm too lazy now.

good luck
greetings from the Netherlands
0 Kudos
Message 6 of 6
(4,353 Views)