02-01-2010 03:09 PM
I am using a motion system in conjunction with a number of other devices (power laser, frit dispenser, etc) and would like a simple way to sequence tasks.
For instance I have a sequence:
Send motion system to starting position at high speed.
Open Laser shutter
Send motion system to next position at low speed.
Close Laser Shutter
Send motion system to next position at high speed
Open Shutter
Send motion system to next position at low speed
Close Shutter
Move motion to idle position
In the past I have hard-coded these operations or used a state machine.
It seems that there should be something else that I can use that is part of standard LabView (notifiers, queues, etc).
Perhaps fill a queue with all tasks and only advance when the prior one is done (if this is the solution, I am unsure how to implement it).
I would assume that this is a fairly common task.
Any input is appreciated.
Thanks
02-02-2010 02:33 AM
For this type of application I would recommend to use a queued state machine design pattern. The architecture in the linked document might be a bit oversized for your application, but it should give you at least some ideas how to proceed.
I hope this helps,
Jochen Klier
National Instruments
02-02-2010 12:34 PM
Thanks for the thought.
I am actually already using a producer/consumer loop for this application.
Essentially there are a number of operator actions that can be performed while the system is working (e.g. pulling production documents, updating a database, etc).
Each of those "button presses" cause an item in the consumer loop.
Additionally, for the processing, a case is invoked in the consumer loop to start the motion system.
While the system is moving, the timeout event is used to invoke another consumer case and get motion system status (position, following error, etc).
The system cannot wait for the motion to stop (status updates are needed, as well as access to other functions).
I would need a separate queue for the motion/laser/frit system to accomplish this.
If this is the appropriate way then that is okay.
As it is , I am considering just updating my old way of doing things and having an array of clusters with each element having either a motion profile, laser setting, etc and remove elements from the array as they are finished.
02-03-2010 02:00 AM
Without insight into your code it's quite hard to give more detailed advice and as in every language there is not a one and only approach. As long as your application architecture stays scalable and maintainable, the approach that you have lined out (commands and parameters in an array of clusters) sounds reasonable to me.
If you want a more sound opinion, please post some code (not the complete project) or some screenshots and I will involve one of our system specialists.
Thanks and kind regards,
Jochen