Questions on PID tunning using Mesa 8i20 drive
- Henk
- Offline
- Platinum Member
Less
More
- Posts: 395
- Thank you received: 80
08 Dec 2017 16:05 #102780
by Henk
Questions on PID tunning using Mesa 8i20 drive was created by Henk
Hi
I have a question on PID tunning for position control on a milling machine using a Mesa 8i20 drive.
So far i have figured out how to use BLDC to control the motor thanks to Andypugh posts on the forum but i couldn't find anything related to PID tuning a torque mode drive.
I have retrofitted 4 machines using LCNC and always used P and FF1 with great success tuning velocity loops, but this one seems to be getting the better of me.
The motor is a 6 pole Baumuller BLDC motor with 3 Hall sensors, nominal current is 15 and peak is 30A.(i know this is pushing limits with the 8i20 but bear with me..) BLDC is loaded with config "qh". I am using the linear encoder on that axis (rawcounts) to drive bldc.0.rawcounts. The screw has 10mm pitch and a 2:1 toothed belt to the motor makes the scale 5000 per rotor revolution.
I managed to get the axis to stay within +- 0.05mm with slow speeds but the 8i20 doesnt always respond and i get an ferror almost immediately. The 8i20 also doesnt seem to be able to drive the axis from zero when it is at the end of travel where it is slightly more "tight" ( i can turn the motor easily by hand in this area of travel when not enabled.) My conclusion is that because of my PID settings the motor isnt getting enough current fast enough to do its job)
from what i have seen over the past few days, the 8i20 has more than enough to properly drive this motor and load, it is a setting problem that i cant figure out...
Now the questions....
1. This being a torque mode drive, is there a specific process to follow when PID tuning. I have tried nearly everything..
2. Im confused by the values of the parameters in the ini section below and the 8i20 parameters also copied below. The 8i20 manual includes the following:
Setting the MAX_OUTPUT, OUTPUT_SCALE, OUTPUT_MIN_LIMIT, OUTPUT_MAX_LIMIT to 30,30,-30 and 30 seems to result in a too low current value sent to the 8i20, it cannot move the axis. The 8i20 manual states " RMS motor current = QISETPOINT * NVMAXCURRENT/3276700" which led me to the settings below. Im not sure if im using the full 8i20 potential with this
MAX_OUTPUT = 3276700
ENCODER_SCALE = -1000
OUTPUT_SCALE = 3276700
OUTPUT_MIN_LIMIT = -3276700
OUTPUT_MAX_LIMIT = 3276700
setp hm2_7i92.0.8i20.1.2.current-scalemax 30
setp hm2_7i92.0.8i20.1.2.current-maxlim 30
setp hm2_7i92.0.8i20.1.2.current-minlim -30
for ref, i have attached my ini and hal files. thanks for the assistance
Henk
I have a question on PID tunning for position control on a milling machine using a Mesa 8i20 drive.
So far i have figured out how to use BLDC to control the motor thanks to Andypugh posts on the forum but i couldn't find anything related to PID tuning a torque mode drive.
I have retrofitted 4 machines using LCNC and always used P and FF1 with great success tuning velocity loops, but this one seems to be getting the better of me.
The motor is a 6 pole Baumuller BLDC motor with 3 Hall sensors, nominal current is 15 and peak is 30A.(i know this is pushing limits with the 8i20 but bear with me..) BLDC is loaded with config "qh". I am using the linear encoder on that axis (rawcounts) to drive bldc.0.rawcounts. The screw has 10mm pitch and a 2:1 toothed belt to the motor makes the scale 5000 per rotor revolution.
I managed to get the axis to stay within +- 0.05mm with slow speeds but the 8i20 doesnt always respond and i get an ferror almost immediately. The 8i20 also doesnt seem to be able to drive the axis from zero when it is at the end of travel where it is slightly more "tight" ( i can turn the motor easily by hand in this area of travel when not enabled.) My conclusion is that because of my PID settings the motor isnt getting enough current fast enough to do its job)
from what i have seen over the past few days, the 8i20 has more than enough to properly drive this motor and load, it is a setting problem that i cant figure out...
Now the questions....
1. This being a torque mode drive, is there a specific process to follow when PID tuning. I have tried nearly everything..
2. Im confused by the values of the parameters in the ini section below and the 8i20 parameters also copied below. The 8i20 manual includes the following:
Setting the MAX_OUTPUT, OUTPUT_SCALE, OUTPUT_MIN_LIMIT, OUTPUT_MAX_LIMIT to 30,30,-30 and 30 seems to result in a too low current value sent to the 8i20, it cannot move the axis. The 8i20 manual states " RMS motor current = QISETPOINT * NVMAXCURRENT/3276700" which led me to the settings below. Im not sure if im using the full 8i20 potential with this
MAX_OUTPUT = 3276700
ENCODER_SCALE = -1000
OUTPUT_SCALE = 3276700
OUTPUT_MIN_LIMIT = -3276700
OUTPUT_MAX_LIMIT = 3276700
setp hm2_7i92.0.8i20.1.2.current-scalemax 30
setp hm2_7i92.0.8i20.1.2.current-maxlim 30
setp hm2_7i92.0.8i20.1.2.current-minlim -30
for ref, i have attached my ini and hal files. thanks for the assistance
Henk
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
Less
More
- Posts: 17853
- Thank you received: 4774
08 Dec 2017 16:44 #102783
by PCW
Replied by PCW on topic Questions on PID tunning using Mesa 8i20 drive
Torque mode tuning is completely different than velocity mode tuning
I would do it this way for a single loop PID control:
Set a small amount of P so you have position control and then increase D as high as you can
without oscillation (a little dithering is OK) The higher the D term you can use, the better the performance
will be. Note that decreasing the servo thread period will allow a higher D term, so if your PC/hardware
supports a 4 KHz servo thread I would use that
Then adjust FF2 for minimal error during acceleration/deceleration
Next adjust P as high as it can be without oscillation
Finally do the same for I
Typically FF1 is not useful for torque mode loops
I would do it this way for a single loop PID control:
Set a small amount of P so you have position control and then increase D as high as you can
without oscillation (a little dithering is OK) The higher the D term you can use, the better the performance
will be. Note that decreasing the servo thread period will allow a higher D term, so if your PC/hardware
supports a 4 KHz servo thread I would use that
Then adjust FF2 for minimal error during acceleration/deceleration
Next adjust P as high as it can be without oscillation
Finally do the same for I
Typically FF1 is not useful for torque mode loops
Please Log in or Create an account to join the conversation.
- Henk
- Offline
- Platinum Member
Less
More
- Posts: 395
- Thank you received: 80
08 Dec 2017 17:06 #102784
by Henk
Replied by Henk on topic Questions on PID tunning using Mesa 8i20 drive
Thank you. I will try that in the morning.
Please Log in or Create an account to join the conversation.
- Todd Zuercher
- Offline
- Platinum Member
Less
More
- Posts: 5009
- Thank you received: 1443
08 Dec 2017 17:10 #102785
by Todd Zuercher
Replied by Todd Zuercher on topic Questions on PID tunning using Mesa 8i20 drive
For a torque mode drive you will need to use some D and I. Adding the right amount of D can often allow you to increase the amount of P that you can use. On my torque mode drives I found that limiting the amount of max error for I (pid.N.maxerrorI) was useful letting me use higher I numbers to get a faster response but preventing windup problems. The FF terms behave nothing like they do in a velocity command loop.
For me it was easier to tune my system using two PID loops (position loop feeding commands to a velocity loop), and running the sevo-thread as fast as I could without getting real time or smart serial errors. Then the outer position loop does most of the work, and tunes like normal. (PS: Don't get to aggressive with the tuning of the inner velocity loop.)
For me it was easier to tune my system using two PID loops (position loop feeding commands to a velocity loop), and running the sevo-thread as fast as I could without getting real time or smart serial errors. Then the outer position loop does most of the work, and tunes like normal. (PS: Don't get to aggressive with the tuning of the inner velocity loop.)
Please Log in or Create an account to join the conversation.
- Henk
- Offline
- Platinum Member
Less
More
- Posts: 395
- Thank you received: 80
09 Dec 2017 11:24 #102814
by Henk
Replied by Henk on topic Questions on PID tunning using Mesa 8i20 drive
Hi
I have tried starting with a P=10 and pushing D as much as possible. This didnt really get me anywhere, it seems that with any significant amount of D (>2) the axis slowly tithers back to the commanded pos but not all the way there. It is better with only P=10 and nothing else. The ferror is nearly acceptable with only P, but i still have the issue at the axis limits. With the best PID settings, the motor doesn't seem to be able to overcome the friction in these places. maybe im just pushing the 8i20 too far...
henk
I have tried starting with a P=10 and pushing D as much as possible. This didnt really get me anywhere, it seems that with any significant amount of D (>2) the axis slowly tithers back to the commanded pos but not all the way there. It is better with only P=10 and nothing else. The ferror is nearly acceptable with only P, but i still have the issue at the axis limits. With the best PID settings, the motor doesn't seem to be able to overcome the friction in these places. maybe im just pushing the 8i20 too far...
henk
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
Less
More
- Posts: 17853
- Thank you received: 4774
09 Dec 2017 14:28 #102822
by PCW
Replied by PCW on topic Questions on PID tunning using Mesa 8i20 drive
Are you sure you have the drive set for 30A full scale?
As far as D goes, that is _expected_ behaviour, with just D the motor will resist motion (viscous damping)
but have no tendency to reduce the position error. You set D first to as high as it is stable and then that will allow you to eventually increase P much higher than is possible without D.
Basically you have to follow the complete instructions before expecting decent tuning/minimal following error
As far as D goes, that is _expected_ behaviour, with just D the motor will resist motion (viscous damping)
but have no tendency to reduce the position error. You set D first to as high as it is stable and then that will allow you to eventually increase P much higher than is possible without D.
Basically you have to follow the complete instructions before expecting decent tuning/minimal following error
Please Log in or Create an account to join the conversation.
- Henk
- Offline
- Platinum Member
Less
More
- Posts: 395
- Thank you received: 80
10 Dec 2017 08:38 #102861
by Henk
Replied by Henk on topic Questions on PID tunning using Mesa 8i20 drive
Hi PCW
I have folowed the instructions, not there yet but i do understand the process now thanks.
I think the problem is with the current. Im not sure how to set the following values to make sure i get to the max of 30A peak. Can you please advise me how these should be set.
Copied from my first post
"
Setting the MAX_OUTPUT, OUTPUT_SCALE, OUTPUT_MIN_LIMIT, OUTPUT_MAX_LIMIT to 30,30,-30 and 30 seems to result in a too low current value sent to the 8i20, it cannot move the axis. The 8i20 manual states " RMS motor current = QISETPOINT * NVMAXCURRENT/3276700" which led me to the settings below. Im not sure if im using the full 8i20 potential with this
MAX_OUTPUT = 3276700
ENCODER_SCALE = -1000
OUTPUT_SCALE = 3276700
OUTPUT_MIN_LIMIT = -3276700
OUTPUT_MAX_LIMIT = 3276700
setp hm2_7i92.0.8i20.1.2.current-scalemax 30
setp hm2_7i92.0.8i20.1.2.current-maxlim 30
setp hm2_7i92.0.8i20.1.2.current-minlim -30
"
Thanks
I have folowed the instructions, not there yet but i do understand the process now thanks.
I think the problem is with the current. Im not sure how to set the following values to make sure i get to the max of 30A peak. Can you please advise me how these should be set.
Copied from my first post
"
Setting the MAX_OUTPUT, OUTPUT_SCALE, OUTPUT_MIN_LIMIT, OUTPUT_MAX_LIMIT to 30,30,-30 and 30 seems to result in a too low current value sent to the 8i20, it cannot move the axis. The 8i20 manual states " RMS motor current = QISETPOINT * NVMAXCURRENT/3276700" which led me to the settings below. Im not sure if im using the full 8i20 potential with this
MAX_OUTPUT = 3276700
ENCODER_SCALE = -1000
OUTPUT_SCALE = 3276700
OUTPUT_MIN_LIMIT = -3276700
OUTPUT_MAX_LIMIT = 3276700
setp hm2_7i92.0.8i20.1.2.current-scalemax 30
setp hm2_7i92.0.8i20.1.2.current-maxlim 30
setp hm2_7i92.0.8i20.1.2.current-minlim -30
"
Thanks
Please Log in or Create an account to join the conversation.
- PCW
- Away
- Moderator
Less
More
- Posts: 17853
- Thank you received: 4774
11 Dec 2017 19:02 #102925
by PCW
Replied by PCW on topic Questions on PID tunning using Mesa 8i20 drive
On Linux, I think you need to set the 8I20 current limit EEPROM setting with setsserial
I will try to do this today if I get a chance
I will try to do this today if I get a chance
Please Log in or Create an account to join the conversation.
- Henk
- Offline
- Platinum Member
Less
More
- Posts: 395
- Thank you received: 80
12 Dec 2017 11:46 #102987
by Henk
Replied by Henk on topic Questions on PID tunning using Mesa 8i20 drive
HI PCW
Thanks, that solved it!!!
Axis now tuned to within acceptable limits. Ill be using 8i20's in the future without hesitation
Henk
Thanks, that solved it!!!
Axis now tuned to within acceptable limits. Ill be using 8i20's in the future without hesitation
Henk
Please Log in or Create an account to join the conversation.
- andypugh
- Offline
- Moderator
Less
More
- Posts: 23310
- Thank you received: 4858
14 Dec 2017 11:50 #103106
by andypugh
Replied by andypugh on topic Questions on PID tunning using Mesa 8i20 drive
I was just about to ask about the nvmaxcurrent, but it seems you are already there.
I have a change in the pipeline that allows you to set the smart-serial parameters in HAL rather than using the somewhat clunky setsserial method.
I feel a bit "iffy" about using the axis scales for commutation, which you seem to be doing. I would certainly not recommend "qhi" because that would get messed up any time that the belt positions were changed. However what you have ought to be OK (and smoother than pure "h" mode).
I assume there is no motor encoder?
I have a change in the pipeline that allows you to set the smart-serial parameters in HAL rather than using the somewhat clunky setsserial method.
I feel a bit "iffy" about using the axis scales for commutation, which you seem to be doing. I would certainly not recommend "qhi" because that would get messed up any time that the belt positions were changed. However what you have ought to be OK (and smoother than pure "h" mode).
I assume there is no motor encoder?
Please Log in or Create an account to join the conversation.
Moderators: PCW, jmelson
Time to create page: 0.078 seconds