Skip to content

PVWatts albedo soiling checks and outputs#864

Merged
cpaulgilman merged 11 commits into
developfrom
pvwattsv8-albedo
Oct 3, 2022
Merged

PVWatts albedo soiling checks and outputs#864
cpaulgilman merged 11 commits into
developfrom
pvwattsv8-albedo

Conversation

@cpaulgilman

Copy link
Copy Markdown
Collaborator

Add albedo and soiling to time series results to facilitate troubleshooting.

Fix albedo logic to correctly assign default 0.2 or 0.6 value depending on weather file albedo validity, snow model enabled, snow depth data.

Goes with NatLabRockies/SAM#1136

Weather files for testing (snow/albedo, no albedo, mix of valid and invalid albedo):
albedo-test-wf.zip

Add albedo and soiling to time series results to facilitate troubleshooting.

Fix albedo logic to correctly assign default 0.2 or 0.6 value depending on weather file albedo validity, snow model enabled, snow depth data.
Allow PySAM and SDK users to set default albedo (used when weather file and input albedo array both are invalid).

Also clean up some variable meta labels.

@janinefreeman janinefreeman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Having trouble compiling SAM at the moment, but have a few comments based on just reading the code. Will work on getting SAM building so I can test after you have a chance to look at these comments. Thanks again for putting this PR together!!!

Comment thread ssc/cmod_pvwattsv8.cpp
if (std::isfinite(wf.alb) && wf.alb > 0 && wf.alb < 1 && (albedo_len == 0 || use_wf_albedo))
// check albedo is valid value between 0 and 1. if not, set to default value 0.2
// if the snow loss model is enabled and there's valid snow depth > 0.5 cm, then set to 0.6
if (alb <= 0 || alb >= 1)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

If albedo_len is wrong, pvwatts will never use the snow value because the albedo default set in line 816 won't trigger this if statement. Suggest replacing line 816 with the contents of this if statement.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 22acecb

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Also note that there is a separate issue with the snow model: NatLabRockies/SAM#1137

Comment thread ssc/cmod_pvwattsv8.cpp Outdated

// conditions to use albedo from wf instead of albedo user input:
// * wf.alb exists and is valid and use_wf_albedo = 1
// * wf.alb exists and is valid and use_wf_albedo = 0 and albedo_len = 0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this the desired behavior? You can remind me if we discussed at a meeting and I forgot, but I would think that if use_wf_albedo = 0 and user-specified albedo is not defined, I would be expecting it to use internal defaults (or the defaults that I set via the SDK), even if albedo exists in the weather file.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I agree with the behavior you describe. Fixed in 22acecb.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Based on discussions at the 9/20/2022 SAM meeting, we agreed to simplify the albedo logic:

If use_wf_albedo is true, and wf albedo is available and valid, use wf albedo, otherwise use default albedo (snow or no snow, depending on snow depth and snow model enabled).

If use_wf_albedo is false, and user albedo is available and valid, use user albedo, otherwise use default albedo as above.

Fix logic so:

1. Correct default albedo (snow/no snow) is applied when albedo input array length is incorrect.

2. Default albedo is used when use_wf_albedo = 0 and albedo input is not defined: Never use weather file albedo when use_wf_albedo = 0.

@sjanzou sjanzou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice test addition and I could not break the logic!

@cpaulgilman cpaulgilman merged commit 440d992 into develop Oct 3, 2022
@cpaulgilman cpaulgilman deleted the pvwattsv8-albedo branch October 3, 2022 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants