LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Combining two VI's

Hello,

 

I had two VI's which I made for two different purposes. These two VI's had while loops, case structures and shift registers.

I had to use one of the VI's funtion in the other , hence copy pasted one of the VI in the other.

But the output, dosent seem to appear.

 

Any hints to what the problem can be and how it is to be solved.

 

Thank You

Anupam.

LabVIEW 2013 User

0 Kudos
Message 1 of 8
(3,194 Views)

Dependent loop.pngThe VI on the right is not running until the vi on the left is stopped. You have created a dependency by connecting the wire between the two vi's. The first must be stopped to pass the value to start the second. 

Message 2 of 8
(3,168 Views)

Thanks for pointing out the mistake.

I made changes to the VI and I got the output.

Now the problem , which I am facing is due to the "Wait VI" which I have placed, which delays the whole process. Due to this I am having trouble in coutning time between 5 peaks.

The "Time taken for 5 peaks to arrive" indicator detects lot more time due to the delay.

Any fixes for this.

Should I include a factor in my calculation which can resolve the issue?

 

Thanks a lot.

ANupam

0 Kudos
Message 3 of 8
(3,146 Views)

I think the easiest way to fix this problem is to not use a real time clock and instead keep some sort of simulated time inside your loop. For instance, for each loop iteration, add a fixed increment of "time" to a shift register and use that instead of comparing it to a system time (I imagine the real sample time between all these data points is known).

 

However, I would like to point out that you have 2 wait vis in your diagram. One is 100ms and another 10ms. I dunno if it was intentional. When I deleted the longer one, the vi sped up quite a bit.

 

Also, in general, I imagine your two VI solution is likely better. The issue is you need to understand how to pass data between loops. To do this, you need to implement queues for passing data (or events or notifiers). However, that might involve a bit more planning and work than what you've setup so far.

Message 4 of 8
(3,135 Views)

Where do I begin ?

Thanks

0 Kudos
Message 5 of 8
(3,126 Views)

I updated your VI to create a simulated time instead of using the real time. I also pointed out the two Wait (ms) vi's you have that might be doing the wrong thing. You only should need 1 of these per loop. How did you pick the value for the wait vi? Anyways, let me know what you think.

 

To learn more about queues and communicating between loops, you could start here:

http://www.ni.com/white-paper/3023/en/

 

However, many people on these forums know a lot more about the resources available for learning than I do.

Message 6 of 8
(3,120 Views)

I am a beginner.

The first Vi is not made by me. In the second VI, I placed the "wait -100ms" for the reason you mentioned, that the VI speeded up.

I am not sure why the "wait " was placed in the first VI.

 

Thanks.

 

Download All
0 Kudos
Message 7 of 8
(3,097 Views)

The purpose of the Wait in the first VI is to "clock" the Chart.  You are simulating acquiring data at 100Hz and displaying it.  100Hz means one point every 10 milliseconds, and since your While loop is extracting a point at a time from a (constant) array to be plotted, this becomes the "data" stream.

 

Do you know about the three common types of symbols used to get data into and out of While/For loops?  The Shift Register, the "ordinary" tunnel (which is what you use), and the Indexing tunnel (which looks like an open square with a pair of square brackets, "[]", inside it?  Indexing tunnels are very handy for "walking down" the elements of an Array, and Shift Registers are essentially "memory" elements.  I would use these two elements to repetitively "play" your dummy waveform ...

 

Bob Schor 

0 Kudos
Message 8 of 8
(3,092 Views)