Skip to content

improve modelchain inference error text #703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/sphinx/source/whatsnew/v0.6.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Enhancements
* Add SOLRAD data reader to :ref:`iotools`.
* Add EPW data reader to :ref:`iotools`. (:issue:`591`)
* Add PSM3 reader to :ref:`iotools`. (:issue:`592`)
* Improve ModelChain inference method error text. (:issue:`621`)

Bug fixes
~~~~~~~~~
Expand Down Expand Up @@ -60,3 +61,4 @@ Contributors
* Todd Hendricks (:ghuser:`tahentx`)
* Kevin Anderson (:ghuser:`kevinsa5`)
* :ghuser:`bentomlinson`
* Jonathan Gaffiot (:ghuser:`jgaffiot`)
24 changes: 18 additions & 6 deletions pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ class ModelChain(object):
interface for all of the modeling steps necessary for calculating PV
power from a time series of weather inputs.

See https://pvlib-python.readthedocs.io/en/stable/modelchain.html
for examples.

Parameters
----------
system : PVSystem
Expand Down Expand Up @@ -411,7 +414,9 @@ def infer_dc_model(self):
return self.pvwatts_dc, 'pvwatts'
else:
raise ValueError('could not infer DC model from '
'system.module_parameters')
'system.module_parameters. Check '
'system.module_parameters or explicitly '
'set the model with the dc_model kwarg.')

def sapm(self):
self.dc = self.system.sapm(self.effective_irradiance/1000.,
Expand Down Expand Up @@ -530,7 +535,9 @@ def infer_ac_model(self):
return self.pvwatts_inverter
else:
raise ValueError('could not infer AC model from '
'system.inverter_parameters')
'system.inverter_parameters. Check '
'system.inverter_parameters or explicitly '
'set the model with the ac_model kwarg.')

def snlinverter(self):
self.ac = self.system.snlinverter(self.dc['v_mp'], self.dc['p_mp'])
Expand Down Expand Up @@ -577,7 +584,11 @@ def infer_aoi_model(self):
return self.ashrae_aoi_loss
else:
raise ValueError('could not infer AOI model from '
'system.module_parameters')
'system.module_parameters. Check that the '
'system.module_parameters contain parameters for '
'the physical, aoi, or ashrae model; explicitly '
'set model with aoi_model kwarg; or set '
'aoi_model="no_loss".')

def ashrae_aoi_loss(self):
self.aoi_modifier = self.system.ashraeiam(self.aoi)
Expand Down Expand Up @@ -628,9 +639,10 @@ def infer_spectral_model(self):
else:
raise ValueError('could not infer spectral model from '
'system.module_parameters. Check that the '
'parameters contain valid '
'first_solar_spectral_coefficients or a valid '
'Material or Technology value')
'system.module_parameters contain valid '
'first_solar_spectral_coefficients, a valid '
'Material or Technology value, or set '
'spectral_model="no_loss".')

def first_solar_spectral_loss(self):
self.spectral_modifier = self.system.first_solar_spectral_loss(
Expand Down