Created
September 18, 2012 23:45
-
-
Save pdp7/3746767 to your computer and use it in GitHub Desktop.
Snippet of class PID from https://github.com/eastein/chillmon/blob/master/chillmon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class PID(object) : | |
| def __init__(self, temp_probe, target) : | |
| self.temp_probe = temp_probe | |
| self.samples = [] | |
| self.target = target | |
| GPIO.setup(CHILLPIN, GPIO.OUT) | |
| self.pid_ts = None | |
| self.events = [] | |
| GPIO.output(CHILLPIN, False) | |
| self.fPeriod = 300.0 | |
| self.fMinOff = 60.0 * 3 | |
| assert self.fPeriod > self.fMinOff | |
| # pid state | |
| self.fError = None | |
| self.fIError = 0.0 | |
| self.fDError = None | |
| self.fPriorError = None | |
| self.fPID = None | |
| self.fTemp = None | |
| # guesstimated PID constants. ratio, not percentage based. | |
| self.fKP = 0.02 | |
| self.fKI = 0.002 | |
| self.fKD = 0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment