The following code breaks if PID becomes > 1.0
off_sec = (1.0 - self.fPID) * self.fPeriod
off_sec = max(off_sec, self.fMinOff)
on_sec = self.fPeriod - off_sec
So off_sec becomes negative in the case that self.fPID > 1 in the first line. In the second line it gets set to self.fMinOff. So the right thing happens, but it isn't exactly clean.
In the case where PID becomes negative, off_sec becomes > self.fPeriod. This means on_sec becomes a negative number. I'm not sure what the code would do here; the following code would be called:
self.events.append((now + on_sec, False))
So the chiller is supposed to turn off before it turns on. I'm guessing this is an unsorted array, so this would result in the pin going high then low immediately.
Added P, I, and D variables #3
Bug fix for math where PID > 1.0 #4