LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically specify name in 'Bundle by Name'

The intended goal for the VI is to read configuration information from a file and updated the indicated controls on multiple instruments.

The file configuration is as follows:
Instrument Control Value

Each piece of data on the line within the file is delimited by a space. Instrument is a value from 1 to 4 indicating the particular instrument. A case statement can be used to associate between the instruments which would indicate the global cluster to use. Control is a string indicating the name of the control within the cluster to update. Value is simply the value to assign to the control.

The problem at this point occurs when trying to dynamically assign a name to the bundle by name function, or t
o come up with a method that would do the same thing.

Any help would be greatly appreciated!

Thank you

- Mark Roberto
Message 1 of 14
(5,209 Views)
Make a VI with 3 inputs:
a Cluster Refnum
a string for element name
a variant for element value.

Read the Controls[] property of the Cluster Refnum and input it in a For
Loop.
Read the Label.Text property for each control refnum: it is the element
name.
If the name matches, input the variant input the the value property of the
control
Close the Control refnum in the loop.

Jean-Pierre Drolet
Scientech R&D


LabVIEW, C'est LabVIEW

Message 2 of 14
(5,209 Views)
Jean-Pierre,

I like the idea of using Refnums, however, how can a refnum value be written to, or read from, a file? I haven't seen any way to convert it to another data type, or extract a value, if indeed it's that simple. I think this approach would be the most dynamic if it'll work with the config files.

Thanks for you help!

Mark Roberto
MD Robotics
0 Kudos
Message 4 of 14
(5,209 Views)
Do not put the refnums on file since they might differ from one run to the
next. Use the Instrument value to select one of 4 refnums to your instrument
clusters.

If you have only numeric values, use %f format to scan Value to a number. If
Value may represent different datatypes, (numbers, booleans, strings, path),
you will need a way to identify the type. You could use the ClassID property
of the control to scan the string according to control datatype.

Jean-Pierre Drolet



"mroberto" a écrit dans le message news:
50650000000500000029350000-993342863000@exchange.ni.com...
> Jean-Pierre,
>
> I like the idea of using Refnums, however, how can a refnum value be
> written to, or read from, a file? I haven't seen any way to convert it

> to another data type, or extract a value, if indeed it's that simple.
> I think this approach would be the most dynamic if it'll work with the
> config files.
>
> Thanks for you help!
>
> Mark Roberto
> MD Robotics


LabVIEW, C'est LabVIEW

0 Kudos
Message 8 of 14
(5,209 Views)
Hi,

you can use a case structure. Wire the Name of your instrument to the
condition and insert cases for every instrument. Now you have to add the
different "bundle by name" to the cases.

Henrik

mroberto schrieb in im Newsbeitrag:
50650000000800000021240000-993342863000@exchange.ni.com...
> The intended goal for the VI is to read configuration information from
> a file and updated the indicated controls on multiple instruments.
>
> The file configuration is as follows:
> Instrument Control Value
>
> Each piece of data on the line within the file is delimited by a
> space. Instrument is a value from 1 to 4 indicating the particular
> instrument. A case statement can be used to associate between the
> instruments which would indicate the global clust
er to use. Control is
> a string indicating the name of the control within the cluster to
> update. Value is simply the value to assign to the control.
>
> The problem at this point occurs when trying to dynamically assign a
> name to the bundle by name function, or to come up with a method that
> would do the same thing.
>
> Any help would be greatly appreciated!
>
> Thank you
>
> - Mark Roberto
0 Kudos
Message 3 of 14
(5,209 Views)
Henrik,

That's my back-up solution if I can't get a more dynamic approach. 🙂

Case statements were the first thing that came to mind, however, due to the fact that we could be reading 40 controls from a file, it can quickly become a very unmanageable solution. However, if no other solutions work, this is the way we'll have to do it.

Thank you,

Mark Roberto
MD Robotics
0 Kudos
Message 5 of 14
(5,209 Views)
Henrik Skupin wrote:
: Hi,

: you can use a case structure. Wire the Name of your instrument to the
: condition and insert cases for every instrument. Now you have to add the
: different "bundle by name" to the cases.

That's ugly. Why does the data type have to be a cluster? I see the
convenience of clusters for readability, but can't you use an array instead?

Rudolf
0 Kudos
Message 7 of 14
(5,209 Views)
Rudolf,

I need to use multiple data types. I could have boolean, numerical, and string controls all within the same panel. An array would require too much converting between data types creating too much overhead.

Any thoughts on a possible solution?

Mark
0 Kudos
Message 9 of 14
(5,209 Views)
mroberto wrote in news:50650000000800000021240000-
993342863000@exchange.ni.com:

> The intended goal for the VI is to read configuration information from
> a file and updated the indicated controls on multiple instruments.
>
> The file configuration is as follows:
> Instrument Control Value
>
> Each piece of data on the line within the file is delimited by a
> space. Instrument is a value from 1 to 4 indicating the particular
> instrument. A case statement can be used to associate between the
> instruments which would indicate the global cluster to use. Control is
> a string indicating the name of the control within the cluster to
> update. Value is simply the value to assign to the control.
>
> The problem at this point occurs when trying
to dynamically assign a
> name to the bundle by name function, or to come up with a method that
> would do the same thing.
>
> Any help would be greatly appreciated!
>
> Thank you
>
> - Mark Roberto

Mark,

To fulfill a collection of given ideas...
There is a way of using export/import strings LabVIEW feature to do that.
You can use exported strings file as a configuration source for your
"multiple" instruments vi. This will give you an opportunity to change, say
captions (I'd recommend it to use instead labels) in a text form of
configuration file.
Then you can open vi reference and run method of import strings.
Also there is a way of dynamically loading of each prepared instrument
according to "configuration file". You can see it in
.../LabVIEW/examples/..dynload.llb
--
Sergey Krasnishov
________________
Automated Control Sustems
National Instruments Alliance Member
Moscow Russia
http://acs.levsha.ru
Message 6 of 14
(5,209 Views)
Sergey,

Unfortunately that method doesn't sound like it would give me as much versatility as I require. The export/import strings only stores the default values, not the current values of each control.

Any other ideas?

I do thank you for your help!

Mark Roberto
MD Robotics
0 Kudos
Message 10 of 14
(5,209 Views)