plt.legend() plt.savefig(os.path.join(os.path.dirname(__file__), '..', '..', 'SolarCalculations.wiki/DemoSolarAngles1.png')) #### reset plt.close() # calculate solar azimuth angle for a summer day in Golden, CO longitude = 105.2 stdmeridian = 105 latitude = 39.75 x = [] solar_az = [] for hour in range(0,24): # gives zero-based hours as expected in the datetime constructor x.append(hour) dt = datetime(2001, 6, 21, hour, 00, 00) solar_az.append(solar.solarAzimuthAngle(dt, True, longitude, stdmeridian, latitude).degrees) plt.plot(x, solar_az, 'b', label='Solar Azimuth Angle') plt.xlim([0,23]) plt.suptitle("Solar Azimuth Angle", fontsize=14, fontweight='bold') plt.xlabel("Hour of Day -- Clock Time") plt.ylabel("Angle [degrees]") plt.grid(True, axis='both') plt.legend() plt.savefig(os.path.join(os.path.dirname(__file__), '..', '..', 'SolarCalculations.wiki/DemoSolarAnglesSolarAzimuth.png')) ### reset plt.close() # calculate wall azimuth angles for a summer day in Golden, CO longitude = 105.2
import csv # Golden, CO longitude = 104.85 stdmeridian = 105 latitude = 39.57 with open('/tmp/compare_winter_angles_library.csv', 'w') as csvfile: mywriter = csv.writer(csvfile) mywriter.writerow(['Hour', 'Hour Angle', 'Solar Altitude', 'Solar Azimuth']) for hour in range(0,24): # gives zero-based hours as expected in the datetime constructor x = hour dt = datetime(2001, 12, 21, hour, 30, 00) thour = solar.hourAngle(dt, False, longitude, stdmeridian).degrees altitude = solar.altitudeAngle(dt, False, longitude, stdmeridian, latitude).degrees azimuth = solar.solarAzimuthAngle(dt, False, longitude, stdmeridian, latitude).degrees mywriter.writerow([x, -thour, altitude, azimuth]) with open('/tmp/compare_summer_angles_library.csv', 'w') as csvfile: mywriter = csv.writer(csvfile) mywriter.writerow(['Hour', 'Hour Angle', 'Solar Altitude', 'Solar Azimuth']) for hour in range(0,24): # gives zero-based hours as expected in the datetime constructor x = hour dt = datetime(2001, 7, 21, hour, 30, 00) thour = solar.hourAngle(dt, False, longitude, stdmeridian).degrees altitude = solar.altitudeAngle(dt, False, longitude, stdmeridian, latitude).degrees azimuth = solar.solarAzimuthAngle(dt, False, longitude, stdmeridian, latitude).degrees mywriter.writerow([x, -thour, altitude, azimuth]) with open('/tmp/compare_summer_incidence_library.csv', 'w') as csvfile: mywriter = csv.writer(csvfile)
east_wall_normal_from_north = 90 south_wall_normal_from_north = 180 west_wall_normal_from_north = 270 with open('/tmp/eplus_validation_location.csv', 'w') as csvfile: mywriter = csv.writer(csvfile) mywriter.writerow(['Hour', 'Hour Angle', 'Solar Altitude', 'Solar Azimuth', 'Cos East Wall Theta', 'Cos South Wall Theta', 'Cos West Wall Theta']) for month in range(1,3): # just january and february thisLat = getLat(month) thisLong = getLong(month) for day in range(1,monthrange(2011, month)[1]+1): # just make sure it isn't a leap year for hour in range(0,24): # gives zero-based hours as expected in the datetime constructor x = hour dt = datetime(2011, month, day, hour, 30, 00) thour = solar.hourAngle(dt, False, thisLong, stdmeridian).degrees altitude = solar.altitudeAngle(dt, False, thisLong, stdmeridian, thisLat).degrees azimuth = solar.solarAzimuthAngle(dt, False, thisLong, stdmeridian, thisLat).degrees east_theta = solar.solarAngleOfIncidence(dt, False, thisLong, stdmeridian, thisLat, east_wall_normal_from_north).radians south_theta = solar.solarAngleOfIncidence(dt, False, thisLong, stdmeridian, thisLat, south_wall_normal_from_north).radians west_theta = solar.solarAngleOfIncidence(dt, False, thisLong, stdmeridian, thisLat, west_wall_normal_from_north).radians if east_theta != None: east_theta = math.cos(east_theta) if south_theta != None: south_theta = math.cos(south_theta) if west_theta != None: west_theta = math.cos(west_theta) mywriter.writerow([x, -thour, altitude, azimuth, east_theta, south_theta, west_theta]) def getWallOrientation(month): if month <= 1: return 0 elif month == 2:
#### reset plt.close() # calculate solar azimuth angle for a summer day in Golden, CO longitude = 105.2 stdmeridian = 105 latitude = 39.75 x = [] solar_az = [] for hour in range( 0, 24): # gives zero-based hours as expected in the datetime constructor x.append(hour) dt = datetime(2001, 6, 21, hour, 00, 00) solar_az.append( solar.solarAzimuthAngle(dt, True, longitude, stdmeridian, latitude).degrees) plt.plot(x, solar_az, 'b', label='Solar Azimuth Angle') plt.xlim([0, 23]) plt.suptitle("Solar Azimuth Angle", fontsize=14, fontweight='bold') plt.xlabel("Hour of Day -- Clock Time") plt.ylabel("Angle [degrees]") plt.grid(True, axis='both') plt.legend() plt.savefig( os.path.join(os.path.dirname(__file__), '..', '..', 'SolarCalculations.wiki/DemoSolarAnglesSolarAzimuth.png')) ### reset plt.close()
for month in range(1, 3): # just january and february thisLat = getLat(month) thisLong = getLong(month) for day in range(1, monthrange(2011, month)[1] + 1): # just make sure it isn't a leap year for hour in range( 0, 24 ): # gives zero-based hours as expected in the datetime constructor x = hour dt = datetime(2011, month, day, hour, 30, 00) thour = solar.hourAngle(dt, False, thisLong, stdmeridian).degrees altitude = solar.altitudeAngle(dt, False, thisLong, stdmeridian, thisLat).degrees azimuth = solar.solarAzimuthAngle(dt, False, thisLong, stdmeridian, thisLat).degrees east_theta = solar.solarAngleOfIncidence( dt, False, thisLong, stdmeridian, thisLat, east_wall_normal_from_north).radians south_theta = solar.solarAngleOfIncidence( dt, False, thisLong, stdmeridian, thisLat, south_wall_normal_from_north).radians west_theta = solar.solarAngleOfIncidence( dt, False, thisLong, stdmeridian, thisLat, west_wall_normal_from_north).radians if east_theta != None: east_theta = math.cos(east_theta) if south_theta != None: south_theta = math.cos(south_theta) if west_theta != None: west_theta = math.cos(west_theta)