LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Design issue with similar machines, but different Globals

Hi,
I know my questions about Global Variables has been up before, but maybe not in this kind of issue. The original coding has been done by someone else than me, but i want to change it. Now every machine has a folder and each folder consist of similar information as the next one. So there are 4 duplicate of every control and it's a nightmare to update the global variables in the total of around 200 files. I would like to combine the files so that only 1 file for "every action" would exist. So how should i do it. I have a few ideas but i would like to know how "the professionals" would do it.

I've read that you should avoid of using a lot of Global Variables, but i don't know if in my case i can avoid them. Some of them could be removed when it's a realtime test that's going on and during the test you can open the attached VI, so how other could you transfer the information?

System consist of:
4 hardware test machines
22 FP devices reading and writing
~50 Global Variables / per machine (50 variables per file, 1 file per machine)

The attachments contines of one of the VIs that i'm working on. I'm not sure if you can open it because it contains many subVIs, but you get the picture of what i'm working with. So any ideas how to combine 4 same VIs with different Global Variables?
Download All
0 Kudos
Message 1 of 10
(3,318 Views)
Here is another pic of a VI how i would do the system, but that's just my opinon. Now i would like yours.
0 Kudos
Message 2 of 10
(3,315 Views)
Does no one have anything to comment or suggest?
0 Kudos
Message 3 of 10
(3,266 Views)
Hi Englund,

what about moving all those single globals into a cluster?
Does every "FP device/file" use the same globals? Make an array of cluster!

Make this cluster a type definition for easy changing to new types etc. in all sub-vis...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 10
(3,262 Views)
That's a great idea about the cluster and it has crossed my mind before. FPs don't use a global.vi yet, they are hardcoded into the system which is not good in the update perspective. The type def was a new thing for me, so thanks for that.
How about the memory consumption of this kind of cluster or does it matter in this case with a relatively small amount of globals and FPs.
This cluster would then import all 200 globals and all FP devices when the type def is imported into a VI, or is LV reading also now the whole global.vi before importing a single value from it.
0 Kudos
Message 5 of 10
(3,257 Views)
This didn't solve the problem to not needing to have so many globals to change. I still need the globals to insert the values from the control type def. Now there is additional controls (the type def control) in the front panel "eating" memory, so it this better or worse? Or did i understand the solution in a wrong way. I realize that it's a good way to collect the 4 global files (including 50 variables) into a single type control, but is it useful?
Could you describe some more?
0 Kudos
Message 6 of 10
(3,253 Views)
Hi Englund,

you feed the cluster through the vi like your error cluster. In the subvi's you only unbundle/bundle the values you need!
Example (Pretty silly, as the 'Select' operation isn't needed at all - I have to kill a student for that Smiley Mad) :

The cluster 'Messvorschrift' contains about 50 values (partly in sub-clusters or arrays). You get the value needed for operation and write it back when needed.
This scheme is pretty straightforward - but has a problem: it leeds to race conditions when you access your global several times in parallel!

Then you should use a LV2-style global aka 'Action engine' - look for the last community nuggets in the forum!

Message Edited by GerdW on 05-22-2007 09:22 AM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 10
(3,238 Views)
Thank you. I did that also, but the main problem whould have been howto join  the four similar VIs and from there link to respective globals.

What i need is:
1 VI controlling 4 machines ie. 4 global files
Main UI has 4 controls from where i can link for example number 1 to represent machine 1. The number 1 would circulate into every VI it's calling and by number 1 it's using global file 1.

But somehow i can't figure out how to do it in a "good" way. To add case structures to every place a global is called is also a sort of wast of time, because the updating is terrible.
I have an idea how to do it, but i don't know how to get it in coding Smiley Sad
The idea would be to make a somekind of General Global file where each global would have a generic name ie. Voltage Measurement and each VI that would need it would call for Voltage Measurement and according to the number that i told you about above the VI would fetch the right global.

I don't know if this would work or if there is a better way. I've just been coding LV for merely 10 month, so i'm not a pro. I wish someone that have done somekind of similar programming with controlling same kind of equipment with the same VI would have a good idea of how to handle this. I've read that people have made 4 different VIs (executables) working separetely, but in my system there also a mutual DC measurement where all the VIs states have to be known.
0 Kudos
Message 8 of 10
(3,223 Views)
Hi Englund,

have you looked into the community nugget describing ActionEngines aka LV2-style globals? This could be your way to go!

This vi holds your 'global data' (don't confuse it with a LabView Global variable!). You would need two selection inputs: your 'file' number and the name of the variable (preferrable made as an enum control). One input to write new data, one output to read data...

This is an example made for a measurement setup. It holds the actual process state:

The  'command' input selects the operation: just reading actual state or setting new values. There are 3 inputs as I use 3 different datatypes inside. All data is kept in a cluster 'global data'. Don't forget the error cluster for easy dataflow programming!

Message Edited by GerdW on 05-23-2007 09:19 AM

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 10
(3,202 Views)
Thanks Gerd,
All your answers combined led me to a solution to make a polymorphic VI which have a case including a type def of the globals and according to which machine number (Unsigned Byte) it is it will choose which VI to use. I looked at the action engine also, but to start to build my system upon that is not wise according to my knowledge of "easy" updating. Thank you for your help. I will try to solve this somehow.
0 Kudos
Message 10 of 10
(3,172 Views)