Skip to content

Commit 840beb7

Browse files
added main placeholder test and temporarily took out module area in short wave heat transfer calculation
1 parent bfdcf0e commit 840beb7

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

pvlib/temperature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ def hayes(poa_effective, temp_air, wind_speed, module_efficiency, module_area,
796796
dt = pd.to_timedelta(to_offset(freq)).seconds
797797

798798
# radiation (from sun)
799-
q_short_wave_radiation = module_area * poa_effective
799+
q_short_wave_radiation = poa_effective # module_area * poa_effective
800800

801801
# converted electrical energy
802802
p_out = module_efficiency * module_area * poa_effective

pvlib/tests/test_temperature.py

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from conftest import DATA_DIR, assert_series_equal
66
from numpy.testing import assert_allclose
77

8-
from pvlib import temperature
8+
from pvlib import temperature, location, irradiance, iam
99

1010

1111
@pytest.fixture
@@ -206,5 +206,56 @@ def test__calculate_radiative_heat():
206206

207207
def test_hayes():
208208
# TODO placeholder until final model is validated
209-
pass
210209

210+
# simulate psm3 data
211+
data_psm3 = [
212+
{'Latitude': 39.66, 'Longitude': -105.207},
213+
pd.DataFrame(
214+
data={
215+
'DNI': [0, 163, 133, 189],
216+
'DHI': [0, 4, 12, 16],
217+
'GHI': [0, 7, 16, 25],
218+
'Temperature': [-13.2, -13.1, -13.1, -13],
219+
'Wind Speed': [1.6, 1.7, 1.7, 1.7]
220+
},
221+
index=pd.date_range('2019-01-01 07:25:00',
222+
'2019-01-01 07:40:00',
223+
freq='5min')
224+
)
225+
]
226+
227+
# data preparation
228+
module_tilt = 30
229+
module_azimuth = 180
230+
site = location.Location(
231+
latitude=data_psm3[0]['Latitude'],
232+
longitude=data_psm3[0]['Longitude'],
233+
tz='MST'
234+
)
235+
solar_position = site.get_solarposition(times=data_psm3[1].index)
236+
poa_global = irradiance.get_total_irradiance(
237+
surface_tilt=module_tilt,
238+
surface_azimuth=module_azimuth,
239+
dni=data_psm3[1]['DNI'],
240+
ghi=data_psm3[1]['GHI'],
241+
dhi=data_psm3[1]['DHI'],
242+
solar_zenith=solar_position['apparent_zenith'],
243+
solar_azimuth=solar_position['azimuth']
244+
)['poa_global']
245+
temp_air = data_psm3[1]['Temperature']
246+
wind_speed = data_psm3[1]['Wind Speed']
247+
248+
# 1. Calculate module temp with new model
249+
aoi = irradiance.aoi(module_tilt, module_azimuth,
250+
solar_position['zenith'],
251+
solar_position['azimuth'])
252+
poa_effective = poa_global.multiply(iam.ashrae(aoi))
253+
module_efficiency = 0.176
254+
module_area = 2.47 # m^2
255+
module_weight = 34.5
256+
tmod_hayes = temperature.hayes(poa_effective, temp_air, wind_speed,
257+
module_efficiency, module_area,
258+
module_weight, module_tilt)
259+
260+
assert [round(t, 2) for t in tmod_hayes.values] == \
261+
[-13.20, -7.81, -8.98, -9.85]

0 commit comments

Comments
 (0)