|
@@ -30,10 +30,11 @@ class DHU_AB(BaseDevice):
|
|
|
wheel_2 = None,
|
|
wheel_2 = None,
|
|
|
coolingcoil_2 = 'CoolingCoil2',
|
|
coolingcoil_2 = 'CoolingCoil2',
|
|
|
coolingcoil_3 = 'CoolingCoil2',
|
|
coolingcoil_3 = 'CoolingCoil2',
|
|
|
- heatingcoil_1 = 'SteamCoil',
|
|
|
|
|
- heatingcoil_2 = 'SteamCoil',
|
|
|
|
|
|
|
+ heatingcoil_1 = 'SteamCoilVal',
|
|
|
|
|
+ heatingcoil_2 = 'SteamCoilVal',
|
|
|
mixed_1 = 'Mixed',
|
|
mixed_1 = 'Mixed',
|
|
|
mixed_2 = 'Mixed',
|
|
mixed_2 = 'Mixed',
|
|
|
|
|
+ other_info = None
|
|
|
) -> None:
|
|
) -> None:
|
|
|
super().__init__()
|
|
super().__init__()
|
|
|
self.DHU_type = DHU_type.replace('DHU_','')
|
|
self.DHU_type = DHU_type.replace('DHU_','')
|
|
@@ -58,11 +59,13 @@ class DHU_AB(BaseDevice):
|
|
|
}
|
|
}
|
|
|
self.exist_Fa_H = exist_Fa_H
|
|
self.exist_Fa_H = exist_Fa_H
|
|
|
self.exist_Fa_B = exist_Fa_B
|
|
self.exist_Fa_B = exist_Fa_B
|
|
|
|
|
+ self.other_info = other_info if other_info is not None else {}
|
|
|
self.record_load_info(
|
|
self.record_load_info(
|
|
|
components_str = self.components_str,
|
|
components_str = self.components_str,
|
|
|
DHU_type = self.DHU_type,
|
|
DHU_type = self.DHU_type,
|
|
|
exist_Fa_H = self.exist_Fa_H,
|
|
exist_Fa_H = self.exist_Fa_H,
|
|
|
- exist_Fa_B = self.exist_Fa_B
|
|
|
|
|
|
|
+ exist_Fa_B = self.exist_Fa_B,
|
|
|
|
|
+ other_info = self.other_info
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
@property
|
|
@property
|
|
@@ -73,9 +76,15 @@ class DHU_AB(BaseDevice):
|
|
|
}
|
|
}
|
|
|
output ={}
|
|
output ={}
|
|
|
for comp_name,comp_model in self.components_str.items():
|
|
for comp_name,comp_model in self.components_str.items():
|
|
|
|
|
+ if comp_model == 'SteamCoilVal':
|
|
|
|
|
+ output[comp_name] = coil_steam.SteamCoilVal(
|
|
|
|
|
+ name = comp_name,
|
|
|
|
|
+ Fs_rated = self.other_info[f'{comp_name}_Fs_rated']
|
|
|
|
|
+ )
|
|
|
|
|
+ continue
|
|
|
for comp_map_k,comp_map_v in comp_map.items():
|
|
for comp_map_k,comp_map_v in comp_map.items():
|
|
|
if comp_model.startswith(comp_map_k):
|
|
if comp_model.startswith(comp_map_k):
|
|
|
- output[comp_name] = getattr(comp_map_v,comp_model)(comp_name)
|
|
|
|
|
|
|
+ output[comp_name] = getattr(comp_map_v,comp_model)(name = comp_name)
|
|
|
return output
|
|
return output
|
|
|
|
|
|
|
|
@property
|
|
@property
|
|
@@ -125,6 +134,10 @@ class DHU_AB(BaseDevice):
|
|
|
columns[f'{heatingcoil_idx}_Fs'] = f'{heatingcoil_idx}_Fs'
|
|
columns[f'{heatingcoil_idx}_Fs'] = f'{heatingcoil_idx}_Fs'
|
|
|
elif isinstance(self.components[heatingcoil_idx],coil_steam.SteamCoil):
|
|
elif isinstance(self.components[heatingcoil_idx],coil_steam.SteamCoil):
|
|
|
columns['wheel_2_ToutC'] = 'wheel_2_ToutC'
|
|
columns['wheel_2_ToutC'] = 'wheel_2_ToutC'
|
|
|
|
|
+ columns['wheel_1_ToutR'] = 'wheel_1_ToutR'
|
|
|
|
|
+ columns['mixed_2_ToutA'] = 'mixed_2_ToutA'
|
|
|
|
|
+ elif isinstance(self.components[heatingcoil_idx],coil_steam.SteamCoilVal):
|
|
|
|
|
+ columns[f'{heatingcoil_idx}_Val'] = f'{heatingcoil_idx}_Val'
|
|
|
else:
|
|
else:
|
|
|
raise Exception('WRONG')
|
|
raise Exception('WRONG')
|
|
|
return columns
|
|
return columns
|
|
@@ -156,9 +169,9 @@ class DHU_AB(BaseDevice):
|
|
|
)
|
|
)
|
|
|
for std_name,name in self.model_observe_data_columns.items():
|
|
for std_name,name in self.model_observe_data_columns.items():
|
|
|
if name not in observed_data.columns:
|
|
if name not in observed_data.columns:
|
|
|
- continue
|
|
|
|
|
|
|
+ raise Exception(f'Missing column: {name}')
|
|
|
observed_data = observed_data.rename(columns={name:std_name})
|
|
observed_data = observed_data.rename(columns={name:std_name})
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
std_name_equp,std_name_point = std_name.rsplit('_',1)
|
|
std_name_equp,std_name_point = std_name.rsplit('_',1)
|
|
|
sigma = {
|
|
sigma = {
|
|
|
'wheel_2_DoutP' : 0.3,
|
|
'wheel_2_DoutP' : 0.3,
|
|
@@ -167,11 +180,22 @@ class DHU_AB(BaseDevice):
|
|
|
'heatingcoil_1_FP': 10000,
|
|
'heatingcoil_1_FP': 10000,
|
|
|
'heatingcoil_2_FP': 10000,
|
|
'heatingcoil_2_FP': 10000,
|
|
|
}
|
|
}
|
|
|
|
|
+ if std_name in ['heatingcoil_1_Val','heatingcoil_2_Val']:
|
|
|
|
|
+ sigma = res[std_name_equp]['sigma']
|
|
|
|
|
+ else:
|
|
|
|
|
+ sigma = {
|
|
|
|
|
+ 'wheel_2_DoutP' : 0.3,
|
|
|
|
|
+ 'heatingcoil_1_Fs': 20,
|
|
|
|
|
+ 'heatingcoil_2_Fs': 20,
|
|
|
|
|
+ 'heatingcoil_1_FP': 10000,
|
|
|
|
|
+ 'heatingcoil_2_FP': 10000,
|
|
|
|
|
+ }.get(std_name,1)
|
|
|
|
|
+
|
|
|
observe(
|
|
observe(
|
|
|
name = std_name,
|
|
name = std_name,
|
|
|
var = res[std_name_equp][std_name_point],
|
|
var = res[std_name_equp][std_name_point],
|
|
|
observed = observed_data,
|
|
observed = observed_data,
|
|
|
- sigma = sigma.get(std_name,1)
|
|
|
|
|
|
|
+ sigma = sigma
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
self.param_posterior = pm.find_MAP(maxeval=50000,include_transformed=False)
|
|
self.param_posterior = pm.find_MAP(maxeval=50000,include_transformed=False)
|
|
@@ -233,20 +257,26 @@ class DHU_AB(BaseDevice):
|
|
|
|
|
|
|
|
def optimize(
|
|
def optimize(
|
|
|
self,
|
|
self,
|
|
|
- cur_input_data : pd.DataFrame,
|
|
|
|
|
- wheel_1_TinR_ub: float = 120,
|
|
|
|
|
- wheel_1_TinR_lb: float = 70,
|
|
|
|
|
- wheel_2_TinR_ub: float = 120,
|
|
|
|
|
- wheel_2_TinR_lb: float = 70,
|
|
|
|
|
- constrains : list = None,
|
|
|
|
|
- logging : bool = True
|
|
|
|
|
|
|
+ cur_input_data: pd.DataFrame,
|
|
|
|
|
+ wheel_1_TinR : tuple = (70,120),
|
|
|
|
|
+ wheel_2_TinR : tuple = (70,120),
|
|
|
|
|
+ fan_2_Hz : tuple = (30,50),
|
|
|
|
|
+ constrains : list = None,
|
|
|
|
|
+ logging : bool = True,
|
|
|
|
|
+ target : str = 'summary_Fs',
|
|
|
|
|
+ target_min : bool = True
|
|
|
) -> list:
|
|
) -> list:
|
|
|
constrains = [] if constrains is None else constrains
|
|
constrains = [] if constrains is None else constrains
|
|
|
cur_input_data = cur_input_data.iloc[[0],:]
|
|
cur_input_data = cur_input_data.iloc[[0],:]
|
|
|
- opt_var_boundary = {
|
|
|
|
|
- 'wheel_1_TinR':{'lb':wheel_1_TinR_lb,'ub':wheel_1_TinR_ub},
|
|
|
|
|
- 'wheel_2_TinR':{'lb':wheel_2_TinR_lb,'ub':wheel_2_TinR_ub},
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
|
|
+ opt_var_boundary = {}
|
|
|
|
|
+ if wheel_1_TinR is not None:
|
|
|
|
|
+ opt_var_boundary['wheel_1_TinR'] = {'lb':min(wheel_1_TinR),'ub':max(wheel_1_TinR)}
|
|
|
|
|
+ if wheel_2_TinR is not None:
|
|
|
|
|
+ opt_var_boundary['wheel_2_TinR'] = {'lb':min(wheel_2_TinR),'ub':max(wheel_2_TinR)}
|
|
|
|
|
+ if fan_2_Hz is not None:
|
|
|
|
|
+ opt_var_boundary['fan_2_Hz'] = {'lb':min(fan_2_Hz),'ub':max(fan_2_Hz)}
|
|
|
|
|
+
|
|
|
opt_var_value = cur_input_data.loc[:,list(opt_var_boundary.keys())]
|
|
opt_var_value = cur_input_data.loc[:,list(opt_var_boundary.keys())]
|
|
|
oth_var_value = (
|
|
oth_var_value = (
|
|
|
cur_input_data
|
|
cur_input_data
|
|
@@ -258,8 +288,8 @@ class DHU_AB(BaseDevice):
|
|
|
opt_var_boundary = opt_var_boundary,
|
|
opt_var_boundary = opt_var_boundary,
|
|
|
opt_var_value = opt_var_value,
|
|
opt_var_value = opt_var_value,
|
|
|
oth_var_value = oth_var_value,
|
|
oth_var_value = oth_var_value,
|
|
|
- target = 'summary_Fs',
|
|
|
|
|
- target_min = True,
|
|
|
|
|
|
|
+ target = target,
|
|
|
|
|
+ target_min = target_min,
|
|
|
constrains = constrains,
|
|
constrains = constrains,
|
|
|
logging = logging,
|
|
logging = logging,
|
|
|
other_kwargs = {'NIND':2000,'MAXGEN':50}
|
|
other_kwargs = {'NIND':2000,'MAXGEN':50}
|
|
@@ -649,7 +679,7 @@ class AirFlow_DHU_AB:
|
|
|
|
|
|
|
|
elif type == 'DHU_B':
|
|
elif type == 'DHU_B':
|
|
|
wheel_1_FaP = Fa_X
|
|
wheel_1_FaP = Fa_X
|
|
|
- wheel_1_FaC = None
|
|
|
|
|
|
|
+ wheel_1_FaC = np.nan
|
|
|
wheel_1_FaR = Fa_P
|
|
wheel_1_FaR = Fa_P
|
|
|
wheel_2_FaP = Fa_S
|
|
wheel_2_FaP = Fa_S
|
|
|
wheel_2_FaC = Fa_X + Fa_H - Fa_S
|
|
wheel_2_FaC = Fa_X + Fa_H - Fa_S
|