11-04-2014 08:35 AM
I have never used Set Control Values by Index Function before so I decided to benchmark it against two other ways to set front panel controls, using the invoke node Ctrl.Val.Set and using property nodes for Value. But if the VI whose controls I am trying to set is not running I get error 1000 saying "The VI is not in a state compatible with this operation." When I run the VI whose controls I am trying to set I don't get an error. So does this VI truly only work if the VI is running? I can't set the values before I call the VI to run dynamically?
Solved! Go to Solution.
11-04-2014 08:46 AM
I see no point in setting value for control when it is in edit mode (unless you are trying to set a default value). Also the Set Control value by index is introduced in 2013 version only.
11-04-2014 08:49 AM
It is in the 2014 version as well. Also you might want to set the values before running the VI if you are calling a VI dynamically but want to avoid a race condition by running it and then setting control values.
11-04-2014 09:26 AM
As I said unless you set the control value as default it will be cleared once the execution starts. If you want to pass a value to a VI which you want to call dynamically you can do so by using Call by reference primitive,
11-04-2014 09:29 AM
I may be misunderstanding you, but you can create a VI reference set the values using either the invoke node Ctrl.Set.Value or property node for the value property and then run it and you won't lose those values. They don't change back to default.
11-04-2014 09:39 AM
@LJHerskowitz wrote:
I may be misunderstanding you, but you can create a VI reference set the values using either the invoke node Ctrl.Set.Value or property node for the value property and then run it and you won't lose those values. They don't change back to default.
you're absolutely correct. this is how it works. you only get the default value when the VI is brought into memory
now, if the VI is used as a subVI, and the fp control is wired to the connector pane, it will take the default value if the terminal is unwired in the parent VI.
I assume that you're not using this as a subVI and that you're dynamically launching it via VI server and interracting with it by reference.
11-04-2014 09:46 AM
Yes soupy. I call the VI dynamically and set the controls before running it. But it looks like the Set Control by Index doesn't work if the VI is not running. Is that correct? If it is why?
11-04-2014 09:57 AM
Yes. As said the VI is loaded into the memory and stays Idle when you open the VI dynamically and thats why the control values are not chaning. I was in a wrong impression. '
Regarding the Set Control Value by Index you can set the only during the run mode as explained here.
11-04-2014 10:15 AM - edited 11-04-2014 10:16 AM
i'd question why you're doing it this way in the first place.
a little background. this feature was added to address the problem that writing to front panel items by reference is roughly a 1000 times slower than writing to the terminal. i believe this feature operates by writing directly to the transfer buffer. it still ends up being slower than writing to the terminal, but only about 10 times slower.
My company is making use of this new feature. We needed it because we were updating thousands of front panel values on the same VI by reference and labview couldn't keep up (yes, probably could have worked around it in a different way, but there are more details than that...). If your'e not updating thousands of items, you probably shouldn't be using this feature. The performance savings will not be worth the extra development effort it takes.
it probably doesn't work because the transfer buffer doesn't exist when the vi is not running
11-04-2014 10:17 AM
Thanks for the information on how it works. I was only playing with this feature. I have never used it before so I wanted to see which method is the fastest. But I see that it doesn't work the way I expected.