control loop observations
I wanted to throw this out there and see what ideas you all have.
This all started when a buddy created a motor and vehicle model (mathematical) and tried to predict the acceleration performance of his future EV. I suggested we plug in the parameters for my vehicle and see how the predictions match reality.
It was pretty far off though - It said I should be in first gear for only a few seconds whereas it took nearly twice as long to accelerate to shifting speed.
So, i logged some data from the serial port to investigate what the controller was actually doing. Turns out that I was getting about 375A to the motor, despite flooring it, and we had assumed that the controller would be maxed at 500A.
I had set the kp and ki values for 'smoothness' and that resulted in a pretty slow control loop. consequently, the motor speed accelerated faster than the control loop could keep up. By the time it set a new PWM duty cycle, the motor speed had increased and the new PWM value isn't enough to maintain the commanded motor amps.
Increasing both kp and ki makes the control loop faster and I reached a point where I could maintain about 470A during acceleration. I even went too high at one point and the controller immediately went into hardware overcurrent protection with a slight press of the pedal.
However, as the loop speed increased, the 'smoothness' decreased. If I was at a dead stop with a little bit of slack in the gear train, the motor current would shoot up quickly and result in a jerky start that led to slowly damped torque oscillations. Also, abrupt changes in throttle position resulted in torque oscillations due to the elasticity in the geartrain, particularly in 2nd gear.
Has anyone else observed this? For the most part, this isn't necessarily a racing controller, but it might be nice to find a way to have the best of both: fast control loop for fast accelerations and a slower loop during start or cruising the parking lot.
The only idea I had was to allow for Kp and Ki to vary with some other parameter, maybe throttle position or PWM dutycycle. Any other ideas?
|