Table of contents Introduction System Overview Detailed Design Walkthrough Introduction This document is intended for users and developers of EMC2 linux based machine controller, it's purpose is to enable better understanding of the dallur-thc config and components. The end goal to enable users to customize the configuration for their own machines and implement new features missing from the sample config. The Torch Height Control config will only work with EMC2 2.1 or more recent due to dependencies on halui, feedrate and other features missing from EMC 2.0.x, as 2.1 has not been released at the writing of this document it is recommended to use the latest build from the current CVS source. Additional information on the dallur-thc config can be found at: http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Torch_Height_Control Additional information on Bob Campbell's thc-300 can be found at: http://www.campbelldesigns.com/plasma-torch-height-control.php http://www.campbelldesigns.com/files/thc-300-user-guide.pdf Additional information on the MP1000-THC can be found at: http://www.candcnc.com/MP1000.htm http://www.candcnc.com/PDF/MP1000-THC-Manual_1-15.pdf http://www.candcnc.com/PDF/MP1000-THC-Manual_16-32.pdf http://www.candcnc.com/PDF/MP1000-THC-Manual_33-46.pdf System Overview The goal of making a THC config for EMC 2 was to provide plasma table owners with a fully featured alternative to existing commercial systems. The THC config is by far the most complex of the sample configurations, it uses numerous Blocks components, extensive ladders and a lot of signals. Providing the THC functionality as configuration shows the full potential of EMC2 and just how easy it is to implement custom designs and machine configurations, with the addition of classicladder it easier than ever to make complex functionality in an easy and fun way. Requirements & feature requests 01. Process binary input signals from a parallel port 1.1 Arc OK signal (ArcOK) 1.2 Float Switch (FloatSwitch) 1.3 Move Z axis UP (senseUP) 1.4 Move Z axis Down (senseDown) 02. Control the Z axis of a cnc plasma table to change the standoff distance 2.1 Move Z axis UP (moveUP) 2.2 Move Z axis Down (moveDown) 2.2 Never move beyond a maximum/minimum height provided by the user 2.3 Provide a method of changing Z axis movement speed dynamically 03. Output a 15Khz Charge Pump signal to enable the THC controller board 3.1 Make a 15Khz CP signal which can be used to enable/disable the THC board to ensure better safety. 3.2 Output the CP signal to a parallel port pin 04. Turn the plasma torch on using a parallel output signal 4.1 Create a signal to turn the plasma torch on (TorchON) 4.2 Output the Torch ON signal to a parallel port pin (TorchON) 05. Implement an Initial inverse homing sequence using a float switch 06. Implement Switch Travel,Pierce Gap and Pierce Delay (configurable delay impossible at this time, has to be edited manually in ladder) 07. Implement corner height hold where Z axis movement is locked if feedrate drops below a certain % 08. Trigger estop if the Arc is disrupted or not struck within reasonable time 09. If Arc is not requested but gcode is being executed move torch to a safe height 09.1 The maxmimum and minimum(safe) height for the axis should be configurable (ZMaxCord & ZMinCord) 10. Enable users to manually verify initial inverse homing before gcode is executed 11. User must retain jog functionality but it should be disabled when cutting is in progress 12. It must be possible to operate the machine in manual mode (without gcode) Detailed Design For reviewing this design I highly recommend using the diagram at http://wiki.linuxcnc.org/uploads/Dallur_thc.png 01. Height adjustments during cutting To override Z axis movement the first step is to decouple the axis.X.motor-pos-cmd from the stepgen.X, this enables us to override the target coordinates for the Z axis. We must still enable the user to manually jog the axis when cutting is not in progress, to do this we use a mux controlled by the LockPierceHeight signal, if we have an LockPierceHeight signal we disconnect the Z axis input signal and forward the feedback coordinates instead of the requested coordinates. The feedback coordinates are the current position. The next step is to determine if we have a senseUP or senseDown signal, in case one of them is active we want to move the Z axis up or down correspondingly until the signal is deactivated. This is done by muxing each direction independently, if a signal is active the target coordinate forwarded will be set to the maximum (Down movement) or minimum (Up movement) allowed for the Z axis as configured by the user. Finally we mux the results from both directions using the senseZDown signal to switch between them. Keep in mind that if neither SenseUP or SenseDown signals are active the original signal will be passed through, this signal is either the feedback or the coords requested by the user/gcode. 02. Establishing Pierce Height & Getting there Before the Arc is struck there will be no feedback from the SenseUP/SenseDown signals so an alternative feedback is needed to place the torch at the correct height to strike the arc. Once we know the height of the work surface relative to the torch tip we want to override the target coordinates for the Z axis and replace it with the current position plus relative distance plus SwitchTravel plus PierceGap. The Trigger for an automated inverse homing sequence is the SpindleON/TorchON signal, both in manual and automatic mode this signal should immediatly pause any gcode execution and move the torch to the correct height before passing the signal to the TorchON pin. We start by summing up the PierceGap and SwitchTravel, normally the SwitchTravel is a positive number while the PierceGap is a negative number. The next step is to sum this up with the current position, this gives us a potential target coordinate. To complete this function we need to ensure that this target coordinate is stored every time the float switch is pressed, this is done by creating a mux with a loopback, if LockPierceHeight is set the mux will change from being equal to the sum of PierceGap/SwitchTravel/CurrentPosition to being the sum of PierceGap/SwitchTravel/CurrentPosition when the LockPierceHeight was enabled. The result of this mux is called PierceHeight but PierceHeight is also used as the feedback. To get advanced timers and state aware circuits the advanced logic to control the Initial Homing and Pierce is done in a ladder. The ladder for dallur-thc can be seen at: http://wiki.linuxcnc.org/uploads/dallur-classicladder.png There are 3 rungs in this ladder, the first one is the state-aware estop with external triggers, this circuit is just a slightly modified example from the classicladder example, see: http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Sample_HAL_And_ClassicLadder Rung 1 The only difference from the example is the addition of B0 which is a signal to enable rung 3 to trigger an estop Rung 2 is used to control the LockPierceHeight (Q7) and MoveZtoPierceHeight(Q8), the first circuit is activated by the SpindleON/TorchON (I5) request from the user or gcode, next we check if the FloatSwitch is on because the only time we want to LockPierceHeight and MoveZtoPierceHeight is when the float switch has been triggered. If LockPierceHeight is already active we know that the FloatSwitch has been triggered since SpindleON/TorchON(I5) was last set so we can bypass the FloatSwitch (I3) check. However we only want to do this for the first time the FloatSwitch is triggered so we put in a timer which is not reset until the I5 or I3 signals are reset with a bypass that retains the circuit for as long as MoveZtoPierceHeight (Q8) is active, MoveZtoPierceHeight is disconnected as soon as TorchIsAtPierceHeight (I7) is true, TorchIsAtPierceHeight is external to the ladder but it is a compare (comp) which is true if the CurrentPosition is >= PierceHeight. LockPierceHeight (Q7) is set to active every time the circuit is activated, the second circuit then deactivates LockPierceHeight (Q7) when ever SpindleON/TorchON I5 is turned off. To recap, If TorchON requested and FloatSwitch Active or LockPierceHeight active MoveZtoPierceHeight until TorchIsAtPierceHeight then LockPierceHeight stays active until TorchOFF at which time it is tuned off. Rung 3 is used to control moveZtoFloat (Q3), moveZtoSafe (Q4), feed-hold (Q6) and turn_torch_on (Q5). The first circuit is used to determine if the mode is manual or auto, if automatic mode is on it means we are running gcode and in that scenario we want to move the Z torch to a safe location when SpindleON/TorchON (I5) is not being requested, the main purpose of this is to keep the torch safe when moving it around so it will not run into uneven surfaces. The second circuit is a bit complex due to the nature of the initialization sequence. Branch 1 If SpindleON/TorchON (I5) is requested and ArcOK(I4) activate feed-hold (Q6) until the PierceDelay(I8)* timer is up. We want to hold the gcode execution until the pierce timer is elapsed and we have pierced through the material. Branch 2 If SpindleON/TorchON (I5) on requested and If ArcOK is is false we activate feed-hold(Q6), reset moveZtoSafe (Q4) to disable it, and activate moveZtoFloat (Q3) until float-switch (I3) is on activated. If TorchIsAtPierceHeight (I7) becomes true it will activate turn_torch_on (Q5) which will open up an alternative path so it will remain open until SpindleON/TorchON (I5) turns off. Branch 3 If SpindleON/TorchON (I5) is requested and if turn_torch_on (Q5) is active we start a timer set by the ArcStartTimeout(I9)*, if at any point ArcOK(I4) turns off after the time is up we activate B0 which causes an ESTOp in Rung1. * Impossible to implement at this time due to limitations in classicladder, has to be edit manually in ladder 03. Feedhold and Pause When gcode-execution needs to be halted to perform inverse homing it is done by setting feed-hold which in turn sets motion.adaptive-feed to 0, this is done in realtime so the program is instantly halted. The feed-hold action can also set the gcode execution to pause using halui, this happens in userspace so it is not instance but used with feed-hold it enables the user to manually verify the torch height before starting a cut. The Feedhold config is borrowed from the mazak examples line by line except the pause function was added. 04. Corner Heightlock and Corner Slowdown TBD 05. GUI & UIs with HalVCP For better usability there are some signals and options that are made available through a GUI UI made with a VCP panel. Adjustable % speed of movement on Z Axis Options (adjustable parameters) PierceGap (float, distance from tip to surface at pierce time) Pierce Delay (float, time to wait from ArcOK until gcode execution will resume and PierceGap is disabled) Corner Height Lock (bit, an option to lock torch height if feedrate drops below a certain %) Manual Init Verify (bit, an option to manually verify torch standoff before arc is struck, gcode is put on pause through UI) Z live speed (float, the % of the maximum movement speed of Z axis which to use for height adjustments) Z move speed (float, the % of the maximum speed use while moving to safe or inverse homing Z axis) MaxZ (float, the lowest Z coord which the torch will go to) MinZ (float, a safe Z height to move the torch to when Arc is off) Sensors (leds, view only) SenseUP (bit, a "led" to be lit when arc/tip voltage is to high) SenseDown (bit, a "led" to be lit when arc/tip voltage is to low) ArcOK (bit, a "led" to show when the arc is OK) 06. Float Switch & Homing Homing is done to the top of the Z axis as is the standard practice for CNC applications, this means that the FloatSwitch should never be used as a home and/or limit switch, it should be wired through the THC board as seperate signal, this is not the way other CNC controllers do Z axis so existing Mach2/3 users need to verify their setup before using EMC2 with the dallur-thc config. This does give users the flexibility of setting up a seperate inductive/capacative limit switch which if set up with enough accuracy can protect the torch from ever diving into the cutting material (although EMC2 should in theory never move the torch into the work piece). ClassicLadder Signal List: Q0 io-emc-enable-in Q3 moveZtoFloat Q4 moveZtoSafe Q5 turn_torch_on Q6 feed-hold Q7 LockPierceHeight Q8 MoveZtoPierceHeight I0 io-user-enable-out I1 ext-estop I2 io-user-request-enable I3 senseZFloatSwitch I4 senseArcOK I5 io-spindle-forward I6 ui_mode_is_auto I7 TorchIsAtPierceHeight I8 PierceDelay I9 ArcStartTimeout I10 ProgramIsPaused I11 limit-estop B0 Estop rung 3 to 1 B1 Estop rung 2 to 1 Glossary: EMC Enhanced Machine Controller EMC2 Versions 2.X of EMC THC Torch Height Control GUI Graphical User Interface UI User Interface halui Hal interface module to connect HAL pins to NML commands CVS Concurrent Versioning System, a versioned storage commonly used for source code Blocks A realtime HAL components containing a number of simple functions Z axis The UP/Down axis in three dimensional space ChargePump An interface to disable/enable inputs/outputs of a hardware components CP ChargePump Float Switch A switch to detect surface heights Capacative switch An electronic switch which can sense other objects at a distance Inductive switch An electronic switch which can sense metallic objects at a distance Pierce Gap The gap between the tip of a plasma torch and the workpiece Switch Travel The distance from the tip of the plasma torch to the workpiece when the float switch is triggered Inverse Homing Placing a plasma torch at the correct standoff from the workpiece by an automatic process ladder A graphically generated program typically used on for a PLC mux A multiplexer, combines multiple signals into one signal PLC Programmable Logic Controller