Go Down

Topic: Arduino PID Library: Out of Beta (Read 4228 times) previous topic - next topic

br3ttb

Apr 15, 2011, 10:02 pm Last Edit: Apr 26, 2011, 02:01 pm by br3ttb Reason: 1
After being in Beta for way too long, the Arduino PID Library is ready (I think) for prime time. The new and improved PID_v1 can be downloaded here.

I made some major changes to the internal code, but what I hope the end-user notices most is that I tried to simplify things.  The two biggest examples of this:
 

  • I switched to the Kp, Ki, Kd form of the PID.  I still like the other version better, but this is what everyone is expecting, and it isn't really about what I want.

  • There are significantly fewer functions.  All that's left is what's absolutely necessary to make the pid work well.



The biggest improvement this time around, and by far the most difficult, is that I've explained myself.  In excruciating detail.  If you want to know how and why I did things in the code, it's all there.

As always, questions and comments are greatly appreciated.

-Brett

Update: the previous PID thread became a rather unwieldy place for Q&A.  In an attempt to have things be a little more organized, I've created a google group

Coding Badly


First, thank you!  I appreciate the work you've done.

Second, are you interested in specific technical comments?  If "yes", would you prefer them posted here, on your blog, or something else?

br3ttb

#2
Apr 16, 2011, 03:01 am Last Edit: Apr 16, 2011, 04:08 am by br3ttb Reason: 1
Quote
are you interested in specific technical comments?

Yeah absolutely.  If it pertains to something addressed in one the blog posts, it probably makes the most sense to post there, so I can respond in context.  For more general stuff, here probably makes more sense.  But no huge deal. I'm more interested in the feedback than where it's delivered.

Graynomad

Thanks br3ttb, I skimmed your tute and already know 10x what I used to about PID, I'll have a better read later.

______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Coding Badly


mowcius

Neat - I was just implementing the beta version - looks like I'll switch to this now :)

Nice writeup - I'm learning a lot too.

br3ttb

@Coding Badly.  Excellent, thank you.  responded.
@mowcius, @Graynomad  I'm not the biggest fan of the work involved in doing a writeup.  The fact that it's useful to you makes all the difference.  thanks.

mowcius

Oh that writeup really makes the difference - To most people using the arduino platform, code without a writeup is as useful as no code - they wouldn't know how to use it and therefore wouldn't be able to.

Your writeup obviously goes into a lot more than just how to use it but that's much appreciated - educates us all :)

mowcius

I think DIRECT implies other things but i can't think of anything to change it to. Obviously FORWARD would be no better.

Perhaps you want to mention the point that double is acting with the same precision as a float but presumably is there in case double is added with full precision in the future.

br3ttb

Quote
I think DIRECT implies other things but i can't think of anything to change it to
agreed.  when there's a question about naming I fall back to industrial standards.  I did the same thing with "sample time"

Quote
Perhaps you want to mention the point that double is acting with the same precision as a float but presumably is there in case double is added with full precision in the future.
yes!  can't believe I forgot to do that.  True double-precision is WAY overkill for PID.  Now I just need to figure out where to put it...

mowcius

It's almost as bad as things like 'proper time'... but I can live with DIRECT - makes sure people read your documentation :)

I'll let you know if I find any actual issues with it rather than me nitpicking ;)

retrolefty


It's almost as bad as things like 'proper time'... but I can live with DIRECT - makes sure people read your documentation :)

I'll let you know if I find any actual issues with it rather than me nitpicking ;)


Having worked in the process control industry I can state that the concept of direct/reverse acting controller can be hard for newcomers to grasp at first. An example might be a simple level controller for a vessel where there is a pump forcing liquid into a vessel and a PID controller reading the level and manipulating a control valve to keep the vessel level at a fixed level. Now depending on if the valve is on the inlet side to the vessel or on the outlet of the vessel will dictate with control action one requires, direct or reverse.

Also control valves come in direct and reverse acting versions and that can also require a flipping of the controller action. In the 'old days' it could be quite confusing to see one valve that would move to full open with 100% output and another valve that would move to fully closed with 100% controller output. Most control valves in industrial service have a 'fail safe' requirement defined by the process engineers for each specific control valve in the plant that would determine which way a pnumatic valve would move with a loss of all control power via internal spring force. Modern computer process control systems have kind of eleminated the confusion for the control operators such that it's always clear on the computer screen what the position of a control valve is regardless of it's control action. But of course the complexity is still where, just transfeered to the control system engineers to configure each controller properly.

Lefty

mmcp42

just skimmer through the explanations
stunning bit of reading
have marked for in-depth study!

thanks
there are only 10 types of people
them that understands binary
and them that doesn't

Go Up