Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Example request of Abstract Messages in AF

Hi, I've been trying to learn AF for a while now and I'm stuck on the topic of abstract messages. Digging through the AF help in LV 2015, I found this:

Creating Abstract Messages

You also can create an abstract message class before you create the actor class to receive the message. An abstract message contains the message data and provides the Send Message method. The actor class that sends the abstract message class does not have to know which actor class will receive the abstract message class and how the actor class will receive the message class.

To create an abstract message class for an actor class, right-click an actor class and select Actor Framework»Create Abstract Message for Caller from the shortcut menu.

After you create an abstract message class, you must create a child message class of the abstract message class. The actor class that receives the abstract message class can use the new child message class to communicate with the actor class that sends the abstract message class. To create a child message class, right-click a public method VI of the actor class that will receive the abstract message class and select Actor Framework»Create Child of Abstract Message.


Is there an example that shows this functionality?

Message 1 of 14
(11,229 Views)

Have you already checked out this one?

0 Kudos
Message 2 of 14
(10,045 Views)

You can also have a look to this well described example.

Message 3 of 14
(10,046 Views)

Oli_Wachno wrote:


Have you already checked out this one?

I hadn't seen this before, and it is a nice simple example; thank you! Unfortunately it does not show a zero-coupled actor communicating data back to another actor, such as a caller, in a zero coupled way, which is what I'm hung up on.

skusie wrote:

You can also have a look to this well described example.

Thanks for the link, but I hate that example. The author decided to use a complicated physics problem of tidal water levels based on plantery gravity crap to explain an already complicated topic of message abstraction in AF. I found it slightly useful at first, but kept getting frustrated and lost in the details.

I'm looking for a simple example that uses the current AF messaging vi's that shows how an actor can communicate data back to another actor such as a caller in a zero-coupled way using the technique of asbtract messages. Thanks for any help!

0 Kudos
Message 4 of 14
(10,046 Views)

I posted this a while back. It's a simple example, but on reflection there may be too much detail in it (I tend to write tutorials in this step-by-step manner). It's loosely related to this tutorial, with both projects doing the same thing.

Message 5 of 14
(10,046 Views)

First, let me say that "Zero Coupling" is THE MOST IMPORTANT part of developing reuse modules in AF.

Here is a link to an example I previously posted with Zero Coupling:

https://decibel.ni.com/content/docs/DOC-42980

Let me know if you need further explanation.

Additionally, I have another step which is "two way zero coupled messages":

https://decibel.ni.com/content/thread/46499?tstart=0

This is my answer to not having "Interfaces" in LabVIEW. The message interface can be described outside of any actors and then children can be used to implement the communication between caller and nested actor.

Good luck.

Casey

Casey Lamers


Phoenix, LLC


casey.lamers@phoenixwi.com


CLA, LabVIEW Champion


Check Out the Software Engineering Processes, Architecture, and Design track at NIWeek. 2018 I guarantee you will learn things you can use daily! I will be presenting!

Message 6 of 14
(10,046 Views)

psammut schrieb:

Oli_Wachno wrote:


Have you already checked out this one?

I hadn't seen this before, and it is a nice simple example; thank you! Unfortunately it does not show a zero-coupled actor communicating data back to another actor, such as a caller, in a zero coupled way, which is what I'm hung up on.

Well, you can apply this concept also in the other direction. Each Actor will need two LUTs... but the disadvantage of this concept is, that you have tons of message classes in you project.

Casey's approach is does not require this, so you might want to give it a try

Message 7 of 14
(10,046 Views)

Thank you everyone! I finally got my test system working and I think I have a better understanding of the abstract message technique to disconnect the coupling between a nested actor, which does stuff and sends data back to the world, from its caller.

DMurrayIRL wrote:

I posted this a while back. It's a simple example, but on reflection there may be too much detail in it (I tend to write tutorials in this step-by-step manner). It's loosely related to this tutorial, with both projects doing the same thing.

This example was great thank you. I actually did this example back when I was trying to learn the basics of AF. At that time, I was still wrapping my head around the basic concepts such as how to put functionality in the actor core, and different schemes of shutting down actors with events. Because of that, the topic of actor message abstraction was way over my head and I wasn't able to grasp the concepts (i was still trying to learn how actors send messages to each other, let alone abstraction!)

Casey wrote:

First, let me say that "Zero Coupling" is THE MOST IMPORTANT part of developing reuse modules in AF.

Here is a link to an example I previously posted with Zero Coupling:

https://decibel.ni.com/content/docs/DOC-42980

Let me know if you need further explanation.

Additionally, I have another step which is "two way zero coupled messages":

https://decibel.ni.com/content/thread/46499?tstart=0

This is my answer to not having "Interfaces" in LabVIEW. The message interface can be described outside of any actors and then children can be used to implement the communication between caller and nested actor.

Good luck.

Casey

Thank you, I had not seen this example. It seems to be the same concept as Murray's, correct?

That being: you create an abstract message class for an actor that you are trying to make re-usable. That abtract message allows the re-useable actor to pack data into it and send it to whatever actor it needs to go to (whether it is the caller, or any other other that sent a request).

What I was getting hung up on, was the need to give this re-useable actor the implemented child object, so that the correct Do method on the "callee actor"  gets called. Murray's example gives us two ways of doing this, one being a means through private data that gets initialized by the callee actor with its child message object, and another way by sending along this object through a "data request" message.

I think that's enough for me and I'm not gonna spend the extra mental resources I don't have to learn the LUT way.

Thanks!

PS. If anyone reading this that is also having a hard time struggling to learn abstract messaging techniques, make sure you have a good grasp on basic AF coding with coupled actors sending messages to each other. Once you got that down and have made an application or two using AF, then dive into zero-coupling. Unless you're much smarter than I am and can fully grasp all these topics at once

0 Kudos
Message 8 of 14
(10,046 Views)

Hi all,

Thank you for this topic that has been very usefull for us to understand the concept of the abstract messages and ZC actors.

The tutorial and project "Beginner Tutorial: Zero-Coupled Actor Project" of DMurrayIRL was really usefull .

I just want to add that maybe new users should have a simple tutorial ,why not exactly the same than DMurray's BUT that shows how to do the job with the LV2015 AF shortcuts.

First, to create the actors and standard messages (it's hard to follow the document with all the micro steps 'create .lvlib', 'change inheritance', which are done automatically)

Second, to create all the abstract messages.

It would be great to have an example that says something like:

Here is how you create your reusable ZC_Actor, that can pass 'Some Data' to its caller.

Here is how you create your Caller_App_Actor, that will call ZC_Actor, and use its 'Some Data'.

And of course, all that as fast as possible, using the shortcuts of LV2015.

Today, I think I understand properly how all that works, and how to use the shortcuts, but as I haven't seen any tutorials, I'm not so sure I do the things the best way I could.

0 Kudos
Message 9 of 14
(10,046 Views)

Jonzarwal wrote:

The tutorial and project "Beginner Tutorial: Zero-Coupled Actor Project" of DMurrayIRL was really usefull .

I just want to add that maybe new users should have a simple tutorial ,why not exactly the same than DMurray's BUT that shows how to do the job with the LV2015 AF shortcuts.

First, to create the actors and standard messages (it's hard to follow the document with all the micro steps 'create .lvlib', 'change inheritance', which are done automatically)

Second, to create all the abstract messages.

I absolutely second this. DMurrayIRL's ZC example was the clearest, most organized, and simplest example I found, with my only gripe being all the nitty gritty details of manually making messages and libraries.

I understand the point DMurrayIRL was trying to make by forcing the reader to make their own messages to understand the data flow, but honestly if the reader is still trying to learn how basic AF messages are put together, then I don't think they should be trying to learn ZC concepts.

Personally, I feel like this path would be best for learning:

         Making your own AF application will show you first hand the need for ZC techniques to make re-useable actors.


0 Kudos
Message 10 of 14
(10,046 Views)