-
Notifications
You must be signed in to change notification settings - Fork 1.1k
initial implementation of pvsyst_celltemp function (#552) #628
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
Conversation
General FYI, I started with the code @mikofski presented and implemented aspects from sapm_celltemp() for some consistency. A potential concern is that I implemented different temp_models keys than what sapm_celltemp() uses to mirror the default options presented for PVSyst on the PVLIB website. This may end up being confusing when using the same PVSystem instance to execute both pvsyst_celltemp() and sapm_celltemp() and limit future options for running both concurrently. Let me know if there are other preferred options or, instead, if we should include more independent PVSyst-centric options. |
I think the Be sure to update api.rst and whatsnew.rst. Thanks for the contribution! |
I've updated the docs @cwhanse, thanks for your guidance! |
@CameronTStark could you |
@cwhanse @CameronTStark why the closing and reopening? can we leave it open until merged? |
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.
Thanks @CameronTStark!
I made a handful of minor comments below (hoping that this still works with the PR closed).
Nice job on the tests.
Sorry, I hit the Comment and close button by accident. |
@wholmgren it looks like the PR isn't updating with my latest commit now that its closed again. Maybe it'll update if it's reopened? |
I also must have mis-clicked and closed it. |
@CameronTStark can you try to resolve the merge conflict? Then I think it's ready to merge. |
Thanks for the contribution @CameronTStark |
Sure thing and thanks for the easy introduction to contributing here. If there's another place to contribute next that makes sense from here please let me know. If not I'll just check issues again and dive in. |
Good comment, @mikofski, Mark<mailto:Mark.Mikofski@dnvgl.com> I hadn’t considered that.
Easy issue and PR, both welcome.
From: Mark Mikofski <notifications@github.com>
Sent: Tuesday, December 11, 2018 2:39 PM
To: pvlib/pvlib-python <pvlib-python@noreply.github.com>
Cc: Hansen, Clifford W <cwhanse@sandia.gov>; State change <state_change@noreply.github.com>
Subject: [EXTERNAL] Re: [pvlib/pvlib-python] initial implementation of pvsyst_celltemp function (#552) (#628)
@mikofski commented on this pull request.
________________________________
In pvlib/pvsystem.py<#628 (comment)>:
+
+ Returns
+ -------
+ temp_cell : numeric or Series
+ Cell temperature in degrees Celsius
+
+ References
+ ----------
+ [1]"PVsyst 6 Help", Files.pvsyst.com, 2018. [Online]. Available:
+ http://files.pvsyst.com/help/index.html. [Accessed: 10- Dec- 2018].
+
+ [2] Faiman, D. (2008). "Assessing the outdoor operating temperature of
+ photovoltaic modules." Progress in Photovoltaics 16(4): 307-315.
+ """
+
+ temp_models = {"freestanding": (29.0, 0), "insulated": (15.0, 0)}
My thoughts in case this is ever revisited, sorry for commenting so late.
* Move this constant to the module level. IMO avoid internally scoped constants. The computer needs to find memory for this every time this function is called. If it's defined at the module level then I think this memory will only be allocated once, when the module is imported the first time.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub<#628 (review)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AFJNLzUEc_NbGcuSybs0wDy2UPmKpN6xks5u4CXhgaJpZM4ZHfAi>.
|
natural_convenction_coeff, forced_convection_coeff = temp_models[ | ||
temp_model.lower() | ||
] | ||
elif isinstance(temp_model, (tuple, list)): |
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.
@CameronTStark in the future maybe consider duck typing instead of type checking. Even though duck typing is the Pythonic preference, it may not always work best. I think your solution here is fine, but in general I think duck typing usually results in more robust code. Eg:
else:
natural_convenction_coeff, forced_convection_coeff = temp_model
# already raises ValueError or TypeError
# or use try: except to raise a more descriptive exception
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.
@mikofski Yes, thanks for the suggestion! I've been trying to pay attention more to duck typing in my code and thought about it for this instance but since this was my first contribution and sapm_celltemp() had the Look Before You Leap type check in it already I figured I'd just follow convention.
@CameronTStark thanks for this good pull request. A related contribution would be to add |
Sounds good. I'll get on it. Thanks! |
@CameronTStark thanks! Just a note, the method tests should verify that the object methods call the underlying function, there's not a need to retest the function's output. |
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.
The variable absorption_coeff
has a very misleading name. It is in fact the portion of the incident irradiance that is converted to heat.
On a more general note, does this model originate with PVsyst? There are several variations of the same model that differ only in the way they define and/or determine the coefficients. Would we like to have completely separate functions for these variations? Or rather one core function and some helper functions for the coefficient calculations? Or some other organization? |
Incidentally, these questions arose while I was discussing with my student intern which model he should code for his first contribution to pvlib-python. |
@adriesse can you point me to an example of the variations? I'm not as familiar with this family of temperature models as I'd like to be. If I understand correctly, the underlying model is Faiman's, and PVsyst implements a variation of it. As best we know, I can see value in |
I see it as the portion of irradiance that is absorbed by the cell, either as heat or converted to current. In either case absorption coefficient is the term used in the PVsyst documentation so it seems helpful to retain the name in pvlib. |
That one is called |
You are correct, I see the issue now. We have a parameter named alpha_absorption ( = 0.9) which is referred to in the PVsyst documentation as Alpha
We have an internal variable PR welcome to clarify the naming. |
Regarding model variations: The determination of cell/module temperature using an energy balance equation and a simple heat transfer coefficient "U" goes way back. PVsyst, SAM, TRNSYS, Duffie & Beckman, Faiman all do it, and I expect there are others. Making part of the U value proportional to wind speed is old too: D&B makes reference to a 1954 textbook, and certain constants from that book persist in SAM today despite the fact they were derived for a 0.5m2 plate. The variations principally arise from assumptions regarding the fraction of energy absorbed, the relative importance given to wind speed, and various adjustments (direct or indirect) to the U values for mounting. |
Actually, |
Sigh, then the other variable |
docs/sphinx/source/api.rst
for API changes.docs/sphinx/source/whatsnew
file for all changes.