Subvi in the memory of the loop

Hello

I have a loop that contains 3 subVIs that are exactly the same (that's why I use a Subvi ) each Subvi controls a device (again 3 devices that are the same). The entries to each Subvi is from a Mathscript node. Thus, on each iteration of the loop (1 s), the output of the Mathscript node will be introduced in the subVIs.

The problem is that one of the 3 devices (the same one every time) gives an error after running for a few seconds. The error usually occurs because that the device does not receive an acknowledgment message after 3 seconds of running. I renamed the Subvi that controls this device, without changing the code and everything seems to work normally. Now, since the subVIs are all the same, I swapped two of them (one that I have renamed and another) and series of programs without problem.

I don't know how labview treats same subVIs inside loops, and that's what I want to know. Even if the output of the Mathscript node occur at the same time (after performance of all knots), and therefore the entry of the subVIs are all ready at the same time, the SubVIs seems to launch successively, or at least not instantly.

The device that fires an error is the first to run, and knowing that the Subvi contains a timeout 2000 ms, this device does not receive the recognition after 3s (because the acknowledgement is sent to the next iteration of the loop, if the subVIs 3 should go first before the iteration of the loop). That is, I changed the Subvi to decrease its 1710 ms delay time and use the same Subvi for 3 machines (without renaming it useless) and the program works flawlessly again.

So, I'm just curious how Labview deal of same subvis that simultaneously run inside a loop.

Thank you

I agree with Ben.

Mark your sub - VI as re-entering to allow all three instance of the same VI to run at the same time.

Default VI is marked as non-reentrant so they in turn running sub - VI.

In my Action Engine nugget , I have included this image to illustrate how multiple calls to a VI which is not reentrant is shared between instances.

If you don't want to make the screws under reentrant you might also do a save as... and use three identicle VI which differ only in name. I generally avoid this approach because the code for the sub - VI changes require that change all versions. Better to bite the bullet and learn how to set the VI as re-entering.

I hope this helps,

Ben

# 10 000

Tags: NI Software

Similar Questions

  • Node inside the loop - out of memory

    Hello world

    I have a Mathscript node inside a Subvi is called inside a loop for. After a few iterations of the loop, I run out of memory. That's why I added another node in Mathcript with the function 'clear' outside the Subvi, hoping that after I get the variables from the node I could erase the memory of the Mathscript, but this does not work, it is always short of memory.  Is anyone know how can you delete variable memory Mathscript node, once they were saved in the variables in Labview? Thanks in advance.

    You don't even really any useful information to solve the problem. As I exaplained, constantly deleting data sets just to reassign them to the next iteration is generally ill advised, because it causes just more performance and same memory fragmentation issues. It is best to operate locally as much as possible.

    Who wrote the code matlab? Maybe it's very inefficient? What is doing? Perhaps rewrite in LabVIEW you gain significant performance.

  • indicate the end of the loop to the Subvi state information user

    I hope that I can adequately describe this as an example would take time.

    I have a test that implements a chip by using a scheme of control in series. This takes place in a Subvi. When the control bits that all entered the chip, a flag is asserted. I want this indicator to display on the front of the parent company of VI. The parent VI runs the Subvi iteratively until all the test cases are covered. A user dialog box interrupts this main loop to give time for the user to physically move a probe. I would like to indicate to the user that the test conducted in the Subvi is over and he can move the probe to the next test point.

    If I do a link with the flag in the Sub - VI the indicator on the main façade follows the status of the indicator in the Subvi through the first iteration, but then stays like that, even if the flag is disabled in the Subvi at the beginning of the iteration.

    How can I get an indicator in the main VI to display the status of the indicator in the Subvi?

    As Dennis said, it's a matter of data flow.  The Boolean value is passed out of the Subvi that once completed the Subvi.  At this point, your GUI indicator is defined with the value coming from the Sub - VI.  What I suggest is to erase this GUI indicator just before running the Subvi.  I does not affect the Subvi at all, only the indicator is on your main façade.

  • A generated within a loop in a subvi output data can be transferred to the main program for each iteration of the loop?

    Hi LV users,.

    I have a very basic question, I have not succeeded to asnwer using basic considerations.

    I made a sub - vi that performs a scan of current-voltage using a unit of measurement-source Keithley and a loop FOR.

    The subvi outputs 2 tables with my data (essentially an array of voltage and the corresponding current table). I also defined a Terminal at the exit of a group of these 2 tables in order to plot a graph XY - output. Specifically, I indexed this cluster to update after each iteration of the loop FOR, in my sub - vi (the indicator is placed outside the loop, of course).

    My problem is that I want my main program to display the XY-graph in real time, with an update after each iteration of the loop FOR which is in my sub - vi.

    I have a problem because my sub - vi output terminals are available for the main program concluded as soon as the sub - vi has completed its own execution (which is what we expect of sub - vi to do).

    How can I use a sub - vi (because it's handy) and get in the main program in the course of its performance data that are generated from the loops of sub - vi?

    Thanks in advance for your help,

    Yoyo87

    Elements of the queue in the Subvi them put your main VI where you want to display the data and the.

    It is similar to the architecture of producer/consumer. There are examples of it in LabVIEW. The examples work with 2 parallel loops, in your case a loop (the producer) will be in the Subvi.

  • While the loop and the passage of a string to a Subvi problem

    Hello world

    My problem is this: I have a MainVI and a Subvi, the MainVI is running a while loop in which the Subvi is called and goes to 2 parameters, 1 bool and 1 chain. the problem is, inside the Subvi the chain should be placed in a text box so that the user can see before pressing ok.

    Background of the present: normally "Get_DMC.vi" opens with just the text box and a button cancel, means to scan 10 characters of big entry. It still works fine. If the user selects the DMC model in the MainVI, it should only copy the dummy DMC of the MainVI (the above string) to the show, and Subvi in the text box as well as allow another button 'OK' for the opportunity to control themselves (Advanced) users.

    The Subvi is reloaded on every call because he'd be stuck in the while loop, I had not done that. Not quite sure why, if someone has an answer to that aswell please tell me.

    Many thanks in advance,

    Kind regards

    Pedro

    It might be that the writing of the DMC to "Value DMC" model that happens before the "reset DMC by default".  Try the error off DMC Reint default wiring to the value DMC error to force the order of execution

    Ken

  • Cannot read every value of the loop iteration for

    Hiiii...

    I developed a front-end which reads the values of serial port and display on the front panel.

    16 channels, which is a string data value. I've separated this string to read the data of each channel, but at the end of the loop for, I can read data only one channel for an iteration, and also I have to store each value iteration in a text file.

    I'm new to labview. Help, please. I have LabVIEW 8.0.

    Attached is my application code.

    This seems quite inefficient. Why don't you use a business structure? Why don't post it your code.

    In regards to the original code, you try to run by using the run continuously? I ask because I do not see a global loop, so it was not clear whether this was intended to present itself as a simple Subvi or "on-demand". If it's supposed to run continuously until you stop, DO NOT USE CONTINUOUSLY RUN it BUTTON. Use a while loop in your VI. Do not forget to place the initialization and close outside of the loop - you don't need to initialize and close the serial port whenever you loop around.

  • tasks timed inside the loop

    I have a program that has multiple tasks, and I want to work at different frequencies inside the loop.  I wonder what is the most effective way to do this?

    I read on several tasks running button push-based or events, but have not found much of the timed tasks.

    Is the loop timed the best way to go with this?  Have a loop timed for each required task?

    I have attached a vi corrupt that shows what I'm trying to do.

    I'm sure there is an easy solution, but want to find more effective this way.

    Thank you

    For a simple task like this, just turn the loop at the faster pace, you need and perform other tasks to integer multiple of it.

    Here's a simple project (LV 8.6)

    (Of course you have serious problems with stolen memory, as you grow berries of infinite sizes in the uninitialized shift registers. Which must be fixed too).

  • Configuration of the loops in LabVIEW to return to the beginning under certain conditions of CRC calculation

    Hey gurus of LabVIEW,.

    Well, I recommend also move your file in writing to be inside the loop, more precisely inside the TRUE (I could bad told you before).  If the CRC was released in 0, do you all the processing, otherwise do nothing.  Then the next iteration.  By moving the file i/o inside the loop, you're avoiding accumulate huge berries (IE a lot of memory).

  • How can I display a variable evolution in a Subvi on the face before of the main vi as the Subvi is excuting

    In the attached document the vi on the right is sub to the vi on the left. On the Subvi on the right of the variable "playing field" is continuously updated on the façade of the Sub - VI as the loop 'for' is executed, but only the last value of the variable is updated in the table main before vi which is what is expected. My question is how can I display the evolution of the value of 'Playing field' on the main façade of vi that the loop 'for' in the Sub - VI is running?

    Thank you.

    I don't have the drivers you are using. But here's an example of how update an indicator of a Subvi. To create the reference control in the Subvi, select control refnum in refnum palette and drag a numeric (or other) on the refnum control.

    VI the appellant

    Subvi

  • Incorrect display using the loop format for

    Hello

    I have a digital painting using a hexadecimal display format that is autoindexed by a loop for. Within the loop for each unique value is passed to a Subvi needed the hexadecimal display format. Unfortunately, indexing is not keep this hex format but transfers back to a decimal number.

    No idea how to solve this problem?

    Thanks in advance and best regards

    Simon

    Thanks for this tip. The problem was an another Subvi where I created the num-array that will subsequently in the loop for., all the digital elements where the value instead of I32 I16. The controller could not handle these false values, so I got a nonsense.

    Thank you very much for your quick responses!

  • Subvi inside the structure of event wont run a second time.

    I have a Subvi within a structure of the event, and it runs when I press a button, inside the Subvi is code in a while loop, and when the last piece of code is executed, the while loop stops.  I have a bad event triggerring once I have already run once.  Which means that I pressed the button and the code in the event structure was executed and while the main VI works always, I press the same button again and everything works but the Subvi.  How I would do this job?


  • PtbyPt filter FIR in the Loop Simulation

    Hello

    Currently, I am trying to simulate the power in my engine when I apply a voltage step for 20 MS for that I intend to use a FIR filter in the control and simulation module that simulates the other parts of the engine.

    However, I have found that the FIR filter seems to be strange behavior. When I change the order of Runge-Kutta 1 simulation to 2 of Runge-Kutta it effects the output of the filter FIR PtbyPt VI. The two attached images show how the results of the convolution of the IR and the tension, the FIR outside the simulation loop filter and FIR filter in a loop using Runge-Kutta 1 are the same. However, the second image shows that the FIR filter in the loop simulation Runge-Kutta 2, has a different answer.

    Why does this happen? As I understand it, the type of simulation should have little effect on the application of a FIR filter based on pt by pt. I have not changed the timestep or other parts of the simulation. I want to use a simulation of order higher than for other parts of Runge-Kutta 1 would be insufficient for the simulation.

    I'm using LabVIEW 2011 SP1.

    Thank you

    Rhys

    When you try to use RK-2 or higher order, the screw that dumped you inside the control and the Simulation loop, by default, they will all run in the "minor" time steps too. In your case, 'two times' which means the VI will be executed each time step.

    To properly configure these screws, you must "right click" on the VI and select "Installation of the Sub - VI node. This will bring to a Setup page that the second half you will choose in 'Type of Simulation Subvi execution' to 'remove' the "Include minor steps" box and press OK. When you do this, the Sub - VI will be annotated on the upper right with blue 'C' and when you run, it should provide a similar result as RK-1.

    Note that in this dialog box, you can also select discreet, which, in many cases, it is the right selection for 'discrete' systems

    I hope this helps...

  • To end a Subvi after the break (with IMAQdx)

    Hello!

    So, I need to display a grid on a projector and take a picture of him with a camera. My problem is that I want the program to run as quickly as possible and at the moment I can only show the grid a certain amount of time.

    So I would like to confirm that the photo was taken and stop the vi poster sub grille. I thought that by replacing the tempo by a certain time structure

    and send the message 'stop' after taking the picture might work but it doesn't.

    So my idea was to make a sequence and then send the message to "kill".

    I read about the events, but I don't know how to use it and even if it is not too complicated.

    The first picture is the main vi and the second, that I want to end.

    Hello

    Sorry, I don't have that the VI grid is actually a Subvi from the mainVI. You can use a global variable to pass your stop request to the Subvi.

    The question is: do you want to stop the Subvi after loop iteration for all four? Or do you want to start and stop the Subvi in each iteration of the loop for?

    Here is an example for the second option:

    now, it should work. in the first image is set to false - the Subvi 'Grid' will continue to run the shutdown command. After the image was taken at the 'grid' Subvi is hollow arrested the last image.

    See you soon,.

    Cheggers

  • too long in the loops of whlile (timed)

    HY

    I am: routinely labview developer course made, advanced no performance (not even as it may seem, I need that).

    Programm: multi all structure of event loop with lines of command for each loop, more a single elemnt queue for each loop running as a variable. network communication trought the queues is possible! Many hardware addons as controller PXI Motion and IO digital communication, RS232 communication with several controllers different als separated loops. The software also works without connected hardware components.

    problem: lines of "continuous loop" rate should be less than 5 ms, but is about 15ms/iteration at the present time.

    hardware: computers 2core, WinXP32bit, LabVIEW9

    goal: improve rates of loop of the "continuous loop.

    What has been tryied and tested:

    OK, I tried many things, partially with success.

    -make Subvi returning some of them are used many times at the same time in each loop (see hierarchy VI)

    -increase in speed Subvi with code improvements, partially with success

    -Analyze with the profiling of the VI

    Question:

    When I was profiling the performance of my VI, I have identified that summarizing the duration of the Subvi "Continuous loop" does NOT match the current loop duration. they are about 20-30 ms, whereas they should be according to the number of tracks and the total corresponding to 3ms. in other words, it is factor of 6 to 10 slower than it should be in my point of view. I don't really have an idea of why this happens. the printscreen and its corresponding information is without another iteration loop (deque just waiting) running.

    I tried to get more details and made a few tests and comparative analysis with my continuous loop. He showed that this additional time (latency? so high?) is not actually produced by the continuous Subvi and also not part of the loop deque. It seems that almost all the time of the loop is displayed once the code for the loop is finished... and before the beginning of the loop, somehow...

    If you have any suggestions or information, why this is the case, or if you even have ideas for improvements or references, please let me know.

    attached is viewed from the corresponding part of the program. I don't want to the public the entire program for everyone. If you have any ideas or need the code for the specific tests, please send an e-mail directly to stefan.hartmann (at) psi.ch.

    best thanks in advance

    HY

    OK, I found the problem. the long time of iteration is produced mainly due to a queue which was to load and write the string array of 100 x 100 several times by iteration. This is the reason why time iteration actually has been measured so high and produced a further delay by iteration, next to the slot-VI-times.

    I solved this problem by maintaining the use of queues in 100 with chain 1 x 100, where I actually just need a queue by iteration and not the 100 x 100. This means at the time of iteration about 2 Ms!

    see you soon

  • Table of path error 1430 in the loop for

    Hello!

    I have a problem with the 1430 error: path is empty or relative, which seems impossible. The thing is that I have a battery of indicators of path connected to the loop for (check the .jpg and there is no problem with writing to a file by using the paths of an array with the first and last index.) Others are not saved because of the error... to be honest, that all data paths are absolute. Record in the file of the idicator path is the work of a Subvi (merge data vi) but it is in a for loop because I need to make it available to multiple files. There is no error that occur with the work of Subvi to a path. The question is: what labview makes with the paths saved in a table between the loops? I have just run out of ideas so if someone had some time, I would really appreciate for all the tips and ideas.

    K.

    Hello again,

    If someone was interested in the happy ending: the solution is: 2 loops for. I think there must be something with the way that labview sends data between iterations. In any case - don't know how much exactly but works

    the floor is .jpg.

Maybe you are looking for

  • ITunes cannot back up

    As it is shown in the figure. Whenever I connect the iphone to itunes in my laptop. He asked me to unplug. And there is no backup options.

  • Equium L10-142 battery life

    I had the above for a few months now and have understood the battery does not last very long at all.I used to charge for a long time when I arrived at the comp, and I unloaded first uses. I also periodically run the battery and fully charged. It seem

  • How can I delete my payment information for my iPhone

    HI, I just need some help, I want to take my my iPhone off payment information 6. 64 gb, iOS 9.2. I tried to go into the settings of application/ITunes store but I couldn't find a 'none' button or whatever it is to get to be there. I took my iCloud t

  • hs_err_pid3840.txt error is displayed when you log in minecraft (a game) and stops, how do I fix?

    While I started the newspaper in minecraft it black screens and stops off the coast, I tried the following to correct this situation. -Removed .minecraft -Removed and reinstalled java -Deleted files that could in fact this problem And I remember what

  • "Delete Volume" grayed out. What can I do to remove the partition?

    Hello world I have a laptop quite old and finally 37 GB C: drive is full and I would like to delete the partition between it and the 35 GB D: drive so I can use the entire disk. However, when I go into management records 'Delete Volume' is gray, only