LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication Between Parallel Actors

Solved!
Go to solution

Hello,

 

I am trying to learn Actor framework. But all the online material I found involves nested actors, i.e one actor launching another actor. But how does two parallel actors communicate. I am trying to find material on that. Just to remind you there is no parent actor. The launcher is a simple VI that just launches these two actors and they need to communicate between them. Launcher closes after running the 2 actors. So how do I do that ? Thank you. 

0 Kudos
Message 1 of 21
(841 Views)

My understanding is that Actor Framework communication is based on a tree.  You need an actor that is above your two parallel actors that works as a broker.  So for A to send a message to B, it sends a message to Parent and then Parent passes it down to B.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 21
(822 Views)

Like @crossrulz said, that's the reccomended way. However, in special situations, the two actors can communicate directly, you just need to share their enqueuers.

Lucian
CLA
0 Kudos
Message 3 of 21
(789 Views)

Do you know any online material that shows how to do that? I am trying to understand how to share the enqueuers. 

0 Kudos
Message 4 of 21
(784 Views)

You share enqueuers like you would share any other type of data: by messages. Main VI launches the two actors and then sends a message to each actor containing the other actor enqueuer.

Lucian
CLA
0 Kudos
Message 5 of 21
(776 Views)

@govindsankar wrote:

Do you know any online material that shows how to do that? I am trying to understand how to share the enqueuers. 


Here is an example showing two ways to share enqueuers between actors 

snip.png

 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 6 of 21
(753 Views)

I think I got the idea. So there are two actors Actor A and Actor B and in its cluster data we keep a message enqueuer in its cluster and then create a message to recieve a enqueuer for both actors. And in the main VI we launch both actors and then use the VIs, I use the recieve enquer of Actor B with the enqueuer from A and vice versa and then unbundle this clusters in its respective actor cores. I think that is the idea?

0 Kudos
Message 7 of 21
(745 Views)

@govindsankar wrote:

But then the main VI has to be an actor as well right. In my program the launcher or mainVI is not an actor. 


Well yes and no. The "Main" VI does not have to be an actor ... unless you want to send messages to it like an actor, then it needs to be an actor. 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
0 Kudos
Message 8 of 21
(729 Views)

@govindsankar wrote:

I think I got the idea. So there are two actors Actor A and Actor B and in its cluster data we keep a message enqueuer in its cluster and then create a message to recieve a enqueuer for both actors. And in the main VI we launch both actors and then use the VIs, I use the recieve enquer of Actor B with the enqueuer from A and vice versa and then unbundle this clusters in its respective actor cores. I think that is the idea?


Yes, Since the actors are "objects" you have a built in <your actor name here>.ctr cluster with class data for which you can add the enqueuers and other class private data structures. Then in the context of the actor you can "unbundle" the other actors enqueuer and send a message to the other actors. If you have the reference to an enqueuer you can set it in the actors class before launching the actor or you can create a message to send to the actor and pass an enqueuer after the actor is launched. If you make a base class actor that extends the built in actor class you can make methods to pass enqueuer refs across all the actors that inherit from the base class actor. 

 

Jay14159265_0-1710345066207.png

 

Some other helpful things are that if you add items to the cluster of class private data for an actor, you can right click on the actor class object and create accessors: 

 

Jay14159265_1-1710345180222.png

After you create an accessor VI you can right click on it and create an actor message: 

Jay14159265_2-1710345279210.png

 

 

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
Message 9 of 21
(719 Views)

@govindsankar wrote:

Do you know any online material that shows how to do that? I am trying to understand how to share the enqueuers. 


I highly recommend this series of videos by Tom McQuillan: LabVIEW Actor Framework - Tutorial Series 

Message 10 of 21
(711 Views)