View Single Post
Old 07-24-2009, 12:24 AM   #2083 (permalink)
MPaulHolmes
PaulH
 
MPaulHolmes's Avatar
 
Join Date: Feb 2008
Location: Maricopa, AZ (sort of. Actually outside of town)
Posts: 3,832

Michael's Electric Beetle - '71 Volkswagen Superbeetle 500000
Thanks: 1,368
Thanked 1,202 Times in 765 Posts
I didn't get a chance to try it yet. I had to watch one of the foster kids, who was really really naughty. I had an idea about the throttle.

At 0 rpm, the torque is maximum and rpm is minimum. At max rpm, torque is minimum and rpm is maximum. So, what if we took a cue from the nature of the motor. pwmDuty is proportional to speed, and current is proportional to torque. So what if we tried this:
Try to make:

C*current + (1 - C)*pwmDuty

equal to throttle.

C would be a number from 0 to 1. If throttle was 0, then C would be 0. And if throttle was maximum, then C would be 1. To get this, we could do:

attempt = (throttle*current + (MAX_THROTTLE - throttle)*pwmDuty)/MAX_THROTTLE

Then, you change pwmDuty based on if attempt is too little or too big, compared to throttle.
__________________
kits and boards

Last edited by MPaulHolmes; 07-24-2009 at 12:30 AM..
  Reply With Quote