Actor Framework Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Ideas to clean up Root Actor

Solved!
Go to solution

Hello,

 

I'm working on my first AF project and quickly getting into the woods of block diagram complexity. My Root Actor has 15+ messages it is receiving via user events, and most of the screen is taken up by all the setup code; creating events, registering events, etc.

 

What ideas can I use to clean up my messaging strategy?

0 Kudos
Message 1 of 18
(4,263 Views)
Solution
Accepted by topic author sirwin

Try creating the events in prelaunch init.  Place them all in a cluster and place that inside the class private data.

Destroy all the events in stop core.

 

Then in your Actor Core, all you have to do is unbundle the events cluster from actor's private data and register for the entire cluster of events.

 

That should simplify things a bit. 

 

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
Message 2 of 18
(4,243 Views)

15 messages is a (very-)high limit for a single actor. Your actor most likely lack cohesion and might need to be split into several actors. Or maybe take advantage of a parent/ancestor actor that could reuse some of the messages elsewhere in your project.

Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.

Message 3 of 18
(4,224 Views)

@Eric.M wrote:

15 messages is a (very-)high limit for a single actor. Your actor most likely lack cohesion and might need to be split into several actors. Or maybe take advantage of a parent/ancestor actor that could reuse some of the messages elsewhere in your project.


I'd like to tag along as I think I have a similar problem with my mindset. What do you do when you have a UI with a few dozen graphs and indicators that are independent from one another, and that each need to be updated from a number of other actors?

0 Kudos
Message 4 of 18
(4,194 Views)

I agree with Eric.  15 is a lot.   You should look into potentially using nested actors and loading their front panels into subpanels.

 

There is also this:

https://learn.ni.com/center-of-excellence/resources/1151/af-mediated-viewable-actors-observer-meet-m...

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 5 of 18
(4,190 Views)

@Taggart wrote:

I agree with Eric.  15 is a lot.   You should look into potentially using nested actors and loading their front panels into subpanels.

 

There is also this:

https://learn.ni.com/center-of-excellence/resources/1151/af-mediated-viewable-actors-observer-meet-m...


Is there a way to download the code associated with each presentation there?

0 Kudos
Message 6 of 18
(4,185 Views)

I didn't see it there.

You could just try emailing Ethan. 

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 7 of 18
(4,182 Views)

@Taggart wrote:

Try creating the events in prelaunch init.  Place them all in a cluster and place that inside the class private data.

Destroy all the events in stop core.

 

Then in your Actor Core, all you have to do is unbundle the events cluster from actor's private data and register for the entire cluster of events.

 

That should simplify things a bit. 

 


I'm a little slow...can you expand on what it is you are placing in the cluster? Are you saying have a cluster of the data objects and creating a single UE of that cluster type? Or Create a cluster of user events? What about "register for the entire cluster of events". Can you provide a snippet illustrating this?

 

*Edit*

I've attached 3 snippets...one for event creation, one for the actor core, and one for the stop core. Is this close to what you were suggesting? Then for each additional user event, need to add it in the creation VI, the actor core, and stop core...?

Event CreationEvent Creation

Actor CoreActor Core

 

Stop CoreStop Core

0 Kudos
Message 8 of 18
(4,168 Views)

What I was suggesting is:

Inside your actors private data, instead of dropping individual event refnums, drop a cluster and put each event refnum inside the cluster.  Let's just say that cluster is labeled events.

 

Then in your stop core, you have to unbundle each individual refnum and close it.

 

However the advantage comes in the actor core, where you can just unbundle the entire events cluster and wire that into the register for events.

 

That way, when you create a new event you don't have to touch Actor Core (as far as registering for the new event.  It will automatically update to include the new event as soon as you propagate the change to the actors private data.)

You still have to create it and bundle it in prelaunch init and destroy in stop core.

 

Hopefully that is clear.  If not maybe I can post some screenshots later.

 

 

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 9 of 18
(4,148 Views)

Actor CoreActor CorePrelaunch InitPrelaunch InitClass DataClass DataStop CoreStop Core

Sam Taggart
CLA, CPI, CTD, LabVIEW Champion
DQMH Trusted Advisor
Read about my thoughts on Software Development at sasworkshops.com/blog
GCentral
0 Kudos
Message 10 of 18
(4,144 Views)