LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best way of sending signals between two VIs

Solved!
Go to solution
Highlighted

Hello all,

 

I have two VIs. One that generate some complicated signals (sine wave, impulse, etc.). The other one takes manually inputted voltage and pressure send them out to some hardware with a pump, and reads back the output of the pump.

 

2011-03-14_114339.jpg

 

What is the best way of sending the waveforms from the signal VI to the manual control VI? I still need to be able to control the signals manually in that manual control VI.

 

Thanks.

0 Kudos
Message 1 of 12
(1,098 Views)

Hi,

 

Functional globals (SubVI, NO global variable) should be the best way to go.

 

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's Smiley Wink
LabVIEW 5.1 - LabVIEW 2012
Message 2 of 12
(1,094 Views)

I would use queues for this.  They guarantee delivery and do not have sequencing issues (they are FIFO).  They are also very fast (faster than functional global).

This account is no longer active. Contact ShadesOfGray for current posts and information.
Message 3 of 12
(1,091 Views)

I am not familiar with queues. Does this mean I will be running the two VI in parallel? Also, how does the manual control VI know whether to use the manual input or the input from the queue? Thanks. 

0 Kudos
Message 4 of 12
(1,084 Views)

hi

For exactly this kind of process, I am using queues, FG and (relax ppl, I know..) global variables. If you are writting a global in one Vi and reading it in another (to prevent accidental (fake)updating); globals are easy to implement. Many people hate them (I do, sometimes) but for these kind of cases I think they are well adapted.

For FG you need a user control and a vi for each variable you want to share... Both FG and globals are "bottle in the ocean" like of information : you send some info and sometimes this info will arrive somewhere...

If you need to be sure that the info is passed then Queues are to be used...

N

Message 5 of 12
(1,067 Views)

Thanks, but this still doesn't answer my problem with the manual control part. How does my VI know whether to use the value from the control or from the queue. I think the first post might actually be talking about that, but most of it was beyond me.

0 Kudos
Message 7 of 12
(1,053 Views)
Solution
Accepted by topic author Bladhart

Your UI would handle that. If you are using a state machine (hint-hint) you would simply chose the appropriate state for your current configuration. You would provide some mechanism (UI, configuration file, command line argument to name a few) for setting which mode to use and the application would chose the appropriate action.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 8 of 12
(1,050 Views)

 


@nitad54448 wrote:

hi

For exactly this kind of process, I am using queues, FG and (relax ppl, I know..) global variables. If you are writting a global in one Vi and reading it in another (to prevent accidental (fake)updating); globals are easy to implement. Many people hate them (I do, sometimes) but for these kind of cases I think they are well adapted.

For FG you need a user control and a vi for each variable you want to share... Both FG and globals are "bottle in the ocean" like of information : you send some info and sometimes this info will arrive somewhere...

If you need to be sure that the info is passed then Queues are to be used...

N


While you may not run into race conditions using global variables in a write once/read many approach they do not protect you from some part of your application deciding to write to them. FG at least provide some level of protecting access while globals do not. In addition, global variables can create multiple copies of your data. If your data is large, this can be problematic. I much prefered using a defined messaging scheme. The intent is very clear and you can provide safe guards. Even FGs are better. I personally would never recommend the use of global variables even though some cases MAY work out. A defined API is always a prefered approach and helps to keep the code modular and decoupled. This leads to greater reuse. Global variables tie things together and make reuse more difficult.

 



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 9 of 12
(1,046 Views)

 


@DFGray wrote:

I would use queues for this.  They guarantee delivery and do not have sequencing issues (they are FIFO).  They are also very fast (faster than functional global).


I would probably go with DFGray and use a queue.  But be careful that you are not enqueuing faster than you are dequeuing or your pump control may be responding to last year's events...

 

0 Kudos
Message 10 of 12
(1,020 Views)