-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add compute functions for use case 2A #169
Add compute functions for use case 2A #169
Conversation
Codecov Report
@@ Coverage Diff @@
## main #169 +/- ##
==========================================
+ Coverage 87.88% 88.43% +0.55%
==========================================
Files 83 83
Lines 3210 3364 +154
Branches 273 273
==========================================
+ Hits 2821 2975 +154
Misses 343 343
Partials 46 46
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Here's a copy of the table of subcases 2A-1 -- 2A-4 in the powerpoint that @cwhanse provided (nice that something handles the formatting to make copy/paste just work!), plus my understanding of what this approach enables (2A-5 -- 2A-8)
Is that right? If so, I think that's ok. Less efficient some situations, but the flexibility win is pretty big. We could pass no-op functions for dc_model, losses_model, and ac_model to make it clear that we're not computing those quantities. def no_op(mc):
return mc
ModelChain(dc_model=no_op,...) Probably not worth the effort with our well-defined metadata requirements - we're not likely to run into a problem when ModelChain tries to calculate those quantities that we don't actually need. Does your approach also enable the same permutations with/without reference DC power? I didn't dig that hard. Maybe we should turn |
yes
and yes
sounds good to me |
@lboeman do you want to take an initial look? there will likely be some minor changes coming later |
Yep, I'll take a look through it right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very reasonable to me 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a handful of nits. overall looks very good.
if isinstance(self.module_parameters, PVWattsModuleParameters): | ||
self._gamma = self.module_parameters.gamma_pdc | ||
elif isinstance(self.module_parameters, CECModuleParameters): | ||
self._gamma = self.module_parameters.gamma_r |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is the plan to add something like
elif isinstance(self.module_parameters, PVsystModuleParameters):
# https://github.com/pvlib/pvlib-python/pull/1190
from pvlib.ivtools.sdm import pvsyst_temperature_coeff
self._gamma = pvsyst_temperature_coeff(self.module_parameters)
cc @cwhanse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not handle this in an __init__
for each ModuleParameters class like you've done for the inverters and _pac0
? Or vice versa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
with PVsystModuleParameters
, yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wholmgren pvlib #1190 hung up on crafting a test case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cwhanse no worries. we'll go ahead with this and add support for pvsyst module parameters in a follow up PR after you're done.
# to cell temperature via the array's temperature model. If | ||
# module_temperature was supplied and the temperature model is | ||
# sapm, it is converted to cell_temperature, otherwise module | ||
# temperature is used in place of cell_temperature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we don't just use chain.results.cell_temperature
. Doesn't ModelChain
already handle all that logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. If you just give ModelChain
module_temperature and the temperature model is not SAPM, it runs a default air_temp = 20
and wind_speed = 0
through the temperature model to calculate cell_temperature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the model is SAPM, it does appropriately convert from module to cell temp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wholmgren would this SPI issue be fixed by pvlib/pvlib-python#1113? Or made worse by that pvlib issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it depends on what we mean by made worse. Removing the defaults would mean that the SPI code would break unless we handled the cases properly. But explicitly handling those cases would have prevented my confusion.
Ah, I did forget to drop feb. 29 from the actual data if not present in predicted. At this point, I think a follow up issue/PR for that makes sense |
03a0642
to
c1a5537
Compare
In order to convert from any temperature and irradiance input to cell temp and POA global, this just runs the full pvlib.ModelChain on the the reference and actual weather and grabs the results. It also calculates the adjusted power at the inverter level and sums up to the system level. POArat and TempFactor are calculated at the array level (with the array gamma_pdc, poas, and temps) and the simple mean is taken to get to the inverter level.