123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501 |
- import os
- import pandas as pd
- # from logs_conf.logger import *
- from logs.logger import *
- from data_initialize_standard.constant import *
- class SetPointStrategyOff(object):
- """智控模式关闭状态下的水温设定值"""
- def __init__(self, dict_chiller_inner, data_temp_humi):
- # self.dict_code = dict_code
- self.dict_chiller_inner = dict_chiller_inner
- self.data_temp_humi = data_temp_humi
- def chiller_off(self):
- """冷机关机状态下,分制冷和制热模式,回水和进水控制四种情况,将初始设定值赋值"""
- if self.dict_chiller_inner['runMode'] == 0:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempSetInitial']
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempInSetInitial']
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- elif self.dict_chiller_inner['runMode'] == 1:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempSetInitial']
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempInSetInitial']
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- else:
- water_temp_set_new = ''
- logger.critical('============冷机运行模式输入错误============')
- return water_temp_set_new
- def chiller_on(self):
- """冷机开机状态下,分制冷和制热模式,回水和进水控制四种情况,通过对比当前设定值和初始设定值再赋值"""
- if self.dict_chiller_inner['runMode'] == 0:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- if self.dict_chiller_inner['chillerWaterTempSet'] < self.dict_chiller_inner['chillerWaterTempSetInitial']:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempSet']
- else:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempSetInitial']
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- if self.dict_chiller_inner['chillerWaterTempInSet'] < self.dict_chiller_inner['chillerWaterTempInSetInitial']:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempInSet']
- else:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempInSetInitial']
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- elif self.dict_chiller_inner['runMode'] == 1:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- if self.dict_chiller_inner['heatingWaterTempSet'] > self.dict_chiller_inner['heatingWaterTempSetInitial']:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempSet']
- else:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempSetInitial']
- else:
- if self.dict_chiller_inner['heatingWaterTempInSet'] > self.dict_chiller_inner['heatingWaterTempInSetInitial']:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempInSet']
- else:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempInSetInitial']
- else:
- water_temp_set_new = ''
- logger.critical('============冷机运行模式输入错误============')
- return water_temp_set_new
- def self_control_strategy_off(self):
- """判断冷机当前运行状态,进而赋值,主要是对于运行冷机有个恢复初始值的过程"""
- if self.dict_chiller_inner['runStatus'][-1] == 0:
- water_temp_set_new = self.chiller_off()
- elif self.dict_chiller_inner['runStatus'][-1] == 1:
- water_temp_set_new = self.chiller_on()
- else:
- water_temp_set_new = ''
- logger.critical('============冷机运行状态输入错误============')
- return water_temp_set_new
- class SetPointStrategyOnChillerOff(SetPointStrategyOff):
- """冷机停机下水温设定值策略"""
- def __init__(self, dict_chiller_inner, data_temp_humi):
- super(SetPointStrategyOnChillerOff, self).__init__(dict_chiller_inner, data_temp_humi)
- def judge_off_time(self):
- """冷机已关机时长"""
- off_time_latest = pd.to_datetime(self.dict_chiller_inner['chillerOffTimeLatest'])
- date_time_now = pd.to_datetime(self.dict_chiller_inner['triggerTime'])
- chiller_off_time = (date_time_now - off_time_latest).total_seconds()
- if abs(chiller_off_time) < 5:
- chiller_off_time = 0 # 终端设备时间和服务器设备时间之间小偏差修正
- chiller_off_time = chiller_off_time / 3600.0
- return chiller_off_time
- def chiller_off_short_time(self):
- """设定值赋值为最近一次关机时的设定值"""
- if self.dict_chiller_inner['runMode'] == 0:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- water_temp_set_new = self.dict_chiller_inner['offSetTempLatestCooling']
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- water_temp_set_new = self.dict_chiller_inner['offSetTempInLatestCooling']
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- elif self.dict_chiller_inner['runMode'] == 1:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- water_temp_set_new = self.dict_chiller_inner['offSetTempLatestHeating']
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- water_temp_set_new = self.dict_chiller_inner['offSetTempInLatestHeating']
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- else:
- water_temp_set_new = ''
- logger.critical('============冷机运行状态输入错误============')
- return water_temp_set_new
- def water_temp_set_confirm(self):
- """关机时长大于16小时,则设定值为初始设定值;关机时长在16小时以内,则设定值为最近一次关机设定值"""
- chiller_off_time = self.judge_off_time()
- if chiller_off_time > 16:
- water_temp_set_new = self.chiller_off()
- elif 16 >= chiller_off_time >= 0:
- water_temp_set_new = self.chiller_off_short_time()
- else:
- water_temp_set_new = ''
- logger.critical('============冷机停机时间输入错误============')
- return water_temp_set_new
- class JudgeTempControlMode(object):
- def __init__(self, dict_chiller_inner):
- self.dict_chiller_inner = dict_chiller_inner
- def is_single_control_strategy(self):
- """判断所有冷机的冷水控制方式是否唯一,全部为供水或全部为回水
- 0表示全部供水或全部回水,1表示供水和回水共存"""
- para_accs = pd.DataFrame(self.dict_chiller_inner['allChillerControlSelect'], columns=['para_accs'])
- para_accs = para_accs.drop_duplicates()
- if len(para_accs) > 1: # 0为全部供水或全部回水,1为供水和回水共存
- judge_sin_mul = 1 # 供水和回水共存的情况暂不考虑
- elif len(para_accs) == 1:
- judge_sin_mul = 0
- else:
- judge_sin_mul = ''
- logger.critical('============所有冷机制冷控制选择输入错误============')
- return judge_sin_mul
- class JudgeSynchronizeAsynchronous(object):
- """判断冷机的设定值为同步还是异步"""
- def __init__(self, dict_chiller_inner):
- self.dict_chiller_inner = dict_chiller_inner
- def parameter_middle(self):
- """获取所有开机冷机的出水或回水温度设定值的反馈值"""
- if self.dict_chiller_inner['runMode'] == 0:
- """全部为供水或全部为回水,则返回对应模式下水温的设定值反馈值"""
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- para_middle = pd.DataFrame(self.dict_chiller_inner['allChillerWaterTempSetOn'], columns=['para_middle'])
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- para_middle = pd.DataFrame(self.dict_chiller_inner['allChillerWaterTempInSetOn'], columns=['para_middle'])
- else:
- para_middle = ''
- logger.critical('============冷机控制选择输入错误============')
- elif self.dict_chiller_inner['runMode'] == 1:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- para_middle = pd.DataFrame(self.dict_chiller_inner['allHeatingWaterTempSetOn'], columns=['para_middle'])
- else:
- para_middle = pd.DataFrame(self.dict_chiller_inner['allHeatingWaterTempInSetOn'], columns=['para_middle'])
- else:
- para_middle = ''
- logger.critical('============冷机运行模式输入错误============')
- para_middle = para_middle.drop_duplicates()
- list_para_middle = para_middle['para_middle'].tolist()
- return list_para_middle
- def is_synchronize(self, para_middle):
- # if self.judge_sin_mul == 0:
- """全部为供水控制或全部为回水控制的判断,设定值一致为同步,设定值不一致为异步"""
- if len(para_middle) > 1:
- judge_synchronize = 1 # 1为异步,0为同步
- elif len(para_middle) == 1:
- judge_synchronize = 0
- else:
- judge_synchronize = ''
- logger.critical('============所有开机冷机冷冻水温度设定值输入错误============')
- # else: # 供水和回水共存的场景暂不考虑
- # judge_synchronize = ''
- # logger.critical('============所有冷机制冷控制选择输入错误或控制方式不唯一============')
- return judge_synchronize
- def judge_synchronize_asynchronous(self):
- para_middle = self.parameter_middle()
- results = self.is_synchronize(para_middle) # 若供水和回水控制共存,则输出为空值,否则1代表异步,0代表同步
- return results
- # ①异步,制冷设定温度最高,且末端温度不超标,或制热设定温度最低,且末端温度不超标
- # ②异步,制冷设定温度不是最高,且末端温度超标,或制热设定温度不是最低,且末端温度超标
- # ③异步,制冷设定温度最高,且末端温度超标,或制热设定温度最低,且末端温度超标
- # ④异步,制冷设定温度不是最高,且末端温度不超标,或制热设定温度不是最低,且末端温度不超标
- # ⑤同步,末端温度不超标
- # ⑥同步,末端温度超标
- class SetPointStrategyOnChillerOnAsynchronous(SetPointStrategyOff):
- def __init__(self, dict_chiller_inner, data_temp_humi, excess_result):
- super(SetPointStrategyOnChillerOnAsynchronous, self).__init__(dict_chiller_inner, data_temp_humi)
- self.is_out_range = excess_result['isOutRange']
- self.excess_result = excess_result
- def set_temp_bad_in_range(self):
- """
- 异步,制冷设定温度不是最高,且末端温度不超标,或制热设定温度不是最低,且末端温度不超标
- ## 全部为供水控制或全部为回水温度控制:制冷水温上调至 max(所有运行冷机) , 制热水温下调至min(所有运行冷机),最大步受限于停机补偿值##
- :return:
- """
- # 制冷模式,不超标下的异步,水温上调至最大设定值,但最大步长通过停机补偿值限制
- if self.dict_chiller_inner['runMode'] == 0:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- water_temp_set_highest = self.dict_chiller_inner['chillerWaterTempOut'][-1] + \
- 0.75 * self.dict_chiller_inner['coolingShutdownOffset']
- if water_temp_set_highest > max(self.dict_chiller_inner['allChillerWaterTempSetOn']):
- water_temp_set_new = max(self.dict_chiller_inner['allChillerWaterTempSetOn'])
- else:
- water_temp_set_new = water_temp_set_highest
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- water_temp_set_highest = self.dict_chiller_inner['chillerWaterTempIn'][-1] + \
- 0.75 * self.dict_chiller_inner['coolingShutdownOffset']
- if water_temp_set_highest > max(self.dict_chiller_inner['allChillerWaterTempInSetOn']):
- water_temp_set_new = max(self.dict_chiller_inner['allChillerWaterTempInSetOn'])
- else:
- water_temp_set_new = water_temp_set_highest
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- elif self.dict_chiller_inner['runMode'] == 1:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- water_temp_set_lowest = self.dict_chiller_inner['heatingWaterTempOut'] - \
- 0.75 * self.dict_chiller_inner['heatingShutdownOffset']
- if water_temp_set_lowest > min(self.dict_chiller_inner['allHeatingWaterTempSetOn']):
- water_temp_set_new = water_temp_set_lowest
- else:
- water_temp_set_new = min(self.dict_chiller_inner['allHeatingWaterTempSetOn'])
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- water_temp_set_lowest = self.dict_chiller_inner['heatingWaterTempIn'] - \
- 0.75 * self.dict_chiller_inner['heatingShutdownOffset']
- if water_temp_set_lowest > min(self.dict_chiller_inner['allHeatingWaterTempInSetOn']):
- water_temp_set_new = water_temp_set_lowest
- else:
- water_temp_set_new = min(self.dict_chiller_inner['allHeatingWaterTempInSetOn'])
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- else:
- water_temp_set_new = ''
- logger.critical('============冷机运行模式输入错误============')
- return water_temp_set_new
- # ----------------以下内容为重构----------------------
- def set_point_asynchronous(self): # ****************************************************** #
- """
- 分两类:全部为供水温度控制(含制热模式)、全部为回水温度控制(含制热模式), 暂不支持供水和回水温度共存
- 1、全部为供水控制
- (1)满足以下条件,设定值保持不变
- ①异步,(制冷设定温度最高 or 制热设定温度最低) and 末端温度不超标
- ②异步,(制冷设定温度不是最高 or 制热设定温度不是最低) and 末端温度超标
- (2)满足以下条件,制冷设定值下调,至 min(所有运行主机的设定值);制热设定值上调
- 异步,制冷设定温度最高,且末端温度超标,或制热设定温度最低,且末端温度超标
- (3)满足以下条件,制冷设定值上调,至 max(所有运行主机的设定值),制热设定值下调,最大调控步长受限停机补偿值
- 异步,制冷设定温度不是最高,且末端温度不超标,或制热设定温度不是最低,且末端温度不超标
- 2、全部为回水温度控制
- 调整逻辑和 全部为回水温度控制一致,只是水温设定值是进水设定值
- :return:
- """
- if self.dict_chiller_inner['runMode'] == 0:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- if (self.dict_chiller_inner['chillerWaterTempSet'] == max(self.dict_chiller_inner['allChillerWaterTempSetOn'])
- and self.is_out_range == 0) or \
- (self.dict_chiller_inner['chillerWaterTempSet'] < max(self.dict_chiller_inner['allChillerWaterTempSetOn'])
- and self.is_out_range != 0):
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempSet']
- elif self.dict_chiller_inner['chillerWaterTempSet'] == max(self.dict_chiller_inner['allChillerWaterTempSetOn']) \
- and self.is_out_range != 0:
- water_temp_set_new = min(self.dict_chiller_inner['allChillerWaterTempSetOn'])
- elif self.dict_chiller_inner['chillerWaterTempSet'] < max(self.dict_chiller_inner['allChillerWaterTempSetOn']) \
- and self.is_out_range == 0:
- water_temp_set_new = self.set_temp_bad_in_range()
- else:
- water_temp_set_new = ''
- logger.critical('============异步状态输入参数错误============')
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- if (self.dict_chiller_inner['chillerWaterTempInSet'] == max(self.dict_chiller_inner['allChillerWaterTempInSetOn'])
- and self.is_out_range == 0) or \
- (self.dict_chiller_inner['chillerWaterTempInSet'] < max(self.dict_chiller_inner['allChillerWaterTempInSetOn'])
- and self.is_out_range != 0):
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempInSet']
- elif self.dict_chiller_inner['chillerWaterTempInSet'] == max(self.dict_chiller_inner['allChillerWaterTempInSetOn']) \
- and self.is_out_range != 0:
- water_temp_set_new = min(self.dict_chiller_inner['allChillerWaterTempInSetOn'])
- elif self.dict_chiller_inner['chillerWaterTempInSet'] < max(self.dict_chiller_inner['allChillerWaterTempInSetOn']) \
- and self.is_out_range == 0:
- water_temp_set_new = self.set_temp_bad_in_range()
- else:
- water_temp_set_new = ''
- logger.critical('============异步状态输入参数错误============')
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- elif self.dict_chiller_inner['runMode'] == 1:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- if (self.dict_chiller_inner['heatingWaterTempSet'] == min(self.dict_chiller_inner['allHeatingWaterTempSetOn'])
- and self.is_out_range == 0) or \
- (self.dict_chiller_inner['heatingWaterTempSet'] > min(self.dict_chiller_inner['allHeatingWaterTempSetOn'])
- and self.is_out_range != 0):
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempSet']
- elif self.dict_chiller_inner['heatingWaterTempSet'] == min(self.dict_chiller_inner['allHeatingWaterTempSetOn'])\
- and self.is_out_range != 0:
- water_temp_set_new = max(self.dict_chiller_inner['allHeatingWaterTempSetOn'])
- elif self.dict_chiller_inner['heatingWaterTempSet'] > min(self.dict_chiller_inner['allHeatingWaterTempSetOn']) \
- and self.is_out_range == 0:
- water_temp_set_new = self.set_temp_bad_in_range()
- else:
- water_temp_set_new = ''
- logger.critical('============异步状态输入参数错误============')
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- if (self.dict_chiller_inner['heatingWaterTempInSet'] == min(self.dict_chiller_inner['allHeatingWaterTempInSetOn'])
- and self.is_out_range == 0) or \
- (self.dict_chiller_inner['heatingWaterTempInSet'] > min(self.dict_chiller_inner['allHeatingWaterTempInSetOn'])
- and self.is_out_range != 0):
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempInSet']
- elif self.dict_chiller_inner['heatingWaterTempInSet'] == min(self.dict_chiller_inner['allHeatingWaterTempInSetOn'])\
- and self.is_out_range != 0:
- water_temp_set_new = max(self.dict_chiller_inner['allHeatingWaterTempInSetOn'])
- elif self.dict_chiller_inner['heatingWaterTempInSet'] > min(self.dict_chiller_inner['allHeatingWaterTempInSetOn']) \
- and self.is_out_range == 0:
- water_temp_set_new = self.set_temp_bad_in_range()
- else:
- water_temp_set_new = ''
- logger.critical('============异步状态输入参数错误============')
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- else:
- water_temp_set_new = ''
- logger.critical('============冷机运行模式输入错误============')
- # water_temp_set_new = self.water_temp_limit_verify(water_temp_set_new)
- return water_temp_set_new
- # 同步状态下,温度超标
- # 同步状态下,温度不超标
- class SetPointStrategyOnChillerOnSynchronous(SetPointStrategyOnChillerOnAsynchronous):
- def __init__(self, dict_chiller_inner, data_temp_humi, excess_result):
- super(SetPointStrategyOnChillerOnSynchronous, self).__init__(
- dict_chiller_inner, data_temp_humi, excess_result)
- # self.data_upper_correct = data_upper_correct
- def temp_humi_in_range(self, control_bisis):
- # 根据控制依据判断水温调节,温度、湿度、温度和湿度
- if control_bisis == 0 and self.data_temp_humi['deltaTemp'].min():
- delta_water_temp = self.data_temp_humi['deltaTemp'].min() * Coefficient['inTemp']
- self.excess_result['minDelta'] = round(self.data_temp_humi['deltaTemp'].min(), 1)
- elif control_bisis == 1 and self.data_temp_humi['deltaHumi'].min():
- delta_water_temp = self.data_temp_humi['deltaHumi'].min() * Coefficient['inHumi']
- self.excess_result['minDelta'] = round(self.data_temp_humi['deltaHumi'].min(), 1)
- elif control_bisis == 2 and (self.data_temp_humi['deltaTemp'].min() or self.data_temp_humi['deltaHumi'].min()):
- delta_water_temp = min(self.data_temp_humi['deltaTemp'].min() * Coefficient['inTemp'],
- self.data_temp_humi['deltaHumi'].min() * Coefficient['inHumi'])
- if self.data_temp_humi['deltaTemp'].min() * Coefficient['inTemp'] <= \
- self.data_temp_humi['deltaHumi'].min() * Coefficient['inHumi']:
- self.excess_result['minDelta'] = round(self.data_temp_humi['deltaTemp'].min(), 1)
- else:
- self.excess_result['minDelta'] = round(self.data_temp_humi['deltaHumi'].min(), 1)
- self.excess_result['minName'] = self.data_temp_humi.loc[self.data_temp_humi['deltaHumi'].idxmin(), 'ahuName']
- else:
- delta_water_temp = 0
- if self.dict_chiller_inner['runMode'] == 0:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempSet'] + delta_water_temp
- if water_temp_set_new - self.dict_chiller_inner['chillerWaterTempOut'][-1] > \
- 0.75 * self.dict_chiller_inner['coolingShutdownOffset']:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempOut'][-1] + \
- 0.75 * self.dict_chiller_inner['coolingShutdownOffset']
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempInSet'] + delta_water_temp
- if water_temp_set_new - self.dict_chiller_inner['chillerWaterTempIn'][-1] > \
- 0.75 * self.dict_chiller_inner['coolingShutdownOffset']:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempIn'][-1] + \
- 0.75 * self.dict_chiller_inner['coolingShutdownOffset']
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- elif self.dict_chiller_inner['runMode'] == 1:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempSet'] - delta_water_temp
- if self.dict_chiller_inner['heatingWaterTempOut'][-1] - water_temp_set_new > \
- 0.75 * self.dict_chiller_inner['heatingShutdownOffset']:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempOut'][-1] - \
- 0.75 * self.dict_chiller_inner['heatingShutdownOffset']
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempInSet'] - delta_water_temp
- if self.dict_chiller_inner['heatingWaterTempIn'][-1] - water_temp_set_new > \
- 0.75 * self.dict_chiller_inner['heatingShutdownOffset']:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempIn'][-1] - \
- 0.75 * self.dict_chiller_inner['heatingShutdownOffset']
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- else:
- water_temp_set_new = ''
- logger.critical('============冷机运行模式输入错误============')
- return water_temp_set_new
- def temp_humi_out_range(self):
- # 1表示温度超标, 2表示露点超标, 3表示湿度超标
- if self.is_out_range == 1 and self.data_temp_humi['deltaTemp'].min():
- delta_water_temp = self.data_temp_humi['deltaTemp'].min() * Coefficient['outTemp']
- self.excess_result['minDelta'] = round(self.data_temp_humi['deltaTemp'].min(), 1)
- elif self.is_out_range == 2 and self.data_temp_humi['deltaDewPoint'].min():
- delta_water_temp = self.data_temp_humi['deltaDewPoint'].min() * Coefficient['outDewPoint']
- self.excess_result['minDelta'] = round(self.data_temp_humi['deltaDewPoint'].min(), 1)
- elif self.is_out_range == 3 and self.data_temp_humi['deltaHumi'].min():
- delta_water_temp = self.data_temp_humi['deltaHumi'].min() * Coefficient['outHumi']
- self.excess_result['minDelta'] = round(self.data_temp_humi['deltaHumi'].min(), 1)
- else:
- delta_water_temp = 0
- if self.dict_chiller_inner['runMode'] == 0:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempSet'] + delta_water_temp
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- water_temp_set_new = self.dict_chiller_inner['chillerWaterTempInSet'] + delta_water_temp
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- elif self.dict_chiller_inner['runMode'] == 1:
- if self.dict_chiller_inner['waterTempControlMode'] == 0:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempSet'] - delta_water_temp
- elif self.dict_chiller_inner['waterTempControlMode'] == 1:
- water_temp_set_new = self.dict_chiller_inner['heatingWaterTempInSet'] - delta_water_temp
- else:
- water_temp_set_new = ''
- logger.critical('============冷机控制选择输入错误============')
- else:
- water_temp_set_new = ''
- logger.critical('============冷机运行模式输入错误============')
- return water_temp_set_new
- def set_point_synchronous(self, control_bisis):
- if self.is_out_range == 0:
- water_temp_set_new = self.temp_humi_in_range(control_bisis)
- elif self.is_out_range != 0:
- water_temp_set_new = self.temp_humi_out_range()
- else:
- water_temp_set_new = ''
- logger.critical('============温湿度超标输入错误============')
- # water_temp_set_new = self.water_temp_limit_verify(water_temp_set_new)
- return water_temp_set_new, self.excess_result
- # if __name__ == '__main__':
- # data_temp_humi = pd.DataFrame({
- # "tempHumiMeterId": ["3000638", "3000694"],
- # "terminalName": ["监测点A", "监测点B"],
- # "coolingTempUpper": [25.0, 26.0],
- # "coolingHumiUpper": [60.0, 65.0],
- # "heatingTempDown": [18.0, 17.5],
- # "tempReal": [24.5, 25.3],
- # "humiReal": [50, 50],
- # "deltaTemp": [-1, 1],
- # 'deltaDewPoint': [1, 1],
- # "deltaHumi": [1, 1],
- # })
- #
- # ################################# 确认这些参数是实时值还是列表
- # dict_chiller_inner = {'runMode': 0, 'chillerWaterTempSet': 10, 'chillerWaterTempSetUpper': 15,
- # 'chillerWaterTempOut': 9.8, 'chillerWaterTempIn': 9.8, 'coolingWaterTempSetUpper': 45,
- # 'heatingWaterTempInSet': 40, 'heatingWaterTempSet': 43, 'chillerWaterTempInSet': 12,
- # 'waterTempControlMode': 0, 'coolingShutdownOffset': 2, 'heatingShutdownOffset': 2,
- # 'allHeatingWaterTempSetOn': [7, 7], 'allHeatingWaterTempInSetOn': [12, 12],
- # 'allChillerWaterTempSetOn': [9, 10], 'allChillerWaterTempInSetOn': [40, 40],
- # 'runStatus': [1, 1, 1, 1]}
- # excess_result_ = {'isOutRange': 0, 'minDelta': '', 'minName': ''}
- # parameter = (dict_chiller_inner, data_temp_humi)
- # judge_syn_asy = 1
- # basis = 0
- # if judge_syn_asy == 1:
- # spsocoa = SetPointStrategyOnChillerOnAsynchronous(*parameter, excess_result_) # 异步算法
- # water_temp_set = spsocoa.set_point_asynchronous() # 异步算法
- # else:
- # spsocos = SetPointStrategyOnChillerOnSynchronous(*parameter, excess_result_) # 同步算法
- # water_temp_set = spsocos.set_point_synchronous(basis) # 同步算法
- # print(water_temp_set)
|