View Single Post
  #5   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 13:41:18 +0800, Stoob wrote:

On 23-Sep-14 10:23 AM, 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



You need to ping Tim Wescott who sometimes posts here - he's the guru.


What? Who? Huh?

--

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