Example #1
0
def runGPID():
    gPIDInstance = gPID.gPID()
    gPIDInstance.ChangeSetPoint(40.0)
    while True:
        getCFPval = float(GP.getcFP())
        next_PV = gPIDInstance.Compute(getCFPval)
        print "Present Temp: " + str(getCFPval) + "| nextPV: " + str(next_PV)
        GP.HeaterControl(next_PV)
        time.sleep(1)
Example #2
0
 def RunPIDonce(self, measurement_value):
     pid_raw = self.pid_control.update(measurement_value)
     pid = self.Constrain(pid_raw, 0.0, 100.0)
     sys.stdout.flush()
     sys.stdout.write("\rPID RAW: %.02f | PID: %.02f | Temperature: %.02f" %
                      (pid_raw, pid, measurement_value))
     if measurement_value >= self.pid_control.set_point + 30.0:
         self.stop()
     GP.HeaterControl(pid)
Example #3
0
    def UpdateVars(self):
        #Update the temperature variables!
        self.TemperatureData.append(GP.getcFP())
        self.TemperatureData.pop(0)
        self.TrailAvg = np.average(self.TemperatureData[:self.step])
        self.LeadAvg = np.average(self.TemperatureData[-self.step:])
        #Update Pressure Variable
        #self.Pressure = GP.getPressure()
        #Call stability check

        reactor.callWhenRunning(self.StabilityWrapper)
        #get PID Value
        PIDValue = self.gPID.Compute(float(self.LeadAvg))

        if int(PIDValue) != int(self.PIDVal):
            #write PID Value
            GP.HeaterControl(PIDValue)
            self.PIDVal = PIDValue
Example #4
0
def killall():
    GP.HeaterControl(0)
    reactor.stop()
Example #5
0
 def stop(self):
     GP.HeaterControl(0)
     print "Stopped"
     sys.exit("Overheat. Stopped.")