LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Plots In Seperate Windows

I can see why you used occurances and agree that I think they will solve my remaining problems. How do you get the refrum of an occurance on another form and why do you put them in a shift register?
0 Kudos
Message 11 of 18
(1,206 Views)
Occurrence refnum controls are on the REFNUM palette - you can pass them thru connectors, or make globals out of them. Or you can pop up on the GENERATE OCCURRENCE terminal and choose CREATE INDICATOR or CREATE CONTROL.

The Shift Reg. is just a place to store them. You could probably use global variables in this case and be OK. (A global function can store things in a shift reg and have advantages: it's inherently atomic - and if the data is large, a shift reg uses less memory than global variables (no unnecessary copies made).
In this case those advantages are probably not relevant. I have a tendency to encapsulate everything.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 12 of 18
(1,206 Views)
why do you put them in a shift register?"


Also, at the time, I didn't realize that Occurrences were special, in that a given instance of the GENERATE OCCURRENCE function will always refer to the same occurrence, even if it's been called before. In otherwords, the function that generated them didn't NEED to store them.

For this reason, you can't make an array of refnums by using GENERATE OCCURRENCE inside a loop - the array of refnums will all refer to the same occurrence.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 13 of 18
(1,206 Views)
You have mentioned Global Function multiple times, what are you refering too? I have not seen anything refered to as that.
0 Kudos
Message 14 of 18
(1,206 Views)
A global function is a VI whose principal job is to store some data (typically in the shift registers of a WHILE loop with LOOP set to false).

At one time (LabView 2 and earlier) there were no global variables. The way you stored something for use by two or more independent VIs was to have a VI with a READ/WRITE switch input, a DATA input and a DATA output.

If you called it with WRITE = TRUE, it stored the data you gave it.

If you called it with WRITE = FALSE, you read out the data it had stored.

Advantages:
1... You don't make copies of the data when you read it. That's important for memory usage when the data is a 200x64*512 array of CDB (I've used it like that).

2... It's atomic. If you want to store 6 s
eparate items into six globals, you have the problem of knowing when ALL items have changed. Whatever reads them might read them during your change, and read 3 old values and 3 new ones. The global function is guaranteed to deliver the data as a set.

3... You can add functionality. I like to encapsulate things - for example: a config file handler. I like to have a handler (global function) for each type of config file. It has a FUNCTION input, which typically has functions like INIT, SET DEFAULT, READ FILE, WRITE FILE, COMPARE, and so on. The actual config is stored by this VI (in a shift reg, natch). Anybody who wants to deal with a config file calls this VI. That way, anytime I need to change something involving a config file, I have ONE and ONLY ONE place to go.

In my multi-window project, I used a global function to create, store, and manage the occurrences.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 15 of 18
(1,206 Views)
That is what I thought you were refering to. Which should bring me to my final question. I finally have a fully working model using almost the exact method you perscribed. My last question lies in transporting the data to the plots. Right now I have a re-entrant VI that has 6 simulated signal sources and puts them in an array. I placed a copy of this VI in each plot. Is this the most effiecent way todo this? Soon the simulated signal sources will be DAQ express VIs and I wasnt sure if I shoud localize and than transport it VI queue or global variable or something I am not aware of.

It sounds like the way I am doing it now is a global function as you described but I want to make sure by having as many copies of th
e VIs as plots I want to display on the screen that this is memory and processor efficent.

I really wish I could mail you a thank you card or something you have been a life saver. Thank you so much! I will keep learning so maybe one day I could help you.
0 Kudos
Message 16 of 18
(1,206 Views)
If you have a re-entrant VI in each plot window, then they are NOT showing the same data. The re-entrant attribute means that each copy of the VI has its own data space. In your sine-wave example, the results might be the same, but it's really two (or 3, or 4...) copies of the same data - not multiple views of a single pile of data.


If all your windows are identical in function (mine weren't, but in your example yours were), then you want to put as much code into a common VI as possible.

I'm not sure what your end result is trying to accomplish, but if I were trying to allow each window to look at a different channel, then I would have the main store data for all channels) into the global function
, and have each window call that function with a request for channel 2's data or channel 3's data or channel 2 vs. channel 3 in X-Y format. Make the global function do the work of extracting the requested data and assembling it into a plot.
The plot window then just calls the global function with a request to get channel X, and puts the result into a graph.

Long story short: Put as much code and data as you can into a common place, leave as little as possible in the multiple copies that are showing.

really wish I could mail you a thank you card or something you have been a life saver.  Thank you so much!  I will keep learning so maybe one day I could help you."


Your payment will be to stay on the forum and answer somebody else's questions now and then.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 17 of 18
(1,206 Views)
I look around a lot to see if I can answer questions but I havent found any yet that I have half of a clue how to answer. I have only been using LabVIEW since Feb. Thanks for everything.
0 Kudos
Message 18 of 18
(1,206 Views)