09-23-2011 03:03 PM - edited 09-23-2011 03:07 PM
Attached is a snippet of a SubVI that I use for a counter acquisition task. It acquires an RPM, but occasionally gets an erroneous reading, either through noise or otherwise (blips above 16,000 RPM when the expected value is below 8,800.) I re-wrote the subvi to be like what I think is an Action Engine. This way it determines if the number is wrong, and outputs it's last value (a concession I'm willing to make as one or two doubles every few minutes is much better than the hazards of reading an unbelievably high value.)
Is this the correct usage of an AE, and will it work? I'd like someone else to reaffirm my work prior to me actually putting into use, because the problems that could arise if it does something that I really don't expect could be costly and time consuming.
Thanks for any help,
-Ian
PS. Sorry, just realized that it may not make sense without the true case explained. In the case of a true result (i.e. the RPM is measured greater than 16,000) I just wire through the shift register.
Solved! Go to Solution.
09-23-2011 03:18 PM
That looks like it would work to me.
I don't know if I would exactly call it an action engine as they generally have an enum to help determine what "action" it should take. And you may want to have an action such as Init that would be able to reset the shift register to zero like at the beginning of a program so you don't accidentally output an old RPM that was left over from the previous time the VI was run. But that really only becomes an issue of you have one or more iterations of bad data before you happen to get your first good reading of the VI run.
Overall, the VI seems to implement the principles of the uninitialized shift register (which is the heart of an action engine) just fine.
09-23-2011 03:19 PM - edited 09-23-2011 03:23 PM
Well it really isn't an action engine. It is a VI with an uninitialized shift register which is the foundation of an action engine. An action engine will have a case structure with typically a typedef enum connected to the selector. What is in the true case?
Oh and a "snippet" is a png file that contains the code. They can be dragged onto a block diagram and LabVIEW will extract the code from the image. You can create one by selecting some code then Edit/Create VI Snippet from Selection. Better yet use Ton Plomp's Code Capture Tool. It's awesome. What you have is just a screenshot.
[Edit: Doh! beat by a minute ]
[Another edit: Here is a link to an excellent writeup on Action Engines]
09-23-2011 03:28 PM
Thanks guys,
Sorry Steve, Raven get's the solution on this one.
-Ian