Sorry, that last message was getting sort of long, so I thought I should start the new topic here:
My thinking is this: (I know I'm wrong, but I want to understand why)
1. Why go to all the trouble of doing a properly tuned PID loop to modify PWM duty based on current. It was suggested to me that while I was tuning the loop using the unit step, I could get current overshoots above MAX_CURRENT that could wreck the mosfets, so that I would need to add a hardware based current control while tuning.
2. Is a good PID loop really faster than what I'm doing right now to find the target PWM duty that gives the correct current. Here's what I'm doing... During each loop, I read the temperature, throttle position, and current. If current is too high (like if at 10% throttle, it's above 10% of MAX_CURRENT), drop PWM duty by 1 (not throttle), read current, if too big, drop PWM duty by 1, etc...
I figure you shouldn't have to do that drop by one very many times, because during each main loop, I only allow the PWM duty to grow by at most 1, regardless of the actual throttle position. It's sort of hard to explain. I should upload my new code and explain each line in more detail.
|