LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about Actor Framework's Child/Parent execution and messaging dataflow

Let me preface this by saying I'm very new to AF.  Much of the inner workings are still somewhat of a mystery to me- I havent figured it all out yet.  There have been some situations already where the code appears to read like it's going to do one thing, but infact does something entirely different... this makes it really interesting haha, but my questions might sound really dumb.

 

My question spawns from my situation where I currently have an issue with three actors that shouldn't proceed (through a sequence of events) unless two of them are ready to do so... 

 

What I want to ask, is if the child actor is calling the parent actor (thats what it looks like to me), and it self enqueues something before launching the parent actor, that msg is not going to be dequeued until the parent actor vi actually executes within the child actor no?  And if I need some method of this actor's class to finish executing before it starts responding to other actor's msgs to it, can I just drop that method and wire the obj through before the parent actor is launched?

 

Thanks

-pat

0 Kudos
Message 1 of 4
(2,867 Views)

The basic answer to your question is yes.

 

But we need to change a little bit of your explanation.

A Child Actor do not launch its parent.

In the "Actor Core.vi" in the child actor your call the parents implementation of that method.

The base of the Actor Framework is the Actor.lvclass. Its Actor Core.vi method has the function for reading and acting on incoming messages.

Every child of the Actor.lvclass can overwrite the Actor Core.vi to implement additional functions, but must always call its parents implementation of the vi.

 

If you want something to happen before your actor receives messages, then there are to possibilities. 

1. Call the functions/methods before you call the parents Actor Core.vi. ( Like you already have)

2. Overwrite the Pre Launch Init.vi method in the framework with a childs implementation including the functions you need tp have executed.

One thing to be aware of is that the Pre Launch Init.vi is not reentrant, so do not launch any other Actors in that method. Do that in the Actor Core.vi.

One more thing, the Launch Actor.vi will not complete until the Actor, that you have launched, Pre Launch Init.vi has completed.  So don't put any function in the Pre Launch Init.vi that take long time to execute. 

Message 2 of 4
(2,839 Views)

And just to be sure, you have read this and all the documentations?

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

 

There are some good documentation about the Actor Framework and OOP.

 

And one more a little advanced program. The two documentation files (.pptx) gives also a good understanding of the framework.

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

Message 3 of 4
(2,834 Views)

dk-

 

thanks for the response!

 

I don't think I can say I've read all documentation, but I did go through most of the docs with another engineer who seems to have a much better grasp on this stuff than me, he's just rarely available for help  I usually find that starting to play with an implementation really helps me understand the documentation to the point where reading it becomes more effective at me translating it from words to application.  

 

That second link you posted I had only seen some of the images from it- it looks pretty awesome.  I'm bookamrking it.

 

As per my claim of the child vi "launching" it's parent I really just mean calling, so I think I understand that, I was just using the wrong words...  

 

And I think I'm actually using both methods you mentioned for executing things before a child core is launched... I guess you could say it's bad practice that I'm not consistent...

 

Thansk again for the response.  Much appreciated.  I'm sure I will be back to ask you questions at some point...

 

-pat

0 Kudos
Message 4 of 4
(2,806 Views)