LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Actor Framework Basic - The Message Class

Solved!
Go to solution
I am using the Actor Framework Basic. I want to migrate the Queued Message Handler code to Actor Framework code, but I have a question. Let's imagine that we have in figure code http://www.mooregoodideas.com/wp-content/uploads/2015/12/Classic-QMH.png, and I want to build a message for each of the cases that exists, but the parameters of each of the messages is different.
 
For example, let’s say I created a “Logger.lvclass” Actor. This actor can handle one message called “Log”. This takes a string input with the string to be logged. So if I created a Dynamic Dispatch Log.vi for my “Logger” actor and create a message for that method. Now I can create a “CSV Logger.lvcass” that extends my Logger Actor and override “Log.vi” with the CSV functionality. That means that when I launched a CSV Logger, anyone can send it a Log Messaged and it’d be logged to a CSV format. I could also create a “TXT Logger.lvclass” that extended my “Logger” Actor handled the Log message differently. (http://www.mooregoodideas.com/actor-framework-basics-part-4-being-productive-with-actors/)
 
I not be as there is to implement this code. Does anyone know an example that covers this situation? Can anyone attach a sample code? Can someone indicate a link to examples?
 
Thanks.
0 Kudos
Message 1 of 9
(3,030 Views)

Good afternoon, I have a question about using Actor Framework. Deputy example, to better understand what I do. I have a parent class that inherits from the actor, and the various messages are defined for the class, in this case "Get state.vi". Now define a child class that inherits from the parent class. Whether messages that are to be used are the same as those of the parent class, you need to define all messages for the child class or the child class can inherit all messages? How I can do to make a child class run messages from a parent class, with references to the child class?

 

Thanks.

0 Kudos
Message 2 of 9
(2,871 Views)

I'm not that familiar with the actor framework, but one of the best resources I found while learning it was here (at least, I think it was this): https://decibel.ni.com/content/docs/DOC-32600

 

It takes a sample application built using a QMH and shows you the various steps / progression moving it from a QMH to an LVOOP implementation all the way through to the Actor Framework.

 

It should help you see how you can adapt/modify your code to the actor framework.


LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 3 of 9
(2,833 Views)

Thank you. The link has been helpful, but still have not managed to run the example. Deputy what I have done case anyone comes up with an idea.

 

Thank.

0 Kudos
Message 4 of 9
(2,790 Views)

hello gentlemen..

i was just stuck again and again with actor framework usage in labview.

here i try to pass the message of boolean and a numeric between parent and child but it not works anyone help me to solve this?

Certified LabVIEW Developer,
Project Engineer, HTIC IITM.
0 Kudos
Message 5 of 9
(2,487 Views)
The code you attached is working as expected, Passing Boolean state from Parent to Child and Vice versa.
-Can you explain what is not working?
Thanks
uday
0 Kudos
Message 6 of 9
(2,471 Views)

Yes but... Problem is the numeric value not received between parent and child???

 

Certified LabVIEW Developer,
Project Engineer, HTIC IITM.
0 Kudos
Message 7 of 9
(2,467 Views)

@mohamedtanveej17 wrote:

Yes but... Problem is the numeric value not received between parent and child???

 


-You have to add first numeric control and indicator in same way as created for boolean control and indicator for both parent and child actors.

-Create new vi from static dispatch template and follow the same steps followed for Get State from Parent and Child methods.

-In parent inside event structure add new event for Numeric control and pass the value to the new method created.

Thanks
uday
Message 8 of 9
(2,464 Views)
Solution
Accepted by topic author dgd.gomez

Carlos,

 

Firstly, just in case you haven't seen it, there is a subforum/group for Actor Framework questions - the people there are really helpful and the questions are all about Actor Framework problems. They also have some helpful materials stickied.

 

Secondly, what are you trying to do? I opened the example project you uploaded (Example1.zip) and took a look but didn't see anything as the obvious goal.

 

Regarding inheritance, child classes (not the same as nested actors) behave in the same way as with non-Actor Framework OOP code. That is, if you have a dynamic dispatch VI in the parent, you can override it in the child class to modify the behaviour of the VI. VIs in the parent (dynamic or static) can be used by the child, provided it has access to the VI (i.e. the VI is Public or Protected, or the child class is a friend of the parent class and the VI is Community scope.)

 

If the VI called is implemented by the parent (because it is static, or because you don't have an override, or because your override uses 'Call Parent Node') then the private data available should be that of the parent - if you have a child implementation called via dynamic dispatch, the child's private data will be available to the override (but not the parent, during a 'Call Parent Node' VI call).

 

Messages also have their own inheritance hierarchy, but in the simplest case, they inherit only from Actor Framework's 'Message' class. Typically, they are a class with private data, which might be empty, or contain the inputs to the VI that the 'Do.vi' calls, and two VIs, 'Send <MessageName>.vi' and 'Do.vi'. The Do.vi is an override of the Actor Framework's 'Message.lvclass:Do.vi' and the parent does nothing here - what is important is that when an Actor receives the message, it calls the 'Do' VI of the Message that you define. Usually, this calls some public class VI (for example, 'Set Indicator' might be an example that could be called by Message). Here, you will also see that data is often unbundled from the Message class' private data, and used as an input for the public VI of the class that you sent the message to, via the enqueuer.

 

 


GCentral
0 Kudos
Message 9 of 9
(2,458 Views)