Initialize controls/indicators: invoke node-local variables Vales. Which is faster?

Hi all

I would like to get the opinion of the people. This thought just happened for me while I was reading some materials the other day.

And I have not found any topic which talks specifically about speed after searching the forum.

It is faster to initialize your controls/indicators using Invoke node OR write directly to the initial value of your local variables?

From my experience (not large), I have always used the invoke node to initialize controls or indicators.

But when I but this question, I did a simple reference point and it seems the local variable approach is faster, especially

If you have the large number of orders/lights to initialize.

Am I missing something here? The invoke node running something that writing a value of local variable would not do?

I thought since you need to set the initial state by default for the node to invoke anyway, why not just write the desired initial value

your local variables?

I would appreciate if someone can express his own opinion based on their experience and knowledge.

Thank you ~ ~

I may need another Cup of coffee this morning, you are in fact callling the reset by default on each individual control.  My last despises, it is that you use the default method Vals.Reinitialize VI all failing.  It will probably be a bit faster than the method on individual controls.  Still not instant, if.

Are a few msec is worth to you?  If so and you consider the local path, my advice is to group as many controls as possible into clusters for minimize you headaches.

Tags: NI Software

Similar Questions

  • How to create a nested local variable control custom?

    I inherited code which has a cluster of CTL control nested inside another group of control CTL.  If I drag the control nested outside the border of the other, I can right-click to create a local variable, I need to connect to the bundle name.  However, as soon as I drag the inside the limits of external control, it breaks the local variable.

    How can I create a local variable in a cluster THAT CTL nested in a second group CTL?

    Is there some kind of reference OuterCluster.InnerCluster, that I can use if I do a local variable of the external group?

    It turns that I need a local variable for the cluster internal.

    JPG attached shows that I created a local variable for the external cluster (ParametersCluster), used a Unbundle based on the name to access cluster internal (EmptyParmeters) and can access one of the elements through an another Unbundle by name.

  • Structure of the event to local variable

    Hello

    I use a control structure and the table event to detect changes in the value of table.

    At the beginning, I have made changes in the table (for execution) and structure of the detected event.

    The next step was adding a parallel while loop in which I write for the control array (using the local variable).

    During execution the layout of the table changed indeed, but the structure of the event is a not detect it.

    I have attached 2 digits: 1) loop of the structure of the event 2) the parallel loop.

    It is possible works in such a way?

    How can I make the structure of the event to detect changes in the software in the control array?

    Thank you

    Leonid

    Changes made via a local variable are not the user events, so the structure of the event will not detect by definition. You must write to the command by using the property node "Value (follow the signs).

    That said, your small watch of your code starts to raise red flags in my mind with the use of variable and global variable local. While it's not bad, their abuse can lead to the poor programming architecture and race conditions. Perhaps you should consider downloading your VI any kind can someone take a look and offer suggestions on improving it.

  • Simulation & Control with local variables

    Why should I use a local variable in a loop of simulation, but not in a Subvi simulation?

    Local variables will only work in a Subvi are those that relate to controls or indicators located in the Sub - VI.  If you need to pass data between different from the Subvi, so you have several choices.

    1. common variables, as you said.

    2. global variables, as you said.

    3. pass the data in or out through the pane of the connector of the Subvi.

    4. functional Motors Global Variables/Action.

    5 lines of

    6. the references to the controls in the VI main so that they be used with nodes of property in the Sub - VI

  • Local variables are comparable to the value property of a control or indicator?

    I use the buttons / switches mechanical locking action, event structures and local variables to track the status of my switches.  I used local variables with indicators, too.  Now I see that this could be done via the node property of a switch or an indicator.  Should I use the nodes property instead of local variables?  Should I use "switch" mechanical action and control the State of the control buttons / switches?  I used a mechanical locking action because it automatically reset when it is read, but who pushed me in the use of local variables.

    I know the property values to adapt the data flow model, while local variables might be placed in a sequence structure to ensure the order of execution.

    I just don't want my program all except if it is a correct approach.

    Thank you

    DH

    Dark Hollow says:

    Well, I'm changing the properties of user interface in my state machine.  For example, when you push a button to START the TEST, I want to disable and gray this button and activate the button to STOP the TEST.

    No engineer too much. In this case, you can use a single button and label the FALSE case a 'start Test' and the REAL case as TEST 'STOP '. No additional code needed at all. At the same time, you only use the half-Panel space! (and 10% space diagram!)

    Dark Hollow says:

    Another example... I have a couple of dozens of LEDs on the front panel to show the TEST SUCCEEDED.  If I have the wiring all of them, my state machine diagram gets messy.

    Define disorder! In my mind, code is not held together by wire is much messier because it is impossible to determine the order of execution and so program logic. A thread is a small 1 d object. A property node is a significant 2D object. 20 wires are much less messy than 20 knots of property, especially given that each property nodes still hanging by a thread in one way or another!

    In order to reduce the number of threads, use the most appropriate data structures. Instead of a few dozen sighted use a single Bay of LED. A single wire! Keep the table in a shift register and update alone LED as necessary by using "replace subset of the table".

  • Code to skip the steps: initialization of local variables failed

    Hi all

    I'm upgrading some software LabVIEW RT I inherited LabVIEW 2011 to 2015 LabVIEW (32-bit) on a host Windows 7 Professional PC. The target is an SMU-8135. The software ran well when it is compiled under LabVIEW 2011.

    I modified the code to enable the monitoring of what is happening by looking at screen on the target outputs. The initial error that brought me here is that a local cluster variable initialized in the first window of the flat sequence described below have been appearing as the in windows later.

    The code begins with the initialization of local variables in the first window of a flat sequence and provides a quick line of text output to the display of the target (call this text #1) (using RT Debug String.vi) I send two lines of text so that a new row is created and later text does not replace it. . It then writes to the next window in the sequence flat screen two groups of text output to the target. Second text in the window 2 (#3 text) output is equipped with a wire entry from the error from the first text output in the second window (text #2). That is the second exit must wait for the first exit to complete before being sent to the screen.

    I see now some weird symptoms:

    1. when I connect to the target under a remote debugging session I see expected display outputs. Not remotely connected, text #2 is displayed. The code passes to the third window in the flat sequence, so everything in the two window should have executed.

    2. the text #1 appears on the target screen * before * I get the message "Welcome to LabVIEW Real-time 15.0." Is this normal? Whence this message? I searched my screws and subvis to this text and it is not there then it mucst come LabVIEW screws somehow.

    This all started with local variables no initialization in the first window, so apparently, I have a problem of data flow. Given that the problem disappears under the remote debugging, I'm a bit of a loss.

    Thanks in advance for any help,

    Eamonn McKernan

    EamonnMcKernan wrote:

    Text 2 appears only when remotely connected it does not appear when running at startup.

    Your "text 2" seems to be powered by a collection of nodes comments to "initialize on compile or load.  This will return once the empty string the first and therefore should not be display nothing until the code I run a second time.  That is the crux of feedback for?

  • Initialization of a local Variable (variable uninitialized perhaps, but it is initialized?)

    I have behaviors very weird with my code. Some error messages complaining about reference uninitialized variables has led me to search around and found out that the shareware I use has very little initialization of local variables. CVI gives warning of the compiler on these variables, and I don't think he has caught even near each other. I went through the whole file and initialized everything myself.

    Even after that I booted my variables, however, the compiler always indicates they are unitialized, and my code still does not work. I've attached a screen of warnings from the compiler as well as one of the problem functions. Note that in the first warning (36, 9 WARNING: variable '(*tw1).i' maybe is not initialized when used here) there two notes under it, the one who told me where the variable is declared and who says "1, 1 Note: Add initialization to silence this warning. When I double-click on that note, he points to the top of the file, as if he says me to initialize the variable outside the function.

    I also found a very similar post about this but the user has said they were defining the structure twice.

    http://forums.NI.com/T5/LabWindows-CVI/local-array-initializations-not-recognized/m-p/2638119/highli...

    In addition, I understand that the screenshot I've not yet initialized the members of the struct, which I intend to do once that I get rid of these warnings.

    What should I do to remove this error? Any help is greatly appreciated, I've been messing around with this for too long. Thank you!

    emoser,

    I think that the strange warning is due to a bug in the analysis of the variables uninitialized in the compiler. The inaccurate diagnostic tests is issued at the line where you set a variable of local pointer to structure kiss_fft_cpx. It seems that the warning is caused during the pointer variable declaration is immediately followed by a local declaration of a structure of the same type:

    kiss_fft_cpx * tw1 = NULL;

    kiss_fft_cpx t;

    Basically, the incorrect diagnosis will happen:

    1. If a local pointer to a typedef struct variable is followed by a statement of the same variable type.
    2. If the second local variable declaration is not initialized.
    3. It doesn't matter if the pointer variable is initialized or not.

    The bug can come because the compiler can guess that the region of memory in the data segment continues from the pointer variable through the definition of the second variable, because they are of the same base type. A possible workaround in your case would be to go to the declaration of the variables of the same type (in your case, the declaration of the variable t) before the declaration of the pointer:

    kiss_fft_cpx t;

    kiss_fft_cpx * tw1 = NULL;

    Fortunately, this problem is fixed in the latest version of 2015 LabWindows/CVI.

    I hope this helps. I would like to know if the workaround works for you.

    Best regards!

    -Johannes

  • How to read the values of the variables of façade in loops without using local variables or property value nodes?

    I know that local variables and nodes of property value are causing a lot of problems.

    But if I read the value of a variable front outside a loop.

    the value is only read once before the start of the loop.

    Changed the front variable values during the iterations of the loop, is invisible.

    How can I solve this problem?


  • Is there a way to get refnum one control from a local variable or the wire?

    I'm looking for a way to get the refnum of the element of a façade of a local variable or the wire. Is this possible?

    Is there a way to accomplish the following?  (These are published images, this is currently impossible in LV)

    or maybe

    If this kind of thing is not possible, is there a reason for this? If there is no reason why it is impossible, I'll put it on the boards of the suggestion.

    Why do you need this?

    A thread is simply data. It is not associated with a control.

    Similarly, a local variable is a way to access the data in a control, for not interacting with the control itself.

    Is the control of the right-click and selecting Create > reference not good enough for you?

    You can write code to get the reference to the controls connected to the cable and the the control whose desired local variable, but I feel that this is not really what you want.

  • How can I get the changed data in a def type control containing an Xcontrol with a local variable

    Hello

    I did an Xcontrol and I inserted this control in a def type.

    When I want to change the data of the control with a local variable in a VI the VI change nothing. The change of the data is not complete

    How can I fix this problem?

    Thanks for your help

    Hello

    What is your version of LabVIEW? You have a simple example program that demonstrates this behavior?

    I found an other discussions related to your problems with Xcontrols:

    update of type defs Xcontrol faade

    No data change event generated for an XControl in a Type definition

    XControl facede.vi

    I hope this helps.

    Kind regards

  • In collaboration with a no engine in the types of different scheme (local variables).

    The program below is used to control a motor with the NI 9401. However, it has been designed to work in two ways, when you push the buttom "adelante" or "ago" he turns in one direction or another, but if you press 'Start' it begin to move in a particular way (which I mentioned) and if you press again the same ('Start'), we need to stop (this way you can push the door "adelante" or "ago" If you want to). The problem I have is with the "local variables", because when the 'Start' button is the I three while loop and I Don t know how said it stops when the 'Start' button has been pushed and the same when the 'Start' button is pushed, and I press the 'Start' button to stop it. I have a mess with the function of local variables.

    I know it's a little complicated to understand by Word, I tried to explain more clearly.  I hope you can help me.

    Hello matt198717,

    Yes, I think that the problem was trying to use local variables in parallel loops. I use this property at the time of the node and it works!.

  • Comparative analysis of local Variable Transmission times

    Is it possible to compare the time of transmission of local variables?

    I ran some stuff simple reference before, but never something that would understand how long we had to to get a piece of data in a local variable.

    I have attached a simple program that sends information via a local variable, and there is obviously some lag which is visible, well, I'm running at least visible on the system. I know that this lag depends on the system, the program runs on so I would really like to find a way to test it on the PC we use here.

    Any ideas?

    -Ian

    No, they are not the devil as long as you are aware of their capabilities and their limitations.

    Regarding "some applications cannot always use queues or notifiers accomplish certain requirements", give me an application where you cannot use a queue or the declarant, and I bet you can.

    The problem with your 'reference', is that it's a bad test.  You do a visual aspect to two parallel while loops that have no synchronization between them.  If you used a wait until the next msec in both loops, you would see then better synchronization.  Download the file read out of the loop that could cause a random delay.

    And the biggest concern with local variables is "conditions of competition".  Search the forums to learn more about them.  You cannot control this piece of code is running in what order.  If you have two parallel two loop iterations, if the value is written to the local variable before or after that the local variable is read and written to the other indicator determines if a value new or old is used.  If it's an old value, it will be a new iteration of the loop at the bottom before it is updated.

    Search the forums for the terminals of variables local vs vs property nodes, and you will see that the local variables updated the order of milliseconds.  The only reason you see 'in the Kingdom of less than 250 ms' is because it is the rate of the iteration of the loop at the bottom.

  • copy a local variable without front double element

    whenever I have copy and paste a local variable in the block diagram, LV automatically duplicate the front panel which is really awkward... is there anyway to stop the duplication of the façade?  I have look all over the place, but maybe I missed something... .Gee where that parameter could be?

    There are two ways to copy objects in LabVIEW. Of course, we're the regular copy and paste. You can also hold down the Ctrl key and click on and drag any element in LabVIEW to create a copy. It is not only faster, but this copy mechanism can be used for local Variables and related nodes of property without too much a copy of the associated control. Check it out!

  • default local variable

    Hello

    Just a quick question for out me of a hole... I use a local variable to control while loops, and based on a counter value, he makes it or not. When I probe the effective Boolean value, it can't be exectuted, but the value of the local flag is true? is it possible to change this? I need to stay wrong, until it is true!

    See you soon

    Peter

    newbie09 wrote:

    Rich,

    Any quick way to write code to initialize variables, withour reset the entire program?

    Rgds

    Peter

  • Change local variable boolian Programaticaly

    Hi all

    I came across something today, that I have ever dealt with in Labview...

    I downloaded a driver of instrument for a power supply, and got it working OK (using VISA on the USB communication).

    The example program pilot itself works very well and is a quasi State machine.  It it turns on and off and adjusts the voltage and current correctly, as it should.

    Then I need to edit the .VI to add a time on another timer .VI.  I wrote that the small simple VI and it works properly as it should.

    It's just a boolian power timer.  Lights at 08:00 daily, stops at noon every day.

    The problem I have is the boolian called variable "Output (T:Enable)" which is located in the .VI power supply example is a Panel button, but it is called several times as a local variable.

    (once again, I did not write this part and please no lectures on why you should never use a local variable...)

    When you change the State of the button "Output (T:Enable)" Panel, the power supply turns on and off as it should.

    The problem comes when I try to control this value boolian using my timer VI.  I've tried several things, and using debug, I can't 'Output (T:Enable)"to change state.

    The value will change ONLY if the button is pressed or not.

    ATTENTION: The illustrated local variable condition is also a security in case of short or overload, power off if the name cannot be changed.

    Is there a way I can trigger "Output (T:Enable)" using 'My exit timer' but always make sure that stop you it if there is a short circuit?

    This left me speechless... I tried several different things and just can not understand.  Any help would be appreciated.

    Thank you!

    The guy

    Hello guy!

    You are not sure, I understand the problem in its full extent, but I'm guessing that you want to trigger the event that controls the output (T: Enable)? If you want to programmatically, create a node of the control property and use the property "value (follow the signs). Writing of a local variable will not draw the event, although this will change the value of the façade.

Maybe you are looking for