LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Global Variable

Hi All,

 

I have a problem.

I made a program in LabView to read the oxygen value of VERNIER oxygen sensor. I am reading the signal by using a DAQ sensor card. I am able to read in the value in LabView. Until this level, everything goes well. 

Now I want to read the signal of 3 sensors. I am able to read in those three values within the same VI. 

I was looking to a method to spread these sensor signals to 3 different labview programs. How can I do this?

Somebody suggested me to do it with a GLOBAL VARIABLE but I have a problem with that.

When I insert a global variable, I am not able to connect this variable with a numeric value. The icon of the global variable stays dark and I get the error message: "you have connected two terminals of a different type. The type of the source is double (64-bit real (15 digit precision)) the type of the sink is void.

 

Can somebody help me how to solve this problem?

 

regards

Michel

0 Kudos
Message 1 of 9
(3,699 Views)

Why do you want to split them out?  Depending on your DAQ card, you probably won't be able to read 3 different sensors simultaneously.  So by putting them all in the same task, the DAQ card will read them back to back.  If you try to program them to be read separately, there will still need to be some dependency between the reads so that you don't get a "resource in use" error.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 9
(3,686 Views)

Michel000 wrote:

I was looking to a method to spread these sensor signals to 3 different labview programs. How can I do this?



Ok, let's clarify some things first.

1.  What exactly do you mean by "LabVIEW programs"?  Different executables?  Different VIs inside of the same executable that are running in parallel?  Different loops in the same VI that are running in parallel?

2.  Do these other "programs" need to process all of the read data points or do they only care about the latest value?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 9
(3,683 Views)

I programmed a whole main vi with subVI's that does different calculations with the sensor signal. I would like to make 3 exact copies of this. So for every sensor I would like to have 1 mainVI or program that is running. Therefore, in total I would like to have 3 programs that I can run separately.

 

Why do i need something like a global variable? I found out that it is not possible to run more than one VERNIER DAQ function simultaneously in different VI's?? Due to this, I am not able to collect the data continuously in different VI's so I have to collect the data in the same file.

 

But during the data collection I have to “spread” it to the good VI’s…..

0 Kudos
Message 4 of 9
(3,667 Views)

If your sink is "void" that may indicate you have not selected WHICH global. I do not use them but I think you can right-click and select???

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 9
(3,658 Views)
  1. I mean different programs that run independent from each other. They all have to read 1 sensor signal continuously and do automatically some calculations with the measurements.
  2. Every 4 seconds, each program has to get the actual value. All the measured values has to be saved in each program separately.
0 Kudos
Message 6 of 9
(3,656 Views)

Attach your VI's including your global.

 

It is hard to help you improve your code when we can't see it.Smiley Wink

0 Kudos
Message 7 of 9
(3,638 Views)

Lets clarify what you are saying with some corrected LabVIEW terminology.

 

You want:

  • A Data Acquisition process that produces data from three sensors connected to a DAQmx device
  • three Asynchronos processes that each consume one of the three data streams, calculate results from that data and log results.
  • Some means to transfer each data stream from the producer to each consumer

Now we need to ask ourself what the options are and what each methods pro's and cons are:

 

Global Variable: (it is an option) Pro write once read many times so its a 1-N data tranfer. It's LOSSY (you can only store the current value) and you can't get any information other than the data like "Has it changed?" 

 

Notifier: Again its a 1:N data transfer and it is lossy (only the latest value is available) it has the advantage over the Global in that you can wait for a new value before processing the data

 

Queues: These are 1:1 data transfer so the sender needs to know who is expecting the data.  They are LOSSLESS up to a certain limit (queue size max.)  A best implementation would need all consumers running all the time but, they may be controlled in such a way as to either "Process and Log" or "Just bit-bucket the data."

 

I hope you don't chose using the Global but, if you do, you actually have to create the global.vi (File>>New...>>Global)


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 9
(3,633 Views)

Hi Jeff,

 

you described my plan perfectly!

i never used the notifier but i will do some research to find out how it works!

 

regards

Michel

0 Kudos
Message 9 of 9
(3,627 Views)