From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Variables, Controls, References and Strict

It's very handy and powerful the way LabVIEW enables the programmer to change and or create more advanced objects from elementary objects of the same type.  The upper left corner of the image below shows a Boolean variable and a screenshot of the "right-click" menu option that produced the new object to the right indicated by the numbered arrow.   The same is shown below starting with a Boolean class specifier constant.  Here's how I'd describe the purpose or benefit represented by each arrow so far as I understand it.

 

  1. Creating a control from a variable allows the user to edit the value via the front panel and or becomes an input argument of a Sub VI.
  2. Creating a reference to a control gives access to modify it programmatically through property nodes and invoke nodes.
  3. Creating a reference control allows it to be used as an input argument to a Sub VI.
  4. A class specifier constant allows the "variant to data" function to convert a  variant back to the data it was created with.
  5. I suppose a reference to a class specifier constant would enable me to include it as in input argument to a Sub VI.
  6. I'm unclear on what makes the "strict" class specifier constant different and what scenarios it should be used for.

Please correct or elaborate on 1-5 above and explain number 6 (the strict class specifier constant including how to create it).

 

creating advanced objects in LabVIEWcreating advanced objects in LabVIEW

0 Kudos
Message 1 of 7
(1,082 Views)

Some quick clarifications: You start with a Boolean "diagram constant", not a "variable". It help to properly name things to avoid confusion. You need a reference and property nodes if you want to operate on properties in a subVI by providing the reference to a control/indicator located in the caller. If the property node is in the same VI as the control/indicator, you can create a property node that is linked. No need for any reference.

 

What are you actually trying to achieve?

 

0 Kudos
Message 2 of 7
(1,052 Views)

My primary State Machine launches an Oven Controller Sub VI that ramps the oven to the next temperature and then holds that temperature to "soak" the device.  I needed a way for the Oven Controller Sub VI to signal the primary state machine that the "soak time" is completed so the State Machine can return to the "Idle" state and dequeue the next task (collect data).  I ended up passing a reference of a Boolean control (or indicator??) to the Oven Controller Sub VI which sets the value to True after the soak time is completed.  Meanwhile the primary State Machine is just looping every few seconds to check the value of the Boolean using the same reference.  Or I suppose it could check the control directly without using the reference.  I looked into Callback VIs but decided against this option because the test system has absolutely nothing to do during the temperature ramp and soak so no events will be raised.

 

Primary State MachinePrimary State Machine

0 Kudos
Message 3 of 7
(1,035 Views)

That While loop is incredibly crowded.  I would recommend merging a large portion of the data in shift registers into one cluster rather than having a dozen separate registers.

 

Using a front panel control as a substitute for a messaging system or event system is not recommended.  Largely (but not completely...) because this ties your messaging to the speed of your user interface thread, which can be pretty slow.  It also means you can't change your user interface without risking breaking your messaging.

 

However, to get back to the root of it all and the question you actually asked, "strict" means that the reference in question is strictly typed.  An easier example of this might be to consider a "Numeric" control.  A "strict" reference means that it's a specific number type (DBL, I32, U16, etc.) while a non-strict version doesn't have that type information carried with the reference.

 

In the case of Boolean controls, they are not all created equally when it comes to a few things, such as how they work with events, but it matters a lot less than with other control types.

 

At any rate, the only way to create a "Strict" reference is to create it from something that is typed (such as the actual control) as opposed to creating it manually (which has no way to link it to a given control to get the type from it).

 

"Strict" with controls mostly matters when getting or setting the value.  A strict reference will have the actual data type, while a non-strict one will take a Variant as input or output, which then you have to decode, which could either coerce the value or cause an error if the type you pass in isn't an exact match to the real control.

0 Kudos
Message 4 of 7
(1,016 Views)

I would like to add one more thing to Kyle's answer, Strict types carry cosmetic information also, all the changes you make to strictly typed controls get updated by all instances of that control.

bp
0 Kudos
Message 5 of 7
(958 Views)

@bharathp10 wrote:

I would like to add one more thing to Kyle's answer, Strict types carry cosmetic information also, all the changes you make to strictly typed controls get updated by all instances of that control.


I'm pretty sure you're talking about a "Strict type definition", not a strict control reference.  They are not the same thing.

0 Kudos
Message 6 of 7
(930 Views)

Oh Yes, I was referring to strict typedef control.

But we can create control reference of strict type right!!? 

bp
0 Kudos
Message 7 of 7
(924 Views)