functional overall mishap/quirk

While mangling one overall functional implementation, I updated by mistake the playback indicator inside the while loop in the case of reading. I quickly discovered that when any write operation, the indicator has been always reset to a default value. The default value is traceable to an earlier deformation and the value is understandable. What I don't understand is why the indicator inside the loop to reset?

See the super-simple vi attached. This seems counterintuitive, and I'm not missing something basic here.

Thank you!

Hi David,

you have at least a little creative see attachment.

When you want to write only one of the entries of the FGV, you will need to provide more OpModes (read/write)! Enter your OpModes as 'Bob writing' and "Write Mary", where it is only wire one of the entrances to the shift register.

Tags: NI Software

Similar Questions

  • 2 parallel while loops with functional overall to share data

    Hello

    I'm having a problem with the sharing of functional with globals data between two parallel while loops:

    1. One of the loop (bottom) generates a random number periodically and write the total functional sample.
    2. Another loop (above) has a structure of event and when it expires, he would read the functional global and intrigue, a chart data point.

    The problem is sometimes the functional overall seems to be 'locked' and the output becomes zero constant. It also seems that whenever I first open the VI, it works fine. But for the second time running, he begins to have the problem.

    You must initialize your VI stop FGV FRONT of your lower loop begins.  Even if you use a global variable that is functional, you have a race condition.  FGV is read in the lower loop until it had a chance to be initialized with a value of false in the upper loop.  Functional global variables do not forget their data between executions of the VI.  So it is always set on stop the last time that you ran the VI.  This works your VI the first time it's because VI does not have in memory, so when it loads, it loads with the default value False in the shift register.

  • Can I use data value references with a functional overall?

    Can I use data value references with a functional global?  I am trying, but it causes problems:  I run the attached VI with "new DVR" selected.  Then I run it again with "return array" and I get the error 1556: "The reference is invalid. This error might occur because the reference has been deleted."  It seems to have forgotten the DVR, but I thought it should be stored in the shift register.
    
    Another odd thing:  In my VI, if I try to connect the wire shown in "something strange", then the type changes (from U16 array to DBL), i.e. it doesn't recognize the type referenced by the DVR.
    
    I want to pass a very large 4-dimensional array between parallel loops with a functional global.  To avoid memory problems, I want to use a DVR and in-place element structures.  If that's not allowed in Labview, I will try passing it through a user event or notifier.  Any problems with those alternatives?
    
    Thanks.
    

    I received a response from an engineer applications OR on this subject, and it seems that it is perhaps a problem with Labview.  They are working on it, so I'll go ahead and close this discussion.

    Thanks for the help,

    Allan

  • functional overall memory variable allocation

    Hi there everyone and thanks in advance for any answers.

    In my code, I use a global variable that is functional to store an array of values so that I can read more later.

    The user making the test uses 3 different executables. So, he runs the first .exe, the test runs and stop VI indicating the end of the test, then it opens the following executable, it runs and then stops, etc. My question is if I use a FGV to write the value, while the first executable is running, then try to read the value while the executable of 2nd or 3rd runs, the value remains in memory? How the spatial memory of data getting erased? I did a small test 2 different screws running and writing and reading of FGV and it seems to work, but there were times where the data table is empty.  I don't know what I did to to get an empty array, then I will try to understand how it works. All advice is appreciated.

    Thank you!

    Serge

    No, the variable is not persistent between applications. You write the contents of a file on disk, and then reload them. May I ask why there are 3 possibilities of use? Seems a state machine and a single application would be a better solution.

  • help with functional overall

    Small is my first experementing with globals time functional

    After being recommended to read this thread http://forums.ni.com/ni/board/message?board.id=170&message.id=240328&query.id=5387854#M240328

    I decided to start with just a functional global

    (I like that term better as a FG should be just that, a global variable and not perform actions beyond holding data)

    What I have is written 'VI - A' to the 'VI - B' read the FG and FG

    The problem I have is:

    I can open the FG - VI in 'VI - A' it and see updated.

    If I open the FG - VI in 'VI - B' FG - VI is running, but the controls and indicators are still in their default state and not updated by VI - A

    I checked and checked and checked to ensure there has only a single instance of the FG - VI on my machine.

    I even went as far as dragging the FG - VI directly from the diagram of blocks 'VI - A' to 'VI' pattern-block - B


  • Global Variables are preferable to the Globals functional - so there! :-)

    I feel a little controversial today so forgive the brutal title of this post

    I've never used global variables because I was under the misconception that they are somehow 'bad '. That's all I've heard since I started learning the LabVIEW. Review the code in the nets upconvert and downconvert. The ugliest code uses globals and some of the most beautiful code does not work. This means that bad programmers use global variables and globals are so bad programming practice. This is not true. Globals are just easy to use for newbies to use them. ' Not initialized what? I can't find those on the pallette? »

    I think I always wondered unconsciously that globals are bad. They are not bad, it is their use that may be bad. This is true for anything in life.

    The first and the most obvious problem with global variables is racing conditions. But this is not strictly the overall causing the race condition. This is the data stream is not defined.

    But the same is true if functional a global being misused. In the example below there is nothing to enforce data streams.

    You must run the data flow with a thread of error for example.

    Globals do not have a thread of error but not fear - the man of the sequence is here!

    You only need the sequence if the global is directly on your drawing. These two structures of single image sequence could be replaced by a NumericWrite.vi and a NumericRead.vi containing nothing but overall, a command or the indicator respectively and the terminals of the error. Put it online and it is good as gold. Or you might have a Subvi containing nothing but a frame two cases selected by an enumeration containing the elements 'Get' and 'Set '. Now, it looks like a duck and quacks like a duck. Don't you worry by the overhead of the structure of the case either. If the enum is a constant, it will be unfolded.

    Another problem with globals, it's that they are, well, global. Is not different from a functional overall, so it isn't really a problem anyway. Globals and globals functional it is easily taken by placing them in a library and define the scope of the access. Not to mention that libraries give you namespaces and "namespaces are one honking great idea - do several of these!" *

    The real reason to use a global rather than a functional overall is that they are about twice as fast.

    Until this morning I would have recommended to use a more functional global overall. But I changed my mind. Someone can it change back?

    * The Zen of Python


  • Globals functional in BT 8.5

    Hi all!

    I've been struggling with making functional overall in LabView 8.5. I am a very new programmer, my job is essentially to learn LV online and check/optimize the code left by a previous programmer. His code uses a large number of local variables, many of which feed subVIs custom, so I was thinking only globals functional can be a good way to improve the code. I read that local variables are something of a no-no, but he uses them to pass specific data between a loop of producer/consumer (with the exception of the data in the queue). However, I had difficulties to enter the functional concepts behind the globals, and when I looked for examples on the forums I found examples of old/new versions that do not work for me. I think some esserntial concept is beyond me.

    So I have three questions if you have time.

    (1) exactly how the globals functional?

    (2) are they possible in LabView 8.5? My company does not update for fear of damaging the code we have.

    (3) globals functional would be faster than local variables?

    Thank you all for your time!

    -Gobble

    You have two errors in your VI.  A in the case of writing, the other at the Terminal stop.

    The error in the case of writing is what is causing the cut wire.  You create a segment of wire with two sources (one of the shift register, a control).

  • Multiple copies of the functional global using vi references

    I have several producers acquisition in a global operation (a functional overall by the producer). These functional overall are identical except for the name. He would work to have only one functional global VI and get a separate reference for each producer? The corresponding consumer would have also used the appropriate reference to consume the data.

    The functional global contains an array of data that must be analyzed by the consumer. It is possible that the data table does not contain a complete set of data on a unique "store" by the producer operation. Of course, the consumer, is written to search for a complete data record before completing the processing of the file.

    Les__Bartel wrote:

    TST wrote:

    No matter that there is a better way, the answer to the question is Yes. The FGV must be reentrant and the reference you open must be re-entrant too and then you can use the CBR node to run the specific copy of the FGV.

    I thought that a reentrant vi would not maintain the State of the shift register not initialized by one call to the other.

    A reentrant VI will maintain the State of its shift uninitialized registers.  However, you must be very careful, how to do this.  You first need to make sure that it is set to allocate Clones.  What will happen in this situation, it is that each different place call you this sub - VI each will be a different clone.  This means that each call will have its own data.  The problem with this is that you cannot share the data between multiple instances and therefore multiple loops.  If you don't believe me, go play with mean it Point by Point VI.

    So what happens if you assign shared clones?  A big freakin mess '.  You will have no control over which clone called where, and there will be a major data corruption.

    This is why FGVs are almost always not reentrant.

  • global functional

    Hi all.

    Having the application main and 4 under apps.  Each of the 4 under apps functional a global (or motor action) in which he writes and reads a cluster of app-specific data.

    The idea is that using a functional overall for each application data could be transmitted between all and APP of the hand.

    For example, I want to be able to drop the sub-app1 FG on the BD for sub-app2 and read all the data.  At the same time sub-app1 would update its FG on his own comics.

    This doesn't seem to work.  For example the FG1 is updated by sub-app1, BUT the instance of FG1 on the BD for sub-app2 is empty.

    None of the fivet is reentrant; That of why there is never a single instance of each FG, correct?  There is only one (1) instance of each FG on the disk.  Each sub - app and FG are located in a separate LV project.

    Confused.

    Battler.

    MarcoMauri wrote:

    I could be wrong, but because the FG is running various projects, that is to say different application instances, it can be used to Exchange data.

    In all cases are another way to make, for example DataSocket...

    Marco

    I think you're right.

    While the two screws are running the two project go to hiarchy screen and press 'ctrl-a' to show all.

    You will see that the two FG are running is unique contexts. So, this is the fate of an app to talk to another application on the same computer or on PC, so Datasockets, TCP/IP, server of VI...

    Ben

  • Invalid line in functional reference Global

    I must forget something very basic about queue references. Here's my problem... I have a LabVIEW application that generates dynamically from the Q (a queue is generated in order to act as a stream dedicated to each chart created). Queue references are created and stored by a functional overall (FG - Manager.vi queue). This functional global is called the "Launcher" and the "Monitor". Everything works fine until the pitcher is closed how the queue references show "invalid Refnum". The reference is always in memory because the functional overall is still called by the monitor memory then why are my Q turning references invalid? See example attached LV2010sp1.

    See Rolf's response in this thread

  • More applications in multitasking

    I have an air of ipad 2 and I was wondering how you add more apps for multitasking option. Whenever I drag to open the multitasking, I see only a handful of applications for me to use, for example, messenger, Jolt, notes, youtube, etc. But what happens if I wanted to play a game while watching youtube? I can not find this game on the multitasking window or use the two windows when I open the game and try to open youtube to use both applications at the same time. So, is it possible to add other/more apps to the option of multitasking or is application - this all simply not compatible?

    I think that to slide it and split screen features are active on a per app basis.

    That means that the application developer needs to code/program these features in their applications for them to be available for iOS as a drag or divided function virw of the screen.

    The characteristics of multitasking are NOT a function overall iOS.

  • Covered wagon with an average of analog voltages DAQmx

    I searched through screws, I can't seem to find something that will automatically average numbers of boxcar fed into it. I am trying to create a feature of my software that will allow the dynamic configuration of the car covered with an average of some inputs. I would like to avoid hard-coding tables which are filled/rotation etc etc.. Any help is appreciated

    Thank you

    If you use a Functional Global to store the values and call that VI of two different screws, you will access the same data. You could use two Global in the functional shift registers and use a selector to place / extract data from / to the appropriate shift register. Only VI call access one commune VI at the time, so one of the caller of the screw will be 'blocked' until the first caller is done. This does not usually work for data acquisition applications high speed.

    You might consider using named queues instead of functioning overall. You might be interested in this thread on the forums of LAVA that deals with boxcar implimentations. You create a queue for each data stream and can perform functions such as "preview" queue to get all items without actually removing them from the queue. If you use a LabVIEW 8.6, there is a new feature called with loss of queues. You set an upper limit on the size of the queue and "lossy enqueue" allows to add items at the end of the queue. If the queue fills up, then the oldest data element will be lost.

  • Several producers response queue

    In my application, I'm working on an API that is the queue of conduit. Several different parts of the code can send a 'command' and wait for a response.  Obviously if two separate sections of code send a different command roughly at the same time, we have a race condition for the response queue.

    I have many ideas on how to solve this problem (action engine response, get an overview of the queue and search data appropriate, semaphores), but I wonder if there is a ' standard method / best practices "to do.  I have not run into this problem before.  So far, I'm leaning towards semaphores - it seems the simplest solution.  Here's a mockup I did as a proof of concept.

    BowenM wrote:

    Certainly, there is nothing to say that the response must be a queue. I could use a variable overall, functional overall, etc.  The queue was just for the convention, and I freely admit that it is a 'bad' use of a queue. The problem is always the same: how to make data from a producer for many consumers without having a convoluted solution heavy.

    Well, if you do not want to incorporate the queue back into the message and then use a non-reentrant VI is the only access to send commands to your consumers.  This VI would send the command and wait for an answer.  Since the VI is not reentrant, it blocks the other loops until the answer is back.  It's much cleaner and probably faster, than the use of the semaphore.

  • Code reuse within the same VI (when he's not a Subvi)

    My last question here was awarded a point congratulations "to have been a big question", which is quite annoying, because my current skill level, it is hard to imagine the time when I will never be anything other than a "taker" of this forum!  So this is with a "dumb" question to try to put the right folder.

    My front panel has 17 groups of one button + three numerical indicators, it's quite a few elements of façade and 8 groups have an enum indicator as well.  All of these are also controlled by the visibility property nodes or 'off '.

    My program gathers all data for these elements in a table at the end of the main loop and functional global variables, it refreshes the properties and values of all these elements of façade.  It might sound like undisciplined, but because of the similarity between the 17 groups that refresh the elements panel above all happens within a pure FOR loop (albeit with a structure AFFAIR of 17 channels inside) if these controls are at least not sprawled all over my block diagram.

    The only problem I have is that my program takes a few seconds to initialize and get the loop running, period during which the façade shows garbage (well, maybe not garbage, data maybe related to the last time the program was executed, which may have been a context different, so much better if not visible).

    But if I also ran the same right 'before the code refresh of the Panel"after initialization (wipe) the data in my functional overall, the result would be that all of these controls would be invisible or disabled, which is a much better place to start from.

    But what I need to put a copy completely separated from the loop on my block diagram to get this effect?

    Make a sub - VI is out of the question, because it's the front of this VI that I'm working on.

    The word that describes what I want to do (for me) is "subroutine", but in LabVIEW "subroutine" seems to have a very specific meaning, a VI "stripped for speed" that affects no front panel in any case.

    Is this just a problem of my state of mind?  It is true that in my life by far most of the code I wrote has been assembler for microphones integrated 8-bit, these applications are always tied to memory.  At this stage of my career balance reverse but many high-level code I write (Yes, I am a dinosaur).  So I tend to worry about the what will be my compiled code.  Should I just put another copy of the loop (in fact, it is only the nodes of property 'visible' 76 I need) on my schematic and disturbing stop on this subject?

    A number of observations.

    (1) the title of dinosaur not is still FRO seized with many of us competing (I used as well to play the game of 'ICan write this charceter to X lines...) »)

    (2) when you do a lot with the GUI, "David FP updated (this is a property of the FP to stop updates of the screen, serach for this) may spped things upward."

    (3) I use a GUI controller very often in my applications. I posted about it here.

    (4) if Chase you my tags I have a collection of GUI performance.

    I put the code in a VI called from my GUI controller (who calls your FG for the info).

    Regarding the memory

    When we used to depend on someone with a crochete crochet and beads to make our memory, it was justified. Today, memory is cheap and using you save time is fine. When you worry about memory, it's when you find that the code does not fit into 2 G more.

    Ben

  • simple question of Web service

    I use a Web Service to publish data, and this question is, I am sure, from my limited knowledge and use of the web servers.

    I am able to set up a 'add' method, pass 2 numbers to the web server and the web server to return a value. Simple. But, I don't know what to do when I want to get the current value of something that is being updated in a loop.

    For example, let's say I have a VI as below and that the user wants to display the current iteration of the loop in their browser, not permanently, but only when they ask for it. I won't use this VI as the method to call. Instead, I would rather pass the current value of a designated only VI VI to return the value of the digital control to the Web server. But I have no idea how (or if) I can change the value of iteration to a method to be called. Does make sense?

    I thought by using session variables, but this requires constantly written to the session variable in my code, which is probably not a big deal, but it would be nice if she only questioned the current iteration when the user asked for it (kind of like 2 numbers are added only when requested by the user in the example of OR). I'm looking for a way to simply return the current value, only when requested by the user.

    You can do this, but things get a little complicated.  The web server is its own instance of the application, and I don't think you can (or wants to) have a VI running permanently inside.  When you compile an application with active web services, you get two instances of application - execution of the application, the other inside the web server.  I guess that your loop will run in the instance of the main application.  Put a global functional in it that stores the value all what you want to be questioned on the web and make sure you that VI accessible via the server of VI.  Then, in your web services VI, open a connection to the VI for that functional overall server and run, by reference, to get the value that are stored.

Maybe you are looking for