-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Should ModelChain and PVSystemLocalized both have a future in pvlib? #492
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
Comments
In terms of user workflow, I like the |
@jkfm Thanks for the feedback. What I do not understand is why we do not initialize a |
@thunderfish24 I appreciate your efforts to question and improve the API. Please see the following issues for the discussion behind the current design:
The modeling paradigms section of the documentation attempts to summarize the philosophy, though I can't say that it fully captures my thoughts or the community's. With a few years of use, development, and maintenance I can add the following.
|
The TL:DR is I am not in favor of doing away with, or making major changes to, I can't comment on One goal of PVLib (besides providing reference implementations of individual models) is to guide modelers through the modeling steps, from irradiance to AC power, and to educate about the choices available at each step. I think the current |
@wholmgren and @cwhanse Thanks for the additional background, and again thanks for you patience as I come up to speed on PV systems and "out of the weeds" of single diode modeling and calibration. I will do my best to read up on those issues as quickly as I can find time for. My reaction so far to Echoing Cliff's statement about one important goal of PVLib, I think we really should strive to make class PVSystem(object):
...
def calc_model_dc(self, irrad, temp):
"""
Calculate the DC model.
Use the model specified in model_dc, which may be a user-defined
function (more precisely, any callable obeying the API shown here).
TODO Details, inc. irrad and temp being "generic"
"""
return self.scale_voltage_current_power(
self.model_dc(irrad, temp, **self.module_parameters))
... Also, I have struggled a bit to accept the seemingly "non-DRY" wrappers of low level functions with I should have some new code implementing these ideas coming soon in #478. |
@thunderfish24 judging solely on the above code snipping, to me it looks like |
Re: #194 : I like the approach overall, but it seems like the implementation of # user defined parameters and functions
module_parameters = {'a': 3, 'b': 0.001, 'c': 1, 'd': -0.05}
system = PVSystem(module_parameters=module_parameters)
# pvusa_mc_wrapper is a user-defined function. see gist for details
mc = ModelChain(system, location, dc_model=pvusa_mc_wrapper, ac_model=pvusa_ac_mc_wrapper)
mc.run_model(times) I would keep the high-level I haven't had time to dive into why subclasses are a bad design choice for the dc or ac models and PVSystem itself. Also, keeping all the data structure type handling straight through all the layers (e.g., pandas Series vs. pandas Dataframe vs. numpy array vs. (ordered) dict) adds significant mental and development overhead. I made what I thought was a "like-for-like" change in a refactor, and I'm now getting this error from within pandas: "ValueError: Unable to coerce to Series, length must be 2: given 1". |
From my perspective, keywords like |
At this risk of this coming off as yet another screed... @thunderfish24 we share the same goals regarding the purpose of Quick point of clarification:
The implementation details should mostly live in the functions. This goes to my "functions will never go out of style" comment above. Cliff's proposal would work for me. A
If @thunderfish24 what do you think about adding
It is that simple, provided that you supply a Re data structures: this is already too long, so let's discuss that elsewhere! |
@wholmgren closed via #1136? |
Is your feature request related to a problem? Please describe.
It is not clear to me what value
ModelChain
has in comparison to thePVSystemLocalized
class.Describe the solution you'd like
Let's discuss if the codebase can be simplified by removing one or the other of these classes, which appear (at least on the surface) to overlap significantly in purpose, e.g., computing performance for a PVSystem at a given Location.
Describe alternatives you've considered
I'm leaning towards getting rid of
ModelChain
and makingPVSystemLocalized
the workhorse, but I really don't know, because I don't really know what workflow might be more popular among users.Additional context
See the architecture discussion in #487.
The text was updated successfully, but these errors were encountered: