View Single Post
Old 05-07-2015, 02:52 PM   #7050 (permalink)
artc
EcoModding Lurker
 
Join Date: Nov 2012
Location: West
Posts: 7
Thanks: 1
Thanked 3 Times in 3 Posts
Quote:
Originally Posted by MPaulHolmes View Post
I didn't do the PI loop the traditional way.
No argument from me there

You're right in that you're calculating deltaPWM rather than PWM so there's an additional differentiation that comes into play.

Quote:
Originally Posted by MPaulHolmes View Post
(5) deltaPWM = P*errorNew + (I*deltaT - P)*errorOld
(As a PI equation that seem intuitively horribly wrong, but I can' see a problem in the mathematics).

What bothers me about (5) is that somewhere I'm missing an inversion (possibly U5C?). With a "direct" drive I think that lower pwm, lower OCR1A would lead to an increased current which would imply a negative proportional term. However, I think that output of that loop increases with increasing error.
  Reply With Quote