-
Notifications
You must be signed in to change notification settings - Fork 396
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
Fix Rainfall is handled differently between weather file values and Site:Precipitation water manager values #4153 #9290
Changes from 1 commit
62d6c9b
663087a
272ecb7
2ed751a
776ca6e
2f8f8ad
5e143d8
9441a0e
f0e0f03
b042c39
63a2f62
77df693
5770807
be22899
9b30cb7
8344d8d
b4b8a92
5e43004
59712dd
724d4c2
a41d31a
45e8e83
100e3c5
64c2e23
9004c94
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 |
---|---|---|
|
@@ -2309,33 +2309,35 @@ namespace WeatherManager { | |
if (state.dataEnvrn->EMSBeamSolarRadOverrideOn) state.dataEnvrn->BeamSolarRad = state.dataEnvrn->EMSBeamSolarRadOverrideValue; | ||
state.dataEnvrn->LiquidPrecipitation = | ||
state.dataWeatherManager->TodayLiquidPrecip(state.dataGlobal->TimeStep, state.dataGlobal->HourOfDay) / 1000.0; // convert from mm to m | ||
if ((state.dataEnvrn->RunPeriodEnvironment) && (!state.dataGlobal->WarmupFlag)) { | ||
int month = state.dataEnvrn->Month; | ||
state.dataWaterData->RainFall.MonthlyTotalPrecInWeather.at(month - 1) += state.dataEnvrn->LiquidPrecipitation * 1000.0; | ||
if ((state.dataEnvrn->LiquidPrecipitation > 0) && (state.dataGlobal->TimeStep == 1)) { | ||
state.dataWaterData->RainFall.numRainyHoursInWeather.at(month - 1) += 1; | ||
} | ||
} | ||
|
||
// if using epw precipitation, throw warning | ||
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. Looking at this now, it would be clearer (and save a couple of if blocks) to move this (lines 2313 thru 2332) into `WaterManager::UpdatePrecipitation. Review that function for unnecessary if blocks as well. 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. I combined this with the if statement in UpdatePrecipitation |
||
if (state.dataWaterData->RainFall.ModeID == DataWater::RainfallMode::EPWPrecipitation) { | ||
if ((state.dataEnvrn->LiquidPrecipitation == 0) && (state.dataEnvrn->IsRain)) { | ||
state.dataEnvrn->LiquidPrecipitation = 1.5 / 1000.0; | ||
if ((state.dataEnvrn->LiquidPrecipitation == 0) && | ||
// this is the Present Weather Codes field in epw. See column 1-3 in Table 2.16 Weather Codes Field Interpretation | ||
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. It's confusing to have a comment in the middle of the if statement. 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. I just moved the comments above the if statement. |
||
(state.dataWeatherManager->TodayIsRain(state.dataGlobal->TimeStep, state.dataGlobal->HourOfDay)) && | ||
(state.dataWeatherManager->UseRainValues)) { | ||
state.dataEnvrn->LiquidPrecipitation = 1.5 / 1000.0 / state.dataGlobal->TimeStepZone; | ||
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.
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. Right. I should have it divided by NumOfTimeStepInHours. I just added the defaultLiquidPrecip to hold the constant. |
||
ShowRecurringWarningErrorAtEnd(state, | ||
"Rain flag is on but precipitation depth in the weather file is missing or zero. Setting " | ||
"precipitation depth to 1.5 mm for this hour.", | ||
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. 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. Right, this will not be needed. I deleted it. |
||
state.dataWaterData->PrecipOverwrittenByRainFlag); | ||
} | ||
} | ||
if ((state.dataEnvrn->RunPeriodEnvironment) && (!state.dataGlobal->WarmupFlag)) { | ||
int month = state.dataEnvrn->Month; | ||
state.dataWaterData->RainFall.MonthlyTotalPrecInWeather.at(month - 1) += state.dataEnvrn->LiquidPrecipitation * 1000.0; | ||
if ((state.dataEnvrn->LiquidPrecipitation > 0) && (state.dataGlobal->TimeStep == 1)) { | ||
state.dataWaterData->RainFall.numRainyHoursInWeather.at(month - 1) += 1; | ||
} | ||
} | ||
|
||
WaterManager::UpdatePrecipitation(state); | ||
|
||
state.dataEnvrn->TotalCloudCover = state.dataWeatherManager->TodayTotalSkyCover(state.dataGlobal->TimeStep, state.dataGlobal->HourOfDay); | ||
state.dataEnvrn->OpaqueCloudCover = state.dataWeatherManager->TodayOpaqueSkyCover(state.dataGlobal->TimeStep, state.dataGlobal->HourOfDay); | ||
|
||
if (state.dataWeatherManager->UseRainValues) { | ||
state.dataEnvrn->IsRain = state.dataWeatherManager->TodayIsRain( | ||
state.dataGlobal->TimeStep, state.dataGlobal->HourOfDay); //.or. LiquidPrecipitation >= .8d0) ! > .8 mm | ||
Comment on lines
-2337
to
-2338
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. Keep this code but add |
||
state.dataEnvrn->IsRain = state.dataWaterData->RainFall.CurrentAmount > 0.0; | ||
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. Is it ever possible for the weather file data to have a non-zero (small) value for LiquidPrecipitation but TodayIsRain is false? If so, this will change old behavior and flip the rain flag to true. 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. I'll double-check whether this could happen. The other behavior change would be if weather data has TodayIsRain = false but user-input site:precipitation defined non-zero rainfall value. 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.
True, but that's the whole point of this PR in the first place. So that's a good change. 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. I just checked the TMY3 data in the EnergyPlus/weather folder. All of them have PresWeathCodes = 999999999. As a result, none of them can set TodayIsRain to true. I'll download some more weather data and see. 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. @mjwitte I also downloaded 36 more TMY3 whose states are not covered by the weather files in EnergyPlus folder. All of them also have PresWeathCodes = 999999999. |
||
} else { | ||
state.dataEnvrn->IsRain = false; | ||
} | ||
|
@@ -5646,7 +5648,7 @@ namespace WeatherManager { | |
ErrorsFound = true; | ||
} | ||
|
||
// A6, \field Use Weather File Rain Indicators | ||
// A6, \field Use Rain Indicators | ||
if (state.dataIPShortCut->lAlphaFieldBlanks(6) || UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(6), "YES")) { | ||
state.dataWeatherManager->RunPeriodInput(i).useRain = true; | ||
} else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(6), "NO")) { | ||
|
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.
Given that I/O Freeze is almost frozen, the IDD change will likely have to wait until after v22.1 release. And it will need doc updates and a mention in the input rule file (because field name changes must be documented for epJSON).
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.
I'll remove the I/O change for now.