LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using class data in actor user interface?

This may have been asked before but I've not been able to find anything so far...

 

I'm starting to play with the Actor framework in LV2012 and have run into a dilemma.  The system I'm setting up is a fairly common one consisting of test stand control, data acq, logging, control interface, and a "spectator" interface that displays live data for the user(s).  To accomplish this, I have a top level actor that implements the control interface and logging which launches several nested actors that handle stand control and data acq across multiple front ends.  While this works very well for data that comes purely from the measurement front ends, I'm having trouble cleanly integrating meta-data that is generated by the user. 

 

Each message coming from an actor farther down the tree can be logged by the top level actor by maintaining the log file information in the class private data.  However, any data generated on the UI of the Actor Core cannot be logged by using the class data in the Actor Core as there is no guarantee that the class data in the Core is the same as that in the message handler, correct?  For instance, say my class data has a log file path and a group name for the TDMS write VI.  If my user wants to add a note to that group, I could use the class data in the Actor Core to write the note as a property.  No problem.  But what if the active group is decided by a message coming from my front end?  Then the group name in the parent actor core is different than the one in my Actor Core with the UI.  The note would land in the wrong group.  So far I have a couple ideas on how to make this work:

 

1.) Send relevant update messages from the Actor Core to the top level actor using self-to-self enqueuer so that the class data matches.  This seems clumsy as it would require a lot of code duplication.

 

2.) Remove all actual functionality from the Actor Core.  Any UI event would pass data via a message using the self-to-self enqueuer.  This still seems clumsy, but at least would require less duplication (though the same amount of messages).  It would require passing references to all feedback indicators into the class data.

 

3.) Consolidate all metadata generation in the Actor Core and create an additional actor which only logs data.  Any message containing data for logging would be forwarded from the top level actor to the Logging actor.  This would provide a consistent strategy for logging data produced by both the user and other actors, and therefore seems like the best idea.

 

Does anyone have thoughts on this one?  I'm still pretty undecided as to how best to solve this little issue, and I'm sure others have encountered this before. 

 

Thanks.

CLAD
0 Kudos
Message 1 of 5
(2,881 Views)

Ok, I'm going with number 3.  The top level actor will "wrap" incoming data messages in user-generated metadata and forward them on to a "logging" actor.  The log file path and group name will be set from the top level actor and maintained as part of the class data of the logging actor.  The actor core for the logging actor will only have the call parent node.

CLAD
0 Kudos
Message 2 of 5
(2,842 Views)

Hi testingHotAir

 

I just wanted to check in to see if things were working for you with your approach to the solution. It looks like you have a pretty good structure going so it seems like things are set. If you still have questions could you post an example of what you are trying to accomplish? I know my brain sometimes has a hard time grasping the concept of words and has an easier time with actually following code paths.

 

If things are working then great!

 

Regards,

James W.
Applications Engineer
National Instruments
0 Kudos
Message 3 of 5
(2,811 Views)

Hi James,

 

Thanks for the response.

 

This structure is working for me, but there are some clear drawbacks.  The biggest problem I'm having is keeping all the messages straight.  Since the messages are not protected within the class, the multiple levels of nested actors means I spend a lot of time cross checking my actors making sure I've got the message belonging to the actual caller and not one from a level up the hierarchy.  Is there any way to ensure my actors don't try to send messages that their caller can't handle?

CLAD
0 Kudos
Message 4 of 5
(2,802 Views)

Hi testingHotAir,

 

I admit my knowledge of the actor framework is somewhat limited but I was wondering if you had opportuntity to look at our community page on it. You can find it at

 

https://decibel.ni.com/content/groups/actor-framework-2011

 

I would bet you could find some better answers working on the discussion pages within that group.

 

Regards,

James W.
Applications Engineer
National Instruments
0 Kudos
Message 5 of 5
(2,793 Views)