Hello Guest it is April 19, 2024, 11:45:29 AM

Author Topic: Z-axis conditional displacement  (Read 1105 times)

0 Members and 1 Guest are viewing this topic.

Z-axis conditional displacement
« on: October 14, 2019, 10:20:50 PM »
Hello!

I am a fourth year mechanical engineering student. For my final year Capstone design project I am designing an abrasive quality testing machine which will mimic manual sanding conducted by technicians. In other words, I am designing a 2 axis gantry CNC (y and z axes).

During operation, it is essential that the downward force applied by my spindle onto my work piece remains constant. To do this, I would like to use input from a load cell to control/actuate the vertical displacement of the z-axis. This load cell will be placed under my t-slot plate where my work piece is placed.

Does anyone know if this is possible? Is there a way to set-up a load cell as an input and use conditional Gcode to control my z-displacement?

This is my first time using MACH3 so any help would be greatly appreciated!!

NOTE: I have included a simple block diagram of the control system I would like to obtain.

Offline Tweakie.CNC

*
  • *
  •  9,198 9,198
  • Super Kitty
    • View Profile
Re: Z-axis conditional displacement
« Reply #1 on: October 15, 2019, 01:36:37 AM »
Mach3 was never designed to handle conditional Gcode so it is not a task it would perform well.
Although…
I am sure that the output from a load cell could be used in a servo feedback loop to control torque independently from the controller.
PEACE
Re: Z-axis conditional displacement
« Reply #2 on: October 15, 2019, 03:08:34 AM »
Hi,

Quote
Does anyone know if this is possible? Is there a way to set-up a load cell as an input and use conditional Gcode to control my z-displacement?

The short answer is no. There are a number of reasons which may well enlighten you to what can and cannot be achieved
with Mach.

Firstly Gcode does not by and large have conditional statements. The notable exception is Fanuc's MacroB which allows parameterized
Gcode and conditional statements. Neither Mach3 or Mach4Hobby have that ability, Mach4Industrial does have MacroB however.

Even if however you were to stump up and pay $1400 for Mach4Industrial it would still not meet your demands.

All varieties of Mach (3, 4Hobby and 4Industrial) have a scripting language, Cypress Enable (a subset of Visual Basic) in the case
of Mach3 and Lua in the case of Mach4. Lua is by far the more flexible and many times faster to execute than Visual Basic.

With a scripting language conditional Gcode becomes irrelevant....you can write conventional computer code to accomplish the same
thing....right?

Well....no.

The bottom line is that a Windows PC is not and cannot (without huge expense) ever be a realtime system. CNC is however by
necessity a realtime process. The way this incompatibility is covered by Mach, and in fact ALL Windows based PC CNC solutions,
is buffered control.

In a buffered control the Windows application, in our case Mach, is the trajectory planner. It plans axis moves and communicates
them to a realtime motion controller as a series of numeric data, P(osition)V(elocity)T(ime). The data is stored in a FIFO buffer
which could be 500ms in length. The realtime motion controller digests the PVT data and generates the required synchronous pulse
streams to drive the axis drivers. Thus even when Windows stop processing Mach temporarily, the motion controller still has data
in the buffer 'to go on with'. If the buffer ever empties the CNC machine stops usually castastrophically for the workpiece.

The communication delay from the motion controller (monitoring the downward force) to Mach, followed by the processing delay,
followed by a communication delay from Mach to the motion controller, followed by the buffering delay all but precludes
a sensible feedback loop. With Mach3 a reasonable 'around the loop delay' is about 100ms(10Hz). With Mach4, and if you push it,
you can reduce that to about 5ms(200Hz).

If you talk to you Electrical/Control colleages in your Engineering school they will tell you, at length, about the Nyquist sampling
theorem. The upshot is that the fastest possible response to a series of samples is HALF the frequency of the samples.
Even then the 'controllability' of such a system is very poor, and is still maringinal at ONE TENTH of the sample frequency.

Thus with Mach3 the closed loop bandwidth would be about 1Hz. With Mach4 the closed loop bandwidth is about 20Hz.
Thus while Mach4 is much better at 'closing the loop' than Mach3 its still poor. Even a modest servo will have a closed loop
bandwidth of 500Hz or so and good ones up to 5kHz.

Mach is a poor feedback system.....and that is a reflection of the Windows PC on which it is based.

Having said that, NFS have released a script version of THC (which is normally considered a realtime only process) for Mach4.
While it is not nearly as fast as realtime THC enacted by realtime motion controller, NFS obviously consider it sufficient for
most THC purposes. You could possibly adapt it to your application....if you can tolerate a closed loop bandwidth of 20Hz or so.

Your other options are various realtime feedback capable controllers like Kanalogue/KFLOP, Gallil, Hicon or CSMIO/A.
Another very worthy alternative is LinuxCNC. The Linux distro on which LinuxCNC runs must have R(eal)T(ime)E(xtensions)
and as such LinuxCNC makes a capable realtime feedback controller. You could expect jitter of a few microseconds which is pretty
respectable. Of course LinuxCNC is free which will no doubt appeal to you.

Craig

EDIT; Unnecessary and disrespectful comments referring to Mach3 user's removed.
« Last Edit: October 17, 2019, 01:38:36 AM by Tweakie.CNC »
'I enjoy sex at 73.....I live at 71 so its not too far to walk.'