LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Actor Framework and OOP Interface Class problem

Solved!
Go to solution

Hi all!

 

I have an int_Test class being called by the main Actor Core (UI)

I have a Demotest Actor inheriting from the int_Test class and running methods overriding the methods in the interface, but keeping the implementation of the int_Test class.

In the methods for the int_class I have a read-caller enqueuer.

 

When the methods is executed everything works fine, until the Demotest invokes the parent method (int_Test), the send message to the Main actor fired returns the error 1556.

 

I have two questions: does my implementation make the AF think that the caller for the int_Tester is no longer the Main Actor

Core?

If so, how should I handle this?

Int_testMethod.PNGDemoTestMethod.PNG

 

 

Download All
0 Kudos
Message 1 of 10
(4,342 Views)

There is a separate AF forum which may be a good place to go for this (https://forums.ni.com/t5/Actor-Framework-Discussions/bd-p/7101) but here are a few thoughts of mine.

 

It's a bit unclear of exactly what you are doing so I think it would be best if you could attach the project that you are using which shows exactly what is going on. What I would make sure of is that you are using Launch Root Actor to start up your Main Actor which then uses the Launch Nested Actor to start up the DemoTest Actor. The reason I'm being so explicit about this is because my first thought is that you are running into error 1556 because you are simply calling the Actor's methods without actually launching the actor so the queues are never created in the first place (hence them being invalid).

 

On a separate note, is there a reason why you are sending a start message with the data "Initialize DUT" instead of simply sending an Initialize DUT message?

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 10
(4,275 Views)

Hi Jacobson!

 

Few things:

 

a) I did realize there is a forum for AF, but post-factum

b) I am using a Launch Actor to launch the Main Actor

c) I am using the Launch Nested Actor to launch the int_tester Actor

d) I then load the child class of the int_tester onto the int_tester class wire to run the dynamically dispatched methods over-written by the child.  This is the step when the Message Queue gets overwritten to '0' - i.e. no longer exists.  One thing is to may be make the child actor an AF as well and launch that actor as well, but even if I do that, I don't think the int_tester methods would send a message to the Main Actor any longer (when getting the caller actor enquer it will now return a reference to itself)

 

p.s. I have attached the .zip for the project, it's very raw based on the AF template.  Disregard the Actors A/B I just haven't removed them yet.

on the ui choose DemoTest in the enum window and press start test

0 Kudos
Message 3 of 10
(4,273 Views)

So what is it that you are trying to do exactly? What's happening is that you have your int_Tester actor which is a nested actor of your Main Actor so it has a caller and knows the caller's enqueuer. You are just substituting that Actor for a separate, default, actor object which hasn't been launched so it doesn't have a caller (it won't even be able to find it's own enqueuer because they were never initialized).

 

What I'm guessing you want to do it simply launch the DEMOtest actor instead of the int_Tester actor although depending on what you are really trying to do you may be looking to make use of the substitute actor override.

Matt J | National Instruments | CLA
0 Kudos
Message 4 of 10
(4,269 Views)

Again, thanks for your response!

 

I want to set up a Channeling Pattern in the interface class

and run this pattern with it's child's object, which has some dynamically dispatched methods defined in the in the interface class.

0 Kudos
Message 5 of 10
(4,267 Views)
Solution
Accepted by rsmrostov

If you are running a channeling pattern, you don't need to launch the parent class actor (int_test) from the Application actor, you need to launch the child actor (demo_test) at point c) in your list. Then point d) is unncessary. If you have simply replaced an actor object wire, it will not have all the correct queue references, which is why the send message fails.

Ian
LabVIEW since 2012
Message 6 of 10
(4,255 Views)

Thank you IanSh

 

I actually just created an Actor Core for a child and now I seem to understand what to do, I will try to rework my solution and see, what other wall I hit!!!

 

Thanks again

 

One follow up question is:

Do I need to recreate all the messages for the child class?

0 Kudos
Message 7 of 10
(4,253 Views)

Ah, I hadn't even realised that your child class was not a fully functional actor, that is important here.

For the messages, a child should be able to receive messages that the parent can receive without any problem, you don't recreate them. You can of course test this, it's a while since I did actor so I might be wrong. With the Channeling pattern you would have a dynamic dispatch subVI in your method, which is overridden by the child class.

e.g. Parent class has method.vi, method.vi contains some subroutine for override sub plus whatever code isn't going to be overridden.

Child classes override sub.vi

Message class "method send" contains send method.vi and Do.vi. Do.vi calls method.vi (this bit is all scripted anyway when you create message from method)

Now when you send method message to the child actor, it calls the parent method.vi, but the sub.vi is overridden by dynamic dispatch.

 

Hope that is in some way clear, hard to explain actor ideas in writing, hopefully it works as I haven't tested it.

Ian
LabVIEW since 2012
0 Kudos
Message 8 of 10
(4,231 Views)

Hi, I have tried both (Actor's child as a regular class and Actor's child, as an Actor.  I got this working.

One thing I didn't realize, and now seems obvious - overwriting Parent's Actor core - you can still call it's actor core.vi.  I, for some reason, thought, you always call the Main Actor Core.vi.

0 Kudos
Message 9 of 10
(4,223 Views)

Yes, you should always include call parent VI inside any Actor Core.vi

I'm pretty sure this is forced anyway, but it is key otherwise you'd lose the main functionality of an actor! (The root actor class contains the message handling)

Glad to hear it's working, mark this thread solved Smiley Happy

Ian
LabVIEW since 2012
0 Kudos
Message 10 of 10
(4,220 Views)