1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import pandas as pd
- class DataStandardization(object):
- def __init__(self, data_dict):
- self.data_dict = data_dict
- def null_judge(self):
- Num = 0
- for k in self.data_dict:
- if self.data_dict[k] == ' ' or not self.data_dict[k]:
- Num += 1
- return Num
- def dict_standard(self):
- dict_chiller_cooling = self.data_dict['chillerConfigInfo']
- dict_chiller_outer = {}
- dict_code = self.data_dict['controlConfigInfo']
- all_chillers_info = self.data_dict['stationInfo']['allChillersInfo']
- all_chiller_water_temp_set = []
- all_water_temp_control_mode = []
- for i in range(len(all_chillers_info['chillerId'])):
- if all_chillers_info['runStatus'][i] == 1 and all_chillers_info['isInControl'][i] == 1:
- all_chiller_water_temp_set.append(all_chillers_info['chillerWaterTempSet'][i])
- if all_chillers_info['isInControl'][i] == 1:
- all_water_temp_control_mode.append(all_chillers_info['waterTempControlMode'][i])
- dict_chiller_cooling.update({
- 'triggerTime': self.data_dict['stationInfo']['triggerTime'],
- 'runMode': self.data_dict['stationInfo']['runMode'],
- 'runStatus': self.data_dict['chillerInfo']['runStatus'],
- 'chillerOffTimeLatest': self.data_dict['chillerInfo']['chillerOffTimeLatest'],
- 'offSetTempLatestCooling': self.data_dict['chillerInfo']['offSetTempLatestCooling'],
- # 'offSetTempInLatestCooling': 12,
- 'allChillerWaterTempSetOn': all_chiller_water_temp_set,
- # 'allChillerWaterTempInSetOn': [],
- 'allChillerControlSelect': all_water_temp_control_mode,
- # 'allChillerPowerRatio': [],
- 'chillerPowerRatio': self.data_dict['chillerInfo']['chillerPowerRatio'],
- 'chillerWaterTempOut': self.data_dict['chillerInfo']['chillerWaterTempOut'],
- 'chillerWaterTempIn': self.data_dict['chillerInfo']['chillerWaterTempIn'],
- 'chillerWaterTempSet': self.data_dict['chillerInfo']['chillerWaterTempSet'],
- 'chillerWaterTempSetInitial': self.data_dict['controlConfigInfo']['chillerWaterTempSetInitial'],
- 'chillerWaterTempSetUpper': self.data_dict['controlConfigInfo']['chillerWaterTempSetUpper'],
- # 'chillerWaterTempInSetUpper': self.data_dict,
- 'chillerWaterTempSetDown': self.data_dict['controlConfigInfo']['chillerWaterTempSetLower'],
- })
- dict_chiller_outer.update({
- 'triggerTime': self.data_dict['stationInfo']['triggerTime'],
- 'userName': self.data_dict['stationInfo']['userName'],
- 'coolingStationName': self.data_dict['stationInfo']['coolingStationName'],
- 'orgId': self.data_dict['stationInfo']['orgId'],
- 'chillerName': self.data_dict['chillerInfo']['chillerName'],
- 'chillerId': self.data_dict['chillerInfo']['chillerId'],
- 'stationId': self.data_dict['stationInfo']['stationId'],
- 'controllerId': self.data_dict['stationInfo']['controllerId'],
- 'allChillersInfo': self.data_dict['stationInfo']['allChillersInfo']})
- dict_code.update({'upControlTimeLatest': self.data_dict['chillerInfo']['upControlTimeLatest'],
- 'downControlTimeLatest': self.data_dict['chillerInfo']['downControlTimeLatest'],
- 'triggerTime': self.data_dict['stationInfo']['triggerTime'],
- 'runMode': self.data_dict['stationInfo']['runMode'],
- 'calMode': 0, # 监测点计算模式默认值为0
- 'allChillerControlSelect': all_water_temp_control_mode})
- return dict_chiller_cooling, dict_chiller_outer, dict_code
- def dict_safety(self):
- dict_upper_correct = {'refriType': self.data_dict['chillerInfo']['refriType'],
- 'chillerParameter': self.data_dict['chillerSafetyPara']}
- # dict_upper_correct.update({'refriType': self.data_dict['chillerInfo']['refriType'],
- # 'chillerParameter': self.data_dict['chillerSafetyPara']})
- return dict_upper_correct
- def data_multi_comp(self):
- dict_chiller_inner, dict_chiller_outer, dict_code = self.dict_standard()
- dict_upper_correct = self.dict_safety()
- data_temp_humi = pd.DataFrame(self.data_dict['terminalInfo'])
- return dict_chiller_inner, dict_chiller_outer, dict_code, dict_upper_correct, data_temp_humi
|