Walter Gunter Posted January 13, 2014 Report Share Posted January 13, 2014 I can see how to launch a core that I override with my own code. I have a state-machine inside my actor core that runs before the Call Parent Method. My problem is how does this framework/queue system allow me to STOP this state machine? I plan to launch four other state machines like this that will all inherit the ACtor Framework. I would like to be able to start and stop them as needed. Quote Link to comment
drjdpowell Posted January 13, 2014 Report Share Posted January 13, 2014 Why is your Call Parent Method AFTER your “state machine”? It needs to be in parallel to handle messages (such as “Stop”). Quote Link to comment
K-node Posted January 14, 2014 Report Share Posted January 14, 2014 In case you or others have not seen this article... Implementing the State Pattern in Actor Framework (https://decibel.ni.com/content/message/49271#49271) Quote Link to comment
Walter Gunter Posted January 16, 2014 Author Report Share Posted January 16, 2014 Had this in another forum and got some additional guidance: https://decibel.ni.com/content/message/64620#64620 Alright, I am a belie-ber in your words, and recognize that I need to implement them (especially, since I went back to the documentation and saw that it specifically called out to make sure I am running my ActorCore code is in parallel with the Call Parent VI). Create a set of user events to manage your front panel updates. Create these events in your Actor Core.vi and bundle them into the actor object prior to invoking the Call Parent node. Then create a loop in your Actor Core.vi that runs in parallel to the Call Parent node which is dynamically registered for the events. When the actor receives a message, the handling function for that message can generate the appropriate event and pass along any relevant data. Alternatively, you may choose to use queues, notifiers, or other mechanisms to communicate with your parallel loop rather than events. Regardless of which mechanism you prefer, National Instruments recommends that you select only one data transfer mechanism within any given actor, and keep the total number of such mechanisms to a minimum within the application as a whole. Be sure to provide a mechanism to stop your parallel loop and trigger that mechanism by overriding Stop Core.vi in your actor child class. How do I provide the mechanism for the loop to stop? I can't just send a STOP string, nor can I use the STOP button at a higher level to send the STOP command to a lower level directly.....Can I? Edit: Okay, I was able to get my actor to stop by making sure the Call Parent Method was parallel to my process, adding an Event, and then sending a message to my QMH queue. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.