diff --git a/src/EnergyPlus/Data/EnergyPlusData.cc b/src/EnergyPlus/Data/EnergyPlusData.cc index 03b30e7bfbb..db7eed811b0 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.cc +++ b/src/EnergyPlus/Data/EnergyPlusData.cc @@ -309,6 +309,7 @@ EnergyPlusData::~EnergyPlusData() = default; void EnergyPlusData::clear_state() { this->ready = true; + this->init_state_called = false; this->dataAirLoop->clear_state(); this->dataAirLoopHVACDOAS->clear_state(); this->dataAirSystemsData->clear_state(); @@ -570,11 +571,15 @@ void EnergyPlusData::clear_state() void EnergyPlusData::init_state(EnergyPlusData &state) { + if (this->init_state_called) return; + this->init_state_called = true; // The order in which we do this matters. We're going to try to // do this in "topological" order meaning the first to go are the // objects that do not reference any other objects, like fluids, // schedules, curves, etc. - this->dataFluidProps->init_state(state); + this->dataSimulationManager->init_state(state); // GetProjectData + this->dataFluidProps->init_state(state); // GetFluidPropertiesData + this->dataPsychrometrics->init_state(state); // InitializePsychRoutines this->dataAirLoop->init_state(state); this->dataAirLoopHVACDOAS->init_state(state); @@ -736,7 +741,6 @@ void EnergyPlusData::init_state(EnergyPlusData &state) this->dataPollution->init_state(state); this->dataPondGHE->init_state(state); this->dataPowerInductionUnits->init_state(state); - this->dataPsychrometrics->init_state(state); this->dataPsychCache->init_state(state); this->dataPumps->init_state(state); this->dataPurchasedAirMgr->init_state(state); @@ -758,7 +762,6 @@ void EnergyPlusData::init_state(EnergyPlusData &state) this->dataSetPointManager->init_state(state); this->dataShadowComb->init_state(state); this->dataSimAirServingZones->init_state(state); - this->dataSimulationManager->init_state(state); this->dataSingleDuct->init_state(state); this->dataSize->init_state(state); this->dataSizingManager->init_state(state); diff --git a/src/EnergyPlus/Data/EnergyPlusData.hh b/src/EnergyPlus/Data/EnergyPlusData.hh index b1b4f3eeb3d..ff30f15b8f1 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.hh +++ b/src/EnergyPlus/Data/EnergyPlusData.hh @@ -577,6 +577,7 @@ struct EnergyPlusData : BaseGlobalStruct EnergyPlusData(EnergyPlusData &&) = delete; void init_state([[maybe_unused]] EnergyPlusData &state) override; + bool init_state_called = false; void clear_state() override; }; diff --git a/src/EnergyPlus/FluidProperties.cc b/src/EnergyPlus/FluidProperties.cc index c4353b32718..c63f0b6fc95 100644 --- a/src/EnergyPlus/FluidProperties.cc +++ b/src/EnergyPlus/FluidProperties.cc @@ -102,11 +102,6 @@ namespace FluidProperties { // supplying the same data for concentrations of 0.0 and 1.0 only. // Temperature data has to be supplied in ascending order only. - void InitializeGlycRoutines() - { - // TODO: Delete this, the cache is now part of state and initialized with the state constructor - } - void GetFluidPropertiesData(EnergyPlusData &state) { @@ -162,6 +157,9 @@ namespace FluidProperties { // Array initializer only takes one argument. std::bind is used to convert the // actual initializer into a function of one argument. + state.dataFluidProps->NumOfRefrigerants = 0; + state.dataFluidProps->NumOfGlycols = 0; + // For default "glycol" fluids of Water, Ethylene Glycol, and Propylene Glycol static constexpr std::array DefaultGlycolTemps = { @@ -657,8 +655,6 @@ namespace FluidProperties { cNumericFieldNames = ""; lNumericFieldBlanks = false; - InitializeGlycRoutines(); - // Check to see if there is any FluidName input. If not, this is okay as // long as the user only desires to simulate loops with water. More than // one FluidName input is not allowed. @@ -4926,8 +4922,6 @@ namespace FluidProperties { Real64 Temperature; // Temperature to drive values Real64 ReturnValue; // Values returned from glycol functions - state.dataFluidProps->GetInput = false; // input has already been gotten - for (int GlycolNum = 1; GlycolNum <= state.dataFluidProps->NumOfGlycols; ++GlycolNum) { auto &glycol = state.dataFluidProps->GlycolData(GlycolNum); int GlycolIndex = 0; // used in routine calls -- value is returned when first 0 @@ -5168,8 +5162,6 @@ namespace FluidProperties { Real64 Temperature; // Temperature to drive values Real64 ReturnValue; // Values returned from refrigerant functions - state.dataFluidProps->GetInput = false; // input has already been gotten - for (int RefrigNum = 1; RefrigNum <= state.dataFluidProps->NumOfRefrigerants; ++RefrigNum) { int RefrigIndex = 0; // used in routine calls -- value is returned when first 0 // Lay out the basic values: @@ -5606,23 +5598,15 @@ namespace FluidProperties { // FUNCTION LOCAL VARIABLE DECLARATIONS: int HiTempIndex; // index value of next highest Temperature from table int LoTempIndex; // index value of next lowest Temperature from table - int RefrigNum; // index for refrigerant under consideration Real64 TempInterpRatio; // ratio to interpolate in temperature domain - // error counters and dummy string - bool ErrorFlag; // error flag for current call - - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - RefrigNum = 0; + int RefrigNum = 0; // index for refrigerant under consideration if (state.dataFluidProps->NumOfRefrigerants == 0) { ReportFatalRefrigerantErrors( state, state.dataFluidProps->NumOfRefrigerants, RefrigNum, true, Refrigerant, "GetSatPressureRefrig", "properties", CalledFrom); } - ErrorFlag = false; + bool ErrorFlag = false; if (RefrigIndex > 0) { RefrigNum = RefrigIndex; @@ -5717,23 +5701,15 @@ namespace FluidProperties { // FUNCTION LOCAL VARIABLE DECLARATIONS: int HiPresIndex; // index value of next highest Temperature from table int LoPresIndex; // index value of next lowest Temperature from table - int RefrigNum; // index for refrigerant under consideration Real64 PresInterpRatio; // ratio to interpolate in temperature domain - // error counters and dummy string - bool ErrorFlag; // error flag for current call - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - - RefrigNum = 0; + int RefrigNum = 0; // index for refrigerant under consideration if (state.dataFluidProps->NumOfRefrigerants == 0) { ReportFatalRefrigerantErrors( state, state.dataFluidProps->NumOfRefrigerants, RefrigNum, true, Refrigerant, "GetSatTemperatureRefrig", "properties", CalledFrom); } - ErrorFlag = false; + bool ErrorFlag = false; if (RefrigIndex > 0) { RefrigNum = RefrigIndex; @@ -5832,14 +5808,7 @@ namespace FluidProperties { static constexpr std::string_view RoutineName("GetSatEnthalpyRefrig"); // FUNCTION LOCAL VARIABLE DECLARATIONS: - int RefrigNum; // index for refrigerant under consideration - - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - - RefrigNum = 0; + int RefrigNum = 0; if (state.dataFluidProps->NumOfRefrigerants == 0) { ReportFatalRefrigerantErrors( state, state.dataFluidProps->NumOfRefrigerants, RefrigNum, true, Refrigerant, RoutineName, "properties", CalledFrom); @@ -5905,13 +5874,6 @@ namespace FluidProperties { Real64 HiSatProp; // Sat. prop. at higher temp & given quality Real64 TempInterpRatio; // ratio to interpolate in temperature domain - // error counters and dummy string - - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - int RefrigNum = 0; if (state.dataFluidProps->NumOfRefrigerants == 0) { ReportFatalRefrigerantErrors( @@ -6040,11 +6002,6 @@ namespace FluidProperties { // FUNCTION PARAMETER DEFINITIONS: static constexpr std::string_view RoutineName("GetSatSpecificHeatRefrig: "); - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - int RefrigNum = 0; if (state.dataFluidProps->NumOfRefrigerants == 0) { ReportFatalRefrigerantErrors( @@ -6146,12 +6103,6 @@ namespace FluidProperties { int HiTempIndex; // high temperature index value int HiPressIndex; // high pressure index value - // see if data is there - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - int RefrigNum = 0; if (state.dataFluidProps->NumOfRefrigerants == 0) { ReportFatalRefrigerantErrors( @@ -6398,11 +6349,6 @@ namespace FluidProperties { int LoEnthalpyIndex; // Index value of lower enthalpy from data int HiEnthalpyIndex; // Index value of higher enthalpy from data - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - int RefrigNum = 0; if (state.dataFluidProps->NumOfRefrigerants == 0) { ReportFatalRefrigerantErrors( @@ -6674,11 +6620,6 @@ namespace FluidProperties { Real64 RefTSat; // Saturated temperature of the refrigerant. Used to check whether the refrigernat is in the superheat area Real64 Temp; // Temperature of the superheated refrigerant at the given enthalpy and pressure - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - RefrigNum = 0; if (state.dataFluidProps->NumOfRefrigerants == 0) { ReportFatalRefrigerantErrors( @@ -6822,12 +6763,6 @@ namespace FluidProperties { int HiTempIndex; // high temperature index value int HiPressIndex; // high pressure index value - // see if data is there - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - int RefrigNum = 0; if (state.dataFluidProps->NumOfRefrigerants == 0) { ReportFatalRefrigerantErrors( @@ -7091,12 +7026,6 @@ namespace FluidProperties { // FUNCTION PARAMETERS: static constexpr std::string_view RoutineName("GetSpecificHeatGlycol: "); - // Get the input if we haven't already - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - // If no glycols, no fluid properties can be evaluated int GlycolNum(0); if (state.dataFluidProps->NumOfGlycols == 0) @@ -7243,12 +7172,6 @@ namespace FluidProperties { bool LowErrorThisTime = false; bool HighErrorThisTime = false; - // Get the input if we haven't already - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - // If no glycols, no fluid properties can be evaluated int GlycolNum = 0; if (state.dataFluidProps->NumOfGlycols == 0) @@ -7406,12 +7329,6 @@ namespace FluidProperties { bool LowErrorThisTime = false; bool HighErrorThisTime = false; - // Get the input if we haven't already - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - // If no glycols, no fluid properties can be evaluated int GlycolNum = 0; if (state.dataFluidProps->NumOfGlycols == 0) @@ -7572,12 +7489,6 @@ namespace FluidProperties { bool LowErrorThisTime = false; bool HighErrorThisTime = false; - // Get the input if we haven't already - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - // If no glycols, no fluid properties can be evaluated int GlycolNum = 0; if (state.dataFluidProps->NumOfGlycols == 0) @@ -7727,12 +7638,6 @@ namespace FluidProperties { // Return value int FindRefrigerant; - // Make sure we have already read in the input - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - // Check to see if this glycol shows up in the glycol data int Found = Util::FindItemInList(Util::makeUPPER(Refrigerant), state.dataFluidProps->RefrigData); @@ -7769,12 +7674,6 @@ namespace FluidProperties { // Return value int FindGlycol; - // Make sure we have already read in the input - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - // Check to see if this glycol shows up in the glycol data int Found = Util::FindItemInList(Util::makeUPPER(Glycol), state.dataFluidProps->GlycolData, @@ -8024,11 +7923,6 @@ namespace FluidProperties { // Return value int CheckFluidPropertyName; - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - // Item must be either in Refrigerant or Glycol list int Found = 0; if (state.dataFluidProps->NumOfRefrigerants > 0) { @@ -8192,12 +8086,6 @@ namespace FluidProperties { void GetFluidDensityTemperatureLimits(EnergyPlusData &state, int const FluidIndex, Real64 &MinTempLimit, Real64 &MaxTempLimit) { - // Get the input if we haven't already - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - if (FluidIndex > 0) { MinTempLimit = state.dataFluidProps->GlycolData(FluidIndex).RhoLowTempValue; MaxTempLimit = state.dataFluidProps->GlycolData(FluidIndex).RhoHighTempValue; @@ -8206,12 +8094,6 @@ namespace FluidProperties { void GetFluidSpecificHeatTemperatureLimits(EnergyPlusData &state, int const FluidIndex, Real64 &MinTempLimit, Real64 &MaxTempLimit) { - // Get the input if we haven't already - if (state.dataFluidProps->GetInput) { - GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } - if (FluidIndex > 0) { MinTempLimit = state.dataFluidProps->GlycolData(FluidIndex).CpLowTempValue; MaxTempLimit = state.dataFluidProps->GlycolData(FluidIndex).CpHighTempValue; diff --git a/src/EnergyPlus/FluidProperties.hh b/src/EnergyPlus/FluidProperties.hh index c0e77cc9006..3cfe2d5111b 100644 --- a/src/EnergyPlus/FluidProperties.hh +++ b/src/EnergyPlus/FluidProperties.hh @@ -344,8 +344,6 @@ namespace FluidProperties { } }; - void InitializeGlycRoutines(); - void GetFluidPropertiesData(EnergyPlusData &state); template @@ -627,7 +625,6 @@ namespace FluidProperties { struct FluidPropertiesData : BaseGlobalStruct { - bool GetInput = true; // Used to get the input once only int NumOfRefrigerants = 0; // Total number of refrigerants input by user int NumOfGlycols = 0; // Total number of glycols input by user bool DebugReportGlycols = false; @@ -665,7 +662,6 @@ struct FluidPropertiesData : BaseGlobalStruct void init_state(EnergyPlusData &state) override { FluidProperties::GetFluidPropertiesData(state); - this->GetInput = false; } void clear_state() override diff --git a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc index bce02535fa9..ea402f0ea39 100644 --- a/src/EnergyPlus/HVACVariableRefrigerantFlow.cc +++ b/src/EnergyPlus/HVACVariableRefrigerantFlow.cc @@ -2484,10 +2484,6 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // Refrigerant type thisVrfFluidCtrl.RefrigerantName = cAlphaArgs(4); - if (state.dataFluidProps->GetInput) { - EnergyPlus::FluidProperties::GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } if (Util::FindItemInList(thisVrfFluidCtrl.RefrigerantName, state.dataFluidProps->RefrigData, state.dataFluidProps->NumOfRefrigerants) == 0) { ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfFluidCtrl.Name); ShowContinueError(state, "Illegal " + cAlphaFieldNames(4) + " = " + cAlphaArgs(4)); @@ -2883,10 +2879,6 @@ void GetVRFInputData(EnergyPlusData &state, bool &ErrorsFound) // Refrigerant type thisVrfFluidCtrlHR.RefrigerantName = cAlphaArgs(4); - if (state.dataFluidProps->GetInput) { - EnergyPlus::FluidProperties::GetFluidPropertiesData(state); - state.dataFluidProps->GetInput = false; - } if (Util::FindItemInList(thisVrfFluidCtrlHR.RefrigerantName, state.dataFluidProps->RefrigData, state.dataFluidProps->NumOfRefrigerants) == 0) { ShowSevereError(state, cCurrentModuleObject + " = " + thisVrfFluidCtrlHR.Name); diff --git a/src/EnergyPlus/Psychrometrics.hh b/src/EnergyPlus/Psychrometrics.hh index 61360dac72a..b3ebe4d2cb1 100644 --- a/src/EnergyPlus/Psychrometrics.hh +++ b/src/EnergyPlus/Psychrometrics.hh @@ -1702,8 +1702,9 @@ struct PsychrometricsData : BaseGlobalStruct bool ReportErrors = true; bool useInterpolationPsychTsatFnPb = false; - void init_state([[maybe_unused]] EnergyPlusData &state) override + void init_state(EnergyPlusData &state) override { + Psychrometrics::InitializePsychRoutines(state); } void clear_state() override diff --git a/src/EnergyPlus/SimulationManager.cc b/src/EnergyPlus/SimulationManager.cc index d3a03f22aab..70ba13d6ddd 100644 --- a/src/EnergyPlus/SimulationManager.cc +++ b/src/EnergyPlus/SimulationManager.cc @@ -209,12 +209,8 @@ namespace SimulationManager { state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "RunPeriod:CustomRange") > 0 || state.dataSysVars->FullAnnualRun); state.dataErrTracking->AskForConnectionsReport = false; // set to false until sizing is finished - OpenOutputFiles(state); - state.init_state(state); - GetProjectData(state); - Psychrometrics::InitializePsychRoutines(state); CheckForMisMatchedEnvironmentSpecifications(state); CheckForRequestedReporting(state); OutputReportPredefined::SetPredefinedTables(state); diff --git a/src/EnergyPlus/SimulationManager.hh b/src/EnergyPlus/SimulationManager.hh index a376d7ae25a..86f23c4a5d7 100644 --- a/src/EnergyPlus/SimulationManager.hh +++ b/src/EnergyPlus/SimulationManager.hh @@ -99,8 +99,10 @@ struct SimulationManagerData : BaseGlobalStruct bool RunControlInInput = false; bool PreP_Fatal = false; bool WarningOut = true; - void init_state([[maybe_unused]] EnergyPlusData &state) override + void init_state(EnergyPlusData &state) override { + SimulationManager::OpenOutputFiles(state); + SimulationManager::GetProjectData(state); } void clear_state() override diff --git a/src/EnergyPlus/api/func.cc b/src/EnergyPlus/api/func.cc index c17d244fb16..e8e4b5263b4 100644 --- a/src/EnergyPlus/api/func.cc +++ b/src/EnergyPlus/api/func.cc @@ -61,8 +61,7 @@ void initializeFunctionalAPI(EnergyPlusState state) if (!thisState->dataInputProcessing->inputProcessor) { thisState->dataInputProcessing->inputProcessor = EnergyPlus::InputProcessor::factory(); } - EnergyPlus::Psychrometrics::InitializePsychRoutines(*thisState); - EnergyPlus::FluidProperties::InitializeGlycRoutines(); + thisState->init_state(*thisState); } const char *apiVersionFromEPlus(EnergyPlusState) diff --git a/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc b/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc index ea221d656a2..a33c98e10b8 100644 --- a/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc +++ b/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc @@ -10392,6 +10392,7 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_TestOACompConnectionError) }); ASSERT_TRUE(process_idf(idf_objects)); + compare_err_stream_substring("", true); MixedAir::GetOutsideAirSysInputs(*state); state->dataMixedAir->GetOASysInputFlag = false; diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc index 9c74daed695..ea3efeb30bb 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc @@ -1008,6 +1008,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatAirTerminal_MinFlowTurnDownTest) }); ASSERT_TRUE(process_idf(idf_objects)); + compare_err_stream_substring("", true); // clear idf errors // setup variables for VAV Reheat int SysNum = 1; int ZoneNum = 1; @@ -1217,6 +1218,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFanAirTerminal_MinFlowTurnDownTes }); ASSERT_TRUE(process_idf(idf_objects)); + compare_err_stream_substring("", true); // clear idf errors // setup variables for VAV Reheat VS Fan int SysNum = 1; int ZoneNum = 1; @@ -1393,6 +1395,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVHeatCoolReheatAirTerminal_MinFlowTurnDown }); ASSERT_TRUE(process_idf(idf_objects)); + compare_err_stream_substring("", true); // clear idf errors // setup variables for VAV Reheat VS Fan int SysNum = 1; int ZoneNum = 1; @@ -1580,6 +1583,7 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFan_DamperPositionTest) }); ASSERT_TRUE(process_idf(idf_objects)); + compare_err_stream_substring("", true); // clear idf errors // setup variables for VAV Reheat VS Fan int SysNum = 1; int ZoneNum = 1; @@ -1726,6 +1730,7 @@ TEST_F(EnergyPlusFixture, VAVHeatCoolReheatAirTerminal_ZoneOAVolumeFlowRateTest) }); ASSERT_TRUE(process_idf(idf_objects)); + compare_err_stream_substring("", true); // clear idf errors // setup variables for VAV HeatCoolReheat int SysNum = 1; int ZoneNum = 1; diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc index 4430614be84..6fb85c4a598 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc @@ -4965,7 +4965,6 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi state->dataGlobal->TimeStep = 1; state->dataGlobal->MinutesPerTimeStep = 60; ProcessScheduleInput(*state); // read schedules - InitializePsychRoutines(*state); OutputReportPredefined::SetPredefinedTables(*state); GetZoneData(*state, ErrorsFound); diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc index 5e934625bac..993b0e623c1 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc @@ -54,11 +54,13 @@ #include #include #include +#include namespace EnergyPlus { TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) { + state->dataFluidProps->init_state(*state); // this global state is what would be set up by E+ currently state->dataSize->ZoneEqSizing.allocate(1); state->dataEnvrn->StdRhoAir = 1.2; diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc index 7e347403289..08fe992af31 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc @@ -53,11 +53,13 @@ #include #include #include +#include namespace EnergyPlus { TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) { + state->dataFluidProps->init_state(*state); // this global state is what would be set up by E+ currently state->dataEnvrn->StdRhoAir = 1.2; state->dataSize->ZoneEqSizing.allocate(1); diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc index 42a4947212c..ca2acf8aebc 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc @@ -52,11 +52,13 @@ #include #include #include +#include namespace EnergyPlus { TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) { + state->dataFluidProps->init_state(*state); // this global state is what would be set up by E+ currently state->dataEnvrn->StdRhoAir = 1.2; static constexpr std::string_view routineName("HeatingWaterDesCoilLoadUsedForUASizingGauntlet"); diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc index 138d86d8676..a7369eee5c8 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc @@ -52,11 +52,13 @@ #include #include #include +#include namespace EnergyPlus { TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) { + state->dataFluidProps->init_state(*state); // this global state is what would be set up by E+ currently state->dataEnvrn->StdRhoAir = 1.2; state->dataSize->ZoneEqSizing.allocate(1); diff --git a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc index c129056b3d1..e7901625036 100644 --- a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc @@ -52,11 +52,13 @@ #include #include #include +#include namespace EnergyPlus { TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) { + state->dataFluidProps->init_state(*state); // this global state is what would be set up by E+ currently state->dataEnvrn->StdRhoAir = 1.2; static constexpr std::string_view routineName("WaterHeatingCapacitySizingGauntlet"); diff --git a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc index b430530084b..355a4cec876 100644 --- a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc @@ -52,6 +52,7 @@ #include #include #include +#include #include #include @@ -59,6 +60,7 @@ namespace EnergyPlus { TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) { + state->dataFluidProps->init_state(*state); // this global state is what would be set up by E+ currently state->dataEnvrn->StdRhoAir = 1.2; state->dataSize->ZoneEqSizing.allocate(1); diff --git a/tst/EnergyPlus/unit/BoilerHotWater.unit.cc b/tst/EnergyPlus/unit/BoilerHotWater.unit.cc index 19baffc169c..0073f22d5b1 100644 --- a/tst/EnergyPlus/unit/BoilerHotWater.unit.cc +++ b/tst/EnergyPlus/unit/BoilerHotWater.unit.cc @@ -71,6 +71,7 @@ using namespace EnergyPlus::Psychrometrics; TEST_F(EnergyPlusFixture, Boiler_HotWaterSizingTest) { + state->dataFluidProps->init_state(*state); // unit test for autosizing boiler nominal capacity in Boiler:HotWater state->dataBoilers->Boiler.allocate(1); // Hardsized Hot Water Boiler @@ -115,6 +116,7 @@ TEST_F(EnergyPlusFixture, Boiler_HotWaterSizingTest) } TEST_F(EnergyPlusFixture, Boiler_HotWaterAutoSizeTempTest) { + state->dataFluidProps->init_state(*state); // unit test for checking hot water temperature for autosizing // boiler nominal capacity in Boiler:HotWater state->dataBoilers->Boiler.allocate(1); diff --git a/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc b/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc index e550ee9c1ff..aba9d5ec626 100644 --- a/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc +++ b/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc @@ -94,6 +94,7 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_TestOutletNodeConditions) TEST_F(EnergyPlusFixture, ElectricEIRChiller_HeatRecoveryAutosizeTest) { + state->init_state(*state); // unit test for autosizing heat recovery in Chiller:Electric:EIR state->dataChillerElectricEIR->ElectricEIRChiller.allocate(1); auto &thisEIR = state->dataChillerElectricEIR->ElectricEIRChiller(1); @@ -145,11 +146,6 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller) state->dataPlnt->TotNumLoops = 2; state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = 1.20; - state->dataGlobal->NumOfTimeStepInHour = 1; - state->dataGlobal->TimeStep = 1; - state->dataGlobal->MinutesPerTimeStep = 60; - - Psychrometrics::InitializePsychRoutines(*state); std::string const idf_objects = delimited_string({ "Chiller:Electric:EIR,", @@ -195,6 +191,9 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller) EXPECT_TRUE(process_idf(idf_objects, false)); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); state->dataPlnt->PlantLoop.allocate(state->dataPlnt->TotNumLoops); for (int l = 1; l <= state->dataPlnt->TotNumLoops; ++l) { diff --git a/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc b/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc index bbf74d85e25..1bbf38ea6b6 100644 --- a/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc +++ b/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc @@ -139,7 +139,7 @@ TEST_F(EnergyPlusFixture, DOASEffectOnZoneSizing_CalcDOASSupCondsForSizing) TEST_F(EnergyPlusFixture, DOASEffectOnZoneSizing_SizeZoneEquipment) { - + state->init_state(*state); state->dataLoopNodes->Node.allocate(10); state->dataSize->ZoneEqSizing.allocate(2); state->dataHeatBal->Zone.allocate(2); diff --git a/tst/EnergyPlus/unit/DXCoils.unit.cc b/tst/EnergyPlus/unit/DXCoils.unit.cc index 6cb6912e8e0..e2ed52955d4 100644 --- a/tst/EnergyPlus/unit/DXCoils.unit.cc +++ b/tst/EnergyPlus/unit/DXCoils.unit.cc @@ -4633,7 +4633,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput) DX Cooling Coil AHRI 2023 Standard Rating Information, Coil:Cooling:DX:MultiSpeed, ASHP CLG COIL, 31156.1, 3.73, 12.72, 15.17, 15.98, 15.0 )EIO"; replace_pipes_with_spaces(clg_coil_eio_output); - EXPECT_TRUE(compare_eio_stream(clg_coil_eio_output, true)); + EXPECT_TRUE(compare_eio_stream_substring(clg_coil_eio_output, true)); // check multi-speed DX heating coil EXPECT_EQ("ASHP HTG COIL", state->dataDXCoils->DXCoil(2).Name); diff --git a/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc b/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc index 22ed2dd947a..1238b47808c 100644 --- a/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc @@ -71,6 +71,7 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, EvapFluidCoolerSpecs_getDesignCapacitiesTest) { + state->init_state(*state); Real64 MaxLoad; Real64 MinLoad; Real64 OptLoad; diff --git a/tst/EnergyPlus/unit/FaultsManager.unit.cc b/tst/EnergyPlus/unit/FaultsManager.unit.cc index 10cfc08e8a3..ad199ffcd75 100644 --- a/tst/EnergyPlus/unit/FaultsManager.unit.cc +++ b/tst/EnergyPlus/unit/FaultsManager.unit.cc @@ -158,7 +158,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil "ScheduleTypeLimits,", " Fraction, !- Name", " 0, !- Lower Limit Value", - " 1, !- Upper Limit Value", + " 1.5, !- Upper Limit Value", " Continuous; !- Numeric Type", "ScheduleTypeLimits,", @@ -245,7 +245,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil "ScheduleTypeLimits,", " Fraction, !- Name", " 0, !- Lower Limit Value", - " 1, !- Upper Limit Value", + " 1.5, !- Upper Limit Value", " Continuous; !- Numeric Type", "ScheduleTypeLimits,", diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc index 43e61139917..3402f5892fd 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc @@ -118,7 +118,6 @@ void EnergyPlusFixture::SetUp() state->dataUtilityRoutines->outputErrorHeader = false; Psychrometrics::InitializePsychRoutines(*state); - FluidProperties::InitializeGlycRoutines(); createCoilSelectionReportObj(*state); } @@ -184,6 +183,15 @@ bool EnergyPlusFixture::compare_eio_stream(std::string const &expected_string, b return are_equal; } +bool EnergyPlusFixture::compare_eio_stream_substring(std::string const &search_string, bool reset_stream) +{ + auto const stream_str = state->files.eio.get_output(); + bool const found = stream_str.find(search_string) != std::string::npos; + EXPECT_TRUE(found); + if (reset_stream) state->files.eio.open_as_stringstream(); + return found; +} + bool EnergyPlusFixture::compare_mtr_stream(std::string const &expected_string, bool reset_stream) { auto const stream_str = state->files.mtr.get_output(); @@ -307,6 +315,9 @@ bool EnergyPlusFixture::process_idf(std::string_view const idf_snippet, bool use inputProcessor->epJSON = inputProcessor->idf_parser->decode(idf_snippet, inputProcessor->schema(), success); // Add common objects that will trigger a warning if not present + if (inputProcessor->epJSON.find("Timestep") == inputProcessor->epJSON.end()) { + inputProcessor->epJSON["Timestep"] = {{"", {{"idf_order", 0}, {"number_of_timesteps_per_hour", 4}}}}; + } if (inputProcessor->epJSON.find("Version") == inputProcessor->epJSON.end()) { inputProcessor->epJSON["Version"] = {{"", {{"idf_order", 0}, {"version_identifier", DataStringGlobals::MatchVersion}}}}; } @@ -348,9 +359,7 @@ bool EnergyPlusFixture::process_idf(std::string_view const idf_snippet, bool use inputProcessor->initializeMaps(); SimulationManager::PostIPProcessing(*state); - - FluidProperties::GetFluidPropertiesData(*state); - state->dataFluidProps->GetInput = false; + state->init_state(*state); if (state->dataSQLiteProcedures->sqlite) { bool writeOutputToSQLite = false; diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh index b3b8497b049..350878d18c7 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh @@ -171,6 +171,13 @@ protected: // Will return true if string matches the stream and false if it does not bool compare_eio_stream(std::string const &expected_string, bool reset_stream = true); + // Check if EIO string contains a substring. The default is to reset the EIO stream after every call. + // It is easier to test successive functions if the EIO stream is 'empty' before the next call. + // This calls EXPECT_* within the function as well as returns a boolean so you can call [ASSERT/EXPECT]_[TRUE/FALSE] depending + // if it makes sense for the unit test to continue after returning from function. + // Will return true if string matches the stream and false if it does not + bool compare_eio_stream_substring(std::string const &expected_string, bool reset_stream = true); + // Compare an expected string against the MTR stream. The default is to reset the MTR stream after every call. // It is easier to test successive functions if the MTR stream is 'empty' before the next call. // This calls EXPECT_* within the function as well as returns a boolean so you can call [ASSERT/EXPECT]_[TRUE/FALSE] depending diff --git a/tst/EnergyPlus/unit/Furnaces.unit.cc b/tst/EnergyPlus/unit/Furnaces.unit.cc index 7ea94177f89..c98b7c9e906 100644 --- a/tst/EnergyPlus/unit/Furnaces.unit.cc +++ b/tst/EnergyPlus/unit/Furnaces.unit.cc @@ -87,6 +87,7 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) { + state->init_state(*state); int FurnaceNum(1); Real64 OnOffAirFlowRatio; // This is a return value Real64 PartLoadRatio(1.0); diff --git a/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc b/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc index 13b0fb47b1f..cbb8b7c7eb3 100644 --- a/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc +++ b/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc @@ -178,6 +178,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_GetGFunc) TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_Slinky_CalcHXResistance) { + state->init_state(*state); // Initializations GLHESlinky thisGLHE; diff --git a/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc b/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc index 43a0f965845..2bd9dbce437 100644 --- a/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc @@ -67,6 +67,7 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, ExcessiveHeatStorage_Test) { + state->init_state(*state); using namespace DataPlant; using namespace HVACInterfaceManager; Real64 TankOutletTemp; diff --git a/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc b/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc index d4a4eff313c..11e18252587 100644 --- a/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc @@ -1458,7 +1458,7 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_HeatRecoveryTest) { - + state->init_state(*state); state->dataLoopNodes->Node.allocate(2); state->dataHVACMultiSpdHP->MSHeatPump.allocate(1); int HeatRecInNode(1); diff --git a/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc b/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc index d0b10dc7689..7fa8712c0ae 100644 --- a/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc +++ b/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -136,6 +137,8 @@ class HVACSizingSimulationManagerTest : public EnergyPlusFixture TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) { + FluidProperties::GetFluidPropertiesData(*state); + // this test emulates two design days and two sizing weather file days periods // calls code related to coincident plant sizing with HVAC sizing simulation // this test runs 3 system timesteps for each zone timestep @@ -370,6 +373,8 @@ TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep3) { + FluidProperties::GetFluidPropertiesData(*state); + // this test emulates two design days and calls nearly all the OO code related // to coincident plant sizing with HVAC sizing simulation // this test runs 3 system timesteps for each zone timestep @@ -515,6 +520,9 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep3) TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep1) { + + FluidProperties::GetFluidPropertiesData(*state); + // this test emulates two design days and calls nearly all the OO code related // to coincident plant sizing with HVAC sizing simulation // this test runs 1 system timestep for each zone timestep @@ -603,6 +611,9 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep1) TEST_F(HVACSizingSimulationManagerTest, VarySysTimesteps) { + + FluidProperties::GetFluidPropertiesData(*state); + // this test emulates two design days and calls nearly all the OO code related // to coincident plant sizing with HVAC sizing simulation // this test run varies the system timestep some to test irregular diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index 3f5b22152fe..7425c2ebe2e 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -2353,9 +2353,16 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); // Read in IDF - ProcessScheduleInput(*state); // read schedules - Curve::GetCurveInput(*state); // read curves + ProcessScheduleInput(*state); // read schedules + Curve::GetCurveInput(*state); // read curves + // test consecutive call to fluid properties getInput FluidProperties::GetFluidPropertiesData(*state); // read refrigerant properties + EXPECT_EQ(2, state->dataFluidProps->NumOfRefrigerants); + EXPECT_EQ(1, state->dataFluidProps->NumOfGlycols); + + FluidProperties::GetFluidPropertiesData(*state); // should never happen but if it does it's safe + EXPECT_EQ(2, state->dataFluidProps->NumOfRefrigerants); + EXPECT_EQ(1, state->dataFluidProps->NumOfGlycols); // set up ZoneEquipConfig data state->dataGlobal->NumOfZones = 1; @@ -8282,7 +8289,7 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilWater) { // PURPOSE OF THE TEST: // checks VRF terminal units supplemental hot water heating coil calculation - + state->init_state(*state); VRFTerminalUnitEquipment thisVRFTU; int VRFTUNum(1); @@ -8402,6 +8409,7 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilSteam) // PURPOSE OF THE TEST: // checks VRF terminal units supplemental steam heating coil calculation + state->init_state(*state); VRFTerminalUnitEquipment thisVRFTU; int VRFTUNum(1); diff --git a/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc b/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc index 1d92e5a3a85..2c3f06b34fd 100644 --- a/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc +++ b/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc @@ -77,6 +77,7 @@ using namespace DataPlant; TEST_F(EnergyPlusFixture, HWBaseboardRadiator_CalcHWBaseboard) { + state->init_state(*state); Real64 LoadMet; int BBNum; diff --git a/tst/EnergyPlus/unit/Humidifiers.unit.cc b/tst/EnergyPlus/unit/Humidifiers.unit.cc index af7ad5d7796..c37958c73c6 100644 --- a/tst/EnergyPlus/unit/Humidifiers.unit.cc +++ b/tst/EnergyPlus/unit/Humidifiers.unit.cc @@ -71,6 +71,7 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, Humidifiers_Sizing) { + state->init_state(*state); state->dataSize->SysSizingRunDone = true; state->dataSize->CurSysNum = 1; state->dataHumidifiers->NumElecSteamHums = 0; @@ -106,6 +107,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_Sizing) TEST_F(EnergyPlusFixture, Humidifiers_AutoSizing) { + state->init_state(*state); state->dataSize->SysSizingRunDone = true; state->dataSize->CurSysNum = 1; state->dataHumidifiers->NumElecSteamHums = 0; @@ -146,6 +148,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_AutoSizing) TEST_F(EnergyPlusFixture, Humidifiers_EnergyUse) { + state->init_state(*state); HumidifierData thisHum; state->dataHVACGlobal->TimeStepSys = 0.25; diff --git a/tst/EnergyPlus/unit/InputProcessor.unit.cc b/tst/EnergyPlus/unit/InputProcessor.unit.cc index 19b73256320..8e46bd4100a 100644 --- a/tst/EnergyPlus/unit/InputProcessor.unit.cc +++ b/tst/EnergyPlus/unit/InputProcessor.unit.cc @@ -223,6 +223,9 @@ TEST_F(InputProcessorFixture, decode_encode_1) " Relative,", " Relative;", "", + "Timestep,", + " 4;", + "", "Version,", " " + DataStringGlobals::MatchVersion + ";", ""}); @@ -268,6 +271,9 @@ TEST_F(InputProcessorFixture, decode_encode_2) " Relative,", " Relative;", "", + "Timestep,", + " 4;", + "", "Version,", " " + DataStringGlobals::MatchVersion + ";", "", @@ -335,6 +341,9 @@ TEST_F(InputProcessorFixture, decode_encode_3) " ,", " 10;", "", + "Timestep,", + " 4;", + "", "Version,", " " + DataStringGlobals::MatchVersion + ";", ""})); @@ -367,6 +376,9 @@ TEST_F(InputProcessorFixture, byte_order_mark) " Relative,", " Relative;", "", + "Timestep,", + " 4;", + "", "Version,", " " + DataStringGlobals::MatchVersion + ";", ""})); @@ -548,6 +560,7 @@ TEST_F(InputProcessorFixture, parse_bad_utf_8_json_2) "\"vertex_entry_direction\":\"Counterclockwise\"" "}" "}," + "\"Timestep\":{\"\":{\"idf_order\":0,\"number_of_timesteps_per_hour\":4}}," "\"Version\":{" "\"\":{" "\"idf_order\":0," @@ -596,6 +609,7 @@ TEST_F(InputProcessorFixture, parse_bad_utf_8_json_3) "\"vertex_entry_direction\":\"Counterclockwise\"" "}" "}," + "\"Timestep\":{\"\":{\"idf_order\":0,\"number_of_timesteps_per_hour\":4}}," "\"Version\":{" "\"\":{" "\"idf_order\":0," @@ -928,6 +942,9 @@ TEST_F(InputProcessorFixture, parse_idf_extensible_blank_extensibles) " Relative,", " Relative;", "", + "Timestep,", + " 4;", + "", "Version,", " " + DataStringGlobals::MatchVersion + ";", ""})); @@ -4201,6 +4218,11 @@ TEST_F(InputProcessorFixture, reportIDFRecordsStats_basic) { std::string const idf_objects = delimited_string({ + // 1 fields with default, 0 Autosizable, 0 Autocalculatable + // 0 fields defaulted , 0 Autosized , 0 Autocalculated + "Timestep,", + " 4;", // Has a default + // 1 fields with default, 0 Autosizable, 0 Autocalculatable // 0 fields defaulted , 0 Autosized , 0 Autocalculated "Version,", @@ -4283,11 +4305,11 @@ TEST_F(InputProcessorFixture, reportIDFRecordsStats_basic) state->dataInputProcessing->inputProcessor->reportIDFRecordsStats(*state); // TOTAL: - // 36 fields with defaults, 6 Autosizable, 3 Autocalculatable + // 37 fields with defaults, 6 Autosizable, 3 Autocalculatable // 11 fields defaulted , 4 Autosized , 2 Autocalculated - EXPECT_EQ(4, state->dataOutput->iNumberOfRecords); // Number of IDF Records (=Objects) - EXPECT_EQ(36, state->dataOutput->iTotalFieldsWithDefaults); // Total number of fields that could be defaulted + EXPECT_EQ(5, state->dataOutput->iNumberOfRecords); // Number of IDF Records (=Objects) + EXPECT_EQ(37, state->dataOutput->iTotalFieldsWithDefaults); // Total number of fields that could be defaulted EXPECT_EQ(6, state->dataOutput->iTotalAutoSizableFields); // Total number of autosizeable fields EXPECT_EQ(3, state->dataOutput->iTotalAutoCalculatableFields); // Total number of autocalculatable fields EXPECT_EQ(11, state->dataOutput->iNumberOfDefaultedFields); // Number of defaulted fields in IDF @@ -4300,6 +4322,11 @@ TEST_F(InputProcessorFixture, reportIDFRecordsStats_extensible_fields) std::string const idf_objects = delimited_string({ + // 1 fields with default, 0 Autosizable, 0 Autocalculatable + // 0 fields defaulted , 0 Autosized , 0 Autocalculated + "Timestep,", + " 4;", // Has a default + // 1 fields with default, 0 Autosizable, 0 Autocalculatable // 0 fields defaulted , 0 Autosized , 0 Autocalculated "Version,", @@ -4356,11 +4383,11 @@ TEST_F(InputProcessorFixture, reportIDFRecordsStats_extensible_fields) state->dataInputProcessing->inputProcessor->reportIDFRecordsStats(*state); // TOTAL: - // 15 fields with defaults, 0 Autosizable, 0 Autocalculatable + // 16 fields with defaults, 0 Autosizable, 0 Autocalculatable // 2 fields defaulted , 0 Autosized , 0 Autocalculated - EXPECT_EQ(4, state->dataOutput->iNumberOfRecords); // Number of IDF Records (=Objects) - EXPECT_EQ(15, state->dataOutput->iTotalFieldsWithDefaults); // Total number of fields that could be defaulted + EXPECT_EQ(5, state->dataOutput->iNumberOfRecords); // Number of IDF Records (=Objects) + EXPECT_EQ(16, state->dataOutput->iTotalFieldsWithDefaults); // Total number of fields that could be defaulted EXPECT_EQ(0, state->dataOutput->iTotalAutoSizableFields); // Total number of autosizeable fields EXPECT_EQ(0, state->dataOutput->iTotalAutoCalculatableFields); // Total number of autocalculatable fields EXPECT_EQ(2, state->dataOutput->iNumberOfDefaultedFields); // Number of defaulted fields in IDF diff --git a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc index fd592fbe9ab..12513ddf139 100644 --- a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc +++ b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc @@ -206,6 +206,7 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantElectric) TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantVariableFlow) { + FluidProperties::GetFluidPropertiesData(*state); SystemType = LowTempRadiantSystem::SystemType::HydronicSystem; state->dataLowTempRadSys->HydrRadSys(RadSysNum).Name = "LowTempVarFlow 1"; state->dataLowTempRadSys->HydrRadSys(RadSysNum).ZonePtr = 1; @@ -299,6 +300,7 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantVariableFlow) TEST_F(LowTempRadiantSystemTest, SizeCapacityLowTempRadiantVariableFlow) { + FluidProperties::GetFluidPropertiesData(*state); SystemType = LowTempRadiantSystem::SystemType::HydronicSystem; state->dataLowTempRadSys->HydrRadSys(RadSysNum).Name = "LowTempVarFlow 1"; state->dataLowTempRadSys->HydrRadSys(RadSysNum).ZonePtr = 1; @@ -375,6 +377,7 @@ TEST_F(LowTempRadiantSystemTest, SizeCapacityLowTempRadiantVariableFlow) TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantConstantFlow) { + FluidProperties::GetFluidPropertiesData(*state); SystemType = LowTempRadiantSystem::SystemType::ConstantFlowSystem; state->dataLowTempRadSys->CFloRadSys(RadSysNum).Name = "LowTempConstantFlow 1"; state->dataLowTempRadSys->CFloRadSys(RadSysNum).ZonePtr = 1; @@ -2596,6 +2599,7 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadConFlowSystemAutoSizeTempTest) Real64 Density; Real64 Cp; + FluidProperties::GetFluidPropertiesData(*state); SystemType = LowTempRadiantSystem::SystemType::ConstantFlowSystem; state->dataLowTempRadSys->CFloRadSys(RadSysNum).Name = "LowTempConstantFlow"; @@ -2686,6 +2690,7 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadCalcRadSysHXEffectTermTest) Real64 TubeDiameter; Real64 HXEffectFuncResult; int SurfNum; + FluidProperties::GetFluidPropertiesData(*state); // Set values of items that will stay constant for all calls to HX Effectiveness function RadSysNum = 1; diff --git a/tst/EnergyPlus/unit/MixedAir.unit.cc b/tst/EnergyPlus/unit/MixedAir.unit.cc index 0b6f721de7b..34ecef54b8d 100644 --- a/tst/EnergyPlus/unit/MixedAir.unit.cc +++ b/tst/EnergyPlus/unit/MixedAir.unit.cc @@ -6468,6 +6468,7 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->CurrentTime = 0.25; state->dataContaminantBalance->ContaminantControlledZone.allocate(1); state->dataContaminantBalance->ContaminantControlledZone(1).AvaiSchedPtr = 4; state->dataContaminantBalance->ContaminantControlledZone(1).SPSchedIndex = 5; @@ -6565,7 +6566,7 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) " ** ~~~ ** Environment=, at Simulation time= 00:00 - 00:00", }); - EXPECT_TRUE(compare_err_stream(error_string, true)); + EXPECT_TRUE(compare_err_stream_substring(error_string, true)); state->dataAirLoop->AirLoopControlInfo.deallocate(); state->dataSize->OARequirements.deallocate(); diff --git a/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc b/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc index fe22f162eb7..d49a85525c4 100644 --- a/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc +++ b/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc @@ -289,6 +289,7 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->CurrentTime = 0.25; state->dataGlobal->BeginEnvrnFlag = true; state->dataSize->CurZoneEqNum = 1; state->dataEnvrn->OutBaroPress = 101325; // sea level @@ -365,6 +366,8 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) EXPECT_DOUBLE_EQ(SAFanPower, 75.0); EXPECT_DOUBLE_EQ(EAFanPower, 75.0); EXPECT_DOUBLE_EQ(SAFanPower + EAFanPower, state->dataOutdoorAirUnit->OutAirUnit(OAUnitNum).ElecFanRate); + compare_err_stream_substring("", true); + EXPECT_TRUE(compare_err_stream("", true)); // #6173 state->dataOutdoorAirUnit->OutAirUnit(OAUnitNum).ExtAirMassFlow = 0.0; diff --git a/tst/EnergyPlus/unit/OutputFiles.unit.cc b/tst/EnergyPlus/unit/OutputFiles.unit.cc index 6d04767db4b..e0417086a8d 100644 --- a/tst/EnergyPlus/unit/OutputFiles.unit.cc +++ b/tst/EnergyPlus/unit/OutputFiles.unit.cc @@ -276,7 +276,6 @@ TEST_F(EnergyPlusFixture, OutputControlFiles) " ** ~~~ ** See InputOutputReference document for more details.", " ************* Object=Building=Bldg", " ** ~~~ ** Object=GlobalGeometryRules", - " ** ~~~ ** Object=Version", }); compare_err_stream(expected_error); diff --git a/tst/EnergyPlus/unit/OutputProcessor.unit.cc b/tst/EnergyPlus/unit/OutputProcessor.unit.cc index 1411183733c..44ae8837d37 100644 --- a/tst/EnergyPlus/unit/OutputProcessor.unit.cc +++ b/tst/EnergyPlus/unit/OutputProcessor.unit.cc @@ -2990,7 +2990,8 @@ namespace OutputProcessor { auto reportExtendedDataResults = queryResult("SELECT * FROM ReportExtendedData;", "ReportExtendedData"); compare_eso_stream( - delimited_string({"1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", + delimited_string({"Program Version,", + "1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", "2,11,Boiler2,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", "3,11,Boiler3,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n")); @@ -3021,7 +3022,8 @@ namespace OutputProcessor { auto reportExtendedDataResults = queryResult("SELECT * FROM ReportExtendedData;", "ReportExtendedData"); compare_eso_stream( - delimited_string({"1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", + delimited_string({"Program Version,", + "1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", "2,11,Boiler3,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n")); } @@ -3052,7 +3054,8 @@ namespace OutputProcessor { auto reportExtendedDataResults = queryResult("SELECT * FROM ReportExtendedData;", "ReportExtendedData"); compare_eso_stream( - delimited_string({"1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", + delimited_string({"Program Version,", + "1,11,Boiler1,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", "2,11,Boiler2,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]", "3,11,Boiler3,Boiler NaturalGas Rate [W] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n")); @@ -3120,6 +3123,7 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { + "Program Version,", "1,1,Zn003:Wall001,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", "2,1,Zn003:Wall002,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", "3,1,Zn003:Wall002:Win001,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", @@ -3192,6 +3196,7 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { + "Program Version,", "1,1,ZN003:WALL001,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", "2,1,ZN003:WALL002,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", "3,1,ZN003:WALL002:WIN001,AFN Linkage Node 1 to Node 2 Volume Flow Rate [m3/s] !TimeStep", @@ -3289,7 +3294,8 @@ namespace OutputProcessor { UpdateMeterReporting(*state); compare_mtr_stream( - delimited_string({"53,9,InteriorLights:Electricity:Zone:SPACE1 [J] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]", + delimited_string({"Program Version,", + "53,9,InteriorLights:Electricity:Zone:SPACE1 [J] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]", "102,9,InteriorLights:Electricity:Zone:SPACE2 [J] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]", "139,9,InteriorLights:Electricity:Zone:SPACE3 [J] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]", "176,9,InteriorLights:Electricity:Zone:SPACE4 [J] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]", @@ -3740,6 +3746,7 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStep = 4; state->dataGlobal->DayOfSim = 365; state->dataGlobal->DayOfSimChr = "365"; state->dataEnvrn->Month = 12; @@ -3958,6 +3965,7 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { + "Program Version,", "1,1,Environment,Site Outdoor Air Drybulb Temperature [C] !TimeStep", "2,1,Environment,Site Outdoor Air Drybulb Temperature [C] !Hourly", "3,7,Environment,Site Outdoor Air Drybulb Temperature [C] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]", @@ -3988,6 +3996,7 @@ namespace OutputProcessor { compare_mtr_stream(delimited_string( { + "Program Version,", "7,1,Electricity:Facility [J] !TimeStep", "8,1,Electricity:Facility [J] !Hourly", "9,7,Electricity:Facility [J] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]", @@ -4029,6 +4038,7 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStep = 4; state->dataGlobal->DayOfSim = 365; state->dataGlobal->DayOfSimChr = "365"; state->dataEnvrn->Month = 12; @@ -4255,6 +4265,7 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { + "Program Version,", "1,1,Environment,Site Outdoor Air Drybulb Temperature [C] !Each Call", "2,1,Environment,Site Outdoor Air Drybulb Temperature [C] !TimeStep", "3,1,Environment,Site Outdoor Air Drybulb Temperature [C] !Hourly", @@ -4289,6 +4300,7 @@ namespace OutputProcessor { compare_mtr_stream(delimited_string( { + "Program Version,", "8,1,Electricity:Facility [J] !Each Call", "9,1,Electricity:Facility [J] !Hourly", "10,7,Electricity:Facility [J] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]", @@ -4532,6 +4544,7 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { + "Program Version,", "1,1,Environment,Site Outdoor Air Drybulb Temperature [C] !Each Call", "2,1,Environment,Site Outdoor Air Drybulb Temperature [C] !TimeStep", "3,1,Environment,Site Outdoor Air Drybulb Temperature [C] !Hourly", @@ -4553,6 +4566,7 @@ namespace OutputProcessor { compare_mtr_stream(delimited_string( { + "Program Version,", "8,1,Electricity:Facility [J] !Each Call", "9,1,Electricity:Facility [J] !Hourly", "10,7,Electricity:Facility [J] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]", @@ -4571,6 +4585,7 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->TimeStep = 4; state->dataGlobal->DayOfSim = 365; state->dataGlobal->DayOfSimChr = "365"; state->dataEnvrn->Month = 12; @@ -4628,6 +4643,7 @@ namespace OutputProcessor { compare_eso_stream(delimited_string( { + "Program Version,", "2,1,Electricity:Facility [J] !TimeStep", ",365,12,31, 0,24,50.00,60.00,Tuesday", "2,0.0", diff --git a/tst/EnergyPlus/unit/Pipes.unit.cc b/tst/EnergyPlus/unit/Pipes.unit.cc index 6c4163b12d6..27057b9fef4 100644 --- a/tst/EnergyPlus/unit/Pipes.unit.cc +++ b/tst/EnergyPlus/unit/Pipes.unit.cc @@ -82,7 +82,7 @@ TEST_F(EnergyPlusFixture, TestPipesInput) TEST_F(EnergyPlusFixture, CalcPipeHeatTransCoef) { - + state->init_state(*state); state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); state->dataLoopNodes->Node.allocate(2); diff --git a/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc b/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc index 913657fa1d0..4cdfdf1dea1 100644 --- a/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc +++ b/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc @@ -62,6 +62,7 @@ using namespace EnergyPlus; TEST_F(EnergyPlusFixture, ChillerHeater_Autosize) { + state->init_state(*state); // Allocate One Wrapper with One module (=distinct ChillerHeaterPerformance:Electric:EIR) // but with a number of identical number module of 2 in CentralHeatPumpSystem int NumWrappers = 1; diff --git a/tst/EnergyPlus/unit/PlantChillers.unit.cc b/tst/EnergyPlus/unit/PlantChillers.unit.cc index 5e39725b141..c79b4fc5ad2 100644 --- a/tst/EnergyPlus/unit/PlantChillers.unit.cc +++ b/tst/EnergyPlus/unit/PlantChillers.unit.cc @@ -62,6 +62,7 @@ using namespace PlantChillers; TEST_F(EnergyPlusFixture, GTChiller_HeatRecoveryAutosizeTest) { + state->init_state(*state); // unit test for autosizing heat recovery in Chiller:CombustionTurbine state->dataPlantChillers->GTChiller.allocate(1); @@ -99,6 +100,7 @@ TEST_F(EnergyPlusFixture, GTChiller_HeatRecoveryAutosizeTest) TEST_F(EnergyPlusFixture, EngineDrivenChiller_HeatRecoveryAutosizeTest) { + state->init_state(*state); // unit test for autosizing heat recovery in Chiller:EngineDriven state->dataPlantChillers->EngineDrivenChiller.allocate(1); diff --git a/tst/EnergyPlus/unit/PlantLoadProfile.unit.cc b/tst/EnergyPlus/unit/PlantLoadProfile.unit.cc index 67142450ce6..79596369112 100644 --- a/tst/EnergyPlus/unit/PlantLoadProfile.unit.cc +++ b/tst/EnergyPlus/unit/PlantLoadProfile.unit.cc @@ -122,6 +122,7 @@ TEST_F(EnergyPlusFixture, LoadProfile_GetInput) TEST_F(EnergyPlusFixture, LoadProfile_initandsimulate_Waterloop) { + state->init_state(*state); state->dataPlnt->PlantLoop.allocate(1); state->dataLoopNodes->Node.allocate(2); state->dataPlantLoadProfile->PlantProfile.allocate(1); @@ -190,6 +191,7 @@ TEST_F(EnergyPlusFixture, LoadProfile_initandsimulate_Waterloop) TEST_F(EnergyPlusFixture, LoadProfile_initandsimulate_Steamloop) { + state->init_state(*state); state->dataPlnt->PlantLoop.allocate(1); state->dataLoopNodes->Node.allocate(2); state->dataPlantLoadProfile->PlantProfile.allocate(1); diff --git a/tst/EnergyPlus/unit/PlantManager.unit.cc b/tst/EnergyPlus/unit/PlantManager.unit.cc index 6c4dca1e636..354af3d518d 100644 --- a/tst/EnergyPlus/unit/PlantManager.unit.cc +++ b/tst/EnergyPlus/unit/PlantManager.unit.cc @@ -75,6 +75,7 @@ namespace PlantManager { TEST_F(EnergyPlusFixture, PlantManager_SizePlantLoopTest) { + state->init_state(*state); state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).VolumeWasAutoSized = true; state->dataPlnt->PlantLoop(1).MaxVolFlowRate = 5; diff --git a/tst/EnergyPlus/unit/PlantUtilities.unit.cc b/tst/EnergyPlus/unit/PlantUtilities.unit.cc index 5b0e985817d..985eab7d687 100644 --- a/tst/EnergyPlus/unit/PlantUtilities.unit.cc +++ b/tst/EnergyPlus/unit/PlantUtilities.unit.cc @@ -57,6 +57,7 @@ #include "Fixtures/EnergyPlusFixture.hh" #include #include +#include #include #include @@ -89,6 +90,15 @@ TEST_F(EnergyPlusFixture, PlantUtilities_RegisterPlantCompDesignFlowTest1) TEST_F(EnergyPlusFixture, TestRegulateCondenserCompFlowReqOp) { + // test consecutive call to fluid properties getInput + FluidProperties::GetFluidPropertiesData(*state); + EXPECT_EQ(1, state->dataFluidProps->NumOfRefrigerants); + EXPECT_EQ(1, state->dataFluidProps->NumOfGlycols); + + FluidProperties::GetFluidPropertiesData(*state); // should never happen but if it does it's safe + EXPECT_EQ(1, state->dataFluidProps->NumOfRefrigerants); + EXPECT_EQ(1, state->dataFluidProps->NumOfGlycols); + // This test captures all code paths through the RegulateCondenserCompFlowReqOp function // We only need a single component to check here state->dataPlnt->PlantLoop.allocate(1); diff --git a/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc b/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc index 8f49067b8c5..581a6ff02b1 100644 --- a/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc +++ b/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc @@ -75,6 +75,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ChWCoil) int chWInletNodeNum = 9; int chWOutletNodeNum = 15; + state->init_state(*state); state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).Name = "Chilled Water Loop"; @@ -229,6 +230,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_SteamCoil) int wInletNodeNum = 9; int wOutletNodeNum = 15; + state->init_state(*state); state->dataPlnt->TotNumLoops = 1; state->dataPlnt->PlantLoop.allocate(1); state->dataPlnt->PlantLoop(1).Name = "Steam Loop"; diff --git a/tst/EnergyPlus/unit/SimulationManager.unit.cc b/tst/EnergyPlus/unit/SimulationManager.unit.cc index 67d2357667c..954b4afae02 100644 --- a/tst/EnergyPlus/unit/SimulationManager.unit.cc +++ b/tst/EnergyPlus/unit/SimulationManager.unit.cc @@ -112,8 +112,6 @@ TEST_F(EnergyPlusFixture, Test_PerformancePrecisionTradeoffs_DirectSolution_Mess EXPECT_TRUE(process_idf(idf_objects, false)); - SimulationManager::GetProjectData(*state); - std::string const error_string = delimited_string({ " ** Warning ** PerformancePrecisionTradeoffs: Coil Direct Solution simulation is selected.", }); @@ -172,7 +170,6 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(*state); EXPECT_FALSE(state->dataReportFlag->DebugOutput); EXPECT_FALSE(state->dataReportFlag->EvenDuringWarmup); @@ -187,9 +184,9 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) " ; !- Report During Warmup", }); + state->init_state_called = false; EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(*state); EXPECT_TRUE(state->dataReportFlag->DebugOutput); EXPECT_FALSE(state->dataReportFlag->EvenDuringWarmup); @@ -204,9 +201,9 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) " Yes; !- Report During Warmup", }); + state->init_state_called = false; EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(*state); EXPECT_FALSE(state->dataReportFlag->DebugOutput); EXPECT_TRUE(state->dataReportFlag->EvenDuringWarmup); @@ -226,26 +223,21 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) " No; !- Report During Warmup", }); + state->init_state_called = false; + compare_err_stream_substring("", true); // Input processor with throw a severe, so do not use assertions EXPECT_FALSE(process_idf(idf_objects, false)); // Instead do it here, making sure to reset the stream { std::string const expectedError = delimited_string({ " ** Severe ** [Output:DebuggingData] - Object should have no more than 1 properties.", + " ** Warning ** Output:DebuggingData: More than 1 occurrence of this object found, only first will be used.", }); EXPECT_TRUE(compare_err_stream(expectedError, true)); } - SimulationManager::GetProjectData(*state); EXPECT_FALSE(state->dataReportFlag->DebugOutput); EXPECT_TRUE(state->dataReportFlag->EvenDuringWarmup); - - { - std::string const expectedError = delimited_string({ - " ** Warning ** Output:DebuggingData: More than 1 occurrence of this object found, only first will be used.", - }); - EXPECT_TRUE(compare_err_stream(expectedError, true)); - } } } @@ -257,8 +249,6 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_DefaultState) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(*state); - EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); EXPECT_FALSE(state->dataGlobal->DisplayUnusedObjects); @@ -293,8 +283,6 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_SimpleCase) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(*state); - EXPECT_TRUE(state->dataGlobal->DisplayAllWarnings); EXPECT_TRUE(state->dataGlobal->DisplayExtraWarnings); EXPECT_TRUE(state->dataGlobal->DisplayUnusedObjects); @@ -333,8 +321,6 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_AllKeys) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(*state); - EXPECT_TRUE(state->dataGlobal->DisplayAllWarnings); EXPECT_TRUE(state->dataGlobal->DisplayExtraWarnings); EXPECT_TRUE(state->dataGlobal->DisplayUnusedObjects); @@ -362,16 +348,17 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_Unicity) " DisplayAllWarnings; !- Key 1", }); + compare_err_stream_substring("", true); // Input processor will throw a severe, so do not use assertions EXPECT_FALSE(process_idf(idf_objects, false)); // Instead do it here, making sure to reset the stream { std::string const expectedError = delimited_string({ " ** Severe ** [Output:Diagnostics] - Object should have no more than 1 properties.", + " ** Warning ** Output:Diagnostics: More than 1 occurrence of this object found, only first will be used.", }); EXPECT_TRUE(compare_err_stream(expectedError, true)); } - SimulationManager::GetProjectData(*state); EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); @@ -385,13 +372,6 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_Unicity) EXPECT_FALSE(state->dataEnvrn->DisplayWeatherMissingDataWarnings); EXPECT_FALSE(state->dataSysVars->ReportDetailedWarmupConvergence); EXPECT_FALSE(state->dataSysVars->ReportDuringHVACSizingSimulation); - - { - std::string const expectedError = delimited_string({ - " ** Warning ** Output:Diagnostics: More than 1 occurrence of this object found, only first will be used.", - }); - EXPECT_TRUE(compare_err_stream(expectedError, true)); - } } TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_UndocumentedFlags) @@ -421,8 +401,6 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_UndocumentedFlags) }); EXPECT_TRUE(compare_err_stream(expected_warning, true)); - SimulationManager::GetProjectData(*state); - EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); EXPECT_FALSE(state->dataGlobal->DisplayUnusedObjects); @@ -458,8 +436,6 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_HasEmpty) EXPECT_TRUE(process_idf(idf_objects)); - ASSERT_NO_THROW(SimulationManager::GetProjectData(*state)); - EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); EXPECT_FALSE(state->dataGlobal->DisplayUnusedObjects); @@ -496,8 +472,6 @@ TEST_F(EnergyPlusFixture, SimulationManager_HVACSizingSimulationChoiceTest) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(*state); - EXPECT_TRUE(state->dataGlobal->DoHVACSizingSimulation); // get a default value EXPECT_EQ(state->dataGlobal->HVACSizingSimMaxIterations, 1); @@ -519,8 +493,6 @@ TEST_F(EnergyPlusFixture, Test_SimulationControl_ZeroSimulation) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(*state); - ASSERT_THROW(SimulationManager::CheckForMisMatchedEnvironmentSpecifications(*state), std::runtime_error); // no error message from PerformancePrecisionTradeoffs objects // @@ -551,8 +523,6 @@ TEST_F(EnergyPlusFixture, Test_SimulationControl_PureLoadCalc) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(*state); - EXPECT_NO_THROW(SimulationManager::CheckForMisMatchedEnvironmentSpecifications(*state)); // no error message from PerformancePrecisionTradeoffs objects // diff --git a/tst/EnergyPlus/unit/StandardRatings.unit.cc b/tst/EnergyPlus/unit/StandardRatings.unit.cc index c435b75c860..406d05f688f 100644 --- a/tst/EnergyPlus/unit/StandardRatings.unit.cc +++ b/tst/EnergyPlus/unit/StandardRatings.unit.cc @@ -1202,7 +1202,7 @@ TEST_F(EnergyPlusFixture, ChillerIPLVTestWaterCooledReform) { using StandardRatings::CalcChillerIPLV; - + state->init_state(*state); // Setup a water-cooled Chiller:Electric:ReformulatedEIR chiller with reference conditions being at non-rated conditions state->dataChillerReformulatedEIR->ElecReformEIRChiller.allocate(1); state->dataChillerReformulatedEIR->ElecReformEIRChiller(1).Name = "ReformEIRChiller McQuay WSC 471kW/5.89COP/Vanes"; diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index 1d36b7f9d89..d4c559ceba2 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -3912,6 +3912,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_HeatTransferAlgorithmTest) bool ErrorsFound(false); std::string const idf_objects = delimited_string({ + " Timestep, 20;" " HeatBalanceAlgorithm,", " MoisturePenetrationDepthConductionTransferFunction; !- Algorithm", "Material,", diff --git a/tst/EnergyPlus/unit/SwimmingPool.unit.cc b/tst/EnergyPlus/unit/SwimmingPool.unit.cc index d6829e82b38..61d10cc5db5 100644 --- a/tst/EnergyPlus/unit/SwimmingPool.unit.cc +++ b/tst/EnergyPlus/unit/SwimmingPool.unit.cc @@ -501,6 +501,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_reportTest) Real64 constexpr closeEnough = 0.000001; SwimmingPoolData myPool; + state->init_state(*state); // Test Data myPool.Name = "This Pool"; myPool.SurfacePtr = 1; diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 427ab85de53..ca3e396a734 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -296,6 +296,8 @@ class AirloopUnitarySysTest : public EnergyPlusFixture TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) { + FluidProperties::GetFluidPropertiesData(*state); + // Set up raw water coil sizes as coil-on-branch configuration then // test against sizing of same water coils in UnitarySystem @@ -5479,6 +5481,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ConfirmUnitarySystemSizingTest) TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) { + FluidProperties::GetFluidPropertiesData(*state); int AirLoopNum(1); bool FirstHVACIteration(false); HVAC::CompressorOp CompressorOn(HVAC::CompressorOp::On); @@ -5620,6 +5623,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) { + FluidProperties::GetFluidPropertiesData(*state); HVAC::CompressorOp CompressorOn(HVAC::CompressorOp::On); int AirLoopNum(1); bool FirstHVACIteration(false); @@ -20184,6 +20188,7 @@ TEST_F(EnergyPlusFixture, CoilSystemCoolingWater_HeatRecoveryLoop) TEST_F(AirloopUnitarySysTest, WSHPVariableSpeedCoilSizing) { + FluidProperties::GetFluidPropertiesData(*state); // test that correct CapFT inputs are used for the WSHP cooling coil state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); diff --git a/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc b/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc index 440eacf441d..e4307f6da2d 100644 --- a/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc +++ b/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc @@ -232,8 +232,10 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing1) ASSERT_TRUE(process_idf(idf_objects)); state->dataSize->FinalZoneSizing.allocate(1); + state->dataSize->FinalZoneSizing(1).allocateMemberArrays(96); state->dataSize->NumAirTerminalSizingSpec = 1; state->dataSize->TermUnitFinalZoneSizing.allocate(1); + state->dataSize->TermUnitFinalZoneSizing(1).allocateMemberArrays(96); state->dataSize->CalcFinalZoneSizing.allocate(1); state->dataSize->TermUnitSizing.allocate(1); GetZoneData(*state, ErrorsFound); @@ -424,7 +426,9 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing2) ASSERT_TRUE(process_idf(idf_objects)); state->dataSize->FinalZoneSizing.allocate(1); + state->dataSize->FinalZoneSizing(1).allocateMemberArrays(96); state->dataSize->TermUnitFinalZoneSizing.allocate(1); + state->dataSize->TermUnitFinalZoneSizing(1).allocateMemberArrays(96); state->dataSize->NumAirTerminalSizingSpec = 1; state->dataSize->CalcFinalZoneSizing.allocate(1); state->dataSize->TermUnitSizing.allocate(1); @@ -616,7 +620,9 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing3) ASSERT_TRUE(process_idf(idf_objects)); state->dataSize->FinalZoneSizing.allocate(1); + state->dataSize->FinalZoneSizing(1).allocateMemberArrays(96); state->dataSize->TermUnitFinalZoneSizing.allocate(1); + state->dataSize->TermUnitFinalZoneSizing(1).allocateMemberArrays(96); state->dataSize->CalcFinalZoneSizing.allocate(1); state->dataSize->TermUnitSizing.allocate(1); GetZoneData(*state, ErrorsFound); @@ -809,7 +815,9 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing4) ASSERT_TRUE(process_idf(idf_objects)); state->dataSize->FinalZoneSizing.allocate(1); + state->dataSize->FinalZoneSizing(1).allocateMemberArrays(96); state->dataSize->TermUnitFinalZoneSizing.allocate(1); + state->dataSize->TermUnitFinalZoneSizing(1).allocateMemberArrays(96); state->dataSize->CalcFinalZoneSizing.allocate(1); state->dataSize->TermUnitSizing.allocate(1); GetZoneData(*state, ErrorsFound); @@ -958,8 +966,10 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing5) ASSERT_TRUE(process_idf(idf_objects)); state->dataSize->FinalZoneSizing.allocate(1); + state->dataSize->FinalZoneSizing(1).allocateMemberArrays(96); state->dataSize->NumAirTerminalSizingSpec = 1; state->dataSize->TermUnitFinalZoneSizing.allocate(1); + state->dataSize->TermUnitFinalZoneSizing(1).allocateMemberArrays(96); state->dataSize->CalcFinalZoneSizing.allocate(1); state->dataSize->TermUnitSizing.allocate(1); GetZoneData(*state, ErrorsFound); diff --git a/tst/EnergyPlus/unit/WaterCoils.unit.cc b/tst/EnergyPlus/unit/WaterCoils.unit.cc index 7faecd4d5ec..dcc72b3ad45 100644 --- a/tst/EnergyPlus/unit/WaterCoils.unit.cc +++ b/tst/EnergyPlus/unit/WaterCoils.unit.cc @@ -167,6 +167,7 @@ class WaterCoilsTest : public EnergyPlusFixture TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) { + FluidProperties::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -401,6 +402,7 @@ TEST_F(WaterCoilsTest, TdbFnHRhPbTest) TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) { + FluidProperties::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -557,6 +559,7 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) { + FluidProperties::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -716,6 +719,7 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp) { + FluidProperties::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -833,6 +837,7 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp) TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing) { InitializePsychRoutines(*state); + FluidProperties::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); ShowMessage(*state, "Begin Test: state->dataWaterCoils->WaterCoilsTest, CoilCoolingWaterSimpleSizing"); @@ -936,6 +941,7 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing) TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing) { InitializePsychRoutines(*state); + FluidProperties::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); ShowMessage(*state, "Begin Test: state->dataWaterCoils->WaterCoilsTest, CoilCoolingWaterDetailedSizing"); @@ -1051,6 +1057,7 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing) TEST_F(WaterCoilsTest, CoilCoolingWaterDetailed_WarningMath) { InitializePsychRoutines(*state); + FluidProperties::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); @@ -1235,6 +1242,7 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailed_WarningMath) TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing) { InitializePsychRoutines(*state); + FluidProperties::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); ShowMessage(*state, "Begin Test: state->dataWaterCoils->WaterCoilsTest, CoilHeatingWaterSimpleSizing"); @@ -1332,6 +1340,7 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing) } TEST_F(WaterCoilsTest, HotWaterHeatingCoilAutoSizeTempTest) { + FluidProperties::GetFluidPropertiesData(*state); state->dataEnvrn->OutBaroPress = 101325.0; state->dataEnvrn->StdRhoAir = PsyRhoAirFnPbTdbW(*state, state->dataEnvrn->OutBaroPress, 20.0, 0.0); diff --git a/tst/EnergyPlus/unit/WaterUse.unit.cc b/tst/EnergyPlus/unit/WaterUse.unit.cc index 1590fd0a900..61cc656bb85 100644 --- a/tst/EnergyPlus/unit/WaterUse.unit.cc +++ b/tst/EnergyPlus/unit/WaterUse.unit.cc @@ -417,6 +417,7 @@ TEST_F(EnergyPlusFixture, WaterUse_WaterTempWarnings) ASSERT_TRUE(process_idf(idf_objects)); + state->dataGlobal->CurrentTime = 0.25; state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized ScheduleManager::ProcessScheduleInput(*state); // read schedules @@ -1272,6 +1273,7 @@ TEST_F(EnergyPlusFixture, WaterUse_calcH2ODensity_Test) Real64 expectedResult; Real64 allowedTolerance = 0.001; + state->init_state(*state); // Test 1: Set the flag to false means don't recalculate. This means it wasn't set so this should be the default value. state->dataWaterUse->calcRhoH2O = false; expectedResult = 1000.0; diff --git a/tst/EnergyPlus/unit/WeatherManager.unit.cc b/tst/EnergyPlus/unit/WeatherManager.unit.cc index d37191aadbd..bbdcd682397 100644 --- a/tst/EnergyPlus/unit/WeatherManager.unit.cc +++ b/tst/EnergyPlus/unit/WeatherManager.unit.cc @@ -597,7 +597,7 @@ TEST_F(EnergyPlusFixture, WaterMainsOutputReports_CorrelationFromWeatherFileTest }); ASSERT_TRUE(process_idf(idf_objects)); - + compare_eio_stream_substring("", true); bool foundErrors(false); Weather::GetWaterMainsTemperatures(*state, foundErrors); EXPECT_FALSE(foundErrors); // expect no errors @@ -688,6 +688,7 @@ TEST_F(EnergyPlusFixture, ASHRAE_Tau2017ModelTest) bool ErrorsFound(false); state->dataEnvrn->TotDesDays = 2; + state->dataGlobal->NumOfTimeStepInHour = 0; // setup environment state state->dataWeather->Environment.allocate(state->dataEnvrn->TotDesDays); state->dataWeather->DesignDay.allocate(state->dataEnvrn->TotDesDays); @@ -1144,6 +1145,7 @@ TEST_F(EnergyPlusFixture, IRHoriz_InterpretWeatherCalculateMissingIRHoriz) bool ErrorsFound(false); state->dataEnvrn->TotDesDays = 2; + state->dataGlobal->NumOfTimeStepInHour = 0; // setup environment state state->dataWeather->Environment.allocate(state->dataEnvrn->TotDesDays);