Functional Global Variables: an indicator can be used instead of a shift register?

It is a simple question, but I can't find an answer to it. The model agreed to a functional Global Variable is to use an uninitialized as in this example shift register:

('Référence IN' and ' Reference to "is actually a pile of references.) There is also a "Se Refnum" case, which comes the straight through the tunnels shift register.

My question is, why can't we do store the indicator data? It is much simpler to use a shift register (IMHO a non obvious way to store global data!):

The case "Se Refnum" does absolutely nothing. Other functions such as erasure of data can be implemented just as easily. The advantage of the FGV to help avoid race conditions is maintained because you always use the VI to access the data.

JonP says:


Not so much, the Inidicator can happily live outside the case structure, together and Clear would be just assign different values.

If you have only a case structure, the indicator could not live outside of it.  In order to maintain the indicator data, your design requires that it is not written in for a case of Get.  If you have an exterior structure deal that decides on 'Get' or 'set or clear' and (in the case of "Set or clear") contains the terminal of the indicator and a classiquee case that decides on 'Set' or 'clear '.  However, I would consider this a design below using the standard template of the FGV.

The difficulty with retrieving the value if you want to do a read operation / writing change. But LV provides many ways to retrieve data from an indicator (one you don't mention is the 'Value' property), do you mean that's all "incorrect"?

Yes (I mean that they are all incorrect).

You could hack your way around the design to work with a single structure of matter and the terminal of the indicator being outside using a method to read the value of the indicator and through a tunnel to the structure of the case through wiring for the tunnel of writing indicator in the case of 'Get '.  However, who will require a local Variable or value of property node.  As I said, these (I only mentioned the local Variable originally) are not good choices for performance and scalability.  If you are not aware of the functional differences between the terminals, local Variables and nodes of property value, refer to this article (obviously advantages/disadvantages such as redraw objects on the front panel are not relevant here).

I guess you could say that indicators should only be written, but it is difficult to be pure!

No, it's not, just use the classic design of the FGV!

Tags: NI Software

Similar Questions

  • Functional Global Variable reference

    Hi all

    I want to update the value of the indicator element in primary VI, I don't want to use the global variable, due to the problem of race condition. So I create a functional global variable to control reference. It is reliable and can avoid the race condition critical?

    I have attached two Test VI.

    Thanks for your advice.

    Personally, I use user events to send data to the main VI and then he can update the indicator.  This generally works very well since most GUI screws using a Structure of the event anyway.

  • Impossible to go from baseline of connection via functional Global Variable

    Hello

    I'm working on a project of producer/consumer based, which some parties have access to a MySQL database. After the connection to the database, I want to store the reference to the connection inside of a functional global variable. Then other parts of the project that need to use it can only read in the functional global variable.

    For some reason, the reference of the connection is not valid once it has been read functional global variable. It works fine if I have the reference directly from the connection to the request for enforcement VI wiring.

    I have attached a few screws that show the problem, but you will not be able to run them unless you have a database to connect to and hack you the query a little so he selects in your tables.

    SQL_whole_thing works very well. It connects to the database, returns information he requested by the query, and then disconnects. No problem.

    But if I run DB_Connect.vi (which stores the reference to 'DatabaseID_FGV' FGV), follow-up of SQL_Query.vi (which reads to the FGV reference), then I get an error saying that the reference is not valid.

    Anyone has an idea why this happens?

    Thank you

    Christian.

    PS: You'll need DBID_FGVActions.ctl and database_connectioninfo.ctl, also attached

    Your referance on the SR's "outdated" when implementing this way.  Essentially, this means that data in memory to this referance has changed because the referance was stored.  Just because you have changed the data at this location.  This prevents you from spend a refeance for the "old data" and crashing the calling application since the referance Rassi contains assumptions that are more adequate data.

    Consider upgrading this FGV powered Action.  This would be encapulate all the Actions you want to do to the database (connect, disconnect, fecth, writing etc.) and maintain the current referance on the AEs shift register.  Ben establishes a great deal for just this type of functional encapsulation in his famous nugget.  A must read for every programmer

  • Functional global variables with polymorphic VI

    Hello

    I am keen to build a functional global variable in a polymorphic VI. So, for example in a functional global variable, we have case structure. I want to build separate VI for the structure of the case and make a polymorphic VI.

    Is it possible that I could use a polymorphic VI rather than business structures?

    Thank you!

    You could create a polymorphic VI that serves as a wrapper for the FGV.  The idea is that each instance of the polymorphic VI called FGV with selected appropriate case-sensitive.  Then your API is the polymorphic VI instead of FGV.

  • Functional global variable pending

    Hi all

    I understand, by threads of reading on the forum, that a call to a functional Global Variable will block its execution if the FGV is already consulted one another VI, correct? Is there another way that it would block, apart from those shown?

    The reason for the question is that I have a (non-reentrant) FGV which is read by 8 subVIs simultaneously (they are, in fact, the same vi, but configured for returning) and whose time strangely, access varies based on the number of the subvis running.

    In less than 5 screws are trying to access the FGV, execution is blocked (I guess, because when the FGV is disabled and replaced by a constant there is no problem with running) and access lasts less than 50ms. If this number is between 5 and 8, execution is carried out much faster. My first assumption was that FGV has not been initiated until we call the fifth sub - VI, but I don't know how to check that.

    I can understand that there is something wrong with the FGV, but can't put my finger on. Any ideas?

    Thanks in advance for any help.


  • Functional global variable home (RFGV) is cut off by the controls on the front panel

    Hello

    I though that I had found the ultimate way to dynamically manage memory in a system of Exchange. I read on RFGV here: http://labviewwiki.org/Functional_global_variable and put together a static FGV normal to follow the references for each created instance of memory which I then could easily remember just by name. But now I found that all the RFGV completely stops whenever a front panel with a menu control is used, i.e. 'enum', 'ring' or 'control path. I tried to put in different delivery systems, but not luck. I read about that guy who could have fallen into the same problem: http://forums.ni.com/t5/LabVIEW/Do-I-need-to-use-a-semaphore-when-reading-writing-a-functional/m-p/1... but he got no help what I could see.

    I have not tried semaphores. Don't know what that is. Check my little test code and tell me what I am doing wrong. Or maybe there is no solution in this case I have to abandon the idea of the use of RFGV for anything. Maybe memory held all the VI will be assigned statically.

    Run the code (in LV2009) and watch the 6 LEDS Flash. Then click on anyone of 'enum', 'ring' or 'path' (the file dialog box) and watch off LED when dynamic memory is used to write or read while the continoues to static VI.

    Any suggestions?

    Best regards

    Kai

    If the memories are good, what you're running against is not the user interface thread, but an internal mechanism of LV called the loop of the root, which must run in some things. Specifically, in your case, the method run a VI and showing a menu (a menu real, or a context menu of a ring).

    You can work around this problem (and greatly simplify your code) If you use the call node of the reference instead of the method to execute a VI, but I wouldn't recommend it anyway, since I assume that your code is not what you think it does. In LV memory management can be quite complex if you want to be able to control it, so if you feel you really need, I suggest to start by searching for existing materials on the management of memory in LV

  • IE 8 is the browser used by control panel to connect to ms update firefox can be used instead?

    I like to use firefox and ie instantly resumes when I use the control panel to check the updates.is browser descends from this task.

    MS use ActiveX controls on the update site, so you can access this site via IE and not with Firefox or other browsers.

  • can I use instead of conditioning of analogue output signals data acquisition to provide voltage outputs analog?

    Hello guys,.

    I have a general question regarding the units of packaging such as the USB-9263 analog output signal. If I can use it instead of data acquisition to provide an analog voltage output?

    Thank you

    ELA

    Yes, the 9263 can provide 4 output channels analog voltage (+/-10 v range) with up to 1mA of current drive. Looks like: it refers to the short circuit of conditioning of signals and some protection against overvoltage. Link below is the User Guide:

    http://www.NI.com/PDF/manuals/372406b.PDF

    -AK2DM

  • Can I use instead of AHCI RAID

    Hi, I have a dell inspiron 530. In the bios there is no option AHCI. Since the RAID AHCI she does that mean I can use the same?

    PS: I have 2 hard drives (no RAID). I tried to boot into windows on the first hard drive, but then it froze on startup a BSOD flashed for a few milliseconds and then he resatrted.

    Thank you.

    Hi John,.

    Thanks for posting your question on the Forum of the Microsoft community.

    1. have you tried to change the boot drive SATA mode?
    2 are you able to boot your computer?

    3. What is the error code that you get when getting BSOD?

    I understand you have two independent hard drives connected to the controller. If you are able to start your computer successfully, here is an article that can help you change AHCI RAID.
    Error message occurs after you change the mode of the boot drive SATA

    Important: This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    How to back up and restore the registry in Windows

    If you can not start at all, I suggest trying the following methods and check if they are useful.

    Method 1
    Please follow the underlying steps:
     
    Step 1. Disconnect all external devices except the keyboard and mouse.

    Step 2. I would like to start your computer in last known good configuration.

    If method 1 does not work, go to method 2.

    Method 2
    Step 1: Try to start your system in a State of services necessary to the operation and a minimal set of drivers, active Mode without failure.
    Start your computer in safe mode

    Step 2: If the system works fine in safe mode, try to clean the system startup:

    How to perform a clean boot in Windows

    Note: See "how to reset the computer to start normally after a boot minimum troubleshooting" to prepare the computer to start as usual after a repair.

    If method 2 does not work, go to method 3.

    Method 3
    As you cannot start your computer at all, I suggest to run a startup repair to repair the damaged boot system files and attempt to start in normal mode. See the section: how to use Startup Repair in the following link.
    Startup Repair: frequently asked questions

    If this does not help, try to start from an installation disc of Windows 7 to the Windows recovery environment mode and then try to run the Startup Repair tool and check if you are able to start normally.

    Hope this information is useful. Let us know if you need more help, we will be happy to help you further.

  • Word Perfect is not compatible with Windows 7. What can I use instead?

    WordPerfect or treatment.

    I've recently updated my computer to windows 7. I used to have the perfect word, but it is not compatible with this new set up. How can I go on writing documents or summaries. Do I have to buy a new cd to upgrade from word perfect or is there a way I can write documents with this version of windows 7?

    You have a few options:

    You can use the built in word processor called Word Page (start > all programs > Accessories > Word Pad). It is pretty basic and does offer all of the features of a professional processing.

    You can download a free office suite that includes a treatment called Writer (free agency)

    "LibreOffice productivity Suite download ' LibreOffice

    You could buy a new version of WordPerfect, which is compatible with Windows 7, or use Microsoft Office, which includes Microsoft Word:

    Trial license:

    http://Office.Microsoft.com/en-us/try/

    Full license:

    http://support.Microsoft.com/kb/823570

    Get the key;

    http://Office.Microsoft.com/en-us/buy/redir/XT101874326.aspx?CTT=5&origin=HA101847520

  • How can I use / instead of - to separate my website'pages?

    I am doing a url like this: https://www.Adobe.com/br/products/Muse.html ,

    using the / to separate my website'pages.

    When I try to do, software changes to.

    Hello

    You must change the folder structure to get this configuration, Muse currently does not allow this. I add a few threads, which may be useful for this

    Change the structure of folders in Adobe Muse?

    How can I structure my muse with records cc site

    If you can't find something useful, please add your vote here

    Add the folder Structure for Adobe Muse

    Let me know if you have any question.

  • What can I use instead of Front Page 2004?

    Original title: I used Frontpage when you set up a Web site in 2004. I understand that Frontpage has been abandoned by Microsoft 5 years in 2006 and will not work on most of the newer servers

    My we host advises me that Front Page Express is no longer supported on new servers, this was discontinued by Microsoft in 2006. I need tp develop my site witout using the front page extensions or find another software update. Microsoft has such a product or is there any suggestions?

    Adam

    Hi hartfell.

    Microsoft has replaced with a program called Expressions Microsoft FrontPage.

    http://www.Microsoft.com/expression/default.aspx

  • What can I use instead of contribute to the update of existing Web site?

    The site is built with Dreamweaver and my colleague needs to update the text periodically. She will not enter in any of the Dreamweaver program, just use a WYSIWYG editor. I do more complex changes. Now that Contribute is no longer available, what are we doing?

    I just checked with the cat from Adobe...

    When you select Full for 'I want to buy', then contribute 6.5 in 'I have' on this page it gives you an option to $199 to contribute 6.5.

    The "I own it" is supposed to change to 'I want' when you pass upgrade to full.

  • Why LabVIEW example projects using Global Variables?

    I'm puzzled.  I've been pretty good programmers LabVIEW talks (including some who work for the OR) and came away with the impression that Global Variables should, as a general rule, be avoided, with functional Global Variables (alias VI Globals) generally preferred for "local memory".

    I have studied some of the example distributed with LabVIEW, 2012 and 2013, in particular the proposed acquisition in real time and am struck by the use of Global Variables, where I'd be inclined to use instead a FGV.  For examples, to stop all the loops on the RT target, the overall "All the RT loop Stop" is defined; 'Constants' of configuration (such as timeouts, Streme network names, the names of the journal folder) are kept as Globals; Streme network endpoints are stored in Globals.

    [Note - there is a weird spelling of the second word of the network Streme, above - when I tried to post with the correct spelling, I got an error message saying this word is 'not allowed in this community".]  I apologize for the offense, but I must confess that I do not understand what the problem with the help of the spelling of this word...]

    Why use Globals in these cases, rather than write a bunch of VIGs to hold these data?  Note that almost all these Globals are 'Read' essentially (written once when a resource is acquired, for example) or "Read Only" (treated as if they were a constant).  Indeed, read-only variables can be written as a Subvi with only an output terminal, acting as a (visible, due to the icon) constant.

    I can see advantages to this approach.  On the one hand, VIGs can have error bounds who run the data flow (I just spotted a bug "data flow" in code, I am developing that is based on this model, to read configuration data to an XML file in a world and in the same VI, Global wiring to a "use - me" terminal, but with no guarantee that I'll read the overall after I write it).

    It is, I suppose, a matter of 'speed' - perhaps Global Variables are 'faster' than VIGs (especially if the VIG 'sits' on an error line).  My thought, however, is that this difference is likely to be trivial, especially as these VIGs (or Globals) tend to become "occasional" calls (with the exception of the indicator 'all the loop Stop' which is called once per line).

    Are there other arguments or considerations that make a Variable global to a better choice than a VIG?  Is there a reason that LabVIEW developers put in these start-up of projects LabVIEW?

    BS

    I have to ask, how do you use functional Global Variables?  Like just a Get and Set?  If so, you can use a global variable.

    Yes, globals are faster and use much less overhead.  At the summits of CLA in recent years, we talked about using globals.  The most common use is for Write-Once-Read Many and writing-never-Read Many with configuration data.  It's a good idea to use globals with the constants that can change on you.  It turns out that the world will have the same performance as a constant in this case.  This is done so that you don't have 1 place to edit the 'constant '.

    The rule on "Globals are evil" actually goes back several years when NEITHER had the huge "people of the country are bad" vendata.  But NEITHER explains well how to do things properly.  So I found people, instead of using local variables, using the value property node.  It's even worse because the property causes thread swaps and kills your performance.  It wasn't until I shouted to people to use wires and shift registers I have seen improvements in the way in which people wrote their code.  So people are always riffling in the use of globals and decided to use FGVs with the EEG and fixed rather cases.  But this does not solve the problem of the conditions of race with critical data and you cause an additional burden.

    So from my experience, I use globals all the time for configuration data.  Yes, you must be careful about the race conditions.  But as long as you understand that it is a common and useful practice.

    I would not use a global variable for data that are constantly changing (use registers to offset or Action motor) and/or processes that have critical sections of code (use a motor of Action).

    NOTE: I use the definition of Mercer to FGV (a Get/Set only) and motor Action (many cases which specifically affect the data).

  • global variable functional to read and write data from and to the parallel loops

    Hello!

    Here is the following situation: I have 3 parallel while loops. I have the fire at the same time. The first loop reads the data from GPIB instruments. Second readers PID powered analog output card (software waveform static timed, cc. Update 3 seconds interval) with DAQmx features. The third argument stores the data in the case of certain conditions to the PDM file.

    I create a functional global variable (FGV) with write and read options containing the measured data (30 double CC in cluster). So when I get a new reading of the GPIB loop, I put the new values in the FGV.

    In parallel loops, I read the FGV when necessary. I know that, I just create a race condition, because when one of the loops reads or writes data in the FGV, no other loops can access, while they hold their race until the loop of winner completed his reading or writing on it.

    In my case, it is not a problem of losing data measured, and also a few short drapes in some loops are okey. (data measured, including the temperature values, used in the loop of PID and the loop to save file, the system also has constants for a significant period, is not a problem if the PID loop reads sometimes on values previous to the FGV in case if he won the race)

    What is a "barbarian way" to make such a code? (later, I want to give a good GUI to my code, so probably I would have to use some sort of event management,...)

    If you recommend something more elegant, please give me some links where I can learn more.

    I started to read and learn to try to expand my little knowledge in LabView, but to me, it seems I can find examples really pro and documents (http://expressionflow.com/2007/10/01/labview-queued-state-machine-architecture/ , http://forums.ni.com/t5/LabVIEW/Community-Nugget-2009-03-13-An-Event-based-messageing-framework/m-p/... ) and really simple, but not in the "middle range". This forum and other sources of NEITHER are really good, but I want to swim in a huge "info-ocean", without guidance...

    I'm after course 1 Core and Core 2, do you know that some free educational material that is based on these? (to say something 'intermediary'...)

    Thank you very much!

    I would use queues instead of a FGV in this particular case.

    A driving force that would provide a signal saying that the data is ready, you can change your FGV readme...  And maybe have an array of clusters to hold values more waiting to be read, etc...  Things get complicated...

    A queue however will do nicely.  You may have an understanding of producer/consumer.  You will need to do maybe not this 3rd loop.  If install you a state machine, which has (among other States): wait for the data (that is where the queue is read), writing to a file, disk PID.

    Your state of inactivity would be the "waiting for data".

    The PID is dependent on the data?  Otherwise it must operate its own, and Yes, you may have a loop for it.  Should run at a different rate from the loop reading data, you may have a different queue or other means for transmitting data to this loop.

    Another tip would be to define the State of PID as the default state and check for new data at regular intervals, thus reducing to 2 loops (producer / consumer).  The new data would be shared on the wires using a shift register.

    There are many tricks.  However, I would not recommend using a basic FGV as your solution.  An Action Engine, would be okay if it includes a mechanism to flag what data has been read (ie index, etc) or once the data has been read, it is deleted from the AE. 

    There are many ways to implement a solution, you just have to pick the right one that will avoid loosing data.

Maybe you are looking for