Skip to content

Add loss input to example in modelchain.with_pvwatts docs #1863

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 6 commits into from
Sep 21, 2023
Merged
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
36 changes: 29 additions & 7 deletions pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,17 +582,39 @@ def with_pvwatts(cls, system, location,
constructor and take precedence over the default
configuration.

Warning
-------
The PVWatts model defaults to 14 % total system losses. The PVWatts
losses are fractions of DC power and can be modified, as shown in the
example below.

Examples
--------
>>> from pvlib import temperature, pvsystem, location, modelchain
>>> module_parameters = dict(gamma_pdc=-0.003, pdc0=4500)
>>> inverter_parameters = dict(pdc0=4000)
>>> tparams = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
>>> system = PVSystem(surface_tilt=30, surface_azimuth=180,
... module_parameters=module_parameters,
... inverter_parameters=inverter_parameters,
... temperature_model_parameters=tparams)
>>> location = Location(32.2, -110.9)
>>> ModelChain.with_pvwatts(system, location)
>>> tparams = temperature.TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']
>>> system = pvsystem.PVSystem(
>>> surface_tilt=30, surface_azimuth=180,
>>> module_parameters=module_parameters,
>>> inverter_parameters=inverter_parameters,
>>> temperature_model_parameters=tparams)
>>> loc = location.Location(32.2, -110.9)
>>> modelchain.ModelChain.with_pvwatts(system, loc)

The following example is a modification of the example above but where
custom losses have been specified.

>>> pvwatts_losses = {'soiling': 2, 'shading': 3, 'snow': 0, 'mismatch': 2,
>>> 'wiring': 2, 'connections': 0.5, 'lid': 1.5,
>>> 'nameplate_rating': 1, 'age': 0, 'availability': 30}
Comment on lines +608 to +610
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should have two examples here, one that keeps things as simple as possible, and one that gets more into the weeds (like specifying losses)? with_pvwatts is an easy point of entry for ModelChain, and PVWatts isn't really the model to use if you care a lot about the details, so I'm hesitant to make the only usage example more complicated.

IMHO there is also an argument to be made that PVWatts losses aren't really legitimate on their own and are better regarded as a single combined fudge factor, but maybe that's just my editorializing.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think users should ever run a model without any considerations for what losses are specified or at least be aware that losses are accounted for by the model? Acknowledging and accepting the default values is perfectly resonable, but awareness of what they are seems pertinent.

Copy link
Member Author

@AdamRJensen AdamRJensen Sep 18, 2023

Choose a reason for hiding this comment

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

I have created two examples, one simple and one that builds upon the simple one where the losses are modified.

Let me know if it warrants a whatsnew entry (I don't think it does).

>>> system_with_custom_losses = pvsystem.PVSystem(
>>> surface_tilt=30, surface_azimuth=180,
>>> module_parameters=module_parameters,
>>> inverter_parameters=inverter_parameters,
>>> temperature_model_parameters=tparams,
>>> losses_parameters=pvwatts_losses)
>>> modelchain.ModelChain.with_pvwatts(system_with_custom_losses, loc)
ModelChain:
name: None
clearsky_model: ineichen
Expand Down