Skip to content

Commit 5d2a6c8

Browse files
CameronTStarkcwhanse
authored andcommitted
Add PVSystem pvsyst_celltemp methods (#636)
* Add PVSystem pvsyst_celltemp methods * fix _delta_kt_prime_dirint end values (#638) * fix _delta_kt_prime_dirint end values * syntax, test fixes: * syntax and test fixes * more test fixes * more test fixes * and more test fixes * and still more test fixes * add comments, update whatsnew * delete space * Add PVSystem pvsyst_celltemp methods * create global TEMP_MODELS for sapm and pvsyst * correct model choice in pvsyst_celltemp function * Add PVSystem pvsyst_celltemp methods * create global TEMP_MODELS for sapm and pvsyst * correct model choice in pvsyst_celltemp function * convert sapm temp models to tuples * implement _build_kwargs into pvsyst_celltemp * amend with non-default parameters and new api * Stickler-ci polish
1 parent c238c48 commit 5d2a6c8

File tree

3 files changed

+52
-10
lines changed

3 files changed

+52
-10
lines changed

docs/sphinx/source/whatsnew/v0.6.1.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Enhancements
6060
* Add option for :py:func:`pvlib.irradiance.disc` to use relative airmass
6161
by supplying `pressure=None`. (:issue:`449`)
6262
* Created :py:func:`pvlib.pvsystem.pvsyst_celltemp` to implement PVsyst's cell temperature model. (:issue:`552`)
63+
* Add `PVSystem` class method :py:func:`~pvlib.pvsystem.PVSystem.pvsyst_celltemp` (:issue:`633`)
6364

6465

6566
Bug fixes

pvlib/pvsystem.py

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@
4646
}
4747

4848

49+
TEMP_MODELS = {
50+
'sapm': {'open_rack_cell_glassback': (-3.47, -.0594, 3),
51+
'roof_mount_cell_glassback': (-2.98, -.0471, 1),
52+
'open_rack_cell_polymerback': (-3.56, -.0750, 3),
53+
'insulated_back_polymerback': (-2.81, -.0455, 0),
54+
'open_rack_polymer_thinfilm_steel': (-3.58, -.113, 3),
55+
'22x_concentrator_tracker': (-3.23, -.130, 13)},
56+
'pvsyst': {'freestanding': (29.0, 0), 'insulated': (15.0, 0)}
57+
}
58+
4959
# not sure if this belongs in the pvsystem module.
5060
# maybe something more like core.py? It may eventually grow to
5161
# import a lot more functionality from other modules.
@@ -511,6 +521,23 @@ def sapm_effective_irradiance(self, poa_direct, poa_diffuse,
511521
poa_direct, poa_diffuse, airmass_absolute, aoi,
512522
self.module_parameters, reference_irradiance=reference_irradiance)
513523

524+
def pvsyst_celltemp(self, poa_global, wind_speed, temp_air):
525+
"""Uses :py:func:`pvsyst_celltemp` to calculate module temperatures
526+
based on ``self.racking_model`` and the input parameters.
527+
528+
Parameters
529+
----------
530+
See pvsystem.pvsyst_celltemp for details
531+
532+
Returns
533+
-------
534+
See pvsystem.pvsyst_celltemp for details
535+
"""
536+
kwargs = _build_kwargs(['eta_m', 'alpha_absorption'],
537+
self.module_parameters)
538+
return pvsyst_celltemp(poa_global, wind_speed, temp_air,
539+
temp_model=self.racking_model, **kwargs)
540+
514541
def first_solar_spectral_loss(self, pw, airmass_absolute):
515542

516543
"""
@@ -1860,13 +1887,7 @@ def sapm_celltemp(poa_global, wind_speed, temp_air,
18601887
sapm
18611888
'''
18621889

1863-
temp_models = {'open_rack_cell_glassback': [-3.47, -.0594, 3],
1864-
'roof_mount_cell_glassback': [-2.98, -.0471, 1],
1865-
'open_rack_cell_polymerback': [-3.56, -.0750, 3],
1866-
'insulated_back_polymerback': [-2.81, -.0455, 0],
1867-
'open_rack_polymer_thinfilm_steel': [-3.58, -.113, 3],
1868-
'22x_concentrator_tracker': [-3.23, -.130, 13]
1869-
}
1890+
temp_models = TEMP_MODELS['sapm']
18701891

18711892
if isinstance(model, str):
18721893
model = temp_models[model.lower()]
@@ -1880,9 +1901,9 @@ def sapm_celltemp(poa_global, wind_speed, temp_air,
18801901

18811902
E0 = 1000. # Reference irradiance
18821903

1883-
temp_module = pd.Series(poa_global*np.exp(a + b*wind_speed) + temp_air)
1904+
temp_module = pd.Series(poa_global * np.exp(a + b * wind_speed) + temp_air)
18841905

1885-
temp_cell = temp_module + (poa_global / E0)*(deltaT)
1906+
temp_cell = temp_module + (poa_global / E0) * (deltaT)
18861907

18871908
return pd.DataFrame({'temp_cell': temp_cell, 'temp_module': temp_module})
18881909

@@ -1944,7 +1965,7 @@ def pvsyst_celltemp(poa_global, wind_speed, temp_air, eta_m=0.1,
19441965
photovoltaic modules." Progress in Photovoltaics 16(4): 307-315.
19451966
"""
19461967

1947-
temp_models = {"freestanding": (29.0, 0), "insulated": (15.0, 0)}
1968+
temp_models = TEMP_MODELS['pvsyst']
19481969

19491970
if isinstance(temp_model, str):
19501971
natural_convenction_coeff, forced_convection_coeff = temp_models[

pvlib/test/test_pvsystem.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,6 +1118,26 @@ def test_pvsyst_celltemp_with_index():
11181118
assert_series_equal(expected, pvtemps)
11191119

11201120

1121+
def test_PVSystem_pvsyst_celltemp(mocker):
1122+
racking_model = 'insulated'
1123+
alpha_absorption = 0.85
1124+
eta_m = 0.17
1125+
module_parameters = {}
1126+
module_parameters['alpha_absorption'] = alpha_absorption
1127+
module_parameters['eta_m'] = eta_m
1128+
system = pvsystem.PVSystem(racking_model=racking_model,
1129+
module_parameters=module_parameters)
1130+
mocker.spy(pvsystem, 'pvsyst_celltemp')
1131+
irrad = 800
1132+
temp = 45
1133+
wind = 0.5
1134+
out = system.pvsyst_celltemp(irrad, wind, temp)
1135+
pvsystem.pvsyst_celltemp.assert_called_once_with(
1136+
irrad, wind, temp, eta_m, alpha_absorption, racking_model)
1137+
assert isinstance(out, float)
1138+
assert out < 90 and out > 70
1139+
1140+
11211141
def test_adrinverter(sam_data):
11221142
inverters = sam_data['adrinverter']
11231143
testinv = 'Ablerex_Electronics_Co___Ltd___' \

0 commit comments

Comments
 (0)