From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-23-2018 03:25 AM
I have a producer consumer loop, and in one of the cases I am calling a VI dynamically, i.e create a reference of the VI and use the Invoke Node method to run the VI. But I want the VI to continuously run. But for me the producer consumer is continuously running but the dynamic vi just runs once and stops. Also I have not used the close reference. So what should I do for the program to run continuously. Thanking You.
Solved! Go to Solution.
10-23-2018 03:48 AM
Maybe the dynamically called VI needs a while loop?
(I hope you are not talking about the "run continuously" button. That's just a debugging tool.)
It is possible that you have little experience and we can help. Please tell us what you are actually trying to achieve, maybe show some code. There probably are much better solutions to whatever you are trying to do.
10-23-2018 03:57 AM
No, I am not talking about the run continuously button, I know what that is. Here I will attach a pic.
See the place that I have marked, that is dynamically calling VI. You can also see its in a while loop. So I want it continuously run in every loop. Also the top loop is the consumer loop and the bottom is the producer loop. Even though while loop is iterating, the run VI only works once. So how can I continuously run it, that is keep on running until I press the stop button.
10-23-2018 04:08 AM - edited 10-23-2018 04:13 AM
@govindsankar wrote:
No, I am not talking about the run continuously button, I know what that is. Here I will attach a pic.
See the place that I have marked, that is dynamically calling VI. You can also see its in a while loop. So I want it continuously run in every loop. Also the top loop is the consumer loop and the bottom is the producer loop. Even though while loop is iterating, the run VI only works once. So how can I continuously run it, that is keep on running until I press the stop button.
Could you post Write Temp 1 - Copy.vi block diagram image/snippet here? It may help easy to debug it.
10-23-2018 04:18 AM
Hi govind,
I want it continuously run in every loop.
You wan tto start that VI with each iteration of your consumer loop? Why?
Even though while loop is iterating, the run VI only works once.
Why is it running only once? Do you get any error messages?
So how can I continuously run it, that is keep on running until I press the stop button.
Start the VI once - before the consumer loop.
Have it run in its own loop. Transfer data using a queue/notifier…
Btw. why do you create a new OOP instance in each iteration?
10-23-2018 04:32 AM
I think you want each iteration to instantiate a clone of the dynamic VI?
You'll need to make the VI reentrant, and open the reference with 8 as input. Then you need to manage the references you'll be opening. The started VI could do that itself (stop when done)… Note that if the VI starting the clones doesn't keep the reference, and the clone doesn't open a reference, the clone is removed automatically...
10-23-2018 05:01 AM
I was able to do what you told me to do. That is start the loop separately in one condition and have that vi run its own loop. The way I have done is a switch called thermo board 1. When I click on it an event is triggered that enqueues two cases one is the case for the run vi and other is a blank case in the beginning called start. So first the run vi occurs which will run the vi in the background and then it will go to start where nothing happens and it stays idle. This is exactly what I wanted which Mr GerdW has helped me achieve. But now the problem is with event triggering. When I try the event as button thermo board 1 value change, that event occurs twice, so in our case consumer loop it will go to run vi and runs the vi, then goes to start and again goes to run vi, so when it is trying to run a vi that is already running, an error is formed. So I change the event from value change to mouse down for the button and it works properly only once run vi is triggered and then goes to start state and stay idle. So I can program with mouse down, but for learning purposes i need to know what is the difference between value change and mouse down for a push button Boolean. Why is value change event happening twice whereas mouse down only once and goes to timeout.
10-23-2018 05:26 AM - edited 10-23-2018 05:26 AM
10-23-2018 06:42 AM
Mechanical action was switch until released, so that it will work as a push button. Yeah but your method to change it to latch when released worked. Thank You. I need to now learn more about dynamically calling VIs. If anyone has any good link or site for that kindly let me know.