pressure_diff_limit_multi_comp.py 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # from logs_conf.logger import *
  2. from logs.logger import *
  3. from CoolProp.CoolProp import PropsSI
  4. import pandas as pd
  5. import numpy as np
  6. class PressureDiffLimitMultiComp(object):
  7. def __init__(self, dict_chiller_inner, dict_upper_correct):
  8. self.dict_chiller_inner = dict_chiller_inner
  9. self.dict_upper_correct = dict_upper_correct
  10. self.data_general = pd.DataFrame()
  11. def pressure_diff_limit(self, load_ratio):
  12. set_new_pres_fix = ''
  13. if load_ratio > 30:
  14. self.data_general['preDiff'] = self.data_general['condPre'] - self.data_general['evapPre'] - \
  15. self.dict_chiller_inner['safetyPreDiffLowerLimit']
  16. self.dict_upper_correct['preDiff'] = self.data_general['preDiff'].iloc[-1]
  17. if self.dict_upper_correct['preDiff'] < 0:
  18. if self.dict_chiller_inner['runMode'] == 0:
  19. evap_pre_adjust = self.data_general['evapPre'].iloc[-1] + self.dict_upper_correct['preDiff']
  20. print("@@@@@", evap_pre_adjust)
  21. evap_temp_adjust = PropsSI('T', 'P', evap_pre_adjust * 1000, 'Q', 1, self.dict_upper_correct['refriType']) - 273.15
  22. water_temp_adjust = self.data_general['evapTemp'].iloc[-1] - evap_temp_adjust
  23. # set_new_pres_fix = round(self.dict_chiller_inner['chillerWaterTempOut'][-1] - 0.5 * water_temp_adjust, 1) # 原逻辑
  24. set_new_pres_fix = self.dict_chiller_inner['chillerWaterTempSet'] - water_temp_adjust # 调整后
  25. elif self.dict_chiller_inner['runMode'] == 1:
  26. cond_pre_adjust = self.data_general['condPre'].iloc[-1] - self.dict_upper_correct['preDiff']
  27. cond_temp_adjust = PropsSI('T', 'P', cond_pre_adjust * 1000, 'Q', 1, self.dict_upper_correct['refriType']) - 273.15
  28. water_temp_adjust = cond_temp_adjust - self.data_general['condTemp'].iloc[-1]
  29. # set_new_pres_fix = round(self.dict_chiller_inner['coolingWaterTempOut'][-1] - 0.5 * water_temp_adjust, 1) # 原逻辑
  30. set_new_pres_fix = self.dict_chiller_inner['heatingWaterTempSet'] + water_temp_adjust # 调整后
  31. else:
  32. pass
  33. logger.critical('============冷机运行模式错误============')
  34. return set_new_pres_fix
  35. def water_temp_adjust_pre_diff(self, list_chiller_temp):
  36. """
  37. 如果有多组参数计算,则这里取最终值,制冷模式取最低水温,制热模式取最高水温
  38. :param list_chiller_temp:
  39. :return:
  40. """
  41. if list_chiller_temp:
  42. is_lower_oil_pre = 1
  43. if self.dict_chiller_inner['runMode'] == 0:
  44. water_temp_set_pre_diff = min(list_chiller_temp)
  45. else:
  46. water_temp_set_pre_diff = max(list_chiller_temp)
  47. else:
  48. is_lower_oil_pre = 0
  49. water_temp_set_pre_diff = ''
  50. return water_temp_set_pre_diff, is_lower_oil_pre
  51. def is_continuous_run(self, list_load_ratio):
  52. """
  53. 保障连续运行,若需要保障连续运行则判断运行负载和负载率下限,低于下限则制冷下调水温1℃,制热上调水温1℃
  54. :param list_load_ratio:
  55. :return:
  56. """
  57. water_temp_set_run_continue = ''
  58. is_continuous_run_fix = 0
  59. array_load_ratio = np.array(list_load_ratio)
  60. array_load_ratio = np.extract(array_load_ratio > 30, array_load_ratio)
  61. if len(array_load_ratio) == 1 and self.dict_chiller_inner['isContinuousRun'] == 1 \
  62. and array_load_ratio < self.dict_chiller_inner['safetyLoadRatioLowerLimit']:
  63. is_continuous_run_fix = 1
  64. if self.dict_chiller_inner['runMode'] == 0:
  65. water_temp_set_run_continue = self.dict_chiller_inner['chillerWaterTempOut'][-1] - 1.0 # 这里已修改
  66. elif self.dict_chiller_inner['runMode'] == 1:
  67. water_temp_set_run_continue = self.dict_chiller_inner['coolingWaterTempOut'][-1] + 1.0 # 这里已修改
  68. else:
  69. pass
  70. logger.critical('============冷机运行模式输入错误============')
  71. return water_temp_set_run_continue, is_continuous_run_fix
  72. def water_temp_adjust_continuous_run(self, is_lower_oil_pre, is_suction_with_liquid, list_load_ratio):
  73. if is_lower_oil_pre or is_suction_with_liquid:
  74. water_temp_set_run_continue = ''
  75. is_continuous_run_fix = 0
  76. else:
  77. water_temp_set_run_continue, is_continuous_run_fix = self.is_continuous_run(list_load_ratio)
  78. return water_temp_set_run_continue, is_continuous_run_fix