07-23-2018 08:36 AM
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?
Solved! Go to Solution.
07-23-2018 12:31 PM
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.
07-24-2018 06:55 AM
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.
07-27-2018 05:46 PM
@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?
07-27-2018 06:22 PM
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:
07-27-2018 06:48 PM
@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:
Is there a way to download the code associated with each presentation there?
07-27-2018 06:56 PM
I didn't see it there.
You could just try emailing Ethan.
07-28-2018 04:50 PM - edited 07-28-2018 05:27 PM
@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...?
07-29-2018 05:57 PM
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.
07-29-2018 06:00 PM