==== Gas (Oxy Fuel) Cutting Control implementation. ==== Gas cutting control can be easily implemented on myCNC controllers through Hardware PLC. === Simple Gas Cutting Control. === {{gas-control-002.png?400}} * I - relay for ignition unit * F - Fuel valve * OH - Preheat Oxygen valve * OC - Cutting Oxygen valve #include pins.h #include vars.h main() { portset(OUTPUT_FUEL); //turn ON fuel valve portset(OUTPUT_IGNITION); //turn ON sparkle relay timer=timeout_ignition; do{ timer--; }while(timer>0); //delay for ignition portclr(OUTPUT_IGNITION); //turn OFF sparkle relay portset(OUTPUT_OXY_HEAT); //turn ON Preheat Oxygen valve timer=timeout_heating; do{ timer--; }while(timer>0); //pre-heating loop portset(OUTPUT_OXY_CUT); //turn ON Cutting Oxygen valve exit(99); }; myCNC software HMI has access to PLC variable **proc** and able to display its value on main screen. If update **proc** value with current status (Ignition/Preheat/Cutting/Purge) inside PLC procedure, then this status can be displayed on myCNC main screen #include pins.h #include vars.h main() { portset(OUTPUT_FUEL); //turn ON fuel valve portset(OUTPUT_IGNITION); //turn ON sparkle relay proc=plc_proc_ignition; timer=timeout_ignition; do{ timer--; }while(timer>0); //delay for ignition portclr(OUTPUT_IGNITION); //turn OFF sparkle relay portset(OUTPUT_OXY_HEAT); //turn ON Preheat Oxygen valve proc=plc_proc_preheat; timer=timeout_heating; do{ timer--; }while(timer>0); //pre-heating loop portset(OUTPUT_OXY_CUT); //turn ON Cutting Oxygen valve proc=plc_proc_cutting; exit(99); }; How to add PLC process display to myCNC main screen [[mycnc:mycnc_setup#add_display_to_show_current_plc_status_for_gas_cutting|described here]] Relay numbers are defined in **pins.h** #define OUTPUT_FUEL 6 #define OUTPUT_OXY_HEAT 7 #define OUTPUT_OXY_CUT 8 #define OUTPUT_IGNITION 5 Variable names are in **vars.h** #define variable var00 #define command var00 #define parameter var01 #define thc_enabled var04 #define timeout_ignition var05 #define timeout_heating var06 #define ihc_pierce_time var09 #define timeout_purge var07 #define break_heating var15 Time values for Ignition and heating are initializad in **plc-variables.xml** Oxy Fuel Cutting Газовая резка 1 THC Enabled Система слежения THC Enabled 660 Ignition time (Sparkle), ms Время искры, ms 5750 Preheat time (Sparkle), ms Время подогрева, ms 1220 Purge Time, ms Время продувки, ms 220 Pierce Time,ms Время пробивки,мс === Cancel Pre-heat === Preheat procedure can take a long time (we often set 120 seconds for preheat). However if operator see metal sheet is warm enough to start cutting, he has an option to cancel preheat process immediately and start cutting by pressing a button. Easy way - to press on-screen "Start" button. If myCNC software interface is configured for Gas cutting, myCNC software will reset PLC variable, defines in "Gas Cutting" configuration dialog as "break heating" variable. {{mycnc:mycnc-1024g-001-2.png}} in Start Cutting PLC procedure should be handler to monitor "break heating" variable and cancel Pre Heating if variable value is "0" - #include pins.h #include vars.h portset(OUTPUT_FUEL); //turn ON fuel valve portset(OUTPUT_IGNITION); //turn ON sparkle relay proc=plc_proc_ignition; timer=timeout_ignition; do{ timer--; }while(timer>0); //delay for ignition portclr(OUTPUT_IGNITION); //turn OFF sparkle relay portset(OUTPUT_OXY_HEAT); //turn ON Preheat Oxygen valve proc=plc_proc_preheat; break_heating=1; //set break_heating variable timer=timeout_heating; do{ timer--; if (break_heating==0) { timer=0; }; //If break_heating was cleared outside of PLC, clear timer to exit from the loop }while(timer>0); //pre-heating loop portset(OUTPUT_OXY_CUT); //turn ON Cutting Oxygen valve proc=plc_proc_cutting; exit(99); }; === 6 valves Gas Cutting Control === More complicated Gas Cutting control contains 6 valves * I - Ignition * F - Fuel * OH Low - Preheat Oxygen Low Pressure * OH High - Preheat Oxygen High Pressure * OC Low - Cutting Oxygen Low Pressure * OC High - Cutting Oxygen High Pressure {{gas-control-003.png?600}} Start Gas Cutting procedure is simple sequence of following steps - * Ignition (turn on valves for ignition), wait ignition time; * Preheat (turn on valves for preheat), wait preheat time, cancel preheat if "break_heating" variable was reset; * Cutting Oxygen soft start (turn on Cutting Oxygen Low pressure valve), wait soft start time; * Pierce start (turn on Cutting Oxygen High pressure valve), wait pierce time; * Turn off Oxygen Heat Hi pressure to come to soft cutting mode. Source code is - #include pins.h #include vars.h main() { portset(OUTPUT_FUEL); //On Valves for ignition portset(OUTPUT_IGNITION); portset(OUTPUT_OXY_HEAT_LO); proc=plc_proc_ignition; timer=timeout_ignition; //Set Ignition process do{ timer--; }while(timer>0); //wait ignition portclr(OUTPUT_IGNITION); portset(OUTPUT_OXY_HEAT_HI); proc=plc_proc_preheat; break_heating=1; timer=timeout_preheat; do{ timer--; if (break_heating==0) { timer=0; }; } while(timer>0); //heating loop portset(OUTPUT_OXY_CUT_LO); //add Oxy Cutting Lo pressure timer=timeout_soft_start; do{ timer--; }while(timer>0); //wait for Soft Oxy start portset(OUTPUT_OXY_CUT_HI); //add Oxy Cutting Hi pressure timer=ihc_pierce_time; do{ timer--; }while(timer>0); //wait for Pierce portclr(OUTPUT_OXY_HEAT_HI); //add Oxy Cutting Hi pressure if (thc_enabled!=0) { command=0xa4;//Start Height sensing parameter=1; message=PLCCMD_SET_CNC_VAR; texit=timer+3;do{timer++;}while(timer In "Stop Cutting" procedure all the valves should be turned OFF. However due to slow flow speed of fuel gas a loud swat is possible while valves closed. It's useful to purge the gun with Oxygen for about 1-2 secs. Stop Cutting PLC procedure with purge is shown below - #include pins.h #include vars.h main() { portclr(OUTPUT_FUEL); //Off Valves portclr(OUTPUT_IGNITION); portclr(OUTPUT_OXY_HEAT_HI); portclr(OUTPUT_OXY_CUT_LO); portclr(OUTPUT_OXY_CUT_HI); if (proc==plc_proc_cutting) { portset(OUTPUT_OXY_HEAT_LO); timer=timeout_purge; //Set Ignition process do{ timer--; }while(timer>0); //wait ignition }; portclr(OUTPUT_OXY_HEAT_LO); // command=0xa4;//Stop Height sensing parameter=0; message=PLCCMD_SET_CNC_VAR; timer=2;do{timer--;}while(timer>0); proc=plc_proc_idle; exit(99); }; === Gas Cutting Control with Initial Height positioning === {{mycnc-plc-gas-control-004.png?600}} * H1 - Safe Height, defined as distance from cutting height at the end of previous cut. Ignition process started on Safe Height. A system waits 1-2 seconds for stable flame process, then switch to Preheat Process and moves torch down to - * H2 - Preheat Height - defined by Capacitory Height Sensor value. After Preheat process finished, valves switched to "Start Pierce" and torch moved to * H3 - Pierce Height defined as distance from preheat height. After Pierce is finished, Cutting and toolpath motion started, THC is activated and toch moved down by Torch Height Control to * H4 - Cutting Height, defined as Torch Height Control Reference value. #include pins.h #include vars.h main() { portset(OUTPUT_FUEL); //On Valves for ignition portset(OUTPUT_IGNITION); portset(OUTPUT_OXY_HEAT_LO); proc=plc_proc_ignition; timer=timeout_ignition; //Set Ignition process do{ timer--; }while(timer>0); //wait ignition portclr(OUTPUT_IGNITION); portset(OUTPUT_OXY_HEAT_HI); proc=plc_proc_preheat; break_heating=1; timer=timeout_preheat; gvarset(7080,2000); //setup Z axis Speed h=0-30000; g0moveA(0x0,0x4,h); //Z axis, move down do{ timer++; }while (adc010); //heating loop portset(OUTPUT_OXY_CUT_LO); //add Oxygen Cutting Lo pressure gvarset(7080,2000); g0moveA(0x0,0x4,ihc_pierce_height); //Z axis, move up timer=200; do{ timer--; }while (timer>0); //after 0.2sec delay motion is definetely started do { timer++;code=gvarget(6060); }while(code!=0x4d); //then ait till motion finished timer=timeout_soft_start; do{ timer--; }while(timer>0); //wait for Soft Oxygen start portset(OUTPUT_OXY_CUT_HI); //add Oxygen Cutting Hi pressure timer=ihc_pierce_time; do{ timer--; }while(timer>0); //wait for Pierce portclr(OUTPUT_OXY_HEAT_HI); //add Oxy Cutting Hi pressure if (thc_enabled!=0) { command=0xa4;//Start Height sensing parameter=1; message=PLCCMD_SET_CNC_VAR; texit=timer+3;do{timer++;}while(timer #include pins.h #include vars.h main() { portclr(OUTPUT_FUEL); //Off Valves portclr(OUTPUT_IGNITION); portclr(OUTPUT_OXY_HEAT_HI); portclr(OUTPUT_OXY_CUT_LO); portclr(OUTPUT_OXY_CUT_HI); if (proc==plc_proc_cutting) { portset(OUTPUT_OXY_HEAT_LO); timer=timeout_purge; //Set Ignition process do{ timer--; }while(timer>0); //wait ignition portclr(OUTPUT_OXY_HEAT_LO); // if (ihc_lift_height>0) { proc=plc_proc_moveup; gvarset(7080,2000); g0moveA(0x0,0x4,ihc_lift_height); //Z axis timer=300;do{timer--;}while(timer>0); do { timer++;code=gvarget(6060); }while(code!=0x4d); //wait till motion finished(7140 for Multidev) }; }; portclr(OUTPUT_OXY_HEAT_LO); // command=0xa4;//Stop Height sensing parameter=0; message=PLCCMD_SET_CNC_VAR; timer=2;do{timer--;}while(timer>0); proc=plc_proc_idle; exit(99); };