Skip to content
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

pvwatts loss model implementation with user defined input values #484

Closed
Jawairia123 opened this issue Jun 18, 2018 · 6 comments
Closed

Comments

@Jawairia123
Copy link

Hi,

I am trying to use pvwatts loss model with ModelChain with user defined loss values instead of the default ones.

I understand that for default values I just have to pass "pvwatts" string as the losses_model but I am not sure how can I link the loss model with user-specified values in the ModelChain function. I have tried all the possible ways that I can think of but still not sure how this will be implemented.

Will appreciate if anyone can guide me to it!

Thanks in advance!

Regards

@cwhanse
Copy link
Member

cwhanse commented Jun 18, 2018

You can use keyword arguments with pvsystem.pvwatts_losses . It's not clear that these arguments are accessible through a ModelChain object - @wholmgren can you confirm or correct? If they are not accessible we need a new Issue opened.

@wholmgren
Copy link
Member

There is currently no easy way to combine ModelChain and user-defined losses for the pvwatts model. Implementing this in the standard pvlib pattern would require adding an attribute to the PVSystem object that defines the losses, then looking up that data during a call to PVSystem.pvwatts_losses. For example,

system = PVSystem(module_parameters={'pvwatts_losses' = {'soiling': 3, 'wiring': 1}}
system.pvwatts_losses()  # uses tools._build_kwargs to extract keys, if available.

One problem is that most of the losses parameters are poorly described by the existing PVSystem attributes (module_parameters, inverter_parameters, etc), so we might want to define a new generic attribute such as losses_parameters.

In the meantime, you can use the approach outlined here to define your own function that calls the existing pvsystem.pvwatts_losses with your parameters.

@cwhanse
Copy link
Member

cwhanse commented Jun 18, 2018

One problem is that most of the losses parameters are poorly described by the existing PVSystem attributes (module_parameters, inverter_parameters, etc), so we might want to define a new generic attribute such as losses_parameters.

I'm in favor of this approach. Thinking further, perhaps losses_parameters could be a dict with entries for the different categories of loss. We could start with the PVWatts list, or the PVsyst waterfall. Either way, it would be an enhancement and merits its own Issue.

@wholmgren
Copy link
Member

wholmgren commented Jun 18, 2018 via email

@Jawairia123
Copy link
Author

Jawairia123 commented Jun 19, 2018

@wholmgren I tried linking my function with the ModelChain.

If I include "pvwatts" as output to my function. ModelChain is accepting it but otherwise on linking when the output is an integer value (from the pvwatts loss function), there appears an error (the first argument must be callable)

@Jawairia123
Copy link
Author

I have been suggested the following by one of the members of pvlib google group.

a = mc.ac * (1 - pvlib.pvsystem.pvwatts_losses(soiling=2, shading=3, snow=0, mismatch=2, wiring=2, connections=0.5, lid=1.5, nameplate_rating=1, age=0, availability=3)/100)

i.e. to deduce the loss directly from the output. And since pvwatts applies losses only at final stage, this is working.

It would be very helpful to see PVsyst system model and the loss calculation approach in pvlib-python.

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

No branches or pull requests

3 participants