plotting shadow length
This commit is contained in:
		
							parent
							
								
									b570ca824f
								
							
						
					
					
						commit
						5792640d30
					
				| @ -128,9 +128,9 @@ def get_solar_data(c): | |||||||
| def sanity_check_minimum_pitch(c): | def sanity_check_minimum_pitch(c): | ||||||
|     solar_positions, _ = get_solar_data(c) |     solar_positions, _ = get_solar_data(c) | ||||||
|     zenith = solar_positions["zenith"].values |     zenith = solar_positions["zenith"].values | ||||||
|     solar_positions["shadow_length"] = c["panel"]["dimensions"]["length"] * math.tan( |     solar_positions["shadow_length"] = ( | ||||||
|         zenith |         c["panel"]["dimensions"]["length"] + c["environment"]["height"] | ||||||
|     ) |     ) * np.tan(zenith / 180 * np.pi) | ||||||
|     return solar_positions |     return solar_positions | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -20,6 +20,7 @@ environment: | |||||||
|       width: 40 |       width: 40 | ||||||
|     albedo: 0.2 # % of light reflected from the surface |     albedo: 0.2 # % of light reflected from the surface | ||||||
|     tilt: 0 # degrees from horizontal |     tilt: 0 # degrees from horizontal | ||||||
|  |   height: 50 # elevation including building height | ||||||
|   location: |   location: | ||||||
|     latitude: 3.1186108758412945 |     latitude: 3.1186108758412945 | ||||||
|     longitude: 101.57639813680093 |     longitude: 101.57639813680093 | ||||||
|  | |||||||
							
								
								
									
										9
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								main.py
									
									
									
									
									
								
							| @ -3,12 +3,14 @@ import yaml | |||||||
| import logging | import logging | ||||||
| import numpy as np | import numpy as np | ||||||
| import matplotlib.pyplot as pl | import matplotlib.pyplot as pl | ||||||
|  | import matplotlib.dates as mdates | ||||||
| from Utilities.Shading import ( | from Utilities.Shading import ( | ||||||
|     calculate_energy_production_horizontal, |     calculate_energy_production_horizontal, | ||||||
|     calculate_energy_production_vertical, |     calculate_energy_production_vertical, | ||||||
|     sanity_check_minimum_pitch, |     sanity_check_minimum_pitch, | ||||||
| ) | ) | ||||||
| from Utilities.Optimisation import optimise_vertical_panel_pitch | from Utilities.Optimisation import optimise_vertical_panel_pitch | ||||||
|  | import datetime | ||||||
| 
 | 
 | ||||||
| logging.basicConfig( | logging.basicConfig( | ||||||
|     level=logging.INFO, |     level=logging.INFO, | ||||||
| @ -66,6 +68,9 @@ pl.plot( | |||||||
|     label="Horizontal Panels", |     label="Horizontal Panels", | ||||||
| ) | ) | ||||||
| pl.plot(vertical_energy.index, vertical_energy.values, label="Vertical Panels") | pl.plot(vertical_energy.index, vertical_energy.values, label="Vertical Panels") | ||||||
|  | pl.gca().xaxis.set_major_formatter( | ||||||
|  |     mdates.DateFormatter("%H:%M", tz=datetime.timezone(datetime.timedelta(hours=8))) | ||||||
|  | ) | ||||||
| pl.title("Energy Production Comparison") | pl.title("Energy Production Comparison") | ||||||
| pl.xlabel("Time") | pl.xlabel("Time") | ||||||
| pl.ylabel("Energy Production (kWh)") | pl.ylabel("Energy Production (kWh)") | ||||||
| @ -74,9 +79,13 @@ pl.legend() | |||||||
| solar_positions = sanity_check_minimum_pitch(c) | solar_positions = sanity_check_minimum_pitch(c) | ||||||
| pl.subplot(2, 1, 2) | pl.subplot(2, 1, 2) | ||||||
| pl.plot(solar_positions.index, solar_positions["shadow_length"], label="Shadow Length") | pl.plot(solar_positions.index, solar_positions["shadow_length"], label="Shadow Length") | ||||||
|  | pl.gca().xaxis.set_major_formatter( | ||||||
|  |     mdates.DateFormatter("%H:%M", tz=datetime.timezone(datetime.timedelta(hours=8))) | ||||||
|  | ) | ||||||
| pl.title("Shadow Lengths Throughout the Day") | pl.title("Shadow Lengths Throughout the Day") | ||||||
| pl.xlabel("Time") | pl.xlabel("Time") | ||||||
| pl.ylabel("Shadow Length (m)") | pl.ylabel("Shadow Length (m)") | ||||||
| pl.legend() | pl.legend() | ||||||
| 
 | 
 | ||||||
|  | pl.tight_layout() | ||||||
| pl.show() | pl.show() | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user