Weekday and weekend hourly time patterns for Dry Weather inflows are now correctly applied in a mutually exclusive manner in #SWMM 5.1
This is a code note about change 52 in the newer EPA SWMM 5.1.x C code
52. Weekday and weekend hourly time patterns for Dry Weather inflows are now correctly applied in a mutually exclusive manner.
52. Weekday and weekend hourly time patterns for Dry Weather inflows are now correctly applied in a mutually exclusive manner.
Here is the code from SWMM 5.0.022
double inflow_getDwfInflow(TDwfInflow* inflow, int month, int day, int hour)
//
// Input: inflow = dry weather inflow data structure
// month = current month of year of simulation
// day = current day of week of simulation
// hour = current hour of day of simulation
// Output: returns value of dry weather inflow parameter
// Purpose: computes dry weather inflow value at a specific point in time.
//
{
int i, // pattern type index
p; // pattern index
double f = 1.0; // pattern factor
for (i=0; i<4 i="" o:p="">4>
{
p = inflow->patterns[i];
if ( p >= 0 ) f *= inflow_getPatternFactor(p, month, day, hour); //(5.0.019 - LR)
}
return f * inflow->avgValue;
Here is the new 2014+ code, which adjusts the pattern factor based on the day of the week.
double inflow_getDwfInflow(TDwfInflow* inflow, int month, int day, int hour)
//
// Input: inflow = dry weather inflow data structure
// month = current month of year of simulation
// day = current day of week of simulation
// hour = current hour of day of simulation
// Output: returns value of dry weather inflow parameter
// Purpose: computes dry weather inflow value at a specific point in time.
//
{
int p1, p2; // pattern index
doublef = 1.0; // pattern factor
p1 = inflow->patterns[MONTHLY_PATTERN];
if ( p1 >= 0 ) f *= inflow_getPatternFactor(p1, month, day, hour); // Pattern f value is 1 * The Monthly Factor
p1 = inflow->patterns[DAILY_PATTERN];
if ( p1 >= 0 ) f *= inflow_getPatternFactor(p1, month, day, hour); // Pattern f value is last f * The Daily Factor
p1 = inflow->patterns[HOURLY_PATTERN];
p2 = inflow->patterns[WEEKEND_PATTERN];
if ( p2 >= 0 )
{
if ( day == 0 || day == 6 )
f *= inflow_getPatternFactor(p2, month, day, hour); // Pattern f value is last f * The Hourly Factor for Saturday and Sunday
else if ( p1 >= 0 )
f *= inflow_getPatternFactor(p1, month, day, hour); // Pattern f value is last f * The Hourly Factor Monday to Friday
}
else if ( p1 >= 0 ) f *= inflow_getPatternFactor(p1, month, day, hour); // Pattern f value is last f * The Hourly Factor
returnf * inflow->avgValue;
Comments
Post a Comment