-
Notifications
You must be signed in to change notification settings - Fork 536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Current PI Autotuning #426
base: dev
Are you sure you want to change the base?
Conversation
Great! |
To be clear, this method is really more like pole placement, rather than autotuning. I would recommend also setting the filter cutoff based on the controller bandwidth, otherwise the controller will have a higher bandwidth than the filter likely leading to some integral windup or something else undesirable happening. The default filter for faster chips has a cutoff frequency of ~30hz. Something like 1.5-5x the controller bandwidth (so 450-1500hz) is probably a good place to start. In the hfi fork we've been using a fixed ~2khz lowpass for both controllers. |
Oohh, very very very nice! |
Some time ago I shared this: The blog and video in the the next post are great. |
Nice, I'll look into it. |
I believe I used a combination of this Ben Katz blog post and Elwin's project when I wrote this. I did some algebra to convert the coefficients to the form used in SFOC. Extra fun fact is that this same method applies to tuning the velocity PI controller too! The units just change. I'd need to work it out though as I don't remember off the top of my head. |
Shared by @mcells from his fork https://github.com/mcells/Arduino-FOC/blob/d40c7d7fddff4c3e58b26ebd2e2cc846fddfc09e/src/HFIBLDCMotor.cpp#L71
if phase resistance and phase inductance are known:
Will initialize Kp and Ki for q and d current PI controllers automatically based on phase resistance, phase inductance and current bandwidth (default 300).
⚠️ What if users have set phase resistance and phase inductance but were using default PI parameters ? Is there an impact ?
Needs to be adapted if Ld and Lq are available in the future.
if phase resistance and phase inductance are not known:
Same SimpleFOC default values as before are used.
Users that have already tuned their PIs:
They will overwrite Kp and Ki from their code.