Control buttons in local variables

hi,
i have been trying to do this for a long time. i just never learned how to make it work. can someone please guide me?
i have this program with many many local variables and i know that this forum absolutely hate LOCAL VARIABLES.
I want to program this the right way, so can you guys please help take a look at my code and see what i can do in order to REMOVE local variables if possible?
Best regards,
Krispiekream
Attachments:
test.vi ‏768 KB

does this work?
i split up the zip file to 2.88mb each.
i think there is a file size limit of 5mb
can you rename test01.zip to test.z01
can you rename test02.zip to test.z02
Best regards,
Krispiekream
Attachments:
test.zip ‏1078 KB
test01.zip ‏2847 KB
test02.zip ‏2847 KB

Similar Messages

  • Local variable event structure

    Hi,
    I am using an array control and event structure for detecting changes in the array value.
    At first,I have performed changes in the array(during runtime) and the event structure detected it.
    The next step was adding a parallel while loop in which I am writing to the control array(using local variable).
    During the runtime the layout of the array indeed changed,but the event structure didn't detect it.
    I have attached 2 figures :1)The loop of the event structure 2)the parallel loop.
    Is it possible working in such way?
    How can I make the event structure detect changes the software performed in the control array?
    Thanks,
    Leonid
    Solved!
    Go to Solution.
    Attachments:
    event.PNG ‏43 KB
    update.PNG ‏34 KB

    This is a long discussion about "red flags"
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • Create local variable using labview scripting

    I am trying to use labview scripting to create a control and a local variable for that control.  I want both the local variable and the control contained inside a case structure.  My problems are twofold:
    1. the local variable is left blank/unnamed
    2. the local variable is wired outside of the case structure, even though I set it's owner to be the same as the owner for the control (which is placed inside the case structure).
    The flat panel is there because I thought that my problem might be a result of the local var being created before the actual control, so this just forces the control to be created first.  The other thing I wonder about is the VI Object Class for the local variable.  I have tried 'Node' and Control->Boolean, but neither worked.
    I have attached a jpg of the code I'm talking about.  The picture on thetop is of the code in question.  The picture on the bottom is of the resulting code that's created....
    Can anyone offer any help?
    Thank you...
    Attachments:
    vi_scripting_lv.png ‏95 KB

    The reason your locals aren't tied to a control, is because you didn't make a local variable from any control.  Use the Boolean reference wire and wire it to an Invoke Node and select the Create >> Local Variable method.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How can I Change data in a type def control containing a Xcontrol with a local variable

    Hello
    I made a Xcontrol and I inserted this control in a type def.
    When I want to change the control's data with a local variable in a VI, the VI change nothing. The change of data isn't perform
    How can I correct this issue?
    Thanks for your help
    Solved!
    Go to Solution.

    Hello,
    What's your LabVIEW version ? Do you have a simple example program which demonstrates this behavior ?
    I found another discussions related to your issues with Xcontrols:
    updating type defs in Xcontrol Facade
    No Data Change event generated for a XControl in a Type Def
    XControl facede.vi 
    Hope this helps.
    Regards, 
    Steve M.
    National Instruments France
    #adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
    >> Vidéo-t'chats de l'été : présentations techniques et ingénieurs pour répondre à vos questions

  • How can you create a local variable from a boolean control?

    I want to create a local variable from a boolean control, but it says that boolean latch actions are incompatible with local variables, but I need a way to check this boolean control in two differents loops, how can I do it?

    "Graci" schrieb im Newsbeitrag
    news:[email protected]..
    > I want to create a local variable from a boolean control, but it says
    > that boolean latch actions are incompatible with local variables, but
    > I need a way to check this boolean control in two differents loops,
    > how can I do it?
    Use global variables.
    Compare them with a constant Boolean like F or T.
    The result is true or false and then you can use it in a Cae-Loop.
    Martin

  • Simulation & Control with local variables

    Why can I use a local variable in a simulation loop, but not in a simulation sub-VI?
    Solved!
    Go to Solution.

    A little backstory which I should have given when I asked the question. 
    I have a simulation of an engine and I want to enable/disable the engine clutch.  Since there are conditions on changing the clutch state I was using local variables when I developed the engine simulation in a simulation loop.  After I had fixed the bugs I tried to transfer the contents of the simulation loop into a simulation subVI for use in my main project.  I was unable to transfer the simulator because I had local variables in the engine simulation.
    I think I understand that I can't use a local variable in a simulation subVI because there's no front panel due to the way a subVI is called.  
    Thank you for the help in understanding this better.

  • Problem using local variable in event loop

    I have a state machine from which I want to monitor various controls, including "Start" and "Stop" buttons.  Not every state needs to monitor the controls.  At present, most states run timed loops.  In the first state that reads the front panel, I have an Event structure (inside a While loop) that monitors the various controls' Change Value events.  For numeric controls, I update variables (in shift registers) as needed.  The "Start" button is used to end the While loop controlling the Event structure, allowing the State to exit to the next state.
    My problem comes in subsequent states that employ this same idea.  Here, I put a Local Variable bound to the Start button and use the same code, but it frequently happens that when I enter this particular state, I cannot "turn on" the control -- I push the button, but it stays off.  Curiously, if it was On when I enter, I can turn it off, but then I'm stuck not being able to turn it on.
    I mocked up a very simply routine that illustrates this.  There are two sequences (corresponding to the two states).  Both use an Event loop with a local variable bound to my Stop button (really this is an LED control with custom colors).  I've deliberately moved the "initialization" (the declaration of the control in the block diagram) out of the Event loops -- putting it inside the first loop modifies the behavior in another strange way.
    Here's my thinking on how I would expect this to work:  The code outside Event Loop 1 should have little effect.  Assume the Stop button is initially Off.  You will "sit" in Event Loop 1 until you push the Stop button, changing its value to True; this value will be passed out of the Event case and cause the first While loop to exit.  You now enter the second sequence.  As I understand the Exit tunnel, it defaults to "False", so I'd expect to stay in the second Event loop until I turn the Stop button from On to Off, which will pass out a False, and keep me in the While for one more button push.  However, this doesn't happen -- I immediately exit, as though the "True" value of the Stop local variable is being seen and recognized by the Event loop (even though it hasn't changed, at least not in the context of this second loop).
    An even more curious thing occurs if I start this routine with the Stop button turned on.  Now I start in my Event loop waiting for a change, but this time the change will be from On to Off, which won't cause an exit from the frame.  This will be reflected by having the While loop count increment.  We should now be in the state of the example above, i.e. in an Event loop waiting for the control to be pushed again, and turned On.  However, clicking the control has no effect -- I cannot get it to "turn on".
    Where am I going astray in my thinking?  What is it about this method of doing things that violates the Labview paradigm?  As far as I can tell, what I'm doing is "legal", and I don't see the flaw in my reasoning, above (of course not -- otherwise I'd have fixed it myself!).  Note that because I'm using local variables inside Event loops (and I'm doing this because there are two places in my code where I want to do such testing), the Stop control is not latching (as required).  Is there something that gets triggered/set when one reads a latched control?  Do I need to do this "manually" using my local variable?
    I'll try to attach the simple VI that illustrates this behavior.
    Bob Schor
    Attachments:
    Simple Stop Conundrum.vi ‏14 KB

    altenbach wrote:
    Ravens Fan wrote:
    NEVER have multiple event structures that share the same events. 
    Actually, that's OK.  NOT OK is having multiple event structures in the same sequence structure.
    See also: http://forums.ni.com/ni/board/message?board.id=170&message.id=278981#M278981
    That's interesting.  I had always thought I read more messages discouraging such a thing rather than saying it was okay.  Your link lead me to another thread with this message. http://forums.ni.com/ni/board/message?board.id=170&message.id=245793#M245793.  Now that thread was mainly concentrating on registered user events which would be a different, but related animal. 
    So if you have 2 event structures they each have their own event queue?  So if you have a common event, one structure pulls it off its event queue and it does not affect the other structure's event queue?  I guess the inherent problem with this particular VI was that the second event structure locked the front panel.  Since the code never got to that 2nd event structure because the  first loop never stopped because the change was from true to false.  After reading your post and the others, I did some experimentation and turned off the Lock front panel on the 2nd structure, and that prevented the lockup of the program.
    Overall, the example VI still shows problems with the architecture and I think your answer should put the original poster on the right track.  I think as a rule I would probably never put the same event in multiple structures, I feel there are better ways to communicate the same event between different parts of a program,  but I learned something by reading your reply and about how the event structures work in the background.  Thanks.

  • Variation between local variables

    Hello, I use version 7.1 for developing a scada application for seeing liquid tanks levels, and  I need to see the flow depicted at tank indicator from one to another in this way.
    The first tank increase it liquid level only when an electrovalve is activated, the level is writen in a numeric indicator.
    The liquid flows from a second tank only when a second electrovalve is activate.
    When both electrovalves are activated the level variation must be saw both indicator and controls.
    I fail in third point, Is it possible to make it as I madeor anything similar? The vi I made became crazy when I turn on.
    Thank you very much.
    Attachments:
    levels.vi ‏46 KB

    1.  Your VI is designed to only run one time.  It runs once. Then it stops.  My guess is your are using the Run Continuously button.  Don't.  It is only intended for special situations like if you want to debug a VI.  If you want your VI to keep running, then use a while loop around it and a stop button.
    2.  You need a wait statement in your loop.  Without a wait statment,  your VI will run as fast as the CPU allows.
    3.  Local variables are almost always used incorrectly by new LabVIEW users.  Read this thread Why some people say Local Variables are bad... for some reasons why.
    Then I would recommend looking at the online LabVIEW tutorials
    LabVIEW Introduction Course - Three Hours
    LabVIEW Introduction Course - Six Hours

  • What is difference between local variable and property node ?

    What is difference between local variable and property node ?
    " 一天到晚游泳的鱼"
    [email protected]
    我的个人网站:LabVIEW——北方客栈 http://www.labview365.com
    欢迎加入《LabVIEW编程思想》组——http://decibel.ni.com/content/groups/thinking-in-labview

    To make things clear, here are two small examples that show how nasty locals and value properties can be to the naive programmer.
    - Open the diagram of the race condition.vi before running it and try to predict what will be the values of the two counters after the third run.
    - Use the Compare Locals Properties and Wires.vi to find out how slow locals and value properties can be (times 1000+).
    This being demonstrated, I must add that I use globals and value properties quite often, because they are often very convenient
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    Race condition.vi ‏9 KB
    Compare Locals Properties and Wires.vi ‏18 KB

  • Data Acquisition - using local variables to write data to a file

    Hello,
    I am running a Data Acquisition vi (currently in LabVIEW 7.1 but soon to be updated to 8.2) that collects ~100 parameters of data from several sources contained in a while loop. The current configuration (which I did not write) uses very few subVIs and writes to ~100 local variables to store each parameter. It then reads all the local variables and builds an array of all the strings, converts then to a spreadsheet string, then uses the write characters to file function to append to a datafile. I am trying to clean things up and have came up with subVIs to collect the data from the following sources:
    8 serial port sources collecting btwn 8 and 20 parameters each
    ~15 thermocouple readings
    ~10 analog inputs
    ~20 parameters read off an ARINC 429 bus.
    I have come up with a subVI to read each of the sources and have placed the subVIs in the while loop. Each subVI outputs the data that it collects in array or cluster form. I was wondering how best to write each parameter to a CSV file at between 1 and 10 Hz. Should I write each subVI output to a LV and then read them off as was done before (the difference being that I have reduced the # of LVs to ~10 vs >100?
    I should add that precise timing is not that important, so if all the subVIs are not collecting simultaneously (which I understand that they won't be), it does not really matter.
    Thanks.

    Hi jilla,
    jilla wrote:
    What I think that you are saying is to turn the outputs of the 4 subVIs into inputs of a 5th subVI that writes to the data file. Correct?
    Yes.  It may sound like a fine-point, but I beileve it's better to create a VI specifically for formatting data - in your example, 4 arrays IN, a single string OUT.  Then write the string to file as a seperate operation.  GUI-displayed data can go through a similar transformation, the four arrays wired to a subVI which builds output-structures specifically for display.  It's a beginner's mistake to put lots of individual controls and indicators on the screen when groups of them are naturally related (in an object-oriented sense.)  Use clusters to group related controls - this will keep the diagram much cleaner.
    One more question: at what point (either # of data points or frequency of data collection) does it become necessary to use queues? Thanks.
    Well, there's not really a clearly definable "point".  I'd say if your update-rate climbs above 100Hz, or you witness poor program or system performance, then it's time.  The scenario you've described is a fairly simple acquire/display&log loop - and simple is good.   Then-again people can't see/react-to updates faster than about 10Hz - so it doesn't make sense to sacrifice performance - if performance becomes an issue.
    Re: queues:  Queues are sometimes used to buffer data that's "produced" in one place and "consumed" in another.
    Here, if/when logging data, you're logging with every DAQ.  I wouldn't recommend using a queue to transport data from a "DAQ loop" to a "Logging-loop" - those functions can be in the same loop.  Should/could a queue be used to get data from a "DAQ loop" to update the GUI at a lower frequency?  Sure, but a Notifier might be a better choice.   Further, in the (simple?) program you've described, you might use a case structure (True/False) to only update FP indicators every "X" iterations - a simple solution that doesn't require Queues or Notifiers.
    Cheers!
    "Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)

  • How can I put the contents of an array into a set of write local variable clusters?

    I have a set of controls that a user fills in. The controls are clustered by rows, then combined into a 1D array, then written to a file. When I read the file, I want to feed the array back into the clusters with write local variables. Is there a simple way to handle the numerous local variable clusters so I can stuff the array back into them?
    Is there a better way to handle the whole issue of storing and recovering the information?
    The rows are steps in a procedure, and each row (cluster) contains numerical as well as string controls.

    There are many ways of doing this
    You may convert all your data to strings and save as an ascii file (you have to pay attention to the file format, so you can read it properly.
    Or you can use the configuration vi's, it may work in your case.
    or you may use an invoke node to get all controls of the vi's, save it, then read it, without worrying about any format. I have attached a vi that uses this method.
    Attachments:
    Temp.vi ‏52 KB

  • Does a large amount of "local variable" within a vi cause problems?

    Hello -- I am using Labview 7.0 and have a vi where I am going to end up using about 100 "local variables" for indicators that are displaying data. Since I have a lot of true / false case structures I decided to use these local variables instead of having a mess of wiring all over the vi block diagram. It is intimidating though and I was wondering if it causes slowness in vi's?

    I actually only have about 8 indicators -- but I am in the process of creating control algorithms so I have to use many case structures if I want to keep the code all within Labview (simplicity). I am simply referencing the 8 or so indicator values many many times (100 X) I am attaching a copy of the vi like you asked but just take a look at the right hand side of the while loop on the right -- it shows an example of an algorithm I created today that has to reference the data from sensors. I would love to know what a better way to do this. Thanks!
    Attachments:
    ucb drill control daq 1_7.vi ‏666 KB

  • How many ways to read and write a local variable in a called VI?

    Ciao!
    I'm producing my first TestStand sequence. It is called "FirstAttempt" and it is made by a single step which calls a VI. One of the first dilemmas i encountered realizing this sequence is how to read and write a local variable (created going in Variables -> Locals ('FirstAttempt') -> <right click to insert local>) in the called VI.
    The first way (the only one i tried) is to create a control and an indicator on the VI front panel, connect them to their respective terminals in the connector pane and then specify (going in Step Settings -> Module) that these connectors (shown in the Parameter Name column) are linked to the local variable (selected in the Value column).
    The second way (not tried) consists in using TestStand API: create a Sequence Context reference on the VI front panel, link it to a property node in the block diagram, select the property "Locals" and extract from this the local variable name and value which, i think, can be readable and writable.
    So...
    Are the shown ways correct?
    Are there other ways?
    Knowing that a "local" variable can be considered "global" within the whole sequence, is there the possibility to simply create a reference to the local variable and use the reference in the called VI block diagram in order to save space in the connector pane (if using method 1) or in the block diagram (if using method 2)?
    Thanks!
    Message Edited by aRCo on 09-17-2009 05:09 AM

    Hi,
    Before TestStand 3 you would use the second way you quoted as its the only way.
    But now you would use the first way you quoted. You may still what to pass the SequenceContext if you were going to use the TestStand API. For TestStand 3.x and above you would use this way as the first chose. (Personnelly, I would not pass the SequenceContext into a VI if I know it was never going to be used in that VI.)
    Not sure I understand your final comment, maybe you are liking it to passing the reference of a control to a subVI so that the control can be updated from within the subVI.
    If this is the case and you had a situation where you had a step that was running in parallel with the rest of the steps in the sequence either as a separate thread or execution and were dependent on the contents of the  local variable changing from that parallel running step, then you would have to use the API SetVal method to change the local.
    Hope this is clear.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • RE: local variable cross-talk?

    Jeff
    A global can be considered as a variable to the entire code, where lots of
    different vi's can operate it. Locals only have any meaning within their
    own vi, or instances of their own vi.
    If anything writes to a particular global, whether in reenterent vi's or
    not, it's available everywhere in the code.
    What you were asking was about locals though. If a vi is non-renentrant
    (i.e. as they come out of the box) then the values in the locals are vi
    specific, no matter where the vi is, where it was last used, it retains the
    data from it's last operation. If it is re-entrant, then the values in the
    locals for each occurance of the vi are its own for EACH instance, i.e. just
    like different locals in different vi's, it doesn't matter where else the vi
    is used, the data held is that from the last operation of that specific
    instance.
    Simple way to demonstrate this. Make a vi that has one numeric control,
    then code in +1 and get it to write to a local variable for that control.
    Throw in an indicator to wire out the result of what is written to the local
    for the control.
    Then take this vi, put it in a for loop, then put another copy in the for
    loop as well. Wire the indicators to the side of the for loop and create
    indicator arrays for them. Get the loop to run 6 times say. Now try
    running this with the vi in the for loop non-reentrant and then reenterrant.
    One way the arrays will contain either all the odd no.s 1,3,5,7,9,11 and
    then the other array 2,4,6,8,10,12 (don't know which array will be which,
    depends which executes first in the for loop of this example). The other
    way they will both be 1,2,3,4,5,6. In the first example, the same vi has
    run 12 times, i.e. one copy of the vi which retains its info and is called
    in many places and therefore only has one set of values, and the other with
    two re-enterant copies where they have their information specific to that
    instance of them i.e. effectively they are different vi's. Both ways are
    useful, depends what you want.
    If you're looking for a use for non-reenterant vi's then consider this:-
    For instance. Supposing you get many things to try to write to a global
    array of numbers, and you have two vi's one "A" writes to the first element
    in the array and the other "B" writes to the second element. Because in LV
    you have to read a global first and then write to it to perform a change,
    these independant vi's "A" and "B" (be they re-enterant versions of the same
    vi, or different vi's), can be performing the tasks simultaneously in the
    code. I.e. "A" reads, "B" reads, "A" writes, and "B" writes over the top
    with a modified version of what it read, and "A"'s changes are lost. This
    is what's known as a "race condition" as "A" hadn't finished and "B" needed
    to know what "A" was going to write before "B" performed "A" read. Try it,
    hours of fun if you code this kind of thing in inadvertantly!
    If the same vi is used, and is not re enterant, it can only run in one
    instance at a time, hence two read / write operations cannot be performed
    together, problem solved. Unless that gives you timing issues of course,
    waiting for one to finish, to write the other......but that's another whole
    can of worms.
    cheers
    Tim Price
    This e-mail, its content and any files transmitted with it are intended
    solely for the addressee(s) and are confidential and may be legally
    privileged. Access by any other party is unauthorised without the express
    prior written permission of the sender. If you have received this e-mail in
    error you may not copy, disclose to any third party or use the contents,
    attachments or information in any way.
    -----Original Message-----
    From: [email protected]
    [mailto:[email protected]]On Behalf Of Jeffrey W Percival
    Sent: 29 November 2001 21:12
    To: [email protected]
    Subject: Re: local variable cross-talk?
    Another useful reply! What a great news group this is.
    One last thing I wanted to ask about, though, is global vs. local. I see
    you talk about globals, but in fact the variables in my subVI's were locals.
    I can easily understand the behavior I observed accompanying the use of
    global variables, But I guess the use of the word "local" stumped me.
    Should I interpret "local" in LabVIEW's sense to mean "local to all
    instances of this VI"? And global to mean "visible to all instances of this
    VI as well as other VI's"?
    -Jeff
    Tim Price wrote:
    This facility is actually very useful, for instances where you want to
    encapsulate some code so that it can only run in one place at a time,
    i.e.
    global arrays that are written to in more than one place. This method
    can
    eradicate race conditions completely for example when used like this.
    There
    are multiple other uses as well.
    However, using a vi as a module of code, to run in more than one
    instance at
    a time simultaneously, re-entrant is the way to go. Just make sure you
    debug it first!!!
    Remember though, just because a vi may be re-eneterant, doesn't mean
    that
    everything inside is; sub-vi's, Globals etc. The classic one I've seen
    is
    where people think that a re-enterant vi is talking to it's own copy of
    any
    Globals used within it, i.e. counters etc., where in actual fact of
    course,
    they are all using the same Globals.
    Worth playing with a few examples to get familiar with it.
    Tim Price
    Jeffrey W Percival, Senior Scientist and Associate Director
    Space Astronomy Laboratory, University of Wisconsin - Madison
    1150 University Ave, Madison, WI 53706 USA
    608-262-8686 (fax 608-263-0361) [email protected]
    http://www.sal.wisc.edu/~jwp

    Tim Price wrote:
    Tim, thanks very much. I'll try the experiment you suggest.
    Thanks for taking the time.
    -Jeff
    Jeffrey W Percival, Senior Scientist and Associate Director
    Space Astronomy Laboratory, University of Wisconsin - Madison
    1150 University Ave, Madison, WI 53706 USA
    608-262-8686 (fax 608-263-0361) [email protected] http://www.sal.wisc.edu/~jwp

  • Sampling local variable and synchroniz​e with DAQmx

    Hello, 
    I made a small change in the set-up I used with labview and now when I wanted to change the code I'm having a rather complicated problem.
    In my old set-up I was measuring three variables: x and y with a QPD and the power of a laser with a power detector. I was using the DAQmx and I was getting a matrix with three columns with n (sample rate) values. Now, for various reasons I had to take out the second detector. So now I want to build the same matrix as constructed before, but instead of putting the measured values of the laser power I want to put the theoretical values (they are in a local variable) as I cannot measure them. The problem is that this local variable, in general, changes during the DAQmx acquisition time and I would need to sample it at the same rate as I acquire the data from DAQ and then combine all them. How I could sample this variable and attach it to my DAQ results? DAQmx doesn't accept local variables.
    Thanks

    A local variable is not something standalone. It is always associated with a control or indicator. Hows is it updated?
    From your description, it is not clear what you are doing. Can you show us some code instead?
    (Also be more clear when using acronyms. QPD cound mean many things)
    LabVIEW Champion . Do more with less code and in less time .

Maybe you are looking for

  • Document not printing in cv01n,cv02n

    Hi, I am getting the below error while printing the Document in cv02n. Please guide me the way Forward. I have attached the Exel Document and Storage data carrier selected as ZCategory. How to know the exact storage category to my document. Regards,

  • How to create Aperture-like folder structure for referenced files?

    Hello, I've just been exploring the "Relocate Masters for Project" option to take a project's master out of the Library. I like the option to (say) create subfolders at the destination based on image year, month, day. My question is whether there is

  • Mrtotes:  Do you know

    whether there is any way the iMac G4 (1Ghz) video out port (mini VGA) can connect and work with the Apple 17in flat panel studio display with an ADC input port? Is there such an adaptor or cabel or perhaps two connected serially that would work. I am

  • How to imessage from ipod touch

    I am sending a message from my iphone but my son cannot reply from his ipod. His message will not send. Help!

  • Trail balance reports

    hi sap gurus, is there any trail balance report in sap in std system,if any documents to tally TB plz forward to me Regads, MS REDDY