def __init__(self, n, L, C, time=[]): # Constants: self.n = n # Day of year self.L = L # Location object self.C = C # Collector object self.delta = (23.45 * pi / 180) * sin( 2 * pi * (284 + self.n) / 365) # Declination (1.6.1) # Variables: all numpy arrays of length 24*60 = 1440 if len(time ) > 1: # Set up the time array: time_s is normalized (0 - 1) self.time_s = self.stime(time) # hr = (time/100)*100 # mn = time - (time/100)*100 # self.time_s = (hr + (100/60.0)*(mn+(4*(self.L.lon_s-self.L.lon)+solar_time(self.n))))/2400.0 else: self.time_s = (np.arange(1440) + 4 * (self.L.lon_s - self.L.lon) + solar_time(self.n)) / 1440.0 self.omega = (self.time_s - 0.5) * 24 * 15 * ( pi / 180) # Hour angle (15' per hour, a.m. -ve) self.gamma_s = np.array([ solar.azimuth(self.L.phi, self.delta, m) for m in self.omega ]) # Solar azimuth self.theta_z = arccos( cos(self.L.phi) * cos(self.delta) * cos(self.omega) + sin(self.L.phi) * sin(self.delta)) # Zenith angle (1.6.5) self.theta = arccos( cos(self.theta_z) * cos(self.C.beta) + # Angle of incidence on collector (1.6.3) sin(self.theta_z) * sin(self.C.beta) * cos(self.gamma_s - self.C.gamma))
def plotAzimuthDays(lat,days): ts = np.arange(0,24,0.25) for day in days: (mon,md) = solar.findDay(day) plt.plot(ts,solar.azimuth(lat,day,ts),label= mon + " " + str(md) + " " + str(lat) + "deg") plt.xlabel('Hour') plt.ylabel('deg') plt.title('Solar Azimuth Angle over Day at '+str(lat)+' degs lat') axes = plt.axes() handles, labels = axes.get_legend_handles_labels() axes.legend(handles, labels, loc=2) return axes
def plotPath(lat,days): ts = np.arange(0,24,0.25) for day in days: (mon,md) = solar.findDay(day) az= solar.azimuth(lat,day,ts) alt = solar.altitude(lat,day,ts) plt.plot(az,alt,label= mon + " " + str(md) + " " + str(lat) + "deg") plt.xlabel('azimuth') plt.ylabel('altitude') plt.title('Solar Path over Day at '+str(lat)+' degs lat') axes = plt.axes() handles, labels = axes.get_legend_handles_labels() axes.legend(handles, labels, loc=2) return axes
def __init__(self, n, L, C, time=None): # Constants: self.n = n # Day of year self.L = L # Location object self.C = C # Collector object self.delta = (23.45*pi/180) * sin(2*pi*(284+self.n)/365) # Declination (1.6.1) # Variables: all numpy arrays of length 24h * 60min = 1440 if time == None: self.time = np.array([datetime(2000,1,1)+timedelta(days=n-1,minutes=m) for m in range(1440)]) else: self.time = time self.omega = np.array([(t.hour+(t.minute/60.0)-12)*15.0*(pi/180.0) for t in self.time]) # Hour angle (15' per hour, a.m. -ve) self.gamma_s = np.array([solar.azimuth(self.L.phi,self.delta,m) for m in self.omega]) # Solar azimuth self.theta_z = arccos( cos(self.L.phi)*cos(self.delta)*cos(self.omega) + sin(self.L.phi)*sin(self.delta) ) # Zenith angle (1.6.5) self.theta = arccos( cos(self.theta_z)*cos(self.C.beta) + # Angle of incidence on collector (1.6.3) sin(self.theta_z)*sin(self.C.beta)*cos(self.gamma_s-self.C.gamma) ) self.R_b = cos(np.clip(self.theta,0,pi/2))/cos(np.clip(self.theta_z,0,1.55)) # (1.8.1) Ratio of radiation on sloped/horizontal surface G_sc = 1367.0 # Solar constant [W/m2] (p.6) G_on = G_sc * (1+0.033*cos(2.0*pi*n/365)) # Extraterrestial radiation, normal plane [W/m2] (1.4.1) self.G_o = G_on * cos(self.theta_z) # Extraterrestial radiation, horizontal [W/m2] (1.10.1)
def __init__(self, n, L, C, time=[]): # Constants: self.n = n # Day of year self.L = L # Location object self.C = C # Collector object self.delta = (23.45*pi/180) * sin(2*pi*(284+self.n)/365) # Declination (1.6.1) # Variables: all numpy arrays of length 24*60 = 1440 if len(time) > 1: # Set up the time array: time_s is normalized (0 - 1) self.time_s = self.stime(time) # hr = (time/100)*100 # mn = time - (time/100)*100 # self.time_s = (hr + (100/60.0)*(mn+(4*(self.L.lon_s-self.L.lon)+solar_time(self.n))))/2400.0 else: self.time_s = (np.arange(1440)+4*(self.L.lon_s-self.L.lon)+solar_time(self.n))/1440.0 self.omega = (self.time_s-0.5)*24*15*(pi/180) # Hour angle (15' per hour, a.m. -ve) self.gamma_s = np.array([solar.azimuth(self.L.phi,self.delta,m) for m in self.omega]) # Solar azimuth self.theta_z = arccos( cos(self.L.phi)*cos(self.delta)*cos(self.omega) + sin(self.L.phi)*sin(self.delta) ) # Zenith angle (1.6.5) self.theta = arccos( cos(self.theta_z)*cos(self.C.beta) + # Angle of incidence on collector (1.6.3) sin(self.theta_z)*sin(self.C.beta)*cos(self.gamma_s-self.C.gamma) )