11-17-2014 02:34 PM
Hi,
In my application I need to run the subvi 'Create ramp' once when a button is pushed. Then the 'Generate ramp' subvi runs, but I need this subvi output in real time for another subvi to run in the program. Previously this all worked because I had no subvi and only a big messy Vi but now I don't quite get how to make it works.
See here the output of 'Generate ramp' is needed for the 'PID' subvi.
Thank you,
11-17-2014 02:38 PM
Put a case structure around your subVI call. Control the case structure with your button.
11-17-2014 02:40 PM - edited 11-17-2014 02:56 PM
The thing is that the second Subvi includes a While loop. The problem is here I guess, I don't know how to make it without the While loop.
Maybe it will be clearer with those images :
11-17-2014 02:56 PM
What you just showed there is a state diagram. Meaning you should really be looking at a state machine.
And since it looks like you want to continuously generate a ramp pattern, you might want to look into using an Action Engine. It could keep track of your elapsed time and position in the ramp array and update the output as needed.
11-17-2014 04:14 PM
Yeah if you want to design software based on a state transition chart, you might want to base your software on a state machine. Here are a few links.
http://www.ni.com/white-paper/7595/en/
http://www.ni.com/white-paper/3024/en/
http://www.ni.com/white-paper/7604/en/
I think they are covered in Core1 and 2.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
11-17-2014 04:36 PM
I'm assuming that you are doing things a point at a time, with a loop around the "generate all the points" routine. This is a fairly common LabVIEW Design called the Consumer-Producer (or Producer-Consumer) Pattern. You have a Producer loop that generates data continuously at some rate in a loop. To get it out of the loop, the usual method is to put it into a Queue, which also goes to the Consumer, which waits patiently for the data to appear and then plots it, does a PID, or whatever.
In LabVIEW 2013, if you go to File, New, you should be able to find under VI/From Template/Frameworks/Design Patterns two examples of the Producer/Consumer Design Pattern that you can modify to suit your situation.
Bob Schor