Another question on local Variables and their use.

I have read many many posts on forums how we avoid the use of locals at all costs because they go against the stream of LV paradigm however I tried to find a way to replace them in my programs and do not have.

Basic explanation:

I use a state machine to browse specific validation test steps and test of electronic equipment of base. (Panels, timers, relays moduals fuses) Many of these facilities contain LED indicator. In the tests, I took photos of the products and then used the Boolean flags to replicate the LED on the PC so that the test operators can check to make sure the equpiment LED turns on as needed. My problem is that many products contain 20 + LED and have no order to how they are turned on. Because of this that I eventually do a boolean for each LED indicator, put all the indicators in a structure of disabled, then using local Variables at each step to display on the FP LED should now be on. It's often a lot of locals throughout the program.

I tried to make a very basic sample of VI to try to show what is a normal procedure. How can I reduce the amount of local Variables without increasing the complexity of my VI?

If the LED change of State within the meaning of the criterion - within the case statement - you need a parallel loop.

I did a heap of your LED and does an architecture of producer/consumer of your case, 'Test 2' attached.

Edit: In my table, on the bottom line, the text should read "your 6 LEDS are now a Cluster" rather than "your 6 are LED not a Cluster."

Tags: NI Software

Similar Questions

  • Question about local variable in LabVIEW

    I am a new bie to LabVIEW.

    I have a question about local variable in LabView.

    I tried to stop a loop by the local variable, but the value of the loop for counter is different with my hope.

    I think that the loop to stop at 6, but he stopped at 7.

    Could someone help me?

    This looks exactly like a race condition.  You have know control if the control terminal is first in reading or the local variable is written to the first.

    Try to run your code to highlight execution.

    In your code, what usually happens is that order is read and the value is false.  Then the other code will run allowing the value to write to the local variable.  Let's say that in a particular loop iteration, we get the True value.  But control of the final value has already been read as false, then the loop runs again.  The next iteration of the Terminal is read and then he sees the true, will force to stop no matter what happens in the rest of the loop the loop.

    So, why do you use a local variable instead of sending just the wire to the terminal stop?

  • LabVIEW: Concerns with local Variables and the readability of the program

    Hello everyone. I was hired for the summer to work at my University to a new laboratory. All right, but I have some problems with my main VI. I am a new user of labview coming from a C++ background. I went through several iterations of adding features, fixing bugs and doing my readable program. Before the last "cleaning" my program was so big that I couldn't see it all at once on my screen. My goal was to solve this problem. My solution contained three parts: use a state machine show parts of my code at the same time, to remove the son as much as possible, and use structures element to position my code manually.

    I met since problems write other programs that brought me here, and I saw a series of messages condemning the new programmers for their use of local variables instead of cables. I do not know my use of structures element as fancy boxes I can exclude the automatic cleaning is also a terrible practice.

    After doing some more reasearch on the subject I see local variables to add the duplicate in memory entries and their suppression can significantly speed up execution time. I have a delay programmed in a part of my code, but the rest can run as fast as he can as far as I'm concerned.

    I have attached my main program. Looking at it I think I did a good job to make it readable. But I'm not a user expert labVIEW.

    How to balance (do not use local variables, these structures element, etc.) efficiency and readability. Before you make these changes, there was so many things and so many threads all over the place that I couldn't even tell what was going on, and even less my teacher. I really wish I could see my entire program without scrolling on this computer of the laboratory (resolution 1280 x 1024).

    Advice on how I can achieve the efficiency, simplicity and common readability would be greatly appreciated. I feel I've done the latter while sacrificing the first two. Ultimately the three should probably be equally important.

    Thank you.

    Nukem

    LabVIEW 2010

    As said altenbach, attach your event structures.  It should really be only need structure of an event, especially for a simple VI like that (I counted 3).  This is the second time I have recommended this today, but fetch JKI State Machine.  I use as the basis for most of my interfaces.

    Here's a way to manage the break with JKI.

  • How the names of variables and units used in the binary output file

    My colleague will give me LabView generated from the binary files (*.dat). There are more than 60 variables (columns) in the binary output file. I need to know the names of variables and units, which I think he has already configured in LabView. Is there a way for him to produce a file that contains the name of the variable and unity, so that I'll know what contains the binary file? It can create an equivalent ASCII file with a header indicating the name of the variable, but it does not list the units of each variable.

    As you can tell I'm not a user of LabView, so I apologize if this question makes no sense.

    Hi KE,.

    an ASCII (probably the csv format) file is just text - and contains all data (intentially) written to. There is no special function to include units or whatever!

    Your colleague must save the information it records the names and values in the same way...

    (When writing to text files, it could use WriteTextFile, FormatIntoFile, WriteToSpreadsheetFile, WriteBinaryFile even could serve...)

  • Local variables and DSC module

    Hi people,

    I'm a student has initiated a project of simualte a network of gas using DSC module. I generated a VI after a lot of puzzle and shoot, hair that contains several local variables. I just found out that they do not work on the network. I am also very pushed for time. Is there a quick fix to do this, in order to save the integrity of the VI? I have included a copy of the VI.

    any help is much appreciated at this stage of a NewBee frstrated


  • local variable and high Ribbon

    I copied a VI to control the DSA8200 Tek to manage the DSA8300. I guess that all controls remain the same.

    The new DSA8300.VI is attached. Why does show DSA8200 in the top Ribbon on the front panel?

    And when I search this VI "8200", I find a local variable called "DSA8200.vi". How to change that to "DSA8300.vi"?

    I am also attaching ScopeDialog.vi, because it is called by DSA8300.vi.

    Thank you.

    efarr wrote:

    If you can shed some light on why it happened, I could learn something.

    A local variable is the name of the control on his face and that's all the information you need. If show you right-click on any variable local and it the label, the label will be the file name of the container VI. Since you have already changed the name of VI, it has already changed to DSA8300.vi. Since it is redundant information, there is no need to ever show him the label of a local variable.

    I have never shown a label of a local variable before, it was new to me too.

  • Random generation of numbers and their use in mathematics

    I m doing a project and had an idea to do a math game thing where the numbers are generated randomly in both slots. For example, it is between 1 and 100 and the other the same and then add them up. The player will have to add them together and then type them in the reply box and if it's correct or not. I need help with the coding, as I'm new to CS5.

    I worked with a more ancient and outdated Flash version a little more than a year. So I know a little things General and some of the things that must be accomplished. However, ActionScript is fairly new, and I tried to use mathematics. Random because it seems that everyone uses in their tutorials. Yet, I couldn't make it work when playing with it. After you have created the random number, as I said before, I would like to be able to add/subtract/multiply/divide them to another number for an answer, but not to display the answer until a button is hit with the response users. Any help would be greatly appreciated.

    Thank you.

    If any other information is necessary, I can give that info.

    Assuming that your implementation of the stage via the Flash IDE, you can do 4 text boxes and give them instance names leftNumber, answerNumber and mathSymbol, rightNumber. Also create a button with an instance name someButton.

    Make sure that the first 3 fields (leftNumber, mathSymbol, rightNumber are dynamic and the answerNumber field is entered).

    Set your document class hand (file-> setting Actionscript-> Document class-> tpye in 'Hand'

    Now create a new as3 at the same level as your FLA and name it Main.as

    Here is an example of code that I did very briefly to your main class.

    Obviously, this has been done short hand and needs some changes, but it should help you get started (sorry for the [lack] of formatting).

    package

    {

    import flash.display.MovieClip;

    import flash.events.MouseEvent;

    SerializableAttribute public class Main extends MovieClip

    {

    private const HIGHEST_NUMBER:Number = 100;

    private var randomLeft:Number;

    private var randomRight:Number;

    private var randomOperator:String;

    private var correctAnswer:Number;

    public void Main (): void {}

    create random numbers

    randomLeft = Math.floor (Math.random () * HIGHEST_NUMBER) + 1;

    randomRight = Math.floor (Math.random () * HIGHEST_NUMBER) + 1;

    var operatorSwitch:Number = Math.floor (Math.random () * 3) + 1;

    If (operatorSwitch == 1) {randomOperator = '+';}          }

    Else if (operatorSwitch == 2) {randomOperator = "-";}          }

    else {randomOperator = 'x';          }

    correctAnswer = solveProblem();

    setupDisplay();

    This ['someButton'] .addEventListener (MouseEvent.CLICK, checkAnswer, false, 0, true);

    }

    private void solveProblem (): number {}

    If (randomOperator == '+') {return randomLeft + randomRight;}          }

    Else if (randomOperator == '-') {return randomLeft - randomRight;}          }

    else {return randomLeft * randomRight;}          }

    }

    private function setupDisplay (): void {}

    This ["leftNumber"] .text = String (randomLeft);

    This ["rightNumber"] .text = String (randomRight);

    This ["mathSymbol"] .text = String (randomOperator);

    This ["answerNumber"] .text = '? ';

    }

    private void checkAnswer(evt:MouseEvent):void {}

    If (Number (this ["answerNumber"] .text) == correctAnswer) {}

    trace ("YOU SMART if");

    } else {}

    trace ("TRY AGAIN");

    }

    }

    }

    }

  • An another Question NOOOB... Re-use of data entered on form

    I have hunted and just can not find this solution.  Sorry to ask what is probably a simple question for many on this forum.  I have a 8-page document that the end-user must enter their name and some demographic info on the cover page.  I then use this data in the following pages in the header or footer.  Any ideas where can I go to get this answer?  I have about run the length of my short attention span and of patience.  Thank you.

    Give the fields of the same name and on the binding of the object Palette tab change the default link on 'Global' on one of them.

  • Types of Apple ID and their uses as pseudonyms AIM

    Hello

    Apple used to have two methods of creating an Apple ID.

    One was to register and email outside and connect with that.

    The other was to create an ID @mac.com

    This could be a trial account in the beginning or paid to the account.  Paid accounts gave access to additional features.

    Trial accounts would end automatically but the ID would continue to work for iChat under a valid AIM screen name (you added it as if it were OBJECTIVE and used the Apple password.

    Unused accounts would also retain their ability to works like pseudonyms AIM

    The MobileMe Service, which was also paid, but also came with a trial period came later.

    The trial had to be cancelled before the trial ended, or you have been charged and no longer work as pseudonyms AIM

    Expired account also is more worked if it is not paid for.

    In the variation between the services there two you can choose to link all @mac.com account and @me.com ID.

    For the mail, they worked as an ID but in iChat and Messages later, they worked as separated as pseudonyms ID valid even if the passwords are the same.

    More recently, we have iCloud who has less services that are related, but are free.

    More Apple ID can be linked to iCloud and this includes those indicated above and any other from other e-mails apart from the setting in place of Apple.

    This may mean that you have @mac.com, @me.com (related to iCloud f) and an ID of @icloud related to Apple who worked as separate from the screen in the iChat application names.

    You may also have an external e-mail that you access iCloud who may have given you a @me.com address so early and a @icloud.com later one more which are related, but, again, are distinct pseudonyms valid for the objective.

    You will notice the italic "worked" in clause 2 above.

    On July 1, 2014 Apple and AIM changed this OS X: ID me.com or mac.com with AIM in iChat requires OS X v10.7.2 or later - Apple Support

    OS X 10.7.2 brings a change to iChat 6.

    At this point the Messages saved in both objective and Apple to confirm it was you connect.

    iChat 1 so 5 and the beginning iChat 6.0 does not have this connection double check capacity year old ID does not work.

    In truth, neither do @iCloud.com those but older apps do not list add the options of "@icloud.com ' screen names.

    These names all work on the later versions of Messages and the latest version of iChat 6 as described above.

    20:50 Monday. April 4, 2016

     iMac 2.5 Ghz i5 2011 (El Capitan)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro (Snow Leopard 10.6.8) 2 GB
     Mac OS X (10.6.8).
     a few iPhones and an iPad

    Hello

    If Yahoo or Google are also your call ID?

    It seems that these may be accounts in Messages as well.

    iChat Alias

  • Question about activating windows and media used for installation

    Intel Visual BIOS 2 my computer on board DZ87KLT - 75 K (Firmware updated) can not detect the optical drive as boot EFI device. So I made a bootable USB flash drive to my system OEM Windows 7 Pro x 64 DVD manufacturer who (USB flash drive) my system detect successfully as efi boot device. My question is if I do a windows 7 clean install with EFI enabled using the flash drive on the same computer that runs this window for the last 9 months, there will be an activation problem to not use the DVD?

    The problem is that your key is already used. He'll have to re - install Windows by using the same key (as long as it's the same motherboard and not a replacement) phone activation.

    J W Stuart: http://www.pagestart.com

  • Create form that records the data locally - iOS and Windows (using AIR)

    Hi, I need to be able to create a form that stores the parts locally on iPads and touch of Windows screens. The app will be used as a kiosk at exhibitions, so there is no internet connection, but devices will be limited in number and owne3d by the customer.

    Is there a simple way to do this? I looked at other options: HTML5 (where the user is rerouted to local browser) or Acrobat?

    With AIR, you can still use an internal DB SQLlight to store data - or even write a based local text file. Depends on the complexity of the data, I guess.

    Adobe Flash Platform * working with local SQL databases in AIR

  • Recording of data and their use

    I have to build a flash game, where a function that collects the data of the user.

    later, separately, I have to build a game that uses the data collected before.

    I think that to do this in the following way: catch the first step of the user data and store them in xml. Then issue the data from the xml file to use the second game.

    Issues related to the:

    1 - is the right way? Logic?

    2. do you know a better way?

    3. I have a great experience with the ready help of xml files, but never created a Flash xml file. What am I supposed to know for her? What classes etc.?

    4. I found a class that can help him, but he opens a conversation box, that the user can choose the location of the file and the name (FileReference). Can I avoid this? I mean: I want to choose a place name and case number, without the user can control. Is this possible?

    5. given that, I have to download the file (xml) on the server, will have a size limit?

    Thank you!

    If the swf file is to check the responses, I'm not sure what you want to save to the server.  the value of an outcome variable?

    in any case, you must use something like:

    AS3

    var urlLoader:URLLoader = new URLLoader();

    var urlVariables:URLVariables = new URLVariables();

    var urlRequest:URLRequest = new URLRequest("php/savefile.php");  //<-use your="">

    urlVariables.scoreVar = result;  //<-saving a="">

    urlVariables.filenameVar = "score_" + username + ".txt"; //<- saving="" the="" score="" to="" a="" text="" file="" using="" a="" file="" name="" that's="" related="" to="" the="" user's="" name. ="" if="" there="" might="" be="" a="" name="" collision,="" append="" a="" random="" variable="" to="" ensure="" no="">

    urlRequest.data = urlVariables;

    urlLoader.load (urlRequest);

    /////////////////////////

    PHP

    
    
  • question about sending mail and the use of UrlEncodedPostData

    Hello

    I need to send over https three things:

    (1) framework, which is a byte [] object, and has some information about the device and the things that need to be sent to the server

    object String 2) imei - imei of the device.

    (3) data - some data, which are a String object

    now I need to use URlEncodedPostData, but...

    UrlEncodedPostData _post = new UrlEncodedPostData(null, false);
    
    _post.append("frame", ???)-> my frame is a byte[] object
    

    so, what should I do? should I change channel frame? but, later when I send the _post to the server that I use:

    _httpConnection.openDataOutputStream(_post.getBytes());
    

    YH, the problem is-how to put a byte [] object to the urlEncodedPostData and then send it?

    The point of encoding is to ensure that special characters can be detected correctly.  There is no URL address, as the settings.

    You will notice that the class that you are trying to use is called URLEncodedPostData.  I don't know if the same URL encoding is used in BOTH and given POST, but I think this class should be used in the data of PUBLICATION, rather than to GET data (look at the name).  You will find that the process of encoding data GET is not so difficult and I don't know if you look you will find J2ME coding code on the Web, that will help you create correctly to GET URL format.

    However, I still think you should consider the difference between GET and POST, and what data is passed by each type of application.  I think that if you had done that earlier, you wouldn't be in this position, you understand better my answers and you will understand how to create the queries POST you have to best use later.  GET and POST are NOT Blackberry or specific RIM, they are the Web specifications and used on all platforms.  There is a lot of documentation out there.

  • sons are better than local variables?

    Hello

    I built a vi that eventually became huge with lots of sequence and case. Local variables of course reduces a lot of threads, but at the same time consumes memory. So those who are better? son of current throughout the vi or local variables?

    Concerning

    Simo

    The sons are better.

    DataFlow vs Local Variables

    variables local vs DataFlow

    Another question on local Variables and their use

    Why some people say that local Variables are bad

  • 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?


Maybe you are looking for

  • WD my Cloud Setup

    How to open port 80 and 443, and enable UPNP?

  • How to convert my 64 Kbps for bitrate appropriate?

    OK so I read a lot of 'tutorials' on how to do it, I understand that I will edit > Preferences > import settings and I get the stuff I want. After I have get confused as they say just click file and then create a new version, how do I do that? For re

  • Can I recover corrupted iTunes media files via iTunes game?

    I store my movies and music to iTunes on a separate hard drive. This HARD drive has just damaged. I thought that backs up files on Time Machine (which is on another separate hard drive) would allow me to recover songs, but this doesn't seem to be the

  • corners of screen fading white

    Here are the SPECS HP TouchSmart IQ800t custom screen 25 in desktop. Processor T8400 (2.26 GHz, 3 MB)• 4 GB DDR2 800 MHz memory system (2 x 2 048)• 512 MB NVIDIA GeForce 9600M GS HDDrive hard • 1 TB 7200 RPM SATA 3 Gb/s Updated for 64-bit Vista to Wi

  • 6218 USB voltage and pulse acquisition

    I use the USB-6218 to run 2 OR task at the same time in my vi. A task is to acquire a pressure transducer voltage and scaling it. The other task is the counting of pulse frequency with a flow meter and scale. Both tasks will work perfectly when I run