06-16-2017 08:18 AM
I made a PID controller and added a sub vi of a fuzzy controller. The idea is to add the outputs of fuzzy and PID controller. But when I run the vi it does not execute. Her is the vi attached . can some one help.
Solved! Go to Solution.
06-16-2017 08:30 AM
06-16-2017 09:28 AM
@Pargat wrote:
But when I run the vi it does not execute.
What exactly does that mean???
We are missing a subVI (fuzzycont.vi), so we cannot test your code. Make sure to attach all (or simplify so it runs without it while still showing the problem).
06-16-2017 10:10 PM
06-16-2017 10:11 PM
The .fs file is not uploading
06-17-2017 12:38 PM
06-18-2017 03:21 AM
Thanks for the reply first. Well my main vi is working and sub is not and when i press stop button there is no change. The output of the main vi reaches its upper limit but sub vi is not executed. How can they work simulataneously. Kindly help.
06-18-2017 11:46 AM
Hi Pargat,
Well my main vi is working and sub is not and when i press stop button there is no change.
I don't believe your main VI "is working" while the subVI is blocking DATAFLOW…
How can they work simulataneously.
When you want to run things in parallel you need to program them running parallel - THINK DATAFLOW!
As long as you use this subVI in your mainVI loop the subVI will block the mainVI…
06-18-2017 10:01 PM
@GerdW wrote:
"THINK DATAFLOW!" is all you need to obey!
Your subVI will run until you press that stop button. Your main VI will only iterate when the subVI has been finished - basic DATAFLOW!
Dear Pargat,
What GerdW means here is that in LabVIEW (and I imagine any other programming environment you'd care to name) a loop can't go to the next iteration until after it finishes with the current iteration.
When you place a loop in your Main VI, which calls a SubVI who also contains a loop, the Main VI will call the SubVI once per loop iteration - every time the loop runs, it starts the SubVI. It can't go to the next iteration until the SubVI finishes!
When your SubVI contains a loop, it's often indicative that you want the thing in the SubVI to run over and over again - but remember that the SubVI is being called over and over again! If the SubVI contains its own loop, it has to keep running until its own loop finishes, before it can say to the Main VI - "Hey, I'm done, you can go to the next iteration now".
In many cases, the SubVI should be written to just run the code once - it will run the code again in the next iteration of the Main VI's loop. This is often the intended use for mistakenly looping subVIs - really, they shouldn't be looping, because the Main VI is doing that.
06-19-2017 01:41 AM
Thank you so much for sharing your view and helping me solve the problem.
06-19-2017 01:50 AM
Thank u sir ,for helping me to figure out the problem