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

Fix uninit water mains #8677

Merged
merged 4 commits into from
Apr 30, 2021
Merged

Fix uninit water mains #8677

merged 4 commits into from
Apr 30, 2021

Conversation

lefticus
Copy link
Contributor

This fixes use of uninitialized WaterMainsTempMethod

  • I do know this is definitely a real problem, it was found with runtime analysis with valgrind
  • I do not know if this is a correct solution.

@lefticus lefticus requested a review from Myoldmopar March 30, 2021 23:03
@nrel-bot
Copy link

@lefticus @lgentile it has been 28 days since this pull request was last updated.

@mitchute mitchute added the Defect Includes code to repair a defect in EnergyPlus label Apr 29, 2021
@mitchute mitchute added this to the EnergyPlus Future milestone Apr 29, 2021
@Myoldmopar
Copy link
Member

That's an interesting error. I'm going to get a redo on Windows before investigating.

@mitchute
Copy link
Collaborator

It builds fine on my Windows VM FWIW

@Myoldmopar
Copy link
Member

Windows built fine on CI, this is good to go as far as CI goes. This also doesn't cause any diffs, which is a bit surprising if it's actually being used uninitialized. Perhaps it's only being used uninitialized at the very beginning? Before reporting happens? In any case, it looks like this hasn't affected any actual results, so I'm feeling OK with this. I'll take one more look at the change but I think this will go in shortly.

Copy link
Member

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

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

Yeah, again, I think this must've only been using it uninitialized early in the program before outputs were generated because this hasn't caused any strange behavior or spurious diffs that I know of. I'm good with this quick fix.

this->SnowGndRefModifierForDayltg = 1.0; // Modifier to ground reflectance during snow for daylighting
this->SnowGndRefModifier = 1.0; // Modifier to ground reflectance during snow
this->SnowGndRefModifierForDayltg = 1.0; // Modifier to ground reflectance during snow for daylighting
this->WaterMainsTempsMethod = WeatherManager::WaterMainsTempCalcMethod::FixedDefault;
Copy link
Member

Choose a reason for hiding this comment

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

Got it, this is during the clear_state call, and then...

RptIsRain(0), RptIsSnow(0), RptDayType(0), HrAngle(0.0), SolarAltitudeAngle(0.0), SolarAzimuthAngle(0.0), HorizIRSky(0.0),
TimeStepFraction(0.0), NumSPSiteScheduleNamePtrs(0), EndDayOfMonth(12, {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}), LeapYearAdd(0),
DatesShouldBeReset(false), StartDatesCycleShouldBeReset(false), Jan1DatesShouldBeReset(false), RPReadAllWeatherData(false)
SnowGndRefModifierForDayltg(1.0), WaterMainsTempsMethod{WeatherManager::WaterMainsTempCalcMethod::FixedDefault}, WaterMainsTempsSchedule(0),
Copy link
Member

Choose a reason for hiding this comment

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

This was during the default constructor of the data class (which I don't think we actually need...but that's a different story).

@Myoldmopar
Copy link
Member

Thanks @lefticus , merging.

@Myoldmopar Myoldmopar merged commit 6220382 into develop Apr 30, 2021
@Myoldmopar Myoldmopar deleted the Fix_Uninit_WaterMains branch April 30, 2021 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Defect Includes code to repair a defect in EnergyPlus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants