If you do a bit of web searching you'll come back and ask "which of the gazillions of algorithms that are out there is the right one for me?". When you do you may want to cross-post to both this group and to sci.engr.control.
For guidance you may want to check out my article on the Embedded.com website -- it first appeared in Embedded Programming Magazine, and it's still going strong. That article has a simple procedure that you can go through to manually tune a loop, and works very well if the environment's not too challenging. This link will get you there:
formatting link
You may have read it already, and if you didn't then whoever wrote the code very likely did -- the variable names you're using look _very_ familiar.
If you need to do a really good job or if you have a challenging plant to control you'll need to get a copy of my book:
formatting link
If you need to build a controller that tunes itself once, or every time it wakes up you'll want to do a web search on "auto tune".
If you need to build a controller that tunes itself all the time, you'll want to change jobs, or do a web search on "adaptive control".
--
Tim Wescott
Wescott Design Services
http://www.wescottdesign.com
Posting from Google? See http://cfaj.freeshell.org/google/
Do you need to implement control loops in software?
"Applied Control Theory for Embedded Systems" gives you just what it says.
See details at http://www.wescottdesign.com/actfes/actfes.html
The Ziegler-Nichols procedure shows up in a lot of application notes.
Check out Ziegler J and Nichols N in the Transactions of the ASME, volume 64 starting on page 759. It was published in 1942 - the same year that I was born ...
Googling on Ziegler-Nichols produced 32,500 hits - here is the first one.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.