THC

More
28 Mar 2009 22:02 - 29 Mar 2009 16:16 #17 by BigJohnT
THC was created by BigJohnT
I'm working on a Torch Height Control for my plasma cutter. My intent is to use an input into EMC to raise and lower the Z axis as needed to maintain tip voltage at the set point. I plan on using a velocity number from a 5i20 encoder as the signal to base the need of raising or lowering the torch. The 5i20 will get the pulse signal from a custom board into an encoder component.

The V-F board takes in 0-10vdc. It has 100K input resistance so an external 300M resistor will give a 0-310vcd input range. The V-F board is nominally 100 KHz to 1 MHz range for hardware inputs. The board has postscaler to divide the requency down to 32/16/8 full scale for software (parallel port) counting with a lower resolution for a given sampling rate.

Dallur has done some fantastic work on integrating commerical THC controls with EMC and Axis. I hope to expand that a bit for my application.

Well it seems to me the first place for me to start is to hijack the axis.2.motor-pos-cmd. The stock StepConf Wizard I started with generates the following for the Z axis.
net zpos-cmd axis.2.motor-pos-cmd => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb

I added a sum2 component and I changed to:
net zpos-cmd sum2.0.in0 <= axis.2.motor-pos-cmd
net zpos-sum sum2.0.out => stepgen.2.position-cmd
net zpos-fb stepgen.2.position-fb => axis.2.motor-pos-fb

Then I added a pyVCP dial for my offset input:
net zoffset sum2.0.in1 <= pyvcp.OffsetDial

Now when running and I move the dial the Z axis will be offset by that amount.

So Far So Good... :)

John
Last edit: 29 Mar 2009 16:16 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
01 Apr 2009 12:18 - 01 Apr 2009 13:49 #33 by BigJohnT
Replied by BigJohnT on topic Re:THC
The next thing I figure is I want the THC to only be on when the spindle is on and I'm running a program. So I add an and2 component and hook halui.program.is-running and motion.spindle-on to the inputs.

loadrt and2 count=1
addf and2.0 servo-thread
net thc-prg-running and2.0.in0 <= halui.program.is-running
net thc-spindle-on and2.0.in1 <= motion.spindle-on

Now for this work I add a mux2 component.

loadrt mux2 count=1
addf mux2.0 servo-thread
setp mux2.0.in0 0
net thc-enable mux2.0.sel < and2.0.out

and I change the offset line to

net zpos-offset sum2.0.in1 <= mux2.0.out

and I change the input line to

net z-input mux2.0.in1 <= pyvcp.OffsetDial

So now if the program is running and the spindle is on the input from the offset dial will be added to the Z motor position command.

So far so good. Now I need to figure out how to prevent the Z from moving when the spindle goes off. For example if the material is warped up and I'm above Z0 and the torch goes off I don't want the offset to suddenly disappear and the torch slamming into the material. I gotta think on that one a bit... all suggestions welcome :)

After some thought on the way to work it seems like the best plan is to slowly remove any offset after the torch is off (M5) as the torch moves in a positive direction perhaps over the distance of 1/2" to the safe Z height.

John
Last edit: 01 Apr 2009 13:49 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
12 Apr 2009 14:14 - 12 Apr 2009 14:17 #67 by BigJohnT
Replied by BigJohnT on topic Re:THC
I tried the V-F board with a BOB and the parallel port and with the divide by 128 selected the pulse frequency was too fast for either the BOB or the parallel port or that computer so I gave up for the moment on that.

Moving on I connected the V-F board to the 5i20 and still in the divide by 128 mode the velocity numbers are rock steady and the voltage in to frequency out is flat as a pancake.



I'm excited now...
Attachments:
Last edit: 12 Apr 2009 14:17 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
12 Apr 2009 14:20 #68 by BigJohnT
Replied by BigJohnT on topic Re:THC
At divide by 128 I get a resolution of 0.05 volts which is REAL good.

John
Attachments:

Please Log in or Create an account to join the conversation.

More
01 May 2009 20:09 #195 by BigJohnT
Replied by BigJohnT on topic Re:THC
Progress has been a little slow on the THC component but non the less progress has been made.

I used the lowpass algorithm on the input velocity to smooth it out just a bit and that works well. I've made up a test panel with pyVCP and can see the correction being created. I have a full PID in the THC component but so far have used only the P part. I also added a cap to the I so it won't just keep on adding up.

Next up the XY velocity... I need to compare the actual XY velocity to the set velocity and if I'm within range allow the correction to be applied if the THC is enabled.

John

Please Log in or Create an account to join the conversation.

More
02 May 2009 16:21 - 02 May 2009 16:23 #198 by BigJohnT
Replied by BigJohnT on topic Re:THC
And another piece of the puzzle falls into place this morning thanks to Vq^, SWPadnos, and Pythagoras of Samos. Thanks guys.

To get the actual XY velocity I sent the axis.0.motor-pos-cmd signal to a ddt component in to get the velocity out for the X axis and did the same for the Y axis. Now I have the velocity of each axis. Next I had to get the absolute value as I don't need direction information.

I did this in the THC component with:
if(x_vel >= 0.0){abs_x_vel = x_vel;}
else{abs_x_vel = -x_vel;}

Next I needed to find the combination of X and Y's velocity. As Vq^ mentioned that X and Y are orthogonal and that I needed to use the Pythagorean theorem to find the velocity. The SWPadnos offered up enough of the formula for me so I could figure out the rest.
Vxy=sqrt(Vx^2+Vy^2)

using that I added:
x_y_velocity = (sqrt(pow(abs_x_vel,2)+pow(abs_y_vel,2)))*60

now I have the velocity in user units per minute or in my case IPM.

All in all a very productive morning.

Thanks guys
John
Last edit: 02 May 2009 16:23 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
14 May 2009 13:16 #259 by BigJohnT
Replied by BigJohnT on topic Re:THC
Well I'm kinda stuck :(

I'm at the point of removing any correction after the torch goes off and as the Z moves up.

I have a global variable last_z_pos and need to compare it with z_pos_out to see if the Z axis has moved up. Math is not my strong subject so I have to use brute force sometimes to figure it out.

So if last_z_pos < z_pos_out tells me if Z has moved toward the positive direction I need to remove some correction until correction == 0. I don't want to remove it so fast that if I had a positive offset when the torch turns off that I slam the tip into the material. Actually I don't what to remove it so fast as to cause a move in the negative direction...

Hints are welcome :)

John

Please Log in or Create an account to join the conversation.

Time to create page: 0.156 seconds
Powered by Kunena Forum