LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronising two time loops in one vi

Hiii, Everybody

            I am facing the problem for synchronising the timed loop, actually, i want one loop to generate the data and another timed loop to used that generated data to make a buffer of type fifo, but when i run these two loops, it hangs, what happens is upto 200 records, it runs good, but after that both the loop gets hanged, instead i want both to run synchronously without hanged, here with this i am attaching my vi and in the vi i have given some description, and i am also attaching drivers, which are in the vi, which help you to run it.

Thanks,

Nishant

Download All
Message 1 of 7
(3,082 Views)
Labview has a build in FIFO called queue I would recommend for inter loop data exchange.
Your program slow down because of the 'insert into array' in your second loop.
Try to define your array size before you enter the loop and use replace array element.
A lot of articles in the forum handle memory usage and efficient programming styles.
 
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 7
(3,058 Views)
Well, if the two code segments need to be exactly syncronous, their code belongs into one single loop, else you either miss data or read stale data.
 
There there's the performance issues. Shuffling all this data back and forth using locals and globals is just not very efficient. Have you tried shift registers instead? Why are you converting to dynamic data and back just to join the 1D arrays? Use a built array set to concatenate mode instead!
 
Thirtytwo (!) instances of the same code segment just calls for a FOR loop instead. Propertly written, you could reduce all your code to the size of a postcard. 😉
Message 3 of 7
(3,056 Views)
Hii, Altenbach and Henrik,
 
           Thanks to both of you for the good reply.
 
              Henrik, i already have tried the way you suggest of using the Queue, but it wasnt work bcos i dont know the way of using queue, i also have explore the exmples, but still found some difficulti to use it, it is good if you can give me an esample or the link for that, another thing in my vi, array size is not fixed bcoz its a buffer fill up according to the time, so it can be increase or can be decrease, and as i am using the fifo, i am not finding anyways of using the repalce array subset, coz i hhave to do lot of thing afgter that method, which automatically increase the vi load, and thanks for clearing me that the insert into array, takes a time and memory both, i really dont know that thing, thanks very much.
 
          Hey Altenbach thanks for suggesting me the for loop and writing code properly, i have use the for loop, and i think it has already decrease the vi size, which automatically gives the better performance, i was much awaiting for your answer to this question, bcos i have seen that, you have solve a lot of questions of the Timed loop, anyways i am trying to decrease the load of the vi and i am sure that it will work for me, but i am still requesting you to change my code to give performance through the timed loop if possible, which helps me to learn the timed loop.
 
Thanks very much to both of you.
 
Thanks,
Nishant
Message 4 of 7
(3,024 Views)
Please also attach the rest of the project: all globals and "convert sub.vi".
0 Kudos
Message 5 of 7
(3,021 Views)
Hiii, Altenbach
 
      Ya i am attaching the globla vi, some of it are in this post and rest of them will be in next post.
 
Thanks,
Nishant
Download All
Message 6 of 7
(3,018 Views)

Hii,

   Here are other vis, tell me still anything missing.

Thanks,

Nishant

 

Download All
Message 7 of 7
(3,015 Views)