LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

merging two VI's, one VI passing data to the other

Solved!
Go to solution

Hi,

This is more of asking for a suggestion than asking the solution to a problem.

 

At the moment I have two independent VI's

1st VI - Acquire pulse data in real time, filter it, detect peaks, take tiem difference between peaks, use this information to calculate a number of parametres that change in real time depending on the changes in pulse signal.

2nd VI -  Select a breathing rate and guide the user using the fornt panel bars and audio output to follow a rountine.

 

Now I want to combine the two VI's such that the 1st VI processes data and sends some information to 2nd VI. The loop runs at half a second interval so data is dumped into an array every half a second.

The second VI will, depending upon the data obtained form 1st VI, either use this data to change the front panel bar and audio frequencyto guide user or it may use its own values.

 

The second VI will take teh data from 1st VI every few seconds and then perform its own front panel tasks.

The idea is to create a biofeedback system which guides the user (2nd VI) based on user physiological signals (calculated in 1st VI)

 

I have read through information on parallel loops and how data is transferred amongst them. I havent yet implemented any of these and have limited time in my project so wish to get some suggestions.

I would want two front panels so that the data gathering and prcessing graphs are displayed on 1st FP and user guidance on 2nd. I am sure this can eb done by using 2nd VI as sub VI. but not sure if this is the best way two of these should communicate.

ANy suggestions welcome.

 

Thanks,

Jas

 

 

0 Kudos
Message 1 of 5
(2,434 Views)

 

 HI Jas,

 

I think that using your 2nd VI as an sub VI is good thing as in the 1st VI you can acquire and can display the graph and the sub vi FP you use as an user guidance.

Regards
Aks

(Appreciate answers by giving KUDOS)
Hit the stars.............. sky is not the limit.
0 Kudos
Message 2 of 5
(2,419 Views)

Thanks AHK.

Any suggestions on how I should pass the data. Is global / local variable fine

 

0 Kudos
Message 3 of 5
(2,415 Views)
Solution
Accepted by topic author Jaspal
Preferably not. If possible, wire data directly into the subVI though the connector pane. Since you want them to act independently, i would suggest using queues for each data type and/or group. The queues can be referenced by name rather than wiring directly to the subVI.


Never say "Oops." Always say "Ah, interesting!"

0 Kudos
Message 4 of 5
(2,410 Views)
Avoid globals/locals for this kind of message passing.  It is too easy to run into race conditions.  I would recommend queues, since they are fast, have guaranteed delivery, and give you a fair amount of control.  They can also be used across VIs almost as easily as inside a single VI.  Look up LabVIEW help on the producer/consumer architecture for examples (search for "producer/consumer").  It is a fairly simple method.
0 Kudos
Message 5 of 5
(2,408 Views)