Spindle overspeed?
31 Dec 2021 19:32 - 31 Dec 2021 19:37 #230406
by spumco
Spindle overspeed? was created by spumco
I'm slowly re-configuring my mill and have run in to an issue I don't understand how to troubleshoot. Pretty bog-standard setup for spindle control:
Lcnc 2.9 RIP
Qtpyvcp/Probe Basic
0-10v VFD
4096ppr encoder on motor (1:1 drive ratio)
Mesa 7i76e
Problem:
MDI "M3 S1000" results in 1000rpm
MDI "S2000" speeds it up to 2000rpm
MDI "S1000" speeds it up to ~4000rpm (undesired/unexpected behavior)
GUI displays "1000"
spin.out = ~3800
encoder.00.velocity-rpm = ~4000
pid.s.command = 1000
pid.s.output = -3800 (trying to slow it down?)
Except:
MDI "M3 S1000" results in 1000rpm
MDI "S1500" speeds it up to 1500rpm
MDI "S1000" slows it down to 1000rpm (desired/expected behavior)
GUI displays "1000"
spin.out = 1000
encoder.00.velocity-rpm = 1015
pid.s.command = 1000
pid.s.output = 1000
If I MDI "M5" or press the GUI spindle STOP button it slows down properly and stops. I can repeat the above behavior as many times as I want - this doesn't appear to be intermittent or some transient EMI thing.
Basically, if it's at speed and I command a slower speed while it's running it acts up... but not from every speed. I haven't tried slowing from higher starting speeds as I don't want the spindle to go nuclear until I get a better handle on this.
Anyone have an idea where I should start? Hardware/software?
Thanks,
Ralph
Lcnc 2.9 RIP
Qtpyvcp/Probe Basic
0-10v VFD
4096ppr encoder on motor (1:1 drive ratio)
Mesa 7i76e
Problem:
MDI "M3 S1000" results in 1000rpm
MDI "S2000" speeds it up to 2000rpm
MDI "S1000" speeds it up to ~4000rpm (undesired/unexpected behavior)
GUI displays "1000"
spin.out = ~3800
encoder.00.velocity-rpm = ~4000
pid.s.command = 1000
pid.s.output = -3800 (trying to slow it down?)
Except:
MDI "M3 S1000" results in 1000rpm
MDI "S1500" speeds it up to 1500rpm
MDI "S1000" slows it down to 1000rpm (desired/expected behavior)
GUI displays "1000"
spin.out = 1000
encoder.00.velocity-rpm = 1015
pid.s.command = 1000
pid.s.output = 1000
If I MDI "M5" or press the GUI spindle STOP button it slows down properly and stops. I can repeat the above behavior as many times as I want - this doesn't appear to be intermittent or some transient EMI thing.
Basically, if it's at speed and I command a slower speed while it's running it acts up... but not from every speed. I haven't tried slowing from higher starting speeds as I don't want the spindle to go nuclear until I get a better handle on this.
Anyone have an idea where I should start? Hardware/software?
Thanks,
Ralph
Last edit: 31 Dec 2021 19:37 by spumco. Reason: Added pid.s.output data
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19209
- Thank you received: 6438
31 Dec 2021 19:35 #230407
by tommylight
Replied by tommylight on topic Spindle overspeed?
Encoder or encoder counter.
Please Log in or Create an account to join the conversation.
31 Dec 2021 19:38 - 31 Dec 2021 19:44 #230408
by spumco
EDIT - encoder, unless I messed up something in .hal
Replied by spumco on topic Spindle overspeed?
Not sure what you mean Tommy?Encoder or encoder counter.
EDIT - encoder, unless I messed up something in .hal
Last edit: 31 Dec 2021 19:44 by spumco.
Please Log in or Create an account to join the conversation.
- tommylight
- Away
- Moderator
Less
More
- Posts: 19209
- Thank you received: 6438
31 Dec 2021 20:17 #230409
by tommylight
Replied by tommylight on topic Spindle overspeed?
Encoder is counting OK till 1500RPM, but 2000 is to much for it or it is getting messed up due to interference from the spindle or unshielded cable or shield not wired to ground or 5V power going lower with speed.
Mesa should count that easily, so maybe check if DPLL is enabled (or similar, forgot what was that should be enabled).
Mesa should count that easily, so maybe check if DPLL is enabled (or similar, forgot what was that should be enabled).
Please Log in or Create an account to join the conversation.
31 Dec 2021 20:23 - 31 Dec 2021 20:55 #230411
by PCW
Replied by PCW on topic Spindle overspeed?
The simplest fix is to set the spindle P term to 0 (so you are running open loop)
EDIT: a perhaps better fix is to set:
OUTPUT_MIN_LIMIT = 0
In the spindle section of the ini file
The root of the problems is that the 7I76E analog output is unsigned
so does not work with negative numbers. You will get a negative PID
output when the (Commanded_RPM-Current_RPM)*P is
negative. In your example, you have a Current_RPM of 2000 and then
set a Commanded_RPM of 1000. This sets the PID output to -1100
which is interpreted as a large positive number by the 7I76E's
analog output logic.
To do true PID control (that works well at low speeds) you would need to:
1. Drive the 7I76E analog out with the absolute value of the PID output
2. Drive the 7I76E analog direction with the sign of the PID output
EDIT: a perhaps better fix is to set:
OUTPUT_MIN_LIMIT = 0
In the spindle section of the ini file
The root of the problems is that the 7I76E analog output is unsigned
so does not work with negative numbers. You will get a negative PID
output when the (Commanded_RPM-Current_RPM)*P is
negative. In your example, you have a Current_RPM of 2000 and then
set a Commanded_RPM of 1000. This sets the PID output to -1100
which is interpreted as a large positive number by the 7I76E's
analog output logic.
To do true PID control (that works well at low speeds) you would need to:
1. Drive the 7I76E analog out with the absolute value of the PID output
2. Drive the 7I76E analog direction with the sign of the PID output
Last edit: 31 Dec 2021 20:55 by PCW.
The following user(s) said Thank You: tommylight, spumco
Please Log in or Create an account to join the conversation.
31 Dec 2021 22:51 #230419
by spumco
Replied by spumco on topic Spindle overspeed?
I will run open-loop for now, but do you have or can point me to an example of this I can start to work on?To do true PID control (that works well at low speeds) you would need to:
1. Drive the 7I76E analog out with the absolute value of the PID output
2. Drive the 7I76E analog direction with the sign of the PID output
Please Log in or Create an account to join the conversation.
31 Dec 2021 23:00 - 31 Dec 2021 23:03 #230420
by PCW
Replied by PCW on topic Spindle overspeed?
You should be able to run closed loop if you set
OUTPUT_MIN_LIMIT = 0
Doing this alone will have poor performance because of discontinuities
around 0 speed.
It is debatable if closing the spindle speed loop
is of much use unless you have quite poor speed control
in your VFD
If you need PID speed control, (say for accurate control a low speeds
and varying loads) you would need to add one more
absolute function for the PID output and for extracting the sign of
the PID output for controlling the VFD direction signal.
OUTPUT_MIN_LIMIT = 0
Doing this alone will have poor performance because of discontinuities
around 0 speed.
It is debatable if closing the spindle speed loop
is of much use unless you have quite poor speed control
in your VFD
If you need PID speed control, (say for accurate control a low speeds
and varying loads) you would need to add one more
absolute function for the PID output and for extracting the sign of
the PID output for controlling the VFD direction signal.
Last edit: 31 Dec 2021 23:03 by PCW.
Please Log in or Create an account to join the conversation.
01 Jan 2022 00:04 #230424
by spumco
I set OUTPUT_MIN_LIMIT=0 as you suggested and it seems to be working fine. A little fluttering at low speeds (<750rpm).
I think I'll live with it as is unless it causes actual problems during machining.
Thanks again,
Ralph
Replied by spumco on topic Spindle overspeed?
You should be able to run closed loop if you set
OUTPUT_MIN_LIMIT = 0
Doing this alone will have poor performance because of discontinuities
around 0 speed.
It is debatable if closing the spindle speed loop
is of much use unless you have quite poor speed control
in your VFD
If you need PID speed control, (say for accurate control a low speeds
and varying loads) you would need to add one more
absolute function for the PID output and for extracting the sign of
the PID output for controlling the VFD direction signal.
I set OUTPUT_MIN_LIMIT=0 as you suggested and it seems to be working fine. A little fluttering at low speeds (<750rpm).
I think I'll live with it as is unless it causes actual problems during machining.
Thanks again,
Ralph
Please Log in or Create an account to join the conversation.
Time to create page: 0.112 seconds