07-15-2013 05:27 PM
(LabView 12.0.1f3)
Hi,
I am querying a large number of local Shared Variables (and would also like to be able to add/remove variables from the project libraries without editing constants), so in order to programatically generate their URLs I have tried using the "Search Variable Container" VI or the "Variable Container.AllVariables[]" property node. However, if a Shared Variable includes Alarms, then the ".../VariableName/Alarms/Boolean/..." URLs will also be passed out for each alarm!
I have noticed that the "Get Shared Variable List" VI from the DSC toolkit does generate an array of only the Shared Variables, however these are output as I/O type "Network Variable (BV Tag)", whereas functions such as the "Read Variable" VI require a "Variable [Variable], ...] variant type.
Is there a way to exclude the children alarm URLs from a search in a Variable Container, or a way to use the clean DSC variable list to read/write Shared Variable values? Thanks,
--David
07-15-2013 08:56 PM
07-15-2013 10:39 PM
I did consider adding a suffix to all of the variable names, but I am hoping there is a more elegant solution that I'm missing, like typecasting or a seond type of SV Read function.
--David
07-16-2013 01:44 PM
Hi all,
I was able to get a list of URLs using the code in the VI snippet below. I created a variable with an alarm and purposefully triggered it to be sure it wouldn't show up and I only got the URLs of variables, no alarms. Was this what you were after?
07-17-2013 09:16 AM
Miles,
Thanks for that, I see it does generate URLs without the alarms. However, perhaps I was using URL a little too loosely, as I don't know if they in themselves are helpful. The "Get Shared Variable List.vi" in your example also produces a list of variables without alarms, but is there a way to use either output to programmatically read the SV current values?
--David
07-18-2013 04:10 PM
David,
You can take these URLs and feed them into an Open Tag Reader.vi located in Functions >> DSC Module >> Tags, and feed the tag reader into a Read Tag.vi located on the same palette. The Read Tag VI is a polymorphic VI that you'll have to select an instance of. You can probably accomplish your task by using the SharedVariableIO property node in my last example, expanding it to have a data type output as well, and then using the enum from this to act as a case selector for a case structure with all the expected data types you think you will get as separate cases.
Does that sound manageable?