04-18-2013 02:18 PM
Hi
For the past two weeks I have been learning about the Actor Framework and how to use it. It has a lot of great features, but there is one key thing that I am trying to figure out that I cannot get. For all of my actors, I want to log all errors and all warnings to a central error logger. My initial thought was to create an extension class of the Actor Framework and to override “Handle Error.vi”. However, “Handle Error.vi” is only called if there is an error. This means that all warnings will be lost. The only way I can think of to get the behavior I want would be to make a modification to Actor Core.vi by removing the case structure around “Handle Error.vi”. This is undesirable as doing this requires making a modification to Actor Framework.lvlib, moving it, version controlling it, etc…
My question is: does anyone have any other ideas on how I could get around this problem? A change of perspective could really help
.
Thanks,
Carlo
04-19-2013 09:34 AM
Hi Carlo
GIven the relative youth of this framework, I would highly suggest posting to the community group as it is more geared towards this framework than the general LabVIEW forums. You can find this here:
https://decibel.ni.com/content/groups/actor-framework-2011?view=discussions
04-21-2013 05:02 AM
You're right that modifying the VI is a problem, but people have been making all kinds of modifications and you can see that the VI even has a comment on how to do it and you can see how people went about modifying the AF in the group linked to ealier. The only thing which I can think of (other than your suggestion) is to put this in the message class. Create your own parent for the message which will implement this logging in the Do VI and mark child classes as having to call the parent. The problem with that is that this seems like it should belong in the actor and you can't force the users to call the parent at the end of the VI or wire the error into it.
I would suggest overriding the actor core completely, but that won't work because the priority queue doesn't have accessors, so you can't get at it.
04-22-2013 05:52 PM
Well I thought about making creating a child class which does this, but there is one significant roadblock that is annoying. Every time you would used the "Actor Framework Message Make" to make a new message, you will need to make that class a child of the modified Message Class which does the Error Handling after Do.vi. I have managed to get by only making one change to Actor Core.vi: I only removed the case structure around Handle Error.vi. Then, I created an Actor extension class that overrides Handle Error.vi to do my error/warning logging. All Actors I make are children of my Actor extension class.
04-22-2013 05:54 PM
I tried posting there, but I was told that I can only make a private discussion. I ended posting a private discussion, but not much discussion occured. Is there something I am missing to post public discussions?
04-22-2013 07:50 PM
I don't see you in the members list. Maybe you have to join the group to post there.
04-25-2013 02:36 PM
Another way to go: you could modify Message Maker's do.vi template. Put a small VI to the right of the error case that turns warnings into an error with a specific custom error code, and the warning cluster stuffed into the Source field.
C:\Program Files (x86)\National Instruments\LabVIEW 2012\project\_Message Maker\_templates\Message Template\Do.vi
04-25-2013 03:00 PM
That is true. But then either way, I need to modify the original class in vi.lib. I want to avoid that as much as possible. For now, I just removed the case structure in Actor Core.vi. I have created a basic actor extension class that overrides Handle Error.vi to implement the error logging I need. Also, it makes more sense for the Actor to be responsible for logging errors, not the message.
04-25-2013 05:11 PM
Sure, I was just thinking about it. This doesn't modify anything in vi.lib - just the do.vi template, which is in a different place. Turn a warning into an error, then log it in a "Handle Error.vi" or "Handle Last Ack Core.vi" override.
04-25-2013 05:16 PM
Thanks for the reply. So what I mean by "I do no want to modify anything in vi.lib" is I do not want to modify anything that is referenced from a static location on the computer. In the production environment where I work, we need to deploy our code to multiple computer seemlessly. Modifying code in the locations you mentioned would mean somehow version controlling code in C:\Program Files (x86)\National Instruments\... .