Anyone Actually Using External Offsets Branch for THC?

15 Jan 2018 05:48 #104496 by rodw
John, thanks for the clarification. I did post a video of cutting a part about 18" long out of 2mm plate that had one side buckled by about an inch. The torch did a good imitation of a porpoise swimming.... but hey, it cut and we sold the part :)

I think this is nothing like tuning a servo and much more aligned with process control PID loops on the factory shop floor. It might pay to broaden your research on PID tuning beyond just CNC if thats what you were referring to. I've been trying to put some time aside to play again but real business has taken priority for a long time but I think I've got the back broken on most of my ecommerce projects now. When the temps been around 40 deg C (104 deg F), the shed has been a very uninviting place! I nearly expired welding up 200 parts on Saturday!

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

16 Jan 2018 02:34 #104537 by islander261

I am still stuck in the low gain woes. I hope Dewey has a look at this and spots my errors.

I changed the .ini like this in the Z axis section;
# Axis Z
MIN_LIMIT = -3.0
# note these values are double what is actually used because of eoffset-pid being used on this channel, OFFSET_AV_RATIO = .5
#MAX_VELOCITY = 3.8333333
MAX_VELOCITY = 7.666666



HOME = 0.0
FERROR = 0.5
# note these values are double what is actually used because of eoffset-pid being used on this channel
#MAX_VELOCITY = 3.8333333
MAX_VELOCITY = 7.666666
# The values below should be 25% larger than MAX_VELOCITY and MAX_ACCELERATION
# If using BACKLASH compensation STEPGEN_MAXACCEL should be 100% larger.
P = 1000.0
I = 0.0
D = 0.0
FF0 = 0.0
FF1 = 1.0
FF2 = 0.0
BIAS = 0.0
# these are in nanoseconds
DIRSETUP   = 2000
DIRHOLD    = 2000
STEPLEN    = 2000
STEP_SCALE = -10160
MIN_LIMIT = -3.0
MAX_LIMIT = .2500
HOME = 0

I checked the actual distance moved by the Z axis and it matches any commands I gave using MDI, jogging, and gcode.

Here is about the best I could get as a halscope trace of the arc voltage. The Pgain was set to 1 and the Dgain was set to .3. Note while this motion was taking place the Z axis was moving up and down synchronized with the voltage (the set point was 78v) . The cut is good but I will wear out the lead screw or nut in a week with this much motion ( don't ask about how I know about worn Z axis lead screws).
Oh well it was a good try for a screen shot. I think you can still get the general idea of what is happening.

I think that I am going to move on to cleaning up other loose ends at this point and revisit this whole THC thing later. I can always go back to the old control system with about an hours setup now. I still need to get a Sheetcam PP going for this. The one example we look at is really complex and has a lot of bug fixes embedded in it so I think I am going to modify the one I currently use for a basic PP to start with. I cut the same material and thickness 98% of the time so I will hold off on incorporating gcode controlled cutting parameters for now even though my controller is set up to accept them (and does work as far as my testing goes).

I have to go to the mainland to the doctors and have some stitches taken out (just a diagnostic procedure) on Wednesday so I may stop by the steel yard if I have time and they are still open and buy some thicker material to experiment with. Then it is off to a trade show for the next week so nothing will happen.


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

17 Jan 2018 01:55 #104591 by islander261
Well sports fans another day and maybe a little closer.

I started looking this morning at the lower noise ways to read the THCad card for arc voltage. My previous focus had been at all out speed, noise be damned. Well that really didn't change anything. I then upped the halscope gain and was looking at the scaled arc signal and found that there was a strong 60hz component in the noise with the cutter off. Lots of looking around later I found the problem, The safety ground connection to the outlet strip I was using was broken so the control computer and 7i76e box were both floating with respect to ground. Fix this and reduced the noise by about 1/2. So now I have about 200mv pk-pk noise when the cutter is off. I quick cutting test revealed that the scaling was in deed correct but no change in THC performance. As a quick check I disconnected the cutter and voltage divider and had no change in noise. So I connect a wire between the input+ and input- connections on the THCad card, still no change. So this is where I ended up today with the THCad input shorted, about 200mv pk-pk noise still present:

So from I am operating the THCad in the divide by 32 mode. I have an 18.94181:1 voltage divider between the work leads and the THCad. The FS for my card is 970700hz and the Zero is124400hz. Here are my relevant hal entries:
loadrt hostmot2
loadrt hm2_eth board_ip="" config="firmware=hm2/7i76/7i76e.BIT num_encoders=1 num_pwmgens=0 num_stepgens=5" 
setp    hm2_7i76e.0.watchdog.timeout_ns 5000000
setp hm2_7i76e.0.dpll.01.timer-us -100
setp hm2_7i76e.0.stepgen.timer-number 1
setp    hm2_7i76e.0.encoder.00.counter-mode 1
setp    hm2_7i76e.0.encoder.00.filter 1
setp	hm2_7i76e.0.encoder.00.scale -1
net thc-vel-in	hm2_7i76e.0.encoder.00.velocity 
setp     scale.arcvolts.gain .007162211
setp     scale.arcvolts.offset -27.843

Here is the THCad installation:

Does anyone have any ideas about what is going on here? 200mv pk-pk noise seems pretty high to me with the input shorted. And yes, I have a common mode filter on the power input to the 7i76e box.



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

17 Jan 2018 02:26 - 17 Jan 2018 02:30 #104593 by rodw
John, I had problems with noise but your plot when cutting does not look too bad when compared with what I was dealing with as my peak to peak was measured in volts not mV.

I even purchased a cheap USB oscilloscope which gave me a greater insight to the noise.

I'm kicking myself becasue I made 2 changes at once and I need to rip my plasma cutter apart to undo one so I know whats going on. Those 2 changes were:

1. Install an IEC filter at the power input to my electronics box (but sounds like you've done that)
2 Install another EMI filter inside the plasma cutter before the internal torch voltage divider.

Yes I know #2 is installed on a DC circuit when its designed for AC circuits but its just a filter and it works.
The problem with #2 is that it might have an undesirable affect on voltage rise times that could make the system uncontrollable with a PID.

So I want to bypass the #2 filter, test again and see if it is really required or not.

I don't know if I can help much but hey, I can feel your pain over noise!
Last edit: 17 Jan 2018 02:30 by rodw.

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

17 Jan 2018 03:20 #104594 by islander261

Yes the noise may seem trivial but when input to the PID it can really cause things to go crazy. The trouble is with the HF components in the noise. My voltage divider also incorporates a pretty strong low pass filter to keep the plasma power supply switching frequency out of the sensed arc voltage (pure old school analog done with o'scope while cutting). The EMI filter module is usually a good common mode filter (unfortunately 240vac ones aren't that common here, maybe time for another order from China) and because they are met to pass power they have little effect on DC performance. My voltage divider is buried in my plasma power supply now, so I am not happy to have to dig it out and make it straight DC divider. The real problem is that the noise is still present when the plasma cutter is disconnected and the input to the THCad is shorted!

What appears to be happening is that I have way too much gain in the system. The eoffset--pid sends a correction and the mechanics over shoot and by the time the feedback gets to the pid it is time to move the other way. Way too much lag or lowpass filtering in the loop coupled with high mechanical gain.

Have you posted examples of your .ini and .hal files that work? What is the reduction ( lead screw + any gearing) in your Z drive?

I am off to the quack on the mainland tomorrow so I will out of the loop until mid next week . I am hoping to hear from Dewey and PCW about their thoughts on what I am doing wrong. This thing is getting really close to working so the delays a frustrating (plus I have run out of scrap for testing so this is starting to eat into profits aside from the time value). I have cut close to 50 lines now testing.


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

17 Jan 2018 05:41 #104604 by rodw
John, check your email as I sent you my eoffset pid (Dewey's axis version) back on 4 January.

I tend to agree with you about the gain. I have a 269 Oz NEMA23 with a 3:1 timing belt reduction driving a 5mm/rev ball screw. I did say to Dewey once that I thought Velocity and Acceleration would become key tuning parameters so he's added a popup tuning box for them.

There are a couple of internal parameters which might allow you to adjust response but not in the way Dewey intended. When I get a moment, I'll have a dig. You'll really need to get Dewey's GUI working if you are asking him for help! :)

I know about the cost of material... I started with some free offcuts and then I bought an offcut from a steel converter. That was a bit of a challenge as their version of an offcut was generally 3.6m long but I did find a small piece of 8mm mild steel I could not lift that all but hung over all sides of my table.

I finally solved a few of my other problems and projects so hopefully, I'll have more time soon. I need a couple of days to play again.

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

17 Jan 2018 18:13 #104639 by PCW
200 mV of noise relative to 300V full scale really should not cause any issues.
You can trade off noise vs bandwidth by using the lowpass filter on the voltage before its fed into the control loop.
The plasma voltage will always have some HF noise (typically much bigger than 200 mV and due to arc hopping)

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

18 Jan 2018 05:04 #104655 by islander261

Thanks for the reply, I really wanted to avoid diving into another rabbit hole. I have many more hills to climb to get this machine back in production using LinuxCNC. Don't get me wrong, I really want this to work. My attempts at using lowpass filters, both linear and biquad hal compnets, have not resulted in good results. When viewed with halscope they work nicely but eoffset-pid goes crazy with oscillation using filtered feedback.

I am using a THCad 10V version so the 200mv is a bit more significant. So 10 bits in 10 volts is 10/1024= .00976v per lsb so 200mv still seems large for a shorted input.

Most modern air plasmas (what a hobbyist or small shop will have) now run at between 70v and 150v arc voltage when cutting. The intermediate voltage is about 340V for a 240v single phase machine which can be seen during arc starts, but we never servo to this. Yes high powered single gas plasma machines used at steel yards run at much higher arc voltages.


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

18 Jan 2018 14:17 #104664 by PCW
So your scaling is set for 10V full scale?
If so yes 200 mV is way too high (2% of full scale where ~0.1 or 0.2% is expected at a 1KHz sample rate )
but these number suggest ~300V full scale:
setp scale.arcvolts.gain .007162211
setp scale.arcvolts.offset -27.843

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

18 Jan 2018 16:56 #104673 by islander261

Thanks for the reply. You found the error in my analysis.

My THCad is connected to my plasma through a 18.9...:1 voltage divider, hence the scale and offset numbers. I have check the scaling using a 168V power supply verified with a DMM on the input to the voltage divider. When I disconnected my plasma machine, voltage divider and shorted the input to the THCad I didn't change the scaling so I was treating it like an 190v full scale machine. So I guess what I really need to look at is the encoder.velocity pin or set my scaling for 10V full scale and check the noise.

I think that I am going to find that the THCad and associated .hal settings are just fine. .2V/190V = .00105 or .105%.


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

Time to create page: 0.311 seconds
Powered by Kunena Forum