LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Community Nugget 4/08/2007 Action Engines

Solved!
Go to solution

I'm a few years late on this, but I would like to thank Ben for this nugget.

And i pay $$$$ to learn from professors that dont give this high quality type of explination.... why? Smiley Very Happy

Cory K
Message 61 of 161
(8,574 Views)

Inpost #25 of this thread I explained how to use an Action Engine to help manage control references in large apps and to keep our code cleaner. This image is discussed in that thread.

 

Dynamic_Event.JPG

 

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 62 of 161
(8,405 Views)

... and if you have read this far and still don't know what to think about AE's then you may want to follow this thread (on the other side Smiley Wink ) where Daklu get up on his soap-box and declares AEs are an Anti-pattern. Smiley Happy

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 63 of 161
(8,188 Views)

In this thread, I posted a case study of how I use a GUI controller to keep my code clean using sub-VIs while also allowing access to FP object using a GUI Controller form of an Action Engine.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 64 of 161
(7,739 Views)

I'm fairly new to LV and this nugget explained how to do almost exactly what I'm trying to do.  I do have one question however, and it's probably easy...

 

I am using an AE with three cases to control a VISA instrument, the cases (actions) are as follows:

 

Initialize - opens the VISA resource

Set Value - sets the users value on the VISA device

Clear Task - sets all the channels on the device to their off state and clears the VISA task

 

My question is, what do I do about the unwired terminal in the 'Clear Task' case?  The terminal is expecting a VISA resource ID, but the purpose of the final case is to destroy that resource.  I've looked for some sort of NULL constant to wire there but can't find one.  If I tell it to 'use default if unwired', what is the default value? 

 

Screenshots of the 3 cases are below, any advice is greatly appreciated.  Thanks everyone for the info on this board.

 

ae_initialize.JPGae_set_value.JPGae_clear_task.JPG

0 Kudos
Message 65 of 161
(7,149 Views)

Right click the terminal and choose create constant. It should be an empty constant created.

Message 66 of 161
(7,145 Views)

Thanks for(imstuck).  I didn't realize that's all it took to keep LV happy.  Coming from a history of strongly typed text languages, I guess I'm used to explicitly telling the compiler what values I want where, so I wasn't sure if empty constants were really kosher here.  I guess that's why LV makes things easy.

 

This is a great nugget and I think will let me do just what I want.  Thanks again for the help.

Message 67 of 161
(7,134 Views)

@ScaledPilotGuy wrote:

Thanks for(imstuck).  I didn't realize that's all it took to keep LV happy.  Coming from a history of strongly typed text languages, I guess I'm used to explicitly telling the compiler what values I want where, so I wasn't sure if empty constants were really kosher here.  I guess that's why LV makes things easy.

 

This is a great nugget and I think will let me do just what I want.  Thanks again for the help.


You are very welcome and thank you for the kind words. I am glad it is continuing to help.

 

Spoiler

I am still accepting Kudos for this Nugget (since I just need two more for it to move into a tie for the top rated post) so please feel free to Kudos that first message.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 68 of 161
(7,120 Views)
Solution
Accepted by Ben

@Ben wrote:

 

Spoiler

I am still accepting Kudos for this Nugget (since I just need two more for it to move into a tie for the top rated post) so please feel free to Kudos that first message.

Ben


 Strong kudos beg 🙂 haha. That aside, this is such a great nugget because it gives an object oriented approach to LabVIEW, even if you don't use LVOOP. It allows you to keep things organized, and data stored to be accessed any "method" (action/case) in the "class" (subVI). But I guess this statement is nothing new, I just felt the need to reiterate it.

Message 69 of 161
(7,117 Views)

Steve Chandler wrote a very nice micro-nugget that can be found here expaning on the idea (posted by Jim Kring) of using wrappers to encapulate Action Engines.

 

He extends the idea by exploiting libraries and public and private scope.

 

Please click here to read more on this subject.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 70 of 161
(6,351 Views)