View Single Post
  #8   Report Post  
Posted to rec.crafts.metalworking
Tim Wescott[_6_] Tim Wescott[_6_] is offline
external usenet poster
 
Posts: 223
Default PID calculations

On Tue, 23 Sep 2014 07:37:36 -0500, Richard wrote:

On 9/22/2014 9:23 PM, RogerN wrote:
I've seen calculations for PID in a microcontroller but I'm thinking
something is missing.. or perhaps I'm misunderstanding something.

So if Derivative = current_error - previous_error then it's just
effective for one cycle. It seems like it should be the change over a
period of time,
not necessarily one pass through the loop.

One way would be to have an array of error[xx] and take the difference
in change over a period of time involving several of times through the
loop.

Also, I've seen some PID that the I adjustment is in units of time.

This might not be a big deal if there is a real high resolution, but if
you have a temperature control that is heating for a 5 degree error,
chances are the derivative term isn't going to have much effect if it's
calculated every millisecond. If it's calculated over a longer period,
for example how much change in the last 10 minutes, it would be more
meaningful.

I know a way to do this but I'm just looking for better ideas, perhaps
more efficient memory usage.

RogerN



Three is an excellent Wiki page on the subject.

http://en.wikipedia.org/wiki/PID_controller


It gets a bit sketchy in parts -- entire books could be (and have been!)
written about PID controllers alone. But as Wikipedia articles go, I
guess it's about average.

--

Tim Wescott
Wescott Design Services
http://www.wescottdesign.com