Préallouée Subvi in a loop

I inherited the Labview 2012 code, and it runs slower that users would like. I have determined that by changing a certain Subvi to préallouée clone, it speeds up execution significantly. However, I want to assure you that I don't get myself having problems with it.

I have attached a simplified snippet. Basically, the array of values is made up of temperatures, pressures, flow rates, calculated values. The Subvi consists of an instruction box with a number of different calculations that modify the output. The picture of the card determines the index values are used for the inputs & outputs.

My question is:
If the first iteration of the main loop changes an index in the array of values which is then used as input for the second iteration, Labiew will use the most recent value, or based on cloning it will use the older one?

I won't run anything parallelized loop.

Thank you

Jacob

You are the table storage in the shift register and passing a version of that in the Sub - VI.  So it will use the most recent value of the table.

The prealloue Clone done create a copy of the VI everywhere where it is used.  Each have their own memory space and can operate in parallel.

No concave only allows one copy of VI, meaning that it cannot have as a caller at a time.  If being called at several places, and then that happened there must wait the VI ends running before it can use it.

The other reentrant option is shared Clone, which creates a "pool of cloning.  This is similar to the clone preallocated except that clones are created only when necessary.  This causes a small latency time more, but is more effective memory.

Tags: NI Software

Similar Questions

  • Subvi with while loop + event structure works is not in multi tab VI

    Hi all

    I'm developing an interface for the control of a prober using Labview 2012, and I'm stuck with a question.

    First I provide you with a simplified version of my VI control interface and the sub - VI used to generate and manage the mappings of wafer.

    The VI is composed of several tabs: Prober initialization, manipulation of Wafer, Wafer map, status, error.

    The sub - VI can:

    1 / initialize the grid to display the map (Subvi Init grid not provided here)

    2 / coordinates XY for import a txt file (Subvi Wafer map Import)

    3 / view contact information and the index of the sector under the cursor

    4 / and what position die is double clicked and the Boolean 'Edit Wafer map' is true, then the user can change the State (color) of the matrix between die on platelets and selected Die

    My question:

    If I use the sub - VI by itself, it works fine. However, when I use it as a Subvi in the 'Wafer map' tab, the plan does not rise and I can use any features incorporated into the Subvi.

    I suspect that the while loop + structure of the event of sub - VI the bottleneck here.

    However I do not know which way to go, that's why I'd be happy to have some advice and help here.

    Thank you.

    Florian

    The question arises because your hand loop 'for' cycles of 33 times.  In the loop of 32, appears your Subvi and execution is passed to your Subvi.  During this time your main VI expected Subvi in the end, she never does.  You could spend your Subvi out of the main loop of the program and run in a separate process, in order to pass data using queues, but you have to find a way to close the Subvi (i.e. a queue).  By moving the Subvi on the main process, it is independent and you can do what you want to do with the events and others.

  • creation of Subvi in for loop problem

    Hi guys

    I am trying to create sub - VI but part entering inside the Sub - VI contain the loop. As soon as I chose the part of my program for which I want to creat Subvi it a pop up comes. I'm posting pictures of the pop up and program. In the picture of this program, I want to create a Subvi for (for the loop with 10 iteration).

    Please help me find the solution. Your help, I'll appriciate.

    A lot of your local variables must be simply replaced with wires or shift registers.  That would eliminate some of your questions.  Otherwise, I would delete just your seeing terminals before creating the Subvi.

  • Updated entries on day of a Subvi with while loop

    Hi there guys! It's my first serious experience with LabVIEW, so the question may seem trivial to you, but it's not obvious to me how to solve this problem. So I do an installation that integrates a number of flow regulators, a temperature regulator, DAQ, some taps and a mass spectrometer basic tasks. All these must be automated using LabVIEW. I started by doing a VI for each separate task is going very well. Now I need to combine the latter in an experience of master VI, and of course I run into trouble.

    The problem is that I want of course to control this experiences with some selected buttons/dials/what is on the face before of the main VI. However, each of these VI runs a while loop in which fact acquisition of continuous/data communication / whatever. Of course, I want to change settings online. If I just naively tie them at the entrance to the Subvi these will be read only when the Subvi is started, not during each iteration of the while loop.

    I added a very basic example of the problem, so we are all on the same page. The main VI has a button, the State which should update something in the Subvi. However once the Subvi is started it takes control of the execution and the hand-VI seems to be ignored (appears to hang) even if the program has a lot of spare time to read the buttons and put on day of admission. What is the official solution for this kind of problem? My experience in programming that I prefer to keep the intact Subvi, so I can use it as a reusable standard library. Of course a similar question can requested the sub - VI output which will be updated only once the execution is completed (which is never during normal operation).

    PS. I'm using LABView 8.6 on XP

    The best way to set up a BT program must initialize first your settings, and then launch a while loop where you communicate/aquire data or whatever, then after the while loop is finished close and clean up your references.

    Inside the while loop, you can place your code in many of the screws and it is possible to run those in parallel, but I defenetly does not recommend the use of loops in slot face, especially without having to open the front panel or a stop test.

    If your code is completely executed up to your Sub - VI, the main.vi will wait for the sub - Vi ends before continuing the code.

  • call Subvi producer/consumer using vi main to gain the image capture

    Hello world

    I don't know if I get the notion of producer/consumer harm. I tried to write a producer/consumer Subvi that simulate continually grab get the image. When I call the Subvi hand while loop with a main vi, it seems to face an infinite loop. I wonder what someone knows how can I activate a Subvi producer/consumer using primary vi? Thanks in advance.

    Kind regards

    Han Yen

    Bettter use this one.  The one above has a 'small' mistake

  • Clear/fill ComboBox in a Subvi?

    I am building an app with 6-8 pulldown ComboBoxes and each of them will be erased and then first met based on a file.  I wrote a small vi to do exactly what I want, but I can't understand how to pass the PropertyNode[tringsAndValues] each ComboBox to the Subvi?  I wouldn't really have to reproduce this code 6 - 8 times in my main VI.

    The first thing I noticed is that my original small VI used the Structure of sequence flat to make sure I have everything first empty the ComboBox and then fill - LabView wouldn't even accept this as a sub - VI when I tried to add to my main VI, so I'm breaking the clearing in 1 Subvi and filling in another.  I tried first to setup the VI of compensation which is when I noticed that I had found no original way of referencing ComboBox in my Subvi.

    Anyone with ideas?

    Steve

    Create a reference to one of the terminals of the combobox, and then create a control from this reference.  cut and paste the control in the Sub - VI and use it as a control for the reference in the Subvi.

    are you use create-> node-> (property) property?  It's less useful: search the antiderivative of regular property node in the application control pane

    Here's what they look like:

    Once your Subvi accepts a ref of the comboBox, you can put your combobox 6 to 8 refs in an array and then call your subVIs a for loop.

    B

  • Design of master/slave with several slaves in SubVIs

    Hello

    I have always used the classic design of master/slave. But now I need a master/slave design in which one loop master main has 3 slaves and each slave, in turn, has 4 slaves.

    I finished my application with the main master, the level of a slave 1 slave 2 ("subslave') level. As I don't want to copy and paste the code for each loop, I thought about creating a Subvi for each loop and link them right in a main VI.

    In order to make it clear:

    Main VI

    -Master (Subvi x)

    --|

    --> Slave 1 (Subvi y)

    ----|

    ---> Subslave 1 (z Subvi)

    ----|

    ---> Subslave 2 (z Subvi)

    ----|

    ---> Subslave 3 (z Subvi)

    ----|

    ---> Subslave 4 (Subvi z)

    --|

    --> Slave 2 (Subvi y)

    ----|

    ---> Subslave 1 (z Subvi)

    ----|

    ---> Subslave 2 (z Subvi)

    ----|

    ---> Subslave 3 (z Subvi)

    ----|

    ---> Subslave 4 (Subvi z)

    --|

    --> Slave 3 (Subvi y)

    ----|

    ---> Subslave 1 (z Subvi)

    ----|

    ---> Subslave 2 (z Subvi)

    ----|

    ---> Subslave 3 (z Subvi)

    ----|

    ---> Subslave 4 (Subvi z)

    But how can I do? How the Notifier sends the notification to the slave if the master is running in an another Subvi?

    Kind regards

    Gracietti

    You place the reference that was obtained for the notifier to the Subvi via the front panel connector.  In the Subvi, you create a control on the front panel which is the same data type as the reference that is created in the main VI.  Set this control on the Panel connection to the Subvi.  Now when you get the reference in the main VI, you can move this thread to the Subvi.

    It is also possible to use named notifiers.  When you get the notifier in the main VI, give it a name.  Get a notifier in the Sub - VI and give it the same name.  Now that you have created two different reference threads, but the point to the same Registrant last name you gave them.

  • LabVIEW freezes randomly while loop

    Hello world

    I'm relatively new to LabView, I like to think that I learned a lot through trial and error and read this forum, but I am confused by something here. I hope someone out there has an idea.

    I have a program that controls a pump. I am communicating via a USB-serial cable. In general, how my program works is that it sends a command to the pump, and then he immediately starts querying the pump for its status. I have the query in a loop that repeats every second. While the pump is moving it returns the busy status, and when it finishes it returns to the ready state. When the program receives the ready status, it exits the application and send the following command.

    I have a Subvi, which questions the pump, and I use it in many places in my program. The problem is that all this works 95% of the time, 5% of the time the loop freezes for some reason any. The timing of this gel, location in the main program and the number of iterations of the loop that occur before the Frost are all random.

    I've attached pictures of the front panel and block diagram of the Subvi. The loop on the left is querying the pump and the Subvi in the Subvi labelled 2 is communication with the pump on the VISA. When I realized that the program has been stuck in the loop, I added the second loop (right) as a kind of "time out". If the program is blocked at this point for a specified number of seconds, it must end the left loop. But it happens, right loop stops but never left, we read the true statement and sticking. LabView itself is not frozen because I can go and the sons of the probe.

    Again, it is really difficult to solve because it occurs only 5% of the time or less. If anyone has any ideas as to why this is happening, I would be very grateful. I didn't post the real VI here would be useful, but please let me know if you want to take a peek.

    Thank you.

    PS Ce happened when executing the EXE in LabView environment

    Opening and closing of the VISA session several times are generally not a good idea.  It is preferable to configure the port outside the loop, do th ereads and written inside the loop, and then close the session after the end of the loop.  I would not be surprised if your serial port gets frozen due to the frequent opens and closes.

    In the end, you should learn about state machines.  This architecture would be appropriate for this type of program.

    Lynn

  • Why this Subvi takes longer each time I run it?

    I'm running this Subvi inside a loop, with say 2000 iterations. As the iterations increase, I notice that the time increasing, starting around 15ms when I = 0 and move upward constantly until it is around 100 ms to i = 2000.

    Do us admit that there is a method to my madness and not get bogged down in why I want this turning on and off 2,000 times. I have a similar Subvi in the same Hoop, which made a few signals in input/output tasks, which shows the same problem on a large scale. I notice a memory leak when I look at the Windows Task Manager as well.

    I guess the task of tension is created every time that's the problem, and I can certainly go to move before the loop. But I do not understand where va-the lost time. It has to do with how Labview stores/access tasks maybe?

    My guess?  You are creating a new task every time but without closing the if you find yourself using all of the resources on your computer.

  • Global has not read breast all loop - but Local is

    I have a face before written to a variable switch, so it should be read in a while loop.   If the variable is local, it is read and my code works, but I need to do a Subvi the inner loop, so it seems I have to use a global variable - but then it is not read, and the code does not work.  I am very new to Labview and I do not remember this difference being made watch anywhere.  I posted a very simple example.

    Instructions: Click on SW - LV, the beginning of the inner loop; Turn the switch off, inner loop stops.  Click on SW - GV to start the inner loop, but the inner loop does not stop by turning the switch.  If I go on the front of the SW - GV I can stop the inner loop.

    Any help woud be appreciated.

    I use Labview 2011 assessment and Windows 7.

    You are a little out of your reasoning.  I'll explain what continues.

    The outer loop runs in the lower loop and the inner loop runs once per iteration of the outer loop until the value of SW - LV is True. Then the inner loop starts reading the value of SW - LV each iteration until what you press the SW - LV thw to witch point passes the value of SW - LV (believe me, tearing up the Local write on and it works the same)

    The top loop: outer loop runs and the inner loop runs once per iteration of the outer loop until the value of SW - GV is true AND The Global is written.  Global cannot be written again in this loop as the outer loop is waiting for the inner loop at the end (you have a classic blocking!)  Written across the world elsewhere (as from global itself, breaks the deadlock)

  • update of top-level indicator VI of Anou35 loop

    Everybody, Halo

    I have a Subvi with a loop in it and an indicator that changes with each iteration.

    I wish to see the Subvi indicator in the top level vi.

    Please notify

    Thank you

    Ariel

    Hello Ariel,.

    by chance that you posted in the wrong forum, this one's for LabWindows/CVI, you should post in the forum LabVIEW rather

  • Read variable Subvi

    Hi all

    I would continue to read values inside a Subvi. The Subvi is a loop with 100 iterations.

    I mean, I want to read outside the Subvi each iteration, but in the same pole.

    Any idea?

    Concerning

    Kito

    Kitofelipe wrote:

    I would continue to read values inside a Subvi. The Subvi is a loop with 100 iterations.

    I mean, I want to read outside the Subvi each iteration, but in the same pole.

    You can't do it in the same line as the Subvi, because the loop cannot proceed to the next iteration, unless the Subvi has completed. You must use a separate loop.

    What is the purpose of this exercise, complicates useless things?

  • Sub - VI with nodes of feedback used more than once inside a While loop

    All,

    I have a Subvi is a set of operations and using 3 feedback nodes. I use this Subvi inside a loop While 4 times in total. I noticed all instances used to share the same result in each node for your comments, but I would like to have an individual result of each of them. Is there an easy way to work around this problem? I find ways to avoid this: a) create a different vi for each time the Subvi has been used. (b) use global variables instead of feedback nodes. Is there an easier way to get around this problem?

    ExamplePlease note that the two sub - VI are the same) If on my first Subvi I calculate a maximum value and get 1.29 (then goes to the crux of feedback) on my second slot - VI 1.01 my feedback to the Subvi second node records still get the maximum value or 1.29. (and I want it to be 1.01!)

    Hope, that it is not too complicated, I was scratching my head with that for a while, can't find the "easy" button Thanks in advance.

    -Pop

    IM using 9.0.

    It would be useful to join the code. Anyway, I'm not sure how several knots of comments are supposed to work so I will defer to others to answer that. As far as being able to use separate or instances values if you are using a Subvi, you could mark it as reentrant. In this way, each call to it will behave as it were a copy of the VI and it will have its own memory space. This should include the feedback node. You end up with a single slot - VI and in reality a single node of feedback. If you need pass data between calls that simply data through wire. You can also use a motor of Action to store and retrieve values. An EA is MUCH better than a global variable.

  • Send the name and the value of the control to Subvi

    Hi all

    I am trying to send the names and values of the controls to a Subvi.

    I know that I can check out the name and the value of the control by using a property node, but I was looking for a way to make is easy for the programmer to use.

    I think some sort of bundle function, it records the name and the value of the control, but I would like the programmer to be able to connect a random number

    controls to the Subvi without having to specify the number of controls Anywhere.

    I know there is stuff in labview configuration file, but it seems a bit more complex, so what I want to do.

    Also, I know that I can use the OpenG toolkit, but I will not use additional LabVIEW modules, as this VI may run on several different computers.

    I hope I made my problem clear enough!

    Good day

    Concerning

    Tommy

    What, creating an array of references to the command.  On the hand, you will need to fill the table with control references that you want to send to the Subvi.  In the Subvi, use a loop For with indexing to get every reference, and then use the nodes property to get the name and value.

  • How to handle errors in two parallel loops?

    Hello

    I have a loop that contains a structure of event and a second parallel loop that reads digital inputs.

    My question is:

    (a) how can I manage the errors of the various events? So, if in event1 is a mistake that event2 presented as input and can react to this topic. Currently, all events begin with "no error".

    (b) what can I do with the second loop? It is also always startin "without error" and doesn't know anything if there is a mistake in loop1.

    Is this only possible with a global variable?

    Thx for the help

    Create a user-defined event gets triggered whenever an error occurs. The input data to the event must be a cluster of error within another cluster - you'll see why when you go to use it.

    Now create a Subvi when it is called with its cluster of input error indicating an error, it raises the event you created above, otherwise, it does nothing. Install the Subvi in two loops after everything else.

    Register for the user on the structure of your event event and put what you want to happen when an error occurs in its event handler. Probibly should give you the option of quiting. If an error occurs in each loop the same evnt will be drawn and you will have the chance to stop.

    Mike...

Maybe you are looking for