-
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
Changes from all commits
800a42f
e5bd8ad
e52c9cb
63f79b1
3b43a09
116a7ba
e9a9463
6d902e7
a360026
f8c9c52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1887,6 +1887,87 @@ def sapm_celltemp(poa_global, wind_speed, temp_air, | |
return pd.DataFrame({'temp_cell': temp_cell, 'temp_module': temp_module}) | ||
|
||
|
||
def pvsyst_celltemp(poa_global, wind_speed, temp_air, eta_m=0.1, | ||
alpha_absorption=0.9, temp_model="freestanding"): | ||
""" | ||
Calculate cell temperature using the PVSyst model. | ||
|
||
Parameters | ||
---------- | ||
poa_global : numeric | ||
Total incident irradiance in W/m^2. | ||
|
||
wind_speed : numeric | ||
Wind speed in m/s at a height of 10 meters. | ||
|
||
temp_air : numeric | ||
Ambient dry bulb temperature in degrees C. | ||
|
||
eta_m : numeric | ||
Module external efficiency as a fraction, i.e., DC power / poa_global. | ||
|
||
alpha_absorption : float | ||
Absorption coefficient, default is 0.9. | ||
|
||
temp_model : string, tuple, or list, default 'freestanding' (no dict) | ||
Model to be used. | ||
|
||
If string, can be: | ||
|
||
* 'freestanding' (default) | ||
Modules with rear surfaces exposed to open air (e.g. rack | ||
mounted). | ||
* 'insulated' | ||
Modules with rear surfaces in close proximity to another | ||
surface (e.g. roof mounted). | ||
|
||
If tuple/list, supply parameters in the following order: | ||
|
||
* natural_convenction_coeff : float | ||
Natural convection coefficient. Freestanding default is 29, | ||
fully insulated arrays is 15. | ||
|
||
* forced_convection_coeff : float | ||
Forced convection coefficient, default is 0. | ||
|
||
Returns | ||
wholmgren marked this conversation as resolved.
Show resolved
Hide resolved
|
||
------- | ||
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. | ||
""" | ||
CameronTStark marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
temp_models = {"freestanding": (29.0, 0), "insulated": (15.0, 0)} | ||
|
||
if isinstance(temp_model, str): | ||
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 commentThe 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 commentThe 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. |
||
natural_convenction_coeff, forced_convection_coeff = temp_model | ||
else: | ||
raise TypeError( | ||
"Please format temp_model as a str, or tuple/list." | ||
) | ||
|
||
combined_convection_coeff = ( | ||
forced_convection_coeff * wind_speed | ||
) + natural_convenction_coeff | ||
|
||
absorption_coeff = alpha_absorption * poa_global * (1 - eta_m) | ||
temp_difference = absorption_coeff / combined_convection_coeff | ||
temp_cell = temp_air + temp_difference | ||
|
||
return temp_cell | ||
|
||
|
||
def sapm_spectral_loss(airmass_absolute, module): | ||
""" | ||
Calculates the SAPM spectral loss coefficient, F1. | ||
|
Uh oh!
There was an error while loading. Please reload this page.