# from logs_conf.logger import * from logs.logger import * from CoolProp.CoolProp import PropsSI import pandas as pd import numpy as np class PressureDiffLimitMultiComp(object): def __init__(self, dict_chiller_inner, dict_upper_correct): self.dict_chiller_inner = dict_chiller_inner self.dict_upper_correct = dict_upper_correct self.data_general = pd.DataFrame() def pressure_diff_limit(self, load_ratio): set_new_pres_fix = '' if load_ratio > 30: self.data_general['preDiff'] = self.data_general['condPre'] - self.data_general['evapPre'] - \ self.dict_chiller_inner['safetyPreDiffLowerLimit'] self.dict_upper_correct['preDiff'] = self.data_general['preDiff'].iloc[-1] if self.dict_upper_correct['preDiff'] < 0: if self.dict_chiller_inner['runMode'] == 0: evap_pre_adjust = self.data_general['evapPre'].iloc[-1] + self.dict_upper_correct['preDiff'] print("@@@@@", evap_pre_adjust) evap_temp_adjust = PropsSI('T', 'P', evap_pre_adjust * 1000, 'Q', 1, self.dict_upper_correct['refriType']) - 273.15 water_temp_adjust = self.data_general['evapTemp'].iloc[-1] - evap_temp_adjust # set_new_pres_fix = round(self.dict_chiller_inner['chillerWaterTempOut'][-1] - 0.5 * water_temp_adjust, 1) # 原逻辑 set_new_pres_fix = self.dict_chiller_inner['chillerWaterTempSet'] - water_temp_adjust # 调整后 elif self.dict_chiller_inner['runMode'] == 1: cond_pre_adjust = self.data_general['condPre'].iloc[-1] - self.dict_upper_correct['preDiff'] cond_temp_adjust = PropsSI('T', 'P', cond_pre_adjust * 1000, 'Q', 1, self.dict_upper_correct['refriType']) - 273.15 water_temp_adjust = cond_temp_adjust - self.data_general['condTemp'].iloc[-1] # set_new_pres_fix = round(self.dict_chiller_inner['coolingWaterTempOut'][-1] - 0.5 * water_temp_adjust, 1) # 原逻辑 set_new_pres_fix = self.dict_chiller_inner['heatingWaterTempSet'] + water_temp_adjust # 调整后 else: pass logger.critical('============冷机运行模式错误============') return set_new_pres_fix def water_temp_adjust_pre_diff(self, list_chiller_temp): """ 如果有多组参数计算,则这里取最终值,制冷模式取最低水温,制热模式取最高水温 :param list_chiller_temp: :return: """ if list_chiller_temp: is_lower_oil_pre = 1 if self.dict_chiller_inner['runMode'] == 0: water_temp_set_pre_diff = min(list_chiller_temp) else: water_temp_set_pre_diff = max(list_chiller_temp) else: is_lower_oil_pre = 0 water_temp_set_pre_diff = '' return water_temp_set_pre_diff, is_lower_oil_pre def is_continuous_run(self, list_load_ratio): """ 保障连续运行,若需要保障连续运行则判断运行负载和负载率下限,低于下限则制冷下调水温1℃,制热上调水温1℃ :param list_load_ratio: :return: """ water_temp_set_run_continue = '' is_continuous_run_fix = 0 array_load_ratio = np.array(list_load_ratio) array_load_ratio = np.extract(array_load_ratio > 30, array_load_ratio) if len(array_load_ratio) == 1 and self.dict_chiller_inner['isContinuousRun'] == 1 \ and array_load_ratio < self.dict_chiller_inner['safetyLoadRatioLowerLimit']: is_continuous_run_fix = 1 if self.dict_chiller_inner['runMode'] == 0: water_temp_set_run_continue = self.dict_chiller_inner['chillerWaterTempOut'][-1] - 1.0 # 这里已修改 elif self.dict_chiller_inner['runMode'] == 1: water_temp_set_run_continue = self.dict_chiller_inner['coolingWaterTempOut'][-1] + 1.0 # 这里已修改 else: pass logger.critical('============冷机运行模式输入错误============') return water_temp_set_run_continue, is_continuous_run_fix def water_temp_adjust_continuous_run(self, is_lower_oil_pre, is_suction_with_liquid, list_load_ratio): if is_lower_oil_pre or is_suction_with_liquid: water_temp_set_run_continue = '' is_continuous_run_fix = 0 else: water_temp_set_run_continue, is_continuous_run_fix = self.is_continuous_run(list_load_ratio) return water_temp_set_run_continue, is_continuous_run_fix