View Single Post
Old 03-23-2009, 01:05 PM   #622 (permalink)
MazdaMatt
Master EcoModder
 
Join Date: Jun 2008
Location: London, Ontario
Posts: 1,096

2k2Prot5 - '02 Mazda Protege5
90 day: 33.82 mpg (US)
Thanks: 0
Thanked 17 Times in 14 Posts
Paul, you sly devil... you're getting good at this stuff!

Second fail case - Hall stuck at 0. If you are already moving and the hall is stuck at 0, then it will try to push up the current. Then you realize th ings are bad and you drop throttle. Throttle and current will both be 0, so the PWM will NOT CHANGE from where it is! So yes, you ARE going to be rocktting down the road strapped to an electric death machine. I recommend a simple "if throttle = 0, kill it", but that might be harsh on the electronics.

Use excel to choose your values for you. Decide your settling time and overshoot this way. There is, unfortunately, an unknown variable which makes this a little more tricky than it looks. The rate of change of current with respect to PWM duty is NOT constant. At higher rpm, the rate of change of current with respect to pwm duty is lower than it is at low RPM. A properly designed state space version of this controller would alleviate that and you'd get good response across the board.

Be sure to run that calculation on a timer interrupt! You do not want to do this in the main loop.
  Reply With Quote