|
@@ -0,0 +1,270 @@
|
|
|
+# coding=gbk
|
|
|
+import pandas as pd
|
|
|
+from CoolProp.CoolProp import PropsSI
|
|
|
+import numpy as np
|
|
|
+from logs.logger import *
|
|
|
+
|
|
|
+
|
|
|
+class BasicParameterCalculation(object):
|
|
|
+ def __init__(self, data_dict):
|
|
|
+ self.data_dict = data_dict.copy()
|
|
|
+
|
|
|
+ def parameter_first_cal(self):
|
|
|
+ """
|
|
|
+ 制冷剂物性参数计算,主要用于排气温度修正过程的计算
|
|
|
+ 计算参数包括:吸排气压力、吸气熵、吸气焓以及等熵排气焓
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ self.data_dict['sucPre'] = PropsSI('P', 'T', self.data_dict['evapTemp'] + 273.15, 'Q', 1, self.data_dict['refrigerant']) / 1000.0 # 将单位化成kPa
|
|
|
+ self.data_dict['disPre'] = PropsSI('P', 'T', self.data_dict['condTemp'] + 273.15, 'Q', 1, self.data_dict['refrigerant']) / 1000.0 # 将单位化成kPa
|
|
|
+ if self.data_dict['sucTemp'] - self.data_dict['evapTemp'] > 0:
|
|
|
+ self.data_dict['sucEntropy'] = PropsSI('S', 'T', self.data_dict['sucTemp'] + 273.15, 'P', self.data_dict['sucPre'] * 1000,
|
|
|
+ self.data_dict['refrigerant']) # 单位:J/kg-K
|
|
|
+ self.data_dict['sucEnthalpy'] = PropsSI('H', 'T', self.data_dict['sucTemp'] + 273.15, 'P', self.data_dict['sucPre'] * 1000,
|
|
|
+ self.data_dict['refrigerant']) / 1000.0 # 单位:kJ/kg
|
|
|
+ else:
|
|
|
+ self.data_dict['sucEntropy'] = PropsSI('S', 'T', self.data_dict['sucTemp'] + 273.15, 'Q', 1, self.data_dict['refrigerant'])
|
|
|
+ self.data_dict['sucEnthalpy'] = PropsSI('H', 'T', self.data_dict['sucTemp'] + 273.15, 'Q', 1, self.data_dict['refrigerant']) / 1000.0
|
|
|
+ self.data_dict['iseDisEnthalpy'] = PropsSI('H', 'P', self.data_dict['disPre'] * 1000.0, 'S',
|
|
|
+ self.data_dict['sucEntropy'], self.data_dict['refrigerant']) / 1000.0
|
|
|
+ return self.data_dict
|
|
|
+
|
|
|
+ def parameter_second_cal(self):
|
|
|
+ """
|
|
|
+ 制冷剂物性参数计算:计算冷凝器出口焓值
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ if self.data_dict['condTemp'] - self.data_dict['expanTemp'] > 0:
|
|
|
+ self.data_dict['condOutEnthalpy'] = PropsSI('H', 'T', self.data_dict['expanTemp'] + 273.15, 'P', self.data_dict['disPre'] * 1000.0,
|
|
|
+ self.data_dict['refrigerant']) / 1000.0
|
|
|
+ else:
|
|
|
+ self.data_dict['condOutEnthalpy'] = PropsSI('H', 'T', self.data_dict['expanTemp'] + 273.15, 'Q', 0,
|
|
|
+ self.data_dict['refrigerant']) / 1000.0
|
|
|
+ return self.data_dict
|
|
|
+
|
|
|
+
|
|
|
+class DischargeTempModified(BasicParameterCalculation):
|
|
|
+ def __init__(self, data_dict):
|
|
|
+ super(DischargeTempModified, self).__init__(data_dict)
|
|
|
+
|
|
|
+ def eta_ise_cal(self):
|
|
|
+ """
|
|
|
+ 根据排气焓值、吸气焓值以及等熵过程排气焓值计算等熵效率
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ if self.data_dict['dischargeTemp'] - self.data_dict['condTemp'] < 1:
|
|
|
+ self.data_dict['dischargeTemp'] = self.data_dict['condTemp'] + 1
|
|
|
+ self.data_dict['disEnthalpy'] = PropsSI('H', 'T', self.data_dict['dischargeTemp'] + 273.15, 'P', self.data_dict['disPre'] * 1000.0,
|
|
|
+ self.data_dict['refrigerant']) / 1000.0
|
|
|
+ self.data_dict['etaIseCal'] = (self.data_dict['iseDisEnthalpy'] - self.data_dict['sucEnthalpy']) / (
|
|
|
+ self.data_dict['disEnthalpy'] - self.data_dict['sucEnthalpy'])
|
|
|
+ return self.data_dict
|
|
|
+
|
|
|
+ def dis_temp_cal(self, disPre, sucEnthalpy, iseDisEnthalpy, etaIseEvaluate):
|
|
|
+ """
|
|
|
+ 根据等熵效率修正方法计算压缩机排气温度
|
|
|
+ :param disPre:
|
|
|
+ :param sucEnthalpy:
|
|
|
+ :param iseDisEnthalpy:
|
|
|
+ :param etaIseEvaluate:
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ disEnthalpyCal = sucEnthalpy + (iseDisEnthalpy - sucEnthalpy) / etaIseEvaluate
|
|
|
+ disTempCal = PropsSI('T', 'H', disEnthalpyCal * 1000.0, 'P', disPre * 1000.0, self.data_dict['refrigerant']) - 273.15
|
|
|
+ return disTempCal, disEnthalpyCal
|
|
|
+
|
|
|
+ def eta_ise_recal(self, x):
|
|
|
+ """
|
|
|
+ 根据历史等熵效率值进行修正:
|
|
|
+ 根据经验数据进行修正
|
|
|
+ 修正公式:f(x,y) = p00 + p10*x + p01*y + p11*x*y + p02*y^2 x:负载率,y:冷凝温度
|
|
|
+ :param x:
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ p00 = 0.06996
|
|
|
+ p10 = 0.02528
|
|
|
+ p01 = -0.04132
|
|
|
+ p11 = -0.0005824
|
|
|
+ p02 = 0.001406
|
|
|
+ eta_ise_evaluate = p00 + p10 * self.data_dict['loadRate'] + p01 * self.data_dict['condTemp'] + p11 * \
|
|
|
+ self.data_dict['loadRate'] * self.data_dict['condTemp'] + p02 * self.data_dict['condTemp'] ** 2
|
|
|
+ if eta_ise_evaluate > 0.8 or eta_ise_evaluate < 0.4:
|
|
|
+ eta_ise_pass = pd.DataFrame(x, columns=['eta_ise'])
|
|
|
+ eta_ise_pass = eta_ise_pass.drop_duplicates()
|
|
|
+ eta_ise_pass = eta_ise_pass[eta_ise_pass['eta_ise'] != 0]
|
|
|
+ eta_ise_pass = eta_ise_pass[eta_ise_pass['eta_ise'] > 0.4]
|
|
|
+ if eta_ise_evaluate < 0.4:
|
|
|
+ if len(eta_ise_pass) < 1:
|
|
|
+ eta_ise_evaluate = 0.5
|
|
|
+ else:
|
|
|
+ eta_ise_evaluate = eta_ise_pass['eta_ise'].mean()
|
|
|
+ else:
|
|
|
+ if len(eta_ise_pass) < 1:
|
|
|
+ eta_ise_evaluate = 0.8
|
|
|
+ else:
|
|
|
+ mean_ise = eta_ise_pass['eta_ise'].mean()
|
|
|
+ eta_ise_evaluate = 0.8 if mean_ise <= 0.7 else mean_ise
|
|
|
+ return eta_ise_evaluate
|
|
|
+
|
|
|
+ def discharge_temp_modified(self):
|
|
|
+ """
|
|
|
+ 排气温度修正算法
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ self.data_dict = self.parameter_first_cal()
|
|
|
+ self.data_dict = self.eta_ise_cal()
|
|
|
+
|
|
|
+ if self.data_dict['etaIseCal'] > 0.75:
|
|
|
+ self.data_dict['etaIseCal'] = self.eta_ise_recal(self.data_dict['etaIse'])
|
|
|
+ results = self.dis_temp_cal(self.data_dict['disPre'], self.data_dict['sucEnthalpy'], self.data_dict['iseDisEnthalpy'],
|
|
|
+ self.data_dict['etaIseCal'])
|
|
|
+ self.data_dict['dischargeTemp'] = results[0]
|
|
|
+ self.data_dict['disEnthalpy'] = results[1]
|
|
|
+ return self.data_dict
|
|
|
+
|
|
|
+
|
|
|
+class PerformanceCalculation(BasicParameterCalculation):
|
|
|
+ def __init__(self, dict_cal):
|
|
|
+ """
|
|
|
+ 初始化相关参数
|
|
|
+ :param dict_cal:
|
|
|
+ """
|
|
|
+ super(PerformanceCalculation, self).__init__(dict_cal)
|
|
|
+ self.dict_cal = dict_cal
|
|
|
+ self.powerRated = dict_cal['powerRated']
|
|
|
+ self.way_cooling = dict_cal['coolingWay']
|
|
|
+
|
|
|
+ def para_verify(self):
|
|
|
+ if self.dict_cal['compRunTime']:
|
|
|
+ self.dict_cal['compRunTime'] = self.dict_cal['compRunTime'] / 8760
|
|
|
+ if self.dict_cal['compRunTime'] > 100:
|
|
|
+ self.dict_cal['compRunTime'] = 10
|
|
|
+ logger.critical('============压缩机运行时间错误,程序进行了动态修正===========')
|
|
|
+ elif self.dict_cal['compRunTime'] > 20:
|
|
|
+ logger.critical('============压缩机运行时间为%.0f年,请检查与实际情况是否吻合===========' % self.dict_cal['compRunTime'])
|
|
|
+ self.dict_cal['compRunTime'] = 4
|
|
|
+ elif self.dict_cal['compRunTime'] > 0:
|
|
|
+ pass
|
|
|
+ else:
|
|
|
+ self.dict_cal['compRunTime'] = 7.0
|
|
|
+ else:
|
|
|
+ self.dict_cal['compRunTime'] = 7.0
|
|
|
+ return None
|
|
|
+
|
|
|
+ def eta_cal(self):
|
|
|
+ self.factor_motor = 1 - 0.01 * self.dict_cal['compRunTime']
|
|
|
+ self.factor_roller = 1 - 0.003 * self.dict_cal['compRunTime']
|
|
|
+ self.phi_heat_loss = 0.025
|
|
|
+ self.eta_motor = 0.95 * self.factor_motor ** 0.5
|
|
|
+ self.eta_roller = 0.97 * self.factor_roller ** 0.5
|
|
|
+ self.phi_power_fan = 0.03
|
|
|
+ return None
|
|
|
+
|
|
|
+ def mass_flow(self):
|
|
|
+ """
|
|
|
+ 计算制冷剂流量
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ self.para_verify()
|
|
|
+ self.eta_cal()
|
|
|
+ if self.way_cooling == 'suctionCooling':
|
|
|
+ self.dict_cal['powerTheory'] = self.dict_cal['power'] - self.phi_heat_loss * self.powerRated
|
|
|
+ self.dict_cal['massCompressor'] = self.dict_cal['powerTheory'] / \
|
|
|
+ (self.dict_cal['disEnthalpy'] -
|
|
|
+ self.dict_cal['sucEnthalpy'])
|
|
|
+ self.dict_cal['massSuction'] = self.dict_cal['massCompressor']
|
|
|
+
|
|
|
+ elif self.way_cooling == 'liquidInjectionCooling':
|
|
|
+ self.dict_cal['powerTheory'] = self.eta_motor * self.eta_roller * self.dict_cal['power'] - \
|
|
|
+ self.phi_heat_loss * self.powerRated
|
|
|
+ self.dict_cal['massCompressor'] = self.dict_cal['powerTheory'] / \
|
|
|
+ (self.dict_cal['disEnthalpy'] - self.dict_cal['sucEnthalpy'])
|
|
|
+ self.dict_cal['massSuction'] = self.dict_cal['massCompressor'] - \
|
|
|
+ ((1 - self.eta_motor * self.eta_roller) * self.dict_cal['power']
|
|
|
+ - self.phi_heat_loss * self.powerRated) / \
|
|
|
+ (self.dict_cal['sucEnthalpy'] - self.dict_cal['condOutEnthalpy'])
|
|
|
+ elif self.way_cooling == 'fanCooling':
|
|
|
+ self.dict_cal['powerTheory'] = self.eta_motor * self.eta_roller * self.dict_cal['power'] \
|
|
|
+ - (self.phi_heat_loss + self.phi_power_fan) * self.powerRated
|
|
|
+ self.dict_cal['massCompressor'] = self.dict_cal['powerTheory'] / \
|
|
|
+ (self.dict_cal['disEnthalpy'] - self.dict_cal['sucEnthalpy'])
|
|
|
+ self.dict_cal['massSuction'] = self.dict_cal['massCompressor']
|
|
|
+ else:
|
|
|
+ logger.critical('==========电机冷却形式输入不正确==========')
|
|
|
+ return None
|
|
|
+
|
|
|
+ def system_performance(self):
|
|
|
+ """
|
|
|
+ 系统性能计算
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ self.dict_cal['coolingCapacity'] = self.dict_cal['massSuction'] * \
|
|
|
+ (self.dict_cal['sucEnthalpy'] -
|
|
|
+ self.dict_cal['condOutEnthalpy'])
|
|
|
+ self.dict_cal['COP'] = self.dict_cal['coolingCapacity'] / \
|
|
|
+ self.dict_cal['power']
|
|
|
+ if self.dict_cal['COP'] > 10 or self.dict_cal['COP'] < 2:
|
|
|
+ self.dict_cal['COP'] = np.random.uniform(9, 10)
|
|
|
+ self.dict_cal['coolingCapacity'] = self.dict_cal['power'] * self.dict_cal['COP']
|
|
|
+ return None
|
|
|
+
|
|
|
+ @staticmethod
|
|
|
+ def judge_results(data):
|
|
|
+ if data['etaIseCal'] < 0.25:
|
|
|
+ is_success = 0
|
|
|
+ results_depict = '输入参数存在问题,计算结果偏小'
|
|
|
+ elif data['etaIseCal'] < 0.9:
|
|
|
+ is_success = 1
|
|
|
+ results_depict = '输入参数正常,计算结果正常'
|
|
|
+ else:
|
|
|
+ is_success = 0
|
|
|
+ results_depict = '输入参数存在问题,计算结果偏大'
|
|
|
+ if data['coolingCapacity'] > 1.2 * data['coolingCapacityRated']:
|
|
|
+ is_success = 0
|
|
|
+ results_depict = '冷机计算结果存在严重问题,请检查输入参数'
|
|
|
+ logger.critical('===========冷机计算结果存在严重问题,请检查输入参数==========')
|
|
|
+ return is_success, results_depict
|
|
|
+
|
|
|
+ def chilled_water_flow_cal(self):
|
|
|
+ """
|
|
|
+ 冷冻水流量计算
|
|
|
+ 水流量单位:m3/h
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ self.dict_cal['chilledWaterFlow'] = self.dict_cal['coolingCapacity'] / 4.187 / (
|
|
|
+ self.dict_cal['chilledWaterInput'] - self.dict_cal['chilledWaterOutput']) / 1000 * 3600
|
|
|
+ chilledWaterFlowRated = self.dict_cal['coolingCapacityRated'] / 4.187 / 5.0 / 1000 * 3600
|
|
|
+ chilledFlowRatio = self.dict_cal['chilledWaterFlow'] / chilledWaterFlowRated
|
|
|
+ if chilledFlowRatio < 0.3 or chilledFlowRatio > 2.5:
|
|
|
+ self.dict_cal['chilledWaterFlow'] = ''
|
|
|
+ logger.critical('==========冷冻水流量计算异常,请检查输入参数===========')
|
|
|
+ return None
|
|
|
+
|
|
|
+ def cooling_water_flow_cal(self):
|
|
|
+ """
|
|
|
+ 冷却水流量计算
|
|
|
+ 比热容按照4.187计算,暂不进行公式拟合
|
|
|
+ 水流量单位:m3/h
|
|
|
+ :return:
|
|
|
+ """
|
|
|
+ self.dict_cal['coolingWaterFlow'] = (self.dict_cal['power'] + self.dict_cal['coolingCapacity']) / 4.187 / (
|
|
|
+ self.dict_cal['coolingWaterOutput'] - self.dict_cal['coolingWaterInput']) / 1000 * 3600
|
|
|
+ coolingWaterFlowRated = (self.dict_cal['powerRated'] + self.dict_cal['coolingCapacityRated']) / 4.187 / 5.0 / 1000 * 3600
|
|
|
+ coolingFlowRatio = self.dict_cal['coolingWaterFlow'] / coolingWaterFlowRated
|
|
|
+ if coolingFlowRatio < 0.3 or coolingFlowRatio > 2.5:
|
|
|
+ self.dict_cal['coolingWaterFlow'] = ''
|
|
|
+ logger.critical('==========冷却水流量计算异常,请检查输入参数===========')
|
|
|
+ return None
|
|
|
+
|
|
|
+ def performance_calculation(self):
|
|
|
+ self.dict_cal = self.parameter_second_cal()
|
|
|
+ self.mass_flow()
|
|
|
+ self.system_performance()
|
|
|
+ is_success, results_depict = self.judge_results(self.dict_cal)
|
|
|
+ if is_success == 1:
|
|
|
+ self.cooling_water_flow_cal()
|
|
|
+ self.chilled_water_flow_cal()
|
|
|
+ self.dict_cal.update(
|
|
|
+ etaMotor=round(self.eta_motor, 3),
|
|
|
+ etaRoller=round(self.eta_roller, 3))
|
|
|
+ return is_success, results_depict, self.dict_cal
|