8000 Fixed pvwatts_ac model bug using module pdc0 instead of inverted pdc0… · soareshpaulo/pvlib-python@d7feb60 · GitHub
[go: up one dir, main page]

Skip to content

Commit d7feb60

Browse files
JPalakapillyKWHcwhanse
authored andcommitted
Fixed pvwatts_ac model bug using module pdc0 instead of inverted pdc0 (pvlib#735)
* Fixed pvwatts_ac model bug using module pdc0 instead of inverted pdc0 * Edited docstrings * Fixed lint error * Edited test to pass and updated docstring * deleted trailing whitespace * fixed line too long... i need to get a linter smh * Removed DS_store from earlier commit, added .DS_Store to gitignore * Updated docstrings with Cliff's suggestions. * Removed trailing whitespace (for the last time) * Fixed spelling in pvwatts_ac docstring * Update v0.6.4.rst
1 parent de47a36 commit d7feb60

File tree

6 files changed

+25
-14
lines changed

6 files changed

+25
-14
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,6 @@ coverage.xml
8686
#Ignore some notebooks
8787
*.ipynb
8888
!docs/tutorials/*.ipynb
89+
90+
#Ignore Mac DS_store files
91+
*.DS_Store

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,13 @@ Bug fixes
1919
~~~~~~~~~
2020
* Fix installation issue due to missing ``requests`` dependency.
2121
(:issue:`725`)
22-
23-
22+
* Fix PVSystem.pvwatts_ac now uses inverter DC input limit instead of module nameplate capacity.
23+
(:issue:`734`)
2424
Testing
2525
~~~~~~~
2626

2727

2828
Contributors
2929
~~~~~~~~~~~~
3030
* Will Holmgren (:ghuser:`wholmgren`)
31+
* Joseph Palakapilly (:ghuser:`JPalakapillyKWH`)

pvlib/modelchain.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,12 +526,11 @@ def ac_model(self, model):
526526

527527
def infer_ac_model(self):
528528
inverter_params = set(self.system.inverter_parameters.keys())
529-
module_params = set(self.system.module_parameters.keys())
530529
if set(['C0', 'C1', 'C2']) <= inverter_params:
531530
return self.snlinverter
532531
elif set(['ADRCoefficients']) <= inverter_params:
533532
return self.adrinverter
534-
elif set(['pdc0']) <= module_params:
533+
elif set(['pdc0']) <= inverter_params:
535534
return self.pvwatts_inverter
536535
else:
537536
raise ValueError('could not infer AC model from '

pvlib/pvsystem.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ def pvwatts_ac(self, pdc):
736736
kwargs = _build_kwargs(['eta_inv_nom', 'eta_inv_ref'],
737737
self.invert 8000 er_parameters)
738738

739-
return pvwatts_ac(pdc, self.module_parameters['pdc0'], **kwargs)
739+
return pvwatts_ac(pdc, self.inverter_parameters['pdc0'], **kwargs)
740740

741741
def localize(self, location=None, latitude=None, longitude=None,
742742
**kwargs):
@@ -2839,6 +2839,11 @@ def pvwatts_dc(g_poa_effective, temp_cell, pdc0, gamma_pdc, temp_ref=25.):
28392839
28402840
P_{dc} = \frac{G_{poa eff}}{1000} P_{dc0} ( 1 + \gamma_{pdc} (T_{cell} - T_{ref}))
28412841
2842+
Note that the pdc0 is also used as a symbol in :py:func:`pvwatts_ac`. pdc0
2843+
in this function refers to the DC power of the modules at reference
2844+
conditions. pdc0 in :py:func:`pvwatts_ac` refers to the DC power input
2845+
limit of the inverter.
2846+
28422847
Parameters
28432848
----------
28442849
g_poa_effective: numeric
@@ -2849,7 +2854,7 @@ def pvwatts_dc(g_poa_effective, temp_cell, pdc0, gamma_pdc, temp_ref=25.):
28492854
temp_cell: numeric
28502855
Cell temperature in degrees C.
28512856
pdc0: numeric
2852-
Nameplate DC rating.
2857+
Power of the modules at 1000 W/m2 and cell reference temperature.
28532858
gamma_pdc: numeric
28542859
The temperature coefficient in units of 1/C. Typically -0.002 to
28552860
-0.005 per degree C.
@@ -2942,12 +2947,17 @@ def pvwatts_ac(pdc, pdc0, eta_inv_nom=0.96, eta_inv_ref=0.9637):
29422947
29432948
where :math:`\zeta=P_{dc}/P_{dc0}` and :math:`P_{dc0}=P_{ac0}/\eta_{nom}`.
29442949
2950+
Note that the pdc0 is also used as a symbol in :py:func:`pvwatts_dc`. pdc0
2951+
in this function refers to the DC power input limit of the inverter.
2952+
pdc0 in :py:func:`pvwatts_dc` refers to the DC power of the modules
2953+
at reference conditions.
2954+
29452955
Parameters
29462956
----------
29472957
pdc: numeric
29482958
DC power.
29492959
pdc0: numeric
2950-
Nameplate DC rating.
2960+
DC input limit of the inverter.
29512961
eta_inv_nom: numeric, default 0.96
29522962
Nominal inverter efficiency.
29532963
eta_inv_ref: numeric, default 0.9637

pvlib/test/test_modelchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def pvwatts_dc_snl_ac_system(sam_data):
106106
@pytest.fixture
107107
def pvwatts_dc_pvwatts_ac_system(sam_data):
108108
module_parameters = {'pdc0': 220, 'gamma_pdc': -0.003}
109-
inverter_parameters = {'eta_inv_nom': 0.95}
109+
inverter_parameters = {'pdc0': 220, 'eta_inv_nom': 0.95}
110110
system = PVSystem(surface_tilt=32.2, surface_azimuth=180,
111111
module_parameters=module_parameters,
112112
inverter_parameters=inverter_parameters)

pvlib/test/test_pvsystem.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,15 +1424,15 @@ def test_pvwatts_losses_series():
14241424

14251425
def make_pvwatts_system_defaults():
14261426
module_parameters = {'pdc0': 100, 'gamma_pdc': -0.003}
1427-
inverter_parameters = {}
1427+
inverter_parameters = {'pdc0': 90}
14281428
system = pvsystem.PVSystem(module_parameters=module_parameters,
14291429
inverter_parameters=inverter_parameters)
14301430
return system
14311431

14321432

14331433
def make_pvwatts_system_kwargs():
14341434
module_parameters = {'pdc0': 100, 'gamma_pdc': -0.003, 'temp_ref': 20}
1435-
inverter_parameters = {'eta_inv_nom': 0.95, 'eta_inv_ref': 1.0}
1435+
inverter_parameters = {'pdc0': 90, 'eta_inv_nom': 0.95, 'eta_inv_ref': 1.0}
14361436
system = pvsystem.PVSystem(module_parameters=module_parameters,
14371437
inverter_parameters=inverter_parameters)
14381438
return system
@@ -1477,9 +1477,8 @@ def test_PVSystem_pvwatts_ac(mocker):
14771477
mocker.spy(pvsystem, 'pvwatts_ac')
14781478
system = make_pvwatts_system_defaults()
14791479
pdc = 50
1480-
pdc0 = system.module_parameters['pdc0']
14811480
out = system.pvwatts_ac(pdc)
1482-
pvsystem.pvwatts_ac.assert_called_once_with(pdc, pdc0,
1481+
pvsystem.pvwatts_ac.assert_called_once_with(pdc,
14831482
**system.inverter_parameters)
14841483
assert out < pdc
14851484

@@ -1488,8 +1487,7 @@ def test_PVSystem_pvwatts_ac_kwargs(mocker):
14881487
mocker.spy(pvsystem, 'pvwatts_ac')
14891488
system = make_pvwatts_system_kwargs()
14901489
pdc = 50
1491-
pdc0 = system.module_parameters['pdc0']
14921490
out = system.pvwatts_ac(pdc)
1493-
pvsystem.pvwatts_ac.assert_called_once_with(pdc, pdc0,
1491+
pvsystem.pvwatts_ac.assert_called_once_with(pdc,
14941492
**system.inverter_parameters)
14951493
assert out < pdc

0 commit comments

Comments
 (0)
0