Skip to content

Conversation

@cwhanse
Copy link
Member

@cwhanse cwhanse commented Mar 12, 2021

  • Closes Duplicate Notes header in PVSystem.fuentes_celltemp method #1194
  • I am familiar with the contributing guidelines
  • Tests added
  • Updates entries to docs/sphinx/source/api.rst for API changes.
  • Adds description and name entries in the appropriate "what's new" file in docs/sphinx/source/whatsnew for all changes. Includes link to the GitHub Issue with :issue:`num` or this Pull Request with :pull:`num`. Includes contributor name and/or GitHub username (link with :ghuser:`user`).
  • New code is fully documented. Includes numpydoc compliant docstrings, examples, and comments where necessary.
  • Pull request is nearly complete and ready for detailed review.
  • Maintainer: Appropriate GitHub Labels and Milestone are assigned to the Pull Request and linked Issue.

Continuation of #1177

@cwhanse cwhanse added this to the 0.9.0 milestone Mar 13, 2021
Returns
-------
numeric or tuple of numeric
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above


def _build_kwargs_noct_sam(array):
temp_model_kwargs = _build_kwargs([
'noct', 'eta_m_ref', 'transmittance_absorptance',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noct and eta_m_ref are required parameters, not keyword arguments with defaults, so we need to perform explicit lookups for them. User should see a KeyError if they're not found in each array.temperature_model_parameters.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added explicit calls and a ValueError

weather, mocker):
weather['wind_speed'] = 5
weather['temp_air'] = 10
sapm_dc_snl_ac_system.temperature_model_parameters = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1196 will need to update for this one too

Comment on lines 1001 to 1004
arg_list = [poa, temp_air, wind_speed]
if model == self.system.noct_sam_celltemp:
arg_list += [self.results.effective_irradiance]
self.results.cell_temperature = model(*tuple(arg_list))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
arg_list = [poa, temp_air, wind_speed]
if model == self.system.noct_sam_celltemp:
arg_list += [self.results.effective_irradiance]
self.results.cell_temperature = model(*tuple(arg_list))
kwargs = {}
if model == self.system.noct_sam_celltemp:
kwargs['effective_irradiance'] = self.results.effective_irradiance
self.results.cell_temperature = model(poa, temp_air, wind_speed, **kwargs)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to pass keyword arguments as keyword arguments, but I don't feel strongly about it so feel free to reject.

wind_speed : numeric or tuple of numeric
Wind speed in m/s at a height of 10 meters.
effective_irradiance : numeric, tuple of numeric or None.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
effective_irradiance : numeric, tuple of numeric or None.
effective_irradiance : numeric, tuple of numeric, or None.

'array_height', 'mount_standoff'],
array.temperature_model_parameters)
try:
temp_model_kwargs['noct'] = \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
temp_model_kwargs['noct'] = \
# noct_sam required args.
# bundled with kwargs for simplicity
temp_model_kwargs['noct'] = \

temp_model_kwargs['eta_m_ref'] = \
array.temperature_model_parameters['eta_m_ref']
except KeyError:
msg = ('Parameter noct and eta_m_ref are required.'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
msg = ('Parameter noct and eta_m_ref are required.'
msg = ('Parameters noct and eta_m_ref are required.'

@wholmgren wholmgren merged commit f7f9dbb into pvlib:master Mar 15, 2021
@wholmgren wholmgren added the SPI DOE SETO Solar Performance Insight project label Mar 15, 2021
Comment on lines +1001 to +1005
arg_list = [poa, temp_air, wind_speed]
kwargs = {}
if model == self.system.noct_sam_celltemp:
kwargs['effective_irradiance'] = self.results.effective_irradiance
self.results.cell_temperature = model(*tuple(arg_list))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cwhanse when attempting to merge your changes into #1197 I realized that this is not correct because kwargs is not passed to the function. I had suggested

self.results.cell_temperature = model(poa, temp_air, wind_speed, **kwargs)

if you want to keep arg_list, this would also work:

self.results.cell_temperature = model(*arg_list, **kwargs)

note there is no need to cast the list to a tuple.

When fixing, we should add a test to ensure this value is passed properly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My mistake, I'll fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement SPI DOE SETO Solar Performance Insight project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicate Notes header in PVSystem.fuentes_celltemp method

2 participants