Skip to content

Commit

Permalink
Static model update
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhuoran29 committed Dec 23, 2021
1 parent a4cca0a commit ad4ae12
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 13 deletions.
55 changes: 49 additions & 6 deletions PSA/StaticCollector_evacuatedtube.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,14 @@ def design(self):
row_design=data.loc[(data['Month']==self.design_point_date[1]) & (data['Day']==self.design_point_date[2]) & (data['Hour']==self.design_point_date[3])].index.values[0]
T_amb = np.asarray(data['Tdry'])
T_amb_design = self.Tamb_D

# Update Gk (in-plate radiation)
Gk = np.maximum(np.asarray(data['DNI']), np.asarray(data['GHI']))

# Perez coefficients
F11 = [-0.008, 0.130, 0.330, 0.568, 0.873, 1.133, 1.060, 0.678]
F12 = [0.588, 0.683, 0.487, 0.187,-0.392,-1.237,-1.600,-0.327]
F13 = [-0.062,-0.151,-0.221,-0.295,-0.362,-0.412,-0.359,-0.250]
F21 = [-0.060,-0.019, 0.055, 0.109, 0.226, 0.288, 0.264, 0.156]
F22 = [0.072, 0.066,-0.064,-0.152,-0.462,-0.823,-1.127,-1.377]
F23 = [-0.022,-0.029,-0.026,-0.014, 0.001, 0.056, 0.131, 0.251]

Gk_design = self.G

Expand All @@ -113,6 +118,7 @@ def design(self):
zenith = []
azimuth = []
aoi = []
Gk = []
for i in range(len(data)):
# Get hour angle (radian)
dayofyear.append(Month[data['Month'].iloc[i]-1] + data['Day'].iloc[i])
Expand All @@ -136,13 +142,50 @@ def design(self):
+ np.cos(declination[i])*np.cos(self.Lat*np.pi/180)*np.cos(self.tilt_angle*np.pi/180)*np.cos(HRA[i])
- np.cos(declination[i])*np.sin(self.Lat*np.pi/180)*np.sin(self.tilt_angle*np.pi/180)*np.cos(azimuth[i])*np.cos(HRA[i])
- np.cos(declination[i])*np.sin(self.tilt_angle*np.pi/180)*np.sin(azimuth[i])*np.sin(HRA[i])))

# Perez model to calculate Gk: gloabl irradiance over tilted surface
try:
Gh = data['GHI'].iloc[i]
GDh = data['DHI'].iloc[i]
GBn = data['DNI'].iloc[i]
GBk = GBn * np.cos(aoi[i])
Rr = (1 - np.cos(self.tilt_angle*np.pi/180)) / 2
Grk = self.albedo * Gh * Rr
a_coeff = max(0, np.cos(aoi[i]))
c_coeff = max(np.cos(85*np.pi/180), np.cos(zenith[i]))

G_0n = 1367 * (1.000110 + 0.034221 * np.cos(B[i]) + 0.001280 * np.sin(B[i]) + 0.000719 * np.cos(2*B[i]) + 0.000077 * np.sin(2*B[i]))
delta = GDh / G_0n / np.cos(zenith[i])
eps_value = ((GDh + GBn) / GDh + 1.041 * zenith[i]**3)/ (1 + 1.041 * zenith[i]**3)

if eps_value < 1.065:
eps = 0
elif eps_value < 1.23:
eps = 1
elif eps_value < 1.5:
eps = 2
elif eps_value < 1.95:
eps = 3
elif eps_value < 2.8:
eps = 4
elif eps_value < 4.5:
eps = 5
elif eps_value < 6.2:
eps = 6
else:
eps = 7
F1 = max(0, F11[eps] + delta * F12[eps] + zenith[i] * F13[eps])
F2 = F21[eps] + delta * F22[eps] + zenith[i] * F23[eps]
R_D = (1 - F1) * (1 - np.cos(self.tilt_angle*np.pi/180)) / 2 + F1 * a_coeff/c_coeff + F2* np.sin(self.tilt_angle*np.pi/180)
GDk = GDh * R_D

Gk.append(GBk + GDk + Grk)
except:
Gk.append(np.maximum(data['DNI'].iloc[i], data['GHI'].iloc[i]))
else:
zenith.append( 0 )
azimuth.append( 0 )
aoi.append(0)

# print(np.dot(aoi[0:24], 180/pi))
Gk.append(0)

self.mass_flow_design = self.qm * self.A
aoi_design = aoi[row_design]
Expand Down
58 changes: 51 additions & 7 deletions PSA/StaticCollector_flatplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self,
initial_water_temp=85, # inlet water temperature in the solar field, ºC
outlet_water_temp=95, # outlet water temperature in the solar field, ºC
cleanless_factor = 0.95,

albedo = 0.15,
qm=0.02, # specific mass flow rate of collector (kg/s m2)
Tamb_D=30, # design point ambient temperature, C

Expand Down Expand Up @@ -80,6 +80,7 @@ def __init__(self,
self.v2=v2
self.weatherfile= file_name
self.cleanless_factor = cleanless_factor
self.albedo = albedo

#%
def design(self):
Expand All @@ -98,8 +99,13 @@ def design(self):
T_amb = np.asarray(data['Tdry'])
T_amb_design = self.Tamb_D

# Update Gk (in-plate radiation)
Gk = np.maximum(np.asarray(data['DNI']), np.asarray(data['GHI']))
# Perez coefficients
F11 = [-0.008, 0.130, 0.330, 0.568, 0.873, 1.133, 1.060, 0.678]
F12 = [0.588, 0.683, 0.487, 0.187,-0.392,-1.237,-1.600,-0.327]
F13 = [-0.062,-0.151,-0.221,-0.295,-0.362,-0.412,-0.359,-0.250]
F21 = [-0.060,-0.019, 0.055, 0.109, 0.226, 0.288, 0.264, 0.156]
F22 = [0.072, 0.066,-0.064,-0.152,-0.462,-0.823,-1.127,-1.377]
F23 = [-0.022,-0.029,-0.026,-0.014, 0.001, 0.056, 0.131, 0.251]

Gk_design = self.G

Expand All @@ -113,6 +119,7 @@ def design(self):
zenith = []
azimuth = []
aoi = []
Gk = []
for i in range(len(data)):
# Get hour angle (radian)
dayofyear.append(Month[data['Month'].iloc[i]-1] + data['Day'].iloc[i])
Expand All @@ -135,14 +142,51 @@ def design(self):
+ np.sin(declination[i])*np.cos(self.Lat*np.pi/180)*np.sin(self.tilt_angle*np.pi/180)*np.cos(azimuth[i])
+ np.cos(declination[i])*np.cos(self.Lat*np.pi/180)*np.cos(self.tilt_angle*np.pi/180)*np.cos(HRA[i])
- np.cos(declination[i])*np.sin(self.Lat*np.pi/180)*np.sin(self.tilt_angle*np.pi/180)*np.cos(azimuth[i])*np.cos(HRA[i])
- np.cos(declination[i])*np.sin(self.tilt_angle*np.pi/180)*np.sin(azimuth[i])*np.sin(HRA[i])))

- np.cos(declination[i])*np.sin(self.tilt_angle*np.pi/180)*np.sin(azimuth[i])*np.sin(HRA[i])))
# Perez model to calculate Gk: gloabl irradiance over tilted surface
try:
Gh = data['GHI'].iloc[i]
GDh = data['DHI'].iloc[i]
GBn = data['DNI'].iloc[i]
GBk = GBn * np.cos(aoi[i])
Rr = (1 - np.cos(self.tilt_angle*np.pi/180)) / 2
Grk = self.albedo * Gh * Rr
a_coeff = max(0, np.cos(aoi[i]))
c_coeff = max(np.cos(85*np.pi/180), np.cos(zenith[i]))

G_0n = 1367 * (1.000110 + 0.034221 * np.cos(B[i]) + 0.001280 * np.sin(B[i]) + 0.000719 * np.cos(2*B[i]) + 0.000077 * np.sin(2*B[i]))
delta = GDh / G_0n / np.cos(zenith[i])
eps_value = ((GDh + GBn) / GDh + 1.041 * zenith[i]**3)/ (1 + 1.041 * zenith[i]**3)

if eps_value < 1.065:
eps = 0
elif eps_value < 1.23:
eps = 1
elif eps_value < 1.5:
eps = 2
elif eps_value < 1.95:
eps = 3
elif eps_value < 2.8:
eps = 4
elif eps_value < 4.5:
eps = 5
elif eps_value < 6.2:
eps = 6
else:
eps = 7
F1 = max(0, F11[eps] + delta * F12[eps] + zenith[i] * F13[eps])
F2 = F21[eps] + delta * F22[eps] + zenith[i] * F23[eps]
R_D = (1 - F1) * (1 - np.cos(self.tilt_angle*np.pi/180)) / 2 + F1 * a_coeff/c_coeff + F2* np.sin(self.tilt_angle*np.pi/180)
GDk = GDh * R_D

Gk.append(GBk + GDk + Grk)
except:
Gk.append(np.maximum(data['DNI'].iloc[i], data['GHI'].iloc[i]))
else:
zenith.append( 0 )
azimuth.append( 0 )
aoi.append(0)

# print(np.dot(aoi[0:24], 180/pi))
Gk.append(0)

self.mass_flow_design = self.qm * self.A
aoi_design = aoi[row_design]
Expand Down

0 comments on commit ad4ae12

Please sign in to comment.