@@ -83,67 +83,65 @@ def determine_building_supply_temperatures(building_names, locator, substation_s
83
83
buildings_demands = {}
84
84
for name in building_names :
85
85
name = str (name )
86
- buildings_demands [ name ] = pd .read_csv (locator .get_demand_results_file (name ),
87
- usecols = (BUILDINGS_DEMANDS_COLUMNS ))
86
+ demand_df = pd .read_csv (locator .get_demand_results_file (name ),
87
+ usecols = (BUILDINGS_DEMANDS_COLUMNS ))
88
88
Q_substation_heating = 0
89
89
T_supply_heating_C = np .nan
90
90
for system in substation_systems ['heating' ]:
91
91
if system == 'ww' :
92
- Q_substation_heating = Q_substation_heating + buildings_demands [ name ] .Qww_sys_kWh
92
+ Q_substation_heating = Q_substation_heating + demand_df .Qww_sys_kWh
93
93
T_supply_heating_C = np .vectorize (calc_DH_supply )(T_supply_heating_C ,
94
- np .where (buildings_demands [ name ] .Qww_sys_kWh > 0 ,
95
- buildings_demands [ name ] .Tww_sys_sup_C ,
94
+ np .where (demand_df .Qww_sys_kWh > 0 ,
95
+ demand_df .Tww_sys_sup_C ,
96
96
np .nan ))
97
97
else :
98
- Q_substation_heating = Q_substation_heating + buildings_demands [ name ] ['Qhs_sys_' + system + '_kWh' ]
98
+ Q_substation_heating = Q_substation_heating + demand_df ['Qhs_sys_' + system + '_kWh' ]
99
99
# set the building side heating supply temperature
100
100
T_supply_heating_C = np .vectorize (calc_DH_supply )(T_supply_heating_C ,
101
- np .where (buildings_demands [name ][
102
- 'Qhs_sys_' + system + '_kWh' ] > 0 ,
103
- buildings_demands [name ][
104
- 'Ths_sys_sup_' + system + '_C' ],
101
+ np .where (demand_df ['Qhs_sys_' + system + '_kWh' ] > 0 ,
102
+ demand_df ['Ths_sys_sup_' + system + '_C' ],
105
103
np .nan ))
106
104
107
105
Q_substation_cooling = 0
108
106
T_supply_cooling_C = np .nan
109
107
for system in substation_systems ['cooling' ]:
110
108
if system == 'data' :
111
- Q_substation_cooling = Q_substation_cooling + abs (buildings_demands [ name ] .Qcdata_sys_kWh )
109
+ Q_substation_cooling = Q_substation_cooling + abs (demand_df .Qcdata_sys_kWh )
112
110
T_supply_cooling_C = np .vectorize (calc_DC_supply )(T_supply_cooling_C ,
113
111
np .where (
114
- abs (buildings_demands [ name ] .Qcdata_sys_kWh ) > 0 ,
115
- buildings_demands [ name ] .Tcdata_sys_sup_C ,
112
+ abs (demand_df .Qcdata_sys_kWh ) > 0 ,
113
+ demand_df .Tcdata_sys_sup_C ,
116
114
np .nan ))
117
115
elif system == 're' :
118
- Q_substation_cooling = Q_substation_cooling + abs (buildings_demands [ name ] .Qcre_sys_kWh )
116
+ Q_substation_cooling = Q_substation_cooling + abs (demand_df .Qcre_sys_kWh )
119
117
T_supply_cooling_C = np .vectorize (calc_DC_supply )(T_supply_cooling_C ,
120
118
np .where (
121
- abs (buildings_demands [ name ] .Qcre_sys_kWh ) > 0 ,
122
- buildings_demands [ name ] .Tcre_sys_sup_C ,
119
+ abs (demand_df .Qcre_sys_kWh ) > 0 ,
120
+ demand_df .Tcre_sys_sup_C ,
123
121
np .nan ))
124
122
else :
125
- Q_substation_cooling = Q_substation_cooling + abs (buildings_demands [ name ] ['Qcs_sys_' + system + '_kWh' ])
123
+ Q_substation_cooling = Q_substation_cooling + abs (demand_df ['Qcs_sys_' + system + '_kWh' ])
126
124
T_supply_cooling_C = np .vectorize (calc_DC_supply )(T_supply_cooling_C ,
127
- np .where (abs (buildings_demands [name ][
128
- 'Qcs_sys_' + system + '_kWh' ]) > 0 ,
129
- buildings_demands [name ][
130
- 'Tcs_sys_sup_' + system + '_C' ],
125
+ np .where (abs (demand_df ['Qcs_sys_' + system + '_kWh' ]) > 0 ,
126
+ demand_df ['Tcs_sys_sup_' + system + '_C' ],
131
127
np .nan ))
132
128
133
129
# find the target substation supply temperature
134
130
T_supply_DH_C = np .where (Q_substation_heating > 0 , T_supply_heating_C + DT_HEAT , np .nan )
135
131
T_supply_DC_C = np .where (abs (Q_substation_cooling ) > 0 , T_supply_cooling_C - DT_COOL , np .nan )
136
132
137
- buildings_demands [ name ] ['Q_substation_heating' ] = Q_substation_heating
138
- buildings_demands [ name ] ['Q_substation_cooling' ] = abs (Q_substation_cooling )
139
- buildings_demands [ name ] ['T_sup_target_DH' ] = T_supply_DH_C
140
- buildings_demands [ name ] ['T_sup_target_DC' ] = T_supply_DC_C
133
+ demand_df ['Q_substation_heating' ] = Q_substation_heating
134
+ demand_df ['Q_substation_cooling' ] = abs (Q_substation_cooling )
135
+ demand_df ['T_sup_target_DH' ] = T_supply_DH_C
136
+ demand_df ['T_sup_target_DC' ] = T_supply_DC_C
141
137
142
- buildings_demands [ name ] ['T_re_target_DH' ] = T_supply_DH_C - delta_T_supply_return
143
- buildings_demands [ name ] ['T_re_target_DC' ] = T_supply_DC_C + delta_T_supply_return
138
+ demand_df ['T_re_target_DH' ] = T_supply_DH_C - delta_T_supply_return
139
+ demand_df ['T_re_target_DC' ] = T_supply_DC_C + delta_T_supply_return
144
140
145
- buildings_demands [name ]['V_substation_heating_m3pers' ] = (buildings_demands [name ]['Q_substation_heating' ] * 1000 / (delta_T_supply_return * HEAT_CAPACITY_OF_WATER_JPERKGK )) / P_WATER_KGPERM3
146
- buildings_demands [name ]['V_substation_cooling_m3pers' ] = (buildings_demands [name ]['Q_substation_cooling' ] * 1000 / (delta_T_supply_return * HEAT_CAPACITY_OF_WATER_JPERKGK )) / P_WATER_KGPERM3
141
+ demand_df ['V_substation_heating_m3pers' ] = (demand_df ['Q_substation_heating' ] * 1000 / (delta_T_supply_return * HEAT_CAPACITY_OF_WATER_JPERKGK )) / P_WATER_KGPERM3
142
+ demand_df ['V_substation_cooling_m3pers' ] = (demand_df ['Q_substation_cooling' ] * 1000 / (delta_T_supply_return * HEAT_CAPACITY_OF_WATER_JPERKGK )) / P_WATER_KGPERM3
143
+
144
+ buildings_demands [name ] = demand_df
147
145
148
146
return buildings_demands
149
147
0 commit comments