示例#1
0
    def setRamp(self, time, temp):
         # important, turn of previous ramp first, to be able to the same ramp registers a.e. PU_1 and tr_1
        if self.__ramp_on:
            d = self.__setValue(rSSL(0))
            if d == -1:
                return -1
            else:
                self.__ramp_on = False

        # write ramp to TemperatureRegulator
        if not self.__successPU_1:
            if self.__setValue(PU_1(temp)) != -1:
                self.__successPU_1 = True
        if not self.__successtr_1:
            if self.__setValue(tr_1(time)) != -1:
                self.__successtr_1 = True
        if not self.__successrSSL and self.__successPU_1 and self.__successtr_1:
            if self.__setValue(rSSL(1)) != -1:
                self.__successrSSL = True
        # check if all writes were successful, return -1 if not, otherwise 0
        if not self.__successPU_1 or not self.__successtr_1 or not self.__successrSSL:
            return -1
        else:
            # reset success variables for next ramp
            self.__successPU_1 = False
            self.__successtr_1 = False
            self.__successrSSL = False
            self.__ramp_on = True
            return 0 
示例#2
0
    def reset(self):
        # reset success variables for next ramp
        self.__successPU_1 = False
        self.__successtr_1 = False
        self.__successrSSL = False
        self.__ramp_on = True
        # set PU_1 to 0
        self.__setValue(PU_1(0))
        # set tr_1 to 0
        self.__setValue(tr_1(0))
        # set rSSL back to 0
        self.__setValue(rSSL(0))

        # set temp in normal operation mode to 0
        self.setTemp(0)