10000 Change setter for losses_model to allow it to set multiple loss funct… by ncroft-b4 · Pull Request #1084 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Change setter for losses_model to allow it to set multiple loss funct… #1084

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

Closed
wants to merge 19 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Adds functionality for 'pvsyst' to be used as a losses_model. Adds a …
…function for calculating dc losses from a loss percentage at stc based on the method employed by pvsyst.
  • Loading branch information
ncroft-b4 committed Oct 30, 2020
commit 56e1597b20d6da501f71d0611756ffc1ea7e03aa
20 changes: 18 additions & 2 deletions pvlib/modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ class ModelChain:
user-defined function.

losses_model: str, default 'no_loss'
Valid strings are 'pvwatts', 'no_loss'. The loss functions will
be set according to this parameter.
Valid strings are 'pvwatts', 'no_loss', 'pvsyst'. The loss functions
will be set according to this parameter.

name: None or str, default None
Name of ModelChain instance.
Expand Down Expand Up @@ -940,6 +940,9 @@ def losses_model(self, model):
elif model == 'no_loss':
self._losses_model = model
self._dc_losses = self.no_extra_losses
elif model == 'pvsyst':
self._losses_model = model
self._dc_losses = self.pvsyst_dc_losses
else:
raise ValueError(model + ' is not a valid losses model')
else:
Expand All @@ -957,6 +960,19 @@ def no_extra_losses(self):
self.losses = 1
return self

def pvsyst_dc_losses(self):
Copy link
Member

Choose a reason for hiding this comment

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

This is the only DC loss applied by pvsyst? If no, is the plan to add to this method when other DC loss models are implemented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In PVsyst you can also input ohms directly, which we could support pretty easily I think with a different loss parameter that uses the same model chain function but bypasses the equivalent resistance function. I want to investigate that more to confirm the method and then will work to implement.

"""
Calculate time series of ohmic losses and apply those to the mpp power
output of the `dc_model` based on the pvsyst equivalent resistance
method. Uses a `dc_ohmic_percent` parameter in the `losses_parameters`
of the PVsystem.
"""
Rw = self.system.pvsyst_dc_losses_eq_ohms()
ohmic_loss_fraction = Rw * self.dc['i_mp'] / self.dc['v_mp']
self.dc_ohmic_losses = ohmic_loss_fraction * self.dc['p_mp']
self.dc['p_mp'] = self.dc['p_mp'] - self.dc_ohmic_losses
return self

def effective_irradiance_model(self):
fd = self.system.module_parameters.get('FD', 1.)
self.effective_irradiance = self.spectral_modifier * (
Expand Down
0