THE thcup/down is only the fairly high speed digital INPUT to control the Z thru MACH.
THC UP/DOWN is the only input to control Z through Mach...Unless you're talking about a THC that controls the Z independent of Mach.
IF those signals are erratic then the Z will be erratic. The PID filtering takes place in the DTHC.
You're talking about signal conditioning, not PID control. If the tip voltage is all over the place, then the height will be erratic.
Being that Mach3 is NOT a real time controller your on the fly height correction calculations are not going to work well. Yes you can use #vars for Zheight control but ONCE the moves are loading into the buffer then that is it. IF you try to calculate the variable at the point the #var is loaded into the buffer you will find you cannot comp something that has not happened yet. the next problem is the only way you have to update those vars are thru either the brains or the macropump. At a MAX of 10 updates per sec you will fall FAR short of the speed to do it well.
I'm not talking about doing the math inside Mach. I agree that this is way to slow. The purpose of a PID loop is to attempt to look ahead. If the there is a large difference between the set voltage and the tip voltage, then the loop moves the Z at a faster feed rate than if there were a smaller difference in an attempt to "catch up". As the two voltages get closer the PID loop slows the feed rate. It works very well, but it only work if the THC is controlling the Z axis motor drive directly.
The ONLY access you have at that point IS the THC functions up/down to comp the surface heights based on what the DTHC sees. AND it is NOT value based it is like playing ping pong slapping the ball back and forth. THe Z at that point will not even use the motor vel/accel parameters it just basically slaps the motor wide open in the direction it is to move and lets the DTHC deal with it being correct in height. Woops overshot slap it back in the other direction.
This is exactly how the low end THC's do it. Just turn your THC feed rate up to about 25 and watch the Z axis bounce. If these $500 THC's have a PID loop, then it's not working. They simply filter the tip voltage to remove any noise and compare that to a set voltage. If there is a difference, it triggers the THC UP or DOWN commands in Mach. If there were some sort of PID control, then we would be able to run the THC feed rate at 100% as the PID would adjust feed rate and prevent over shooting. As it stands, to reduce over shoot, we have to run the THC feed rate at 5-10%. even that doesn't eliminate it. It just reduces it to an acceptable level.
That is where the PID has to step in. Same basic princible as a servo motor drive.
How exactly does the PID step in? We're talking about a system with ON/OFF UP/DOWN inputs. You can not vary the feed rate based on conditions, which is the purpose of a PID loop. The only possible way this could happen is if the THC were to pulse the THC inputs sort of like a DC speed control, but then I doubt Mach would be able to handle that.
Which THC are you running? I have a Sound Logic and a CandCNC on the bench and I can tell you that neither of them have build in PID control. I know this because (1) They operate through Mach's THC commands and (2) Turning the THC feed rate past 15 turns the Z into a pogo stick.