This is something that I have been talking quite often here : Can LV be used for critical ( deterministic ) machine control ?
I do lots of coding for product endurance rigs that need switching of solenoid valves at a rate varying from 0.2 Sec to 1.5 sec. And being endurance rigs, the typical value for the number of cyles will be around 1 million to 5 million . Thus the tests once started will run for many days / or till the product fails. I was struggling with LV 8.0 timed loop running at 50mS intervals within which a state machine was doing the following :
- Check for safety interlocks
- Switch the solenoid at the programmed rate
- Plot the parameters like flow, pressure, torque etc in "real" time.
- Save critical process values to disk at programmed intervals.
- Keep track of counts and stop cycle when actual cycles = programmed cycles.
SInce I did not ( could not ) use LVRT, I ran into serious problems on only one area in the above list : Switching of the solenoid. The on/off times were never deterministic and for some odd reason used to crash / hang the application altogether after a few hours of running.
The low cost solution :
Since I also code for 8 bit microcontrollers ( MCU ) I tried out the following :
- As soon as the program is launched in the PC, LV will send in the required solenoid switching timing data to the MCU via RS232.
- The MCU will verify the data and confirm back to LV through a DI.
- LV will then start the cycling process like switching on the main motor etc. and send a signal through a DO to the MCU.
- The MCU will take control of the solenoid switching ALONE and the LV will do the rest of the operations in the State Machine.
I am glad to say that this logic has worked out fine and the obtained plots with the extremely deterministic timing of the MCU are a beauty to look at. Though I have explained the hand shake between LV and MCU rather simply , the actual implementation is more refined like monitoring a toggle bit from LV by the MCU ( kind of watch dog function ) and raise an alarm if the LV timed loop exceeds the 50ms by a large margin , consequtively.
Now that I have done this, I am confident of merging ( or sharing ) the jobs between LV and a PLC . The PLC will do deterministic machine control functions and LV will do data acquistion and non-deterministic machine control. OK I do know that there is a handicap when I have to change the machine sequence based on a window in a analog channel. Except for that I can manage all other control functions with the LV-PLC combo ?
What do the LV experts feel about this idea ?
Thanks
Raghunathan
Raghunathan
LabVIEW to Automate Hydraulic Test rigs.