Stormwater-Management-Model icon indicating copy to clipboard operation
Stormwater-Management-Model copied to clipboard

Variable not initialized

Open Tiehong opened this issue 2 years ago • 2 comments

I am getting this error while debugging the engine: image

in the void runoff_execute() method in runoff.c:

// --- see if street sweeping can occur on current date
day = datetime_dayOfYear(currentDate);
if ( SweepStart <= SweepEnd )
{
    if ( day >= SweepStart && day <= SweepEnd ) canSweep = TRUE;
}
else if ( day <= SweepEnd || day >= SweepStart ) canSweep = TRUE;
else canSweep = FALSE;

There is a chance that canSweep is not assigned a value. The following code should avoid such issue.

// --- see if street sweeping can occur on current date
day = datetime_dayOfYear(currentDate);
canSweep = FALSE;
if ( SweepStart <= SweepEnd )
{
    if ( day >= SweepStart && day <= SweepEnd ) canSweep = TRUE;
}
else if ( day <= SweepEnd || day >= SweepStart ) canSweep = TRUE;

Tiehong avatar Oct 14 '22 15:10 Tiehong

I wonder how many SWMM models use street sweeping?

dickinsonre avatar Oct 14 '22 18:10 dickinsonre

I used it once: https://ascelibrary.org/doi/10.1061/9780784412947.007 . I don't know if the model is still in use.

MitchHeineman avatar Oct 14 '22 18:10 MitchHeineman

Addressed in 5.2.3.

cbuahin avatar Aug 01 '23 13:08 cbuahin