Skip to content

Commit a07462e

Browse files
authored
fixed bug with eta_inv_ref and temp_ref in PVSystems pvwatts methods (#253)
1 parent 0b918f1 commit a07462e

File tree

3 files changed

+35
-10
lines changed

3 files changed

+35
-10
lines changed

docs/sphinx/source/whatsnew/v0.4.2.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ Bug fixes
1010
~~~~~~~~~
1111

1212
* Fixed typo in __repr__ method of ModelChain and in its regarding test. (commit: b691358b)
13-
13+
* PVSystem.pvwatts_ac could not use the eta_inv_ref kwarg and
14+
PVSystem.pvwatts_dc could not use the temp_ref kwarg. Fixed. (:issue:`252`)
1415

1516
API Changes
1617
~~~~~~~~~~~
@@ -29,4 +30,5 @@ Code Contributors
2930
~~~~~~~~~~~~~~~~~
3031

3132
* Uwe Krien
33+
* Will Holmgren
3234
* Volker Beutner

pvlib/pvsystem.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,12 @@ def pvwatts_dc(self, g_poa_effective, temp_cell):
489489
490490
See :py:func:`pvwatts_dc` for details.
491491
"""
492+
kwargs = _build_kwargs(['temp_ref'], self.module_parameters)
493+
492494
return pvwatts_dc(g_poa_effective, temp_cell,
493495
self.module_parameters['pdc0'],
494-
self.module_parameters['gamma_pdc'])
496+
self.module_parameters['gamma_pdc'],
497+
**kwargs)
495498

496499
def pvwatts_losses(self, **kwargs):
497500
"""
@@ -512,8 +515,10 @@ def pvwatts_ac(self, pdc):
512515
513516
See :py:func:`pvwatts_ac` for details.
514517
"""
515-
return pvwatts_ac(pdc, self.module_parameters['pdc0'],
516-
eta_inv_nom=self.inverter_parameters['eta_inv_nom'])
518+
kwargs = _build_kwargs(['eta_inv_nom', 'eta_inv_ref'],
519+
self.inverter_parameters)
520+
521+
return pvwatts_ac(pdc, self.module_parameters['pdc0'], **kwargs)
517522

518523
def localize(self, location=None, latitude=None, longitude=None,
519524
**kwargs):

pvlib/test/test_pvsystem.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -786,34 +786,52 @@ def test_pvwatts_losses_series():
786786
assert_series_equal(expected, out)
787787

788788

789-
def make_pvwatts_system():
789+
def make_pvwatts_system_defaults():
790790
module_parameters = {'pdc0': 100, 'gamma_pdc': -0.003}
791-
inverter_parameters = {'eta_inv_nom': 0.95}
791+
inverter_parameters = {}
792+
system = pvsystem.PVSystem(module_parameters=module_parameters,
793+
inverter_parameters=inverter_parameters)
794+
return system
795+
796+
797+
def make_pvwatts_system_kwargs():
798+
module_parameters = {'pdc0': 100, 'gamma_pdc': -0.003, 'temp_ref': 20}
799+
inverter_parameters = {'eta_inv_nom': 0.95, 'eta_inv_ref': 1.0}
792800
system = pvsystem.PVSystem(module_parameters=module_parameters,
793801
inverter_parameters=inverter_parameters)
794802
return system
795803

796804

797805
def test_PVSystem_pvwatts_dc():
798-
system = make_pvwatts_system()
806+
system = make_pvwatts_system_defaults()
799807
irrad_trans = pd.Series([np.nan, 900, 900])
800808
temp_cell = pd.Series([30, np.nan, 30])
801809
expected = pd.Series(np.array([ nan, nan, 88.65]))
802810
out = system.pvwatts_dc(irrad_trans, temp_cell)
803811
assert_series_equal(expected, out)
804812

813+
system = make_pvwatts_system_kwargs()
814+
expected = pd.Series(np.array([ nan, nan, 87.3]))
815+
out = system.pvwatts_dc(irrad_trans, temp_cell)
816+
assert_series_equal(expected, out)
817+
805818

806819
def test_PVSystem_pvwatts_losses():
807-
system = make_pvwatts_system()
820+
system = make_pvwatts_system_defaults()
808821
expected = pd.Series([nan, 14.934904])
809822
age = pd.Series([nan, 1])
810823
out = system.pvwatts_losses(age=age)
811824
assert_series_equal(expected, out)
812825

813826

814827
def test_PVSystem_pvwatts_ac():
815-
system = make_pvwatts_system()
828+
system = make_pvwatts_system_defaults()
816829
pdc = pd.Series([np.nan, 50, 100])
817-
expected = pd.Series(np.array([ nan, 47.608436, 95. ]))
830+
expected = pd.Series(np.array([ nan, 48.1095776694, 96.0]))
831+
out = system.pvwatts_ac(pdc)
832+
assert_series_equal(expected, out)
833+
834+
system = make_pvwatts_system_kwargs()
835+
expected = pd.Series(np.array([ nan, 45.88025, 91.5515]))
818836
out = system.pvwatts_ac(pdc)
819837
assert_series_equal(expected, out)

0 commit comments

Comments
 (0)