water_temp_set_switch.py 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. # from logs_conf.logger import *
  2. from logs.logger import *
  3. from optimized_and_individal.temperature_step_size_10 import ModifyLeavingWaterTempSetTSS10, ModifyReturningWaterTempSetTSS10
  4. from optimized_and_individal.temperature_step_size_05 import ModifyLeavingWaterTempSetTSS05, ModifyReturningWaterTempSetTSS05
  5. class WaterTempSetVerify(object):
  6. def __init__(self, water_temp_set_new, dict_chiller_inner):
  7. self.water_temp_set_new = water_temp_set_new
  8. self.dict_chiller_inner = dict_chiller_inner
  9. # self.dict_chiller_outer = dict_chiller_outer
  10. def modify(self):
  11. if self.dict_chiller_inner['chillerTempStep'] == 0.1:
  12. result = self.water_temp_set_new
  13. # logger.critical('============低工况验证============')
  14. elif self.dict_chiller_inner['chillerTempStep'] == 0.5:
  15. if self.dict_chiller_inner['waterTempControlMode'] == 0:
  16. mlwts_tss05 = ModifyLeavingWaterTempSetTSS05(self.water_temp_set_new, self.dict_chiller_inner)
  17. result = mlwts_tss05.modify_temp()
  18. elif self.dict_chiller_inner['waterTempControlMode'] == 1:
  19. mrwts_tss05 = ModifyReturningWaterTempSetTSS05(self.water_temp_set_new, self.dict_chiller_inner)
  20. result = mrwts_tss05.modify_temp()
  21. else:
  22. result = ''
  23. logger.critical('============冷机控制选择输入错误============')
  24. elif self.dict_chiller_inner['chillerTempStep'] == 1:
  25. if self.dict_chiller_inner['waterTempControlMode'] == 0:
  26. mlwts_tss10 = ModifyLeavingWaterTempSetTSS10(self.water_temp_set_new, self.dict_chiller_inner)
  27. result = mlwts_tss10.modify_temp()
  28. elif self.dict_chiller_inner['waterTempControlMode'] == 1:
  29. mrwts_tss10 = ModifyReturningWaterTempSetTSS10(self.water_temp_set_new, self.dict_chiller_inner)
  30. result = mrwts_tss10.modify_temp()
  31. else:
  32. result = ''
  33. logger.critical('============冷机控制选择输入错误============')
  34. else:
  35. result = ''
  36. logger.critical('============冷机配置参数输入错误============')
  37. return result
  38. def limit_verify(self):
  39. if self.dict_chiller_inner['runMode'] == 0:
  40. if self.dict_chiller_inner['waterTempControlMode'] == 0:
  41. if self.water_temp_set_new > self.dict_chiller_inner['chillerWaterTempSetUpper']:
  42. self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempSetUpper']
  43. elif self.water_temp_set_new < self.dict_chiller_inner['chillerWaterTempSetDown']:
  44. self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempSetDown']
  45. else:
  46. self.water_temp_set_new = self.water_temp_set_new
  47. elif self.dict_chiller_inner['waterTempControlMode'] == 1:
  48. if self.water_temp_set_new > self.dict_chiller_inner['chillerWaterTempInSetUpper']:
  49. self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempInSetUpper']
  50. elif self.water_temp_set_new < self.dict_chiller_inner['chillerWaterTempInSetDown']:
  51. self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempInSetDown']
  52. else:
  53. self.water_temp_set_new = self.water_temp_set_new
  54. else:
  55. self.water_temp_set_new = ''
  56. logger.critical('============冷机控制选择输入错误============')
  57. elif self.dict_chiller_inner['runMode'] == 1:
  58. if self.dict_chiller_inner['waterTempControlMode'] == 0:
  59. if self.water_temp_set_new > self.dict_chiller_inner['heatingWaterTempSetUpper']:
  60. self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempSetUpper']
  61. elif self.water_temp_set_new < self.dict_chiller_inner['heatingWaterTempSetDown']:
  62. self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempSetDown']
  63. else:
  64. self.water_temp_set_new = self.water_temp_set_new
  65. elif self.dict_chiller_inner['waterTempControlMode'] == 1:
  66. if self.water_temp_set_new > self.dict_chiller_inner['heatingWaterTempInSetUpper']:
  67. self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempInSetUpper']
  68. elif self.water_temp_set_new < self.dict_chiller_inner['heatingWaterTempInSetDown']:
  69. self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempInSetDown']
  70. else:
  71. self.water_temp_set_new = self.water_temp_set_new
  72. else:
  73. self.water_temp_set_new = ''
  74. logger.critical('============冷机运行模式输入错误============')
  75. return self.water_temp_set_new
  76. def based_time_temp_range(self):
  77. # 因水温的温度区间是分时设定的,避免因为不同时间段的限制导致制冷温度上升或制热温度下降
  78. if self.dict_chiller_inner['runMode'] == 0:
  79. if self.dict_chiller_inner['waterTempControlMode'] == 0 and \
  80. self.water_temp_set_new > self.dict_chiller_inner['chillerWaterTempSet']:
  81. if self.water_temp_set_new - self.dict_chiller_inner['chillerWaterTempOut'][-1] > \
  82. 0.75 * self.dict_chiller_inner['coolingShutdownOffset']:
  83. self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempOut'][-1] + \
  84. 0.75 * self.dict_chiller_inner['coolingShutdownOffset']
  85. elif self.dict_chiller_inner['waterTempControlMode'] == 1 and \
  86. self.water_temp_set_new > self.dict_chiller_inner['chillerWaterTempInSet']:
  87. if self.water_temp_set_new - self.dict_chiller_inner['chillerWaterTempIn'][-1] > \
  88. 0.75 * self.dict_chiller_inner['coolingShutdownOffset']:
  89. self.water_temp_set_new = self.dict_chiller_inner['chillerWaterTempIn'][-1] + \
  90. 0.75 * self.dict_chiller_inner['coolingShutdownOffset']
  91. elif self.dict_chiller_inner['runMode'] == 1:
  92. if self.dict_chiller_inner['waterTempControlMode'] == 0 and \
  93. self.water_temp_set_new < self.dict_chiller_inner['heatingWaterTempSet']:
  94. if self.dict_chiller_inner['heatingWaterTempOut'][-1] - self.water_temp_set_new > \
  95. 0.75 * self.dict_chiller_inner['heatingShutdownOffset']:
  96. self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempOut'][-1] - \
  97. 0.75 * self.dict_chiller_inner['heatingShutdownOffset']
  98. elif self.dict_chiller_inner['waterTempControlMode'] == 1 and \
  99. self.water_temp_set_new < self.dict_chiller_inner['heatingWaterTempInSet']:
  100. if self.dict_chiller_inner['heatingWaterTempIn'][-1] - self.water_temp_set_new > \
  101. 0.75 * self.dict_chiller_inner['heatingShutdownOffset']:
  102. self.water_temp_set_new = self.dict_chiller_inner['heatingWaterTempIn'][-1] - \
  103. 0.75 * self.dict_chiller_inner['heatingShutdownOffset']
  104. else:
  105. self.water_temp_set_new = ''
  106. logger.critical('============冷机运行模式输入错误============')
  107. return self.water_temp_set_new
  108. # def switch(self):
  109. # """
  110. # 根据品牌转换点表中温湿度,当前只有麦克韦尔为华氏摄氏度
  111. # :return:
  112. # """
  113. # if self.water_temp_set_new:
  114. # if self.dict_chiller_outer['chillerTempType'] == 0: # 水温数据类型为整型
  115. # if self.dict_chiller_outer['chillerTempUnit'] == 1: # 0表示为摄氏,1表示华氏
  116. # results = self.water_temp_set_new * 1.8 + 32
  117. # else:
  118. # results = self.water_temp_set_new
  119. # results = results * self.dict_chiller_outer['chillerTempScale']
  120. # results = int(round(results))
  121. # elif self.dict_chiller_outer['chillerTempType'] == 1: # 水温数据类型为浮点型
  122. # results = self.water_temp_set_new
  123. # else:
  124. # results = ''
  125. # logger.critical('========冷机温度数据类型错误========')
  126. # else:
  127. # results = ''
  128. # logger.critical('========冷机温度设定值为空========')
  129. # return results
  130. def modify_verify(self):
  131. self.water_temp_set_new = self.modify()
  132. self.water_temp_set_new = self.limit_verify()
  133. self.water_temp_set_new = self.based_time_temp_range()
  134. # water_temp_set_switched = self.switch()
  135. return self.water_temp_set_new