# from logs_conf.logger import * from logs.logger import * from optimized_and_individal.temperature_step_size_10 import ModifyLeavingWaterTempSetTSS10, ModifyReturningWaterTempSetTSS10 from optimized_and_individal.temperature_step_size_05 import ModifyLeavingWaterTempSetTSS05, ModifyReturningWaterTempSetTSS05 class WaterTempSetVerify(object): def __init__(self, water_temp_set_new, dict_chiller_inner): self.water_temp_set_new = water_temp_set_new self.dict_chiller_inner = dict_chiller_inner # self.dict_chiller_outer = dict_chiller_outer def modify(self): if self.dict_chiller_inner['chillerTempStep'] == 0.1: result = self.water_temp_set_new # logger.critical('============低工况验证============') elif self.dict_chiller_inner['chillerTempStep'] == 0.5: if self.dict_chiller_inner['waterTempControlMode'] == 0: mlwts_tss05 = ModifyLeavingWaterTempSetTSS05(self.water_temp_set_new, self.dict_chiller_inner) result = mlwts_tss05.modify_temp() elif self.dict_chiller_inner['waterTempControlMode'] == 1: mrwts_tss05 = ModifyReturningWaterTempSetTSS05(self.water_temp_set_new, self.dict_chiller_inner) result = mrwts_tss05.modify_temp() else: result = '' logger.critical('============冷机控制选择输入错误============') elif self.dict_chiller_inner['chillerTempStep'] == 1: if self.dict_chiller_inner['waterTempControlMode'] == 0: mlwts_tss10 = ModifyLeavingWaterTempSetTSS10(self.water_temp_set_new, self.dict_chiller_inner) result = mlwts_tss10.modify_temp() elif self.dict_chiller_inner['waterTempControlMode'] == 1: mrwts_tss10 = ModifyReturningWaterTempSetTSS10(self.water_temp_set_new, self.dict_chiller_inner) result = mrwts_tss10.modify_temp() else: result = '' logger.critical('============冷机控制选择输入错误============') else: result = '' logger.critical('============冷机配置参数输入错误============') return result def limit_verify(self): if self.dict_chiller_inner['runMode'] == 0: if self.dict_chiller_inner['waterTempControlMode'] == 0: if self.water_temp_set_new > self.dict_chiller_inner['chillerWaterTempSetUpper']: self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempSetUpper'] elif self.water_temp_set_new < self.dict_chiller_inner['chillerWaterTempSetDown']: self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempSetDown'] else: self.water_temp_set_new = self.water_temp_set_new elif self.dict_chiller_inner['waterTempControlMode'] == 1: if self.water_temp_set_new > self.dict_chiller_inner['chillerWaterTempInSetUpper']: self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempInSetUpper'] elif self.water_temp_set_new < self.dict_chiller_inner['chillerWaterTempInSetDown']: self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempInSetDown'] else: self.water_temp_set_new = self.water_temp_set_new else: self.water_temp_set_new = '' logger.critical('============冷机控制选择输入错误============') elif self.dict_chiller_inner['runMode'] == 1: if self.dict_chiller_inner['waterTempControlMode'] == 0: if self.water_temp_set_new > self.dict_chiller_inner['heatingWaterTempSetUpper']: self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempSetUpper'] elif self.water_temp_set_new < self.dict_chiller_inner['heatingWaterTempSetDown']: self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempSetDown'] else: self.water_temp_set_new = self.water_temp_set_new elif self.dict_chiller_inner['waterTempControlMode'] == 1: if self.water_temp_set_new > self.dict_chiller_inner['heatingWaterTempInSetUpper']: self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempInSetUpper'] elif self.water_temp_set_new < self.dict_chiller_inner['heatingWaterTempInSetDown']: self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempInSetDown'] else: self.water_temp_set_new = self.water_temp_set_new else: self.water_temp_set_new = '' logger.critical('============冷机运行模式输入错误============') return self.water_temp_set_new def based_time_temp_range(self): # 因水温的温度区间是分时设定的,避免因为不同时间段的限制导致制冷温度上升或制热温度下降 if self.dict_chiller_inner['runMode'] == 0: if self.dict_chiller_inner['waterTempControlMode'] == 0 and \ self.water_temp_set_new > self.dict_chiller_inner['chillerWaterTempSet']: if self.water_temp_set_new - self.dict_chiller_inner['chillerWaterTempOut'][-1] > \ 0.75 * self.dict_chiller_inner['coolingShutdownOffset']: self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempOut'][-1] + \ 0.75 * self.dict_chiller_inner['coolingShutdownOffset'] elif self.dict_chiller_inner['waterTempControlMode'] == 1 and \ self.water_temp_set_new > self.dict_chiller_inner['chillerWaterTempInSet']: if self.water_temp_set_new - self.dict_chiller_inner['chillerWaterTempIn'][-1] > \ 0.75 * self.dict_chiller_inner['coolingShutdownOffset']: self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempIn'][-1] + \ 0.75 * self.dict_chiller_inner['coolingShutdownOffset'] elif self.dict_chiller_inner['runMode'] == 1: if self.dict_chiller_inner['waterTempControlMode'] == 0 and \ self.water_temp_set_new < self.dict_chiller_inner['heatingWaterTempSet']: if self.dict_chiller_inner['heatingWaterTempOut'][-1] - self.water_temp_set_new > \ 0.75 * self.dict_chiller_inner['heatingShutdownOffset']: self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempOut'][-1] - \ 0.75 * self.dict_chiller_inner['heatingShutdownOffset'] elif self.dict_chiller_inner['waterTempControlMode'] == 1 and \ self.water_temp_set_new < self.dict_chiller_inner['heatingWaterTempInSet']: if self.dict_chiller_inner['heatingWaterTempIn'][-1] - self.water_temp_set_new > \ 0.75 * self.dict_chiller_inner['heatingShutdownOffset']: self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempIn'][-1] - \ 0.75 * self.dict_chiller_inner['heatingShutdownOffset'] else: self.water_temp_set_new = '' logger.critical('============冷机运行模式输入错误============') return self.water_temp_set_new # def switch(self): # """ # 根据品牌转换点表中温湿度,当前只有麦克韦尔为华氏摄氏度 # :return: # """ # if self.water_temp_set_new: # if self.dict_chiller_outer['chillerTempType'] == 0: # 水温数据类型为整型 # if self.dict_chiller_outer['chillerTempUnit'] == 1: # 0表示为摄氏,1表示华氏 # results = self.water_temp_set_new * 1.8 + 32 # else: # results = self.water_temp_set_new # results = results * self.dict_chiller_outer['chillerTempScale'] # results = int(round(results)) # elif self.dict_chiller_outer['chillerTempType'] == 1: # 水温数据类型为浮点型 # results = self.water_temp_set_new # else: # results = '' # logger.critical('========冷机温度数据类型错误========') # else: # results = '' # logger.critical('========冷机温度设定值为空========') # return results def modify_verify(self): self.water_temp_set_new = self.modify() self.water_temp_set_new = self.limit_verify() self.water_temp_set_new = self.based_time_temp_range() # water_temp_set_switched = self.switch() return self.water_temp_set_new