G96 Constant Surface Speed Macro + Macroloop (attempt!)

While UCCNC does not currently have a TURN Modual Here is the place to discuss your wants and wishes for TURN

G96 Constant Surface Speed Macro + Macroloop (attempt!)

Postby Robertspark » Sat Oct 28, 2017 4:32 am

Well I thought I'd have a go at a G96 Constant Surface Speed Macro to control the spindle speed relative to the Z axis DRO position.

First Disclaimer: I've not tried this on a machine hooked up to UCCNC as I've not got a spindle I can test it on at present. It would be nice for someone to give it a go and test it for me (some brave sole. Note all it will do is change the spindle speed relative to the X axis position. if the x axis is at zero or less than zero DRO work co-ordinate position the spindle will either run at the highest calculated spindle speed rpm at the smallest possible X axis DRO position or at the maximum spindle speed you set via M751 OR the maximum spindle speed of the machine set within the UCCNC configuration settings (whichever is the lower number).

Firstly you will need to load the M750 macro as a macroloop
This macroloop basically checks to see if you have set the relevant parameters via the M751 macro, and if so, it calculates & sets the corrected spindle speed within the parameters you've set via M751 and also checks your current spindle speed min and max RPM settings (so that these are not exceeded either).

M751 {Dxxxx, Exxxx} sets your maximum spindle rpm (Dvar) and sets your Spindle Surface Speed in UNITS per min (note this is not feet or meters per min!!!, so if you desire 200 meters / min surface speed, set E200000, sorry I could not come up with a way to know if the machine was in metric or imperial, hence followed the standard that the machine is just set in "units"

M752 clears M751 settings and resets the spindle speed either back to the original setting before M751 was set OR if a spindle speed g-code command was received whilst the M751 macro was active it will correct to this spindle speed setting.

NOTE: if you send a Gcode command with a Spindle speed it will be written to the spindle speed setting DRO and corrected after 50mSec with the M751 setting, hence if you did issue a spindle speed setting correction incorretly from within a gcode command the spindle would try to speed up or slow down before being corrected by the still active M751 macro.

The correct way to correct for a change in max RPM or Surface speed during an active M751 macro will be to issue a revised M751 macro.

If you issue an M751 macro without EITHER the D or E vars then the macro will be ignored.

I am going to create a screenset button macro which will ask for E + D and toggle the Constant Surface Speed Macroloop on and off, but not started that yet really.

Its not listed as a working macro yet within the toolbox thread because I need a brave sole to test it please.

idea came from here as far as M751 {Dxxx,Exxx} format (S is not available as a macro var in uccnc)
http://linuxcnc.org/docs/html/gcode/g-c ... de:g96-g97
Attachments
M752.txt
M752 Constant Surface Speed Cancel Macro
(908 Bytes) Downloaded 130 times
M751.txt
M751 Constant Surface Speed Set Macro M750 {Dxxx, Exxx}
(1.12 KiB) Downloaded 143 times
M750.txt
M750 Constant Surface Speed macroloop G96 Emulate
(3.46 KiB) Downloaded 126 times
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 895
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: G96 Constant Surface Speed Macro + Macroloop (attempt!)

Postby StoneyCNC » Wed Feb 28, 2018 1:17 am

Hi guys - would be interested in testing this,.. any more news here?
StoneyCNC
 
Posts: 10
Joined: Wed Aug 13, 2014 10:45 pm

Re: G96 Constant Surface Speed Macro + Macroloop (attempt!)

Postby Robertspark » Wed Feb 28, 2018 2:43 pm

The macrocode is listed below (or above, on my first post), not had any feedback and it seems to have been downloaded quite a few times.
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 895
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: G96 Constant Surface Speed Macro + Macroloop (attempt!)

Postby vargai » Sun Jun 03, 2018 8:11 am

Hi Robert,
I have just placed a wish for G96 on the Hungarian forum and they gave this link.
I would test it his macro on my spindle with pleasure.(yet not assembled onto the lathe frame)
I need some days to hook my 3 phase motor and Vfd-all function is tested separately only the final wiring should be done.
But i think this feature can be tested without drive.
First I tried to check this with a demo software 1.2102 version without success-maybe the active axis enable sign is missing
Then on my licensed 1.2047 one
Configuration and adjustments:
-G18,
Enabled X,Z axis
PWM-to Analog O1- in the diagnostic window I can see the O1 value if changes
M750 configured as loop- it is running (green led)
M751 D, E values given
MDI mode M751 run-it went to its end( I put a message box in it-I have started studying C sharp now so I am newbie)
Either jog mode or from small program by changing X value -I have not detected any changes on O1. (I put M751 into the program)
If the is no changing O1- (0-10V) then no changing rpm.
When manually set S -I have the changing O1 value.
The spindle starts on the last set S value and it seems M751 does not override this value.
Where am I wrong?
What adjustments do you recommend to step forward?
(By the way I have a small A3 format XYZ router and it was driven by the UC300ETH board a week ago- so the panel is OK)
Regards
István
vargai
 
Posts: 6
Joined: Fri Jun 01, 2018 9:16 pm
Location: Hungary, 2476 Pázmánd

Re: G96 Constant Surface Speed Macro + Macroloop (attempt!)

Postby vargai » Tue Jun 05, 2018 8:01 pm

Hi there,
Your guidance was good, but I made a silly mistake in commanding M751.
So the Macro works fine-Sset value is changing according to the XDRO change.
Only one issue:
The S overridden field shows the previously set S value and the PWM/Analoug output value does not change while the Sset value is changing. ( it remains on the overridden value)
Can I switch off the Override function or could you advice what to do?
I hope we are close to the final-I would like to test this function with motor over the weekend.
Thanks
István
vargai
 
Posts: 6
Joined: Fri Jun 01, 2018 9:16 pm
Location: Hungary, 2476 Pázmánd

Re: G96 Constant Surface Speed Macro + Macroloop (attempt!)

Postby Robertspark » Tue Jun 05, 2018 8:05 pm

Sorry been away for the weekend, I'll catch up on this post tomorrow
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 895
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: G96 Constant Surface Speed Macro + Macroloop (attempt!)

Postby Vmax549 » Fri Jun 08, 2018 6:37 pm

I drug out some OLD notes from working on something similar to this.

IT would seem simple to monitor teh Xpos from X0.000 to Xmax and adjust just teh SSO to compensate.

You have a total range of 0 - 300% to work with for SSO and that is a LOT of range for Spindle speed.

I created a simple macroLoop to monitor teh Xpos and adjust teh SSO According to X radius from X0.000. It tracks very well in testing here. I set up a Gcode to run X back and forth from X0.000 to X4.000 and back. Teh SSO followed teh Xradius changes nicely.

I did not do any CSS calculations just tested teh basic function of tracking teh Xpos with SSO changes .

Just a thought, (;-) TP
Vmax549
 
Posts: 1190
Joined: Sun Nov 22, 2015 3:25 am
Location: USA

Re: G96 Constant Surface Speed Macro + Macroloop (attempt!)

Postby Robertspark » Fri Jun 08, 2018 6:49 pm

Thanks TP for the input. I need to get my head back into what is did when i wrote it.... I'll try this weekend

I think at most you can overdrive a vfd by 140% (or something like that) before the motor torque starts to drop off .... It's to do with the motor frequency as the motor rating is say 50hz (everywhere but America i think)... Hence you can over drive it to about 66 or so Hz before torque drops off and the motor coil becomes saturated (or something like that)
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 895
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Re: G96 Constant Surface Speed Macro + Macroloop (attempt!)

Postby dezsoe » Fri Jun 08, 2018 7:20 pm

Hi Robert, I tested your macros yesterday. The macroloop changes the Sset value on screen very nice, but it does nothing to the spindle speed, because that field is designed to be read-only. The only way you can change the spindle speed while a code is running is to change the spindle speed override, as Terry wrote. That is what can be 0 to 300%. I made a quick test with this code and it seems to work:

Code: Select all
// Macroloop for G96

double sSet = AS3.Getfielddouble(869);                                          // Setspindlespeed
double x = exec.GetXpos();

double f = AS3.Getfielddouble(21000) * 1000;                                    // requested mm/min given in m/min

double s = 0.0;
double p = 100.0;

if (x < 0.0001) x = 0.0001;                                                     // don't divide by zero!

s = f / (2 * x * Math.PI);                                                      // speed to run

p = Math.Floor(s / sSet * 100);                                                 // current speed to percent

if (p > 300) p = 300;                                                           // max. 300%

AS3.Setfield(p, 233);                                                           // SRODRO
AS3.Validatefield(233);
dezsoe
 
Posts: 516
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: G96 Constant Surface Speed Macro + Macroloop (attempt!)

Postby Robertspark » Fri Jun 08, 2018 7:26 pm

Thanks dezsoe, now i understand...
Rob
Einstein ― “If you can't explain it to a six year old, you don't understand it yourself”
...working my way through the 1000+ ways things don't work to find the one that does
UC400eth, UC300eth, UCCNC v1.2106, Neuron Lite
UCCNC v1.2105 Macro Manual
Robertspark
 
Posts: 895
Joined: Sat Sep 03, 2016 4:27 pm
Location: Nr Liverpool, England

Next

Return to UCCNC TURN (CNC Lathe)

Who is online

Users browsing this forum: Bing [Bot] and 1 guest