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

Helpful error messages when cell temperature heat transfer method is missing data #1086

Merged
merged 2 commits into from Nov 7, 2023

Conversation

mjprilliman
Copy link
Collaborator

-Throw error in pvsamv1 when ambient pressure and dew point (or wet bulb) is missing from the weather file
-Make tcell nan when this happens to make sure calculation does not continue as normal
-Fixes NREL/SAM#1428

@mjprilliman mjprilliman added the pv photovoltaic, pvsam, pvwatts label Nov 3, 2023
@mjprilliman mjprilliman added this to the SAM Fall 2023 Release milestone Nov 3, 2023
@mjprilliman mjprilliman self-assigned this Nov 3, 2023
@mjprilliman
Copy link
Collaborator Author

@cpaulgilman review for error message.
@sjanzou review on if there is a better way of handling this error?

Copy link
Collaborator

@cpaulgilman cpaulgilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Here are weather files I used for testing with heat transfer cell temp model:
weather-files-for-heat-transfer-cell-temp-tests.zip

Copy link
Collaborator

@sjanzou sjanzou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change isnan to std::isnan throughout changes per NREL/SAM#1223

@@ -480,6 +480,11 @@ bool mcsp_celltemp_t::operator() ( pvinput_t &input, pvmodule_t &module, double

// convert to kelvin
double TA = input.Tdry+273.15;
if (isnan(input.Patm)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use std::isnan instead of isnan, see NREL/SAM#1223

@@ -505,6 +510,11 @@ bool mcsp_celltemp_t::operator() ( pvinput_t &input, pvmodule_t &module, double
Fcs = 1. - Fcg; // !view factor between top of tilted plate and everything else (sky)
Fbs = Fcg; // !view factor bewteen top and ground = bottom and sky
Fbg = Fcs; // !view factor bewteen bottom and ground = top and sky
if (isnan(input.Tdew)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::isnan()

@@ -2188,6 +2188,7 @@ void cm_pvsamv1::exec()
tcell = Subarrays[nn]->customCellTempArray[inrec];
else {
(*Subarrays[nn]->Module->cellTempModel)(in[nn], *Subarrays[nn]->Module->moduleModel, module_voltage, tcell);
if (isnan(tcell)) throw exec_error("pvsamv1", Subarrays[nn]->Module->cellTempModel->error());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::isnan please...

Copy link
Collaborator

@sjanzou sjanzou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating!

@mjprilliman mjprilliman merged commit cb9fd73 into develop Nov 7, 2023
4 checks passed
@mjprilliman mjprilliman deleted the tcell-exec-error branch November 7, 2023 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
added to release notes pv photovoltaic, pvsam, pvwatts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cell temperature equals ambient temperature when using weather file POA
3 participants