View Single Post
  #1   Report Post  
Posted to rec.crafts.metalworking
RogerN RogerN is offline
external usenet poster
 
Posts: 1,475
Default PID calculations


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