Page 1 of 1
Feed control based on spindle load
Posted: Mon Dec 06, 2021 7:37 pm
by GabrielR922
Hi all.
As I work with wood, the grain variation and wood species varies a lot in final hardness and feed requeriments.
My machine has spindle load feedback and i converted it to A. The spindle is capable of 15A max load, but sometimes it can go as high as 19A in some grains.
Is there a way to control feed based on the feedback return ?
I can implement in the loop that controls the speed:
If( amperage>18)
{
feed = 80%
} else
feed = 100%
Can someone help me and provide the variables for this ?
Thanks!
Re: Feed control based on spindle load
Posted: Mon Dec 06, 2021 7:55 pm
by TomKerekes
Hi Gabriel,
Its not clear what you mean by "A" or how the Amperage is interfaced to KFLOP.
But you can set the current feed rate to 80% with:
SetFRO(0.8);
HTH
Re: Feed control based on spindle load
Posted: Mon Dec 06, 2021 8:12 pm
by GabrielR922
Hi Tom,
the kanalog is reading the "A", amperage from the motor this way:
double IPR = KANALOG_CONVERT_ADC_TO_VOLTS(ADC(7)) * 5;
Can i read the actual feedrate? to return after the adjust?
int actual_feed = "GetFRO()";
if(IPR>15)
{
SetFRO(0.8);
}else
{
SetFRO(actual_feed);
}
Thanks!
Re: Feed control based on spindle load
Posted: Mon Dec 06, 2021 8:50 pm
by TomKerekes
Hi Gabriel,
The variable CS0_LastFRO contains the last commanded FRO.
You can look these things up yourself in KMotionDef.h
There is also a function SetFROTemp() to temporarily change the Rate without effecting CS0_LastFRO. The original rate can then be resumed with SetFROTemp(CS0_LastFRO);
HTH
Re: Feed control based on spindle load
Posted: Tue Dec 07, 2021 2:46 pm
by GabrielR922
Hi Tom.
The final code:
Code: Select all
int adjust_rpm; //outside funcion, global scope
void controlspeed()
{
double IPR = KANALOG_CONVERT_ADC_TO_VOLTS(ADC(7)) * 5; // Voltage return from VFD
if (IPR > 10) // if amperage > 10A
{
SetFROTemp(0.8); // Set feed 80%
adjust_rpm = 1; // set variable to confirm feed was modified.
}
if ( IPR < 10 && adjust_rpm == 1) // if amperage is ok and feed was modified, bring it back to normal.
{
SetFROTemp(CS0_LastFRO);
adjust_rpm = 0;
}
}
Thanks for the help.
Re: Feed control based on spindle load
Posted: Tue Dec 07, 2021 5:57 pm
by GabrielR922
Hi Tom.
Need one more help.
I need a non-blocking way to control the maximum spindle amperage and disable the machine if it stays above X value for X time.
Code: Select all
#define DT 3
double LAST_A;
void disable_machine_overload()
{
double IPR = KANALOG_CONVERT_ADC_TO_VOLTS(ADC(7)) * 5; // Voltage return from VFD
static double T0=0.0; // remember the last time we turned on
double T=Time_sec(); // get current Time_sec
if (IPR > 13 && LAST_A > 13 && (T0==0.0 || T > T0 + DT)) {
T0=T;
DoPC(PC_COMM_ESTOP);
printf("T0%5.1f T%5.1f A%5.1f IPR%5.1f sec", T0,T, LAST_A, IPR);
}
LAST_A = IPR;
}
Tried using this code, but it just disables.
Re: Feed control based on spindle load
Posted: Tue Dec 07, 2021 6:19 pm
by GabrielR922
Me again.
i think the logic for the code was wrong.
This seem to work, but need more testing:
Code: Select all
#define DT 3
double LAST_A;
//static double T0; // remember the last time we turned on
void disable_machine_overload()
{
double IPR = KANALOG_CONVERT_ADC_TO_VOLTS(ADC(7)) * 5; // Voltage return from VFD
static double T0=0.0; // remember the last time we turned on
double T=Time_sec(); // get current Time_sec
//if(T0==0.0)
//T0=T;
if (IPR > 15 && LAST_A > 15) {
T0=T;
DoPC(PC_COMM_ESTOP);
printf("T0%5.1f T%5.1f A%5.1f IPR%5.1f sec", T0,T, LAST_A, IPR);
}
if(T0==0.0 || T > T0 + DT)
{
T0=T;
LAST_A = IPR;
}
}