Exemple #1
0
	def analyze_thermal_properties_per_sim(self):
		"""
		Appends thermal properties for all runs and plot histograms
		"""
		
		# initialize temporal matrices
		U_res     = [[np.array([]) for col in range(4)] for row in range(10)]
		C_res     = [[np.array([]) for col in range(4)] for row in range(10)]
		TAU_res   = [[np.array([]) for col in range(4)] for row in range(10)]
		SH_res	  = [[np.array([]) for col in range(4)] for row in range(10)]
		HW_res	  = [[np.array([]) for col in range(4)] for row in range(10)]
		HEAT_res  = [[np.array([]) for col in range(4)] for row in range(10)]
		U_nres    = [np.array([]) for col in range(5)]
		C_nres    = [np.array([]) for col in range(5)]
		TAU_nres  = [np.array([]) for col in range(5)]
		SH_nres	  = [np.array([]) for col in range(5)]
		HW_nres	  = [np.array([]) for col in range(5)]
		HEAT_nres = [np.array([]) for col in range(5)]
		
		# append simulation values
		for run in range(self.N):
			
			# RESIDENTIAL
			for year_class in range(10):
				for btype in range(4):
				
					U_res[year_class][btype]    = np.append(U_res[year_class][btype], self.u_res[run][year_class][btype])
					C_res[year_class][btype]    = np.append(C_res[year_class][btype], self.c_res[run][year_class][btype])
					TAU_res[year_class][btype]  = np.append(TAU_res[year_class][btype], self.tau_res[run][year_class][btype])
					SH_res[year_class][btype]   = np.append(SH_res[year_class][btype], self.sh_per_area_res[run][year_class][btype])
					HW_res[year_class][btype]   = np.append(HW_res[year_class][btype], self.hw_per_area_res[run][year_class][btype])
					HEAT_res[year_class][btype] = np.append(HEAT_res[year_class][btype], self.heat_per_area_res[run][year_class][btype])
			
			# NON-RESIDENTIAL
			for year_class in range(5):
				
				U_nres[year_class] 		 = np.append(U_nres[year_class], self.u_nres[run][year_class])
				C_nres[year_class]		 = np.append(C_nres[year_class], self.c_nres[run][year_class])
				TAU_nres[year_class]	 = np.append(TAU_nres[year_class], self.tau_nres[run][year_class])
				SH_nres[year_class]		 = np.append(SH_nres[year_class], self.sh_per_area_nres[run][year_class])
				HW_nres[year_class]		 = np.append(HW_nres[year_class], self.hw_per_area_nres[run][year_class])
				HEAT_nres[year_class]	 = np.append(HEAT_nres[year_class], self.heat_per_area_nres[run][year_class])
		
		# plot histograms
		### RESIDENTIAL
		###### U-value [MW/K]
		figname = '{}/histU_res.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(3, U_res, 'U-value [MW/K]', figname,
								factor = 1e6, figsize = (30, 25))
		###### U-value [MW/K]
		figname = '{}/histC_res.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(3, C_res, 'Thermal mass [GJ/K]', figname,
								factor = 1e9, figsize = (30, 25))
		###### Tau [h]
		figname = '{}/histTau_res.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(3, TAU_res, 'Tau [h]', figname,
								factor = 3600, figsize = (30, 25))
		###### Space heating demand per unit area [kWh/m2]
		figname = '{}/histSHD_perUnitArea_res.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(3, SH_res, 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))
		###### Hot water demand per unit area [kWh/m2]
		figname = '{}/histHWD_perUnitArea_res.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(3, HW_res, 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))
		###### Total heat demand per unit area [kWh/m2]
		figname = '{}/histHeat_perUnitArea_res.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(3, HEAT_res, 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))
								
		### NON-RESIDENTIAL
		###### U-value [MW/K]
		figname = '{}/histU_nres.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(0, U_nres, 'U-value [MW/K]', figname,
								factor = 1e6, figsize = (30, 25))
		###### U-value [MW/K]
		figname = '{}/histC_nres.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(0, C_nres, 'Thermal mass [GJ/K]', figname,
								factor = 1e9, figsize = (30, 25))
		###### Tau [h]
		figname = '{}/histTau_nres.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(0, TAU_nres, 'Tau [h]', figname,
								factor = 3600, figsize = (30, 25))
		###### Space heating demand per unit area [kWh/m2]
		figname = '{}/histSHD_perUnitArea_nres.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(0, SH_nres, 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))
		###### Hot water demand per unit area [kWh/m2]
		figname = '{}/histHWD_perUnitArea_nres.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(0, HW_nres, 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))
		###### Total heat demand per unit area [kWh/m2]
		figname = '{}/histHeat_perUnitArea_nres.png'.format(self.result_dir)
		UrbanHeatPro.plot_histogram_table(0, HEAT_nres, 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))
Exemple #2
0
	def analyze_thermal_properties_per_run(self, run, result_dir_run):
		"""
		Extracts data from object City and plots a histogram showing the values of the 
		thermal properties for all buildings in the city. Buildings are classified according 
		to year construction class and building type. Analyzed thermal parameters are: 
			U-value [W/K]
			Thermal mass [J/K] 
			Tau [s]
			Space heat demand per unit area [Wh/m2] 
			Hot water demand per unit area [Wh/m2]
			Total heat demand per unit area [Wh/m2]
		"""
	
		# extract data from City object
		for year_class in range(10):
			for btype in range(4):
			
				# extract all buildings B with specific year_class, btype and use
				c0  = self.my_city.energy_per_building[:, 1] == 3  # RESIDENTIAL
				c1  = self.my_city.energy_per_building[:, 2] == year_class
				c2  = self.my_city.energy_per_building[:, 3] == btype
				B   = self.my_city.energy_per_building[c0 * c1 * c2]
			
				# U-value [W/K]
				self.u_res[run][year_class][btype] = np.append(self.u_res[run][year_class][btype], \
														B[:, 13])
				# Thermal mass [J/K]
				self.c_res[run][year_class][btype] = np.append(self.c_res[run][year_class][btype], \
														B[:, 14])							
				# Tau [s]
				self.tau_res[run][year_class][btype] = np.append(self.tau_res[run][year_class][btype], \
														B[:, 15])	
				# Space heat demand per unit area [Wh/m2]
				self.sh_per_area_res[run][year_class][btype] = np.append(self.sh_per_area_res[run][year_class][btype], \
														(B[:, 16] / B[:, 5]))
				# Hot water demand per unit area [Wh/m2]
				self.hw_per_area_res[run][year_class][btype] = np.append(self.hw_per_area_res[run][year_class][btype], \
														(B[:, 17] / B[:, 5]))															 
				# Total heat demand per unit area [Wh/m2]
				self.heat_per_area_res[run][year_class][btype] = np.append(self.heat_per_area_res[run][year_class][btype], \
														(B[:, 18] / B[:, 5]))
		
		for year_class in range(5):
		
			# extract all buildings B with specific year_class, btype and use
			C0  = self.my_city.energy_per_building[:, 1] != 3  # NON-RESIDENTIAL
			c1  = self.my_city.energy_per_building[:, 2] == year_class
			B   = self.my_city.energy_per_building[c0 * c1]
														
			# U-value [W/K]
			self.u_nres[run][year_class] = np.append(self.u_nres[run][year_class], B[:, 13])
			# Thermal mass [J/K]
			self.c_nres[run][year_class] = np.append(self.c_nres[run][year_class], B[:, 14])							
			# Tau [s]
			self.tau_nres[run][year_class] = np.append(self.tau_nres[run][year_class], B[:, 15])
			# Space heat demand per unit area [Wh/m2]
			self.sh_per_area_nres[run][year_class] = np.append(self.sh_per_area_nres[run][year_class], \
														(B[:, 16] / B[:, 5]))
			# Hot water demand per unit area [Wh/m2]
			self.hw_per_area_nres[run][year_class] = np.append(self.hw_per_area_nres[run][year_class], \
														(B[:, 17] / B[:, 5]))															 
			# Total heat demand per unit area [Wh/m2]
			self.heat_per_area_nres[run][year_class] = np.append(self.heat_per_area_nres[run][year_class], \
														(B[:, 18] / B[:, 5]))													
		
		# plot histograms per run 
		### RESIDENTIAL
		###### U-value [MW/K]
		figname = '{}/histU_res_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(3, self.u_res[run], 'U-value [MW/K]', figname,
								factor = 1e6, figsize = (30, 25))
		###### U-value [MW/K]
		figname = '{}/histC_res_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(3, self.c_res[run], 'Thermal mass [GJ/K]', figname,
								factor = 1e9, figsize = (30, 25))
		###### Tau [h]
		figname = '{}/histTau_res_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(3, self.tau_res[run], 'Tau [h]', figname,
								factor = 3600, figsize = (30, 25))
		###### Space heating demand per unit area [kWh/m2]
		figname = '{}/histSHD_perUnitArea_res_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(3, self.sh_per_area_res[run], 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))
		###### Hot water demand per unit area [kWh/m2]
		figname = '{}/histHWD_perUnitArea_res_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(3, self.hw_per_area_res[run], 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))
		###### Total heat demand per unit area [kWh/m2]
		figname = '{}/histHeat_perUnitArea_res_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(3, self.heat_per_area_res[run], 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))
								
		### NON-RESIDENTIAL
		###### U-value [MW/K]
		figname = '{}/histU_nres_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(0, self.u_nres[run], 'U-value [MW/K]', figname,
								factor = 1e6, figsize = (30, 25))
		###### U-value [MW/K]
		figname = '{}/histC_nres_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(0, self.c_nres[run], 'Thermal mass [GJ/K]', figname,
								factor = 1e9, figsize = (30, 25))
		###### Tau [h]
		figname = '{}/histTau_nres_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(0, self.tau_nres[run], 'Tau [h]', figname,
								factor = 3600, figsize = (30, 25))
		###### Space heating demand per unit area [kWh/m2]
		figname = '{}/histSHD_perUnitArea_nres_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(0, self.sh_per_area_nres[run], 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))
		###### Hot water demand per unit area [kWh/m2]
		figname = '{}/histHWD_perUnitArea_nres_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(0, self.hw_per_area_nres[run], 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))
		###### Total heat demand per unit area [kWh/m2]
		figname = '{}/histHeat_perUnitArea_nres_{}.png'.format(result_dir_run, run)
		UrbanHeatPro.plot_histogram_table(0, self.heat_per_area_nres[run], 'Energy [kWh/m2]', figname,
								factor = 1e3, figsize = (30, 25))