From 11b98ce7d9a88e2ae2bcc449369232cc9d10b003 Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Wed, 18 Nov 2020 18:32:30 -0600 Subject: [PATCH 1/5] Rework unit test fixture state instance to clean up build --- tst/EnergyPlus/unit/AdvancedAFN.unit.cc | 92 +- tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc | 63 +- .../unit/AirTerminalSingleDuct.unit.cc | 304 +-- ...alSingleDuctConstantVolumeNoReheat.unit.cc | 213 +-- .../unit/AirTerminalSingleDuctMixer.unit.cc | 480 ++--- .../AirTerminalSingleDuctPIUReheat.unit.cc | 34 +- .../unit/AirflowNetworkBalanceManager.unit.cc | 718 +++---- .../AirflowNetworkSimulationControl.unit.cc | 9 +- .../unit/AirflowNetworkSolver.unit.cc | 13 +- .../unit/Autosizing/All_Simple_Sizing.unit.cc | 277 +-- .../unit/Autosizing/AutosizingFixture.hh | 1 + .../unit/Autosizing/BaseClassSizing.unit.cc | 129 +- .../Autosizing/CoolingAirFlowSizing.unit.cc | 262 +-- .../Autosizing/CoolingCapacitySizing.unit.cc | 127 +- .../unit/Autosizing/CoolingSHRSizing.unit.cc | 59 +- ...oolingWaterDesAirInletHumRatSizing.unit.cc | 74 +- .../CoolingWaterDesAirInletTempSizing.unit.cc | 88 +- ...olingWaterDesAirOutletHumRatSizing.unit.cc | 74 +- ...CoolingWaterDesAirOutletTempSizing.unit.cc | 86 +- ...oolingWaterDesWaterInletTempSizing.unit.cc | 88 +- ...CoolingWaterNumofTubesPerRowSizing.unit.cc | 45 +- .../Autosizing/CoolingWaterflowSizing.unit.cc | 57 +- .../Autosizing/HeatingAirFlowSizing.unit.cc | 262 +-- .../Autosizing/HeatingAirflowUASizing.unit.cc | 100 +- .../Autosizing/HeatingCapacitySizing.unit.cc | 214 +-- ...eatingWaterDesAirInletHumRatSizing.unit.cc | 90 +- .../HeatingWaterDesAirInletTempSizing.unit.cc | 88 +- ...ingWaterDesCoilLoadUsedForUASizing.unit.cc | 93 +- ...DesCoilWaterVolFlowUsedForUASizing.unit.cc | 49 +- .../Autosizing/HeatingWaterflowSizing.unit.cc | 74 +- .../Autosizing/SystemAirFlowSizing.unit.cc | 256 +-- .../WaterHeatingCapacitySizing.unit.cc | 47 +- .../WaterHeatingCoilUASizing.unit.cc | 72 +- tst/EnergyPlus/unit/BaseboardRadiator.unit.cc | 111 +- tst/EnergyPlus/unit/BoilerHotWater.unit.cc | 99 +- tst/EnergyPlus/unit/BoilerSteam.unit.cc | 22 +- .../unit/BranchInputManager.unit.cc | 45 +- .../unit/BranchNodeConnections.unit.cc | 55 +- .../unit/CTElectricGenerator.unit.cc | 5 +- .../unit/ChilledCeilingPanelSimple.unit.cc | 101 +- tst/EnergyPlus/unit/ChillerAbsorption.unit.cc | 7 +- .../unit/ChillerConstantCOP.unit.cc | 19 +- tst/EnergyPlus/unit/ChillerElectric.unit.cc | 113 +- .../unit/ChillerElectricEIR.unit.cc | 53 +- .../unit/ChillerExhaustAbsorption.unit.cc | 39 +- .../unit/ChillerGasAbsorption.unit.cc | 43 +- .../unit/ChillerIndirectAbsorption.unit.cc | 21 +- .../unit/Coils/CoilCoolingDX.unit.cc | 4 +- ...CoilCoolingDXCurveFitOperatingMode.unit.cc | 6 +- .../CoilCoolingDXCurveFitPerformance.unit.cc | 4 +- .../Coils/CoilCoolingDXCurveFitSpeed.unit.cc | 6 +- .../unit/Coils/CoilCoolingDXFixture.hh | 3 + .../unit/CondenserLoopTowers.unit.cc | 485 ++--- .../unit/ConstructionInternalSource.unit.cc | 5 +- .../unit/ConvectionCoefficients.unit.cc | 611 +++--- tst/EnergyPlus/unit/CrossVentMgr.unit.cc | 31 +- tst/EnergyPlus/unit/CurveManager.unit.cc | 129 +- tst/EnergyPlus/unit/DElightManager.unit.cc | 43 +- .../unit/DOASEffectOnZoneSizing.unit.cc | 49 +- tst/EnergyPlus/unit/DXCoils.unit.cc | 601 +++--- tst/EnergyPlus/unit/DataEnvironment.unit.cc | 1 + .../unit/DataGlobalConstants.unit.cc | 1 + tst/EnergyPlus/unit/DataHeatBalance.unit.cc | 91 +- tst/EnergyPlus/unit/DataPlant.unit.cc | 1 + tst/EnergyPlus/unit/DataSizing.unit.cc | 1 + tst/EnergyPlus/unit/DataSurfaces.unit.cc | 41 +- .../unit/DataSystemVariables.unit.cc | 3 +- tst/EnergyPlus/unit/DataZoneEquipment.unit.cc | 17 +- tst/EnergyPlus/unit/Datasets.unit.cc | 11 +- .../unit/DaylightingManager.unit.cc | 273 +-- tst/EnergyPlus/unit/DemandResponse.unit.cc | 3 +- .../unit/DesiccantDehumidifiers.unit.cc | 103 +- .../unit/DisplacementVentMgr.unit.cc | 29 +- tst/EnergyPlus/unit/DualDuct.unit.cc | 68 +- tst/EnergyPlus/unit/EMSManager.unit.cc | 249 +-- tst/EnergyPlus/unit/EarthTube.unit.cc | 9 +- .../unit/EconomicLifeCycleCost.unit.cc | 7 +- tst/EnergyPlus/unit/EconomicTariff.unit.cc | 69 +- .../unit/ElectricBaseboardRadiator.unit.cc | 89 +- .../unit/ElectricPowerServiceManager.unit.cc | 113 +- .../unit/EvaporativeCoolers.unit.cc | 221 +-- .../unit/EvaporativeFluidCoolers.unit.cc | 7 +- tst/EnergyPlus/unit/ExteriorEnergyUse.unit.cc | 29 +- tst/EnergyPlus/unit/FanCoilUnits.unit.cc | 1279 ++++++------- tst/EnergyPlus/unit/Fans.unit.cc | 59 +- tst/EnergyPlus/unit/FaultsManager.unit.cc | 147 +- tst/EnergyPlus/unit/FileSystem.unit.cc | 1 + ...teDifferenceGroundTemperatureModel.unit.cc | 79 +- .../unit/Fixtures/EnergyPlusFixture.cc | 79 +- .../unit/Fixtures/EnergyPlusFixture.hh | 13 +- tst/EnergyPlus/unit/FluidCoolers.unit.cc | 29 +- tst/EnergyPlus/unit/FluidProperties.unit.cc | 23 +- .../unit/FuelCellElectricGenerator.unit.cc | 1 + tst/EnergyPlus/unit/Furnaces.unit.cc | 93 +- tst/EnergyPlus/unit/General.unit.cc | 1 + tst/EnergyPlus/unit/GeneralRoutines.unit.cc | 1 + .../unit/GroundHeatExchangers.unit.cc | 123 +- tst/EnergyPlus/unit/HVACControllers.unit.cc | 345 ++-- tst/EnergyPlus/unit/HVACDXSystem.unit.cc | 81 +- tst/EnergyPlus/unit/HVACFan.unit.cc | 85 +- tst/EnergyPlus/unit/HVACFourPipeBeam.unit.cc | 81 +- .../unit/HVACHXAssistedCoolingCoil.unit.cc | 35 +- .../unit/HVACInterfaceManager.unit.cc | 5 +- tst/EnergyPlus/unit/HVACManager.unit.cc | 93 +- .../unit/HVACMultiSpeedHeatPump.unit.cc | 67 +- .../unit/HVACSizingSimulationManager.unit.cc | 357 ++-- tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc | 19 +- .../unit/HVACUnitaryBypassVAV.unit.cc | 141 +- .../unit/HVACVariableRefrigerantFlow.unit.cc | 705 +++---- .../unit/HWBaseboardRadiator.unit.cc | 5 +- .../unit/HeatBalFiniteDiffManager.unit.cc | 17 +- .../unit/HeatBalanceAirManager.unit.cc | 5 +- .../unit/HeatBalanceIntRadExchange.unit.cc | 83 +- .../unit/HeatBalanceKivaManager.unit.cc | 31 +- .../unit/HeatBalanceManager.unit.cc | 313 +-- .../unit/HeatBalanceMovableInsulation.unit.cc | 45 +- .../unit/HeatBalanceSurfaceManager.unit.cc | 405 ++-- .../unit/HeatPumpWaterToWaterSimple.unit.cc | 125 +- tst/EnergyPlus/unit/HeatRecovery.unit.cc | 103 +- tst/EnergyPlus/unit/HeatingCoils.unit.cc | 15 +- .../unit/HighTempRadiantSystem.unit.cc | 5 +- tst/EnergyPlus/unit/Humidifiers.unit.cc | 15 +- tst/EnergyPlus/unit/HybridModel.unit.cc | 67 +- .../unit/ICEngineElectricGenerator.unit.cc | 3 +- tst/EnergyPlus/unit/ICSCollector.unit.cc | 17 +- tst/EnergyPlus/unit/IceThermalStorage.unit.cc | 113 +- tst/EnergyPlus/unit/InputProcessor.unit.cc | 226 +-- .../unit/IntegratedHeatPump.unit.cc | 57 +- tst/EnergyPlus/unit/InternalHeatGains.unit.cc | 155 +- ...udaAchenbachGroundTemperatureModel.unit.cc | 27 +- .../unit/LowTempRadiantSystem.unit.cc | 415 ++-- .../unit/MicroCHPElectricGenerator.unit.cc | 13 +- .../MicroturbineElectricGenerator.unit.cc | 3 +- tst/EnergyPlus/unit/MixedAir.unit.cc | 712 +++---- tst/EnergyPlus/unit/MixerComponent.unit.cc | 5 +- .../unit/MoistureBalanceEMPD.unit.cc | 47 +- tst/EnergyPlus/unit/NodeInputManager.unit.cc | 27 +- .../unit/OASystemHWPreheatCoil.unit.cc | 53 +- tst/EnergyPlus/unit/OutAirNodeManager.unit.cc | 5 +- tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc | 149 +- tst/EnergyPlus/unit/OutputFiles.unit.cc | 1 + tst/EnergyPlus/unit/OutputProcessor.unit.cc | 1003 +++++----- tst/EnergyPlus/unit/OutputReportData.unit.cc | 17 +- .../unit/OutputReportTabular.unit.cc | 493 ++--- .../unit/OutputReportTabularAnnual.unit.cc | 65 +- tst/EnergyPlus/unit/OutputReports.unit.cc | 25 +- tst/EnergyPlus/unit/PVWatts.unit.cc | 57 +- .../unit/PackagedTerminalHeatPump.unit.cc | 123 +- tst/EnergyPlus/unit/Photovoltaics.unit.cc | 15 +- tst/EnergyPlus/unit/PierceSurface.unit.cc | 1 + tst/EnergyPlus/unit/Pipes.unit.cc | 3 +- tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc | 11 +- tst/EnergyPlus/unit/PlantChillers.unit.cc | 75 +- .../PlantComponentTemperatureSources.unit.cc | 9 +- .../unit/PlantCondLoopOperation.unit.cc | 97 +- .../PlantHeatExchangerFluidToFluid.unit.cc | 209 +- .../unit/PlantLoopHeatPumpEIR.unit.cc | 313 +-- tst/EnergyPlus/unit/PlantManager.unit.cc | 5 +- .../unit/PlantPipingSystemsManager.unit.cc | 159 +- tst/EnergyPlus/unit/PlantUtilities.unit.cc | 5 +- tst/EnergyPlus/unit/PluginManager.unit.cc | 11 +- .../unit/PoweredInductionUnits.unit.cc | 153 +- tst/EnergyPlus/unit/Psychrometrics.unit.cc | 48 +- tst/EnergyPlus/unit/Pumps.unit.cc | 67 +- .../unit/PurchasedAirManager.unit.cc | 47 +- .../unit/ReportCoilSelection.unit.cc | 75 +- tst/EnergyPlus/unit/ResultsFramework.unit.cc | 39 +- .../unit/RoomAirModelUserTempPattern.unit.cc | 1 + .../unit/RoomAirflowNetwork.unit.cc | 33 +- tst/EnergyPlus/unit/RootFinder.unit.cc | 27 +- tst/EnergyPlus/unit/RunPeriod.unit.cc | 93 +- .../unit/RuntimeLanguageProcessor.unit.cc | 21 +- tst/EnergyPlus/unit/SQLite.unit.cc | 3 +- tst/EnergyPlus/unit/SZVAVModel.unit.cc | 87 +- tst/EnergyPlus/unit/ScheduleManager.unit.cc | 379 ++-- tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc | 13 +- tst/EnergyPlus/unit/SetPointManager.unit.cc | 267 +-- .../unit/SimAirServingZones.unit.cc | 109 +- tst/EnergyPlus/unit/SimulationManager.unit.cc | 111 +- tst/EnergyPlus/unit/SingleDuct.unit.cc | 189 +- ...eBuildingSurfaceGroundTemperatures.unit.cc | 15 +- .../unit/SiteDeepGroundTemperatures.unit.cc | 15 +- ...teFCFactorMethodGroundTemperatures.unit.cc | 15 +- tst/EnergyPlus/unit/SiteGroundDomain.unit.cc | 6 +- .../SiteShallowGroundTemperatures.unit.cc | 15 +- .../unit/SizeWaterHeatingCoil.unit.cc | 339 ++-- .../unit/SizingAnalysisObjects.unit.cc | 137 +- tst/EnergyPlus/unit/SizingManager.unit.cc | 115 +- tst/EnergyPlus/unit/SolarShading.unit.cc | 321 ++-- .../unit/SortAndStringUtilities.unit.cc | 1 + tst/EnergyPlus/unit/StandardRatings.unit.cc | 180 +- tst/EnergyPlus/unit/StringUtilities.unit.cc | 1 + tst/EnergyPlus/unit/SurfaceGeometry.unit.cc | 795 ++++---- tst/EnergyPlus/unit/SurfaceOctree.unit.cc | 3 +- tst/EnergyPlus/unit/SwimmingPool.unit.cc | 133 +- .../unit/SystemAvailabilityManager.unit.cc | 609 +++--- tst/EnergyPlus/unit/SystemReports.unit.cc | 86 +- tst/EnergyPlus/unit/ThermalChimney.unit.cc | 49 +- tst/EnergyPlus/unit/ThermalComfort.unit.cc | 365 ++-- .../unit/TranspiredCollector.unit.cc | 45 +- tst/EnergyPlus/unit/UnitHeater.unit.cc | 137 +- tst/EnergyPlus/unit/UnitVentilator.unit.cc | 75 +- .../unit/UnitaryHybridAirConditioner.unit.cc | 151 +- tst/EnergyPlus/unit/UnitarySystem.unit.cc | 1691 +++++++++-------- tst/EnergyPlus/unit/UtilityRoutines.unit.cc | 35 +- tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc | 97 +- .../unit/VariableSpeedCoils.unit.cc | 37 +- tst/EnergyPlus/unit/Vector.unit.cc | 3 +- tst/EnergyPlus/unit/Vectors.unit.cc | 1 + tst/EnergyPlus/unit/VentilatedSlab.unit.cc | 75 +- tst/EnergyPlus/unit/WaterCoils.unit.cc | 853 ++++----- tst/EnergyPlus/unit/WaterManager.unit.cc | 17 +- tst/EnergyPlus/unit/WaterThermalTanks.unit.cc | 553 +++--- .../unit/WaterToAirHeatPump.unit.cc | 87 +- .../unit/WaterToAirHeatPumpSimple.unit.cc | 235 +-- tst/EnergyPlus/unit/WeatherManager.unit.cc | 291 +-- tst/EnergyPlus/unit/WinCalcEngine.unit.cc | 37 +- tst/EnergyPlus/unit/WindowAC.unit.cc | 35 +- .../unit/WindowEquivalentLayer.unit.cc | 77 +- .../WindowLayerEffectiveMultipliers.unit.cc | 1 + tst/EnergyPlus/unit/WindowManager.unit.cc | 167 +- .../unit/XingGroundTemperatureModel.unit.cc | 21 +- .../ZoneContaminantPredictorCorrector.unit.cc | 35 +- .../unit/ZoneEquipmentManager.unit.cc | 451 ++--- .../unit/ZoneHVACEvaporativeCooler.unit.cc | 93 +- tst/EnergyPlus/unit/ZonePlenum.unit.cc | 123 +- .../unit/ZoneTempPredictorCorrector.unit.cc | 333 ++-- tst/EnergyPlus/unit/api/datatransfer.unit.cc | 36 +- 228 files changed, 14830 insertions(+), 14608 deletions(-) diff --git a/tst/EnergyPlus/unit/AdvancedAFN.unit.cc b/tst/EnergyPlus/unit/AdvancedAFN.unit.cc index 51ea74c4649..da6f4056259 100644 --- a/tst/EnergyPlus/unit/AdvancedAFN.unit.cc +++ b/tst/EnergyPlus/unit/AdvancedAFN.unit.cc @@ -57,7 +57,7 @@ #include #include #include - +#include #include "Fixtures/EnergyPlusFixture.hh" using namespace EnergyPlus; @@ -85,28 +85,28 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_AdvancedTest_Test1) int CurveNum; AirflowNetworkNumOfOccuVentCtrls = 1; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl.allocate(AirflowNetworkNumOfOccuVentCtrls); - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinOpeningTime = 4; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinClosingTime = 4; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinTimeControlOnly = true; + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl.allocate(AirflowNetworkNumOfOccuVentCtrls); + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinOpeningTime = 4; + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinClosingTime = 4; + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinTimeControlOnly = true; TimeOpenElapsed = 3.0; TimeCloseElapsed = 0.0; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); EXPECT_EQ(1, OpenStatus); TimeOpenElapsed = 5.0; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); EXPECT_EQ(0, OpenStatus); TimeOpenElapsed = 0.0; TimeCloseElapsed = 3.0; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); EXPECT_EQ(2, OpenStatus); TimeOpenElapsed = 0.0; TimeCloseElapsed = 5.0; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); EXPECT_EQ(0, OpenStatus); OutDryBulbTemp = 15.0; @@ -118,51 +118,51 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_AdvancedTest_Test1) TimeOpenElapsed = 5.0; TimeCloseElapsed = 0.0; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinTimeControlOnly = false; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortBouPoint = 10.0; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortLowTempCurveNum = 1; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortHighTempCurveNum = 2; + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).MinTimeControlOnly = false; + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortBouPoint = 10.0; + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortLowTempCurveNum = 1; + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).ComfortHighTempCurveNum = 2; - state.dataCurveManager->NumCurves = 2; - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->NumCurves = 2; + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); CurveNum = 1; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 21.2; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.09; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = -50.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 10.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 21.2; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.09; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = -50.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 10.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0; CurveNum = 2; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 18.8; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.33; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 10.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 50.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0; - - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 18.8; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.33; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 10.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 50.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0; + + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); EXPECT_EQ(0, OpenProbStatus); EXPECT_EQ(1, CloseProbStatus); MAT(1) = 26.0; MRT(1) = 26.0; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); EXPECT_EQ(2, OpenProbStatus); EXPECT_EQ(0, CloseProbStatus); @@ -175,14 +175,14 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_AdvancedTest_Test1) ZoneThermostatSetPointLo.allocate(1); ZoneThermostatSetPointHi.allocate(1); - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); EXPECT_EQ(1, OpenProbStatus); EXPECT_EQ(0, CloseProbStatus); TempControlType(1) = 4; ZoneThermostatSetPointLo(1) = 22.0; ZoneThermostatSetPointHi(1) = 28.0; - state.dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); + state->dataAirflowNetworkBalanceManager->OccupantVentilationControl(1).calc(*state, 1, TimeOpenElapsed, TimeCloseElapsed, OpenStatus, OpenProbStatus, CloseProbStatus); EXPECT_EQ(1, OpenProbStatus); EXPECT_EQ(0, CloseProbStatus); } diff --git a/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc b/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc index d5e57c3e4e2..ae0e060e7bc 100644 --- a/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc +++ b/tst/EnergyPlus/unit/AirLoopHVACDOAS.unit.cc @@ -52,6 +52,7 @@ #include // EnergyPlus Headers +#include #include "Fixtures/EnergyPlusFixture.hh" #include #include @@ -3949,32 +3950,32 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOASTest) bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(state, ErrorsFound); + HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(6); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(6); - state.dataSurfaceGeometry->CosZoneRelNorth = 1.0; - state.dataSurfaceGeometry->SinZoneRelNorth = 0.0; - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(6); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(6); + state->dataSurfaceGeometry->CosZoneRelNorth = 1.0; + state->dataSurfaceGeometry->SinZoneRelNorth = 0.0; + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; + SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - ZoneEquipmentManager::GetZoneEquipment(state); - SimAirServingZones::GetAirPathData(state); + ZoneEquipmentManager::GetZoneEquipment(*state); + SimAirServingZones::GetAirPathData(*state); // OA inlet node DataLoopNode::Node(2).MassFlowRate = 0.1; DataLoopNode::Node(3).MassFlowRate = 0.1; @@ -3998,7 +3999,7 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOASTest) DataLoopNode::Node(65).HumRat = 0.001; DataLoopNode::Node(66).HumRat = 0.001; - auto &thisAirLoopDOASObjec = state.dataAirLoopHVACDOAS->airloopDOAS[0]; + auto &thisAirLoopDOASObjec = state->dataAirLoopHVACDOAS->airloopDOAS[0]; int index = 0; thisAirLoopDOASObjec.SizingOnceFlag = false; @@ -4006,7 +4007,7 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOASTest) DataLoopNode::Node(11).HumRat = 0.0008; DataLoopNode::Node(70).TempSetPoint = 4.5; Schedule(1).CurrentValue = 1.0; // set availability and fan schedule to 1 - thisAirLoopDOASObjec.SimAirLoopHVACDOAS(state, true, index); + thisAirLoopDOASObjec.SimAirLoopHVACDOAS(*state, true, index); // Mixer outlet EXPECT_NEAR(23.0, DataLoopNode::Node(68).Temp, 0.0001); @@ -4247,22 +4248,22 @@ TEST_F(EnergyPlusFixture, AirLoopHVACDOAS_TestOACompOutletNodeIndex) ASSERT_TRUE(process_idf(idf_objects)); - MixedAir::GetOutsideAirSysInputs(state); + MixedAir::GetOutsideAirSysInputs(*state); MixedAir::GetOASysInputFlag = false; - MixedAir::GetOAMixerInputs(state); + MixedAir::GetOAMixerInputs(*state); - state.dataAirSystemsData->PrimaryAirSystems.allocate(5); - state.dataAirSystemsData->PrimaryAirSystems(1).Name = "PSZ-AC:1"; - state.dataAirSystemsData->PrimaryAirSystems(2).Name = "PSZ-AC:2"; - state.dataAirSystemsData->PrimaryAirSystems(3).Name = "PSZ-AC:3"; - state.dataAirSystemsData->PrimaryAirSystems(4).Name = "PSZ-AC:4"; - state.dataAirSystemsData->PrimaryAirSystems(5).Name = "PSZ-AC:5"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(5); + state->dataAirSystemsData->PrimaryAirSystems(1).Name = "PSZ-AC:1"; + state->dataAirSystemsData->PrimaryAirSystems(2).Name = "PSZ-AC:2"; + state->dataAirSystemsData->PrimaryAirSystems(3).Name = "PSZ-AC:3"; + state->dataAirSystemsData->PrimaryAirSystems(4).Name = "PSZ-AC:4"; + state->dataAirSystemsData->PrimaryAirSystems(5).Name = "PSZ-AC:5"; - AirLoopHVACDOAS::AirLoopDOAS::getAirLoopDOASInput(state); + AirLoopHVACDOAS::AirLoopDOAS::getAirLoopDOASInput(*state); - EXPECT_EQ(state.dataAirLoop->OutsideAirSys(1).ComponentType(2), "HUMIDIFIER:STEAM:ELECTRIC"); - EXPECT_EQ(state.dataAirLoop->OutsideAirSys(1).InletNodeNum(2), 2); - EXPECT_EQ(state.dataAirLoop->OutsideAirSys(1).OutletNodeNum(2), 23); + EXPECT_EQ(state->dataAirLoop->OutsideAirSys(1).ComponentType(2), "HUMIDIFIER:STEAM:ELECTRIC"); + EXPECT_EQ(state->dataAirLoop->OutsideAirSys(1).InletNodeNum(2), 2); + EXPECT_EQ(state->dataAirLoop->OutsideAirSys(1).OutletNodeNum(2), 23); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc index 023c3ad890d..3a179320a97 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuct.unit.cc @@ -57,7 +57,7 @@ // ObjexxFCL Headers #include "Fixtures/EnergyPlusFixture.hh" - +#include #include #include #include @@ -178,16 +178,16 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVReheat_GetInputTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); EXPECT_EQ("AirTerminal:SingleDuct:ConstantVolume:Reheat", sd_airterminal(1).SysType); // AT SD VAV Reheat Type EXPECT_EQ("REHEAT ZONE 1", sd_airterminal(1).SysName); // AT SD VAV Reheat Name @@ -308,16 +308,16 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuct4PipeInduction_GetInputTest) process_idf(idf_objects); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetIndUnits(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetIndUnits(*state); EXPECT_EQ("AirTerminal:SingleDuct:ConstantVolume:FourPipeInduction", IndUnit(1).UnitType); // AT SD VAV Reheat Type EXPECT_EQ("SPACE1-1 FPIU", IndUnit(1).Name); // AT SD VAV Reheat Name @@ -397,16 +397,16 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctVAVHeatCool_GetInputTest) process_idf(idf_objects); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); EXPECT_EQ("AirTerminal:SingleDuct:VAV:HeatAndCool:Reheat", sd_airterminal(1).SysType); // AT SD VAV HeatCool Reheat Type EXPECT_EQ("ZONE 1 VAV SYSTEM", sd_airterminal(1).SysName); // AT SD VAV HeatCool Reheat Name @@ -520,16 +520,16 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctVAVReheatVarSpeedFan_GetInputTest ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); EXPECT_EQ("AirTerminal:SingleDuct:VAV:Reheat:VariableSpeedFan", sd_airterminal(1).SysType); // AT SD VAV HeatCool Reheat Type EXPECT_EQ("SPACE1-1 VAV REHEAT", sd_airterminal(1).SysName); // AT SD VAV HeatCool Reheat Name @@ -617,22 +617,22 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctVAVReheat_NormalActionTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); bool ErrorsFound(false); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); SingleDuct::GetInputFlag = false; - auto &thisZoneEquip(ZoneEquipConfig(state.dataGlobal->NumOfZones)); + auto &thisZoneEquip(ZoneEquipConfig(state->dataGlobal->NumOfZones)); - state.dataGlobal->SysSizingCalc = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->SysSizingCalc = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::StdRhoAir = 1.0; DataEnvironment::OutBaroPress = 101325.0; @@ -674,8 +674,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctVAVReheat_NormalActionTest) bool FirstHVACIteration = false; auto &thisAirDistUnit(DataDefineEquip::AirDistUnit(ZonePtr)); - // run SimulateSingleDuct(state, ) function - SimulateSingleDuct(state, thisAirDistUnit.EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, thisAirDistUnit.EquipIndex(1)); + // run SimulateSingleDuct(*state, ) function + SimulateSingleDuct(*state, thisAirDistUnit.EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, thisAirDistUnit.EquipIndex(1)); // check min, actual and max air mass flow rates during reheat with Normal Action EXPECT_EQ(expectedMassFlowAirReheatMin, sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); EXPECT_EQ(expectedMassFlowAirReheatMin, Node(InletNode).MassFlowRate); @@ -886,8 +886,8 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVAirTerminals_GetInputs) ASSERT_TRUE(process_idf(idf_objects)); - GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); + GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); // VAV Reheat get input test EXPECT_EQ("AirTerminal:SingleDuct:VAV:Reheat", sd_airterminal(1).SysType); // VAV Reheat Type @@ -1016,28 +1016,28 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatAirTerminal_MinFlowTurnDownTest) bool ErrorsFound = false; bool FirstHVACIteration = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(state); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); + ScheduleManager::UpdateScheduleValues(*state); DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); EXPECT_TRUE(compare_err_stream("")); // check VAV reheat air terminal inputs EXPECT_EQ("AirTerminal:SingleDuct:VAV:Reheat", sd_airterminal(SysNum).SysType); // VAV Reheat Type @@ -1056,13 +1056,13 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatAirTerminal_MinFlowTurnDownTest) SingleDuct::sd_airterminal(SysNum).ZoneTurndownMinAirFracSchPtr = 1; // DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); // check inputs and calculated values for turndown fraction set to 1.0 EXPECT_EQ(0.3, sd_airterminal(SysNum).ZoneMinAirFracDes); EXPECT_EQ(1.0, sd_airterminal(SysNum).ZoneTurndownMinAirFrac); @@ -1080,13 +1080,13 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatAirTerminal_MinFlowTurnDownTest) SysMinMassFlowRes = 1.0 * DataEnvironment::StdRhoAir * 0.30 * 0.5; // min flow rate at 0.5 turndown fraction DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); // check inputs and calculated values for turndown fraction set to 0.5 EXPECT_EQ(0.3, sd_airterminal(SysNum).ZoneMinAirFracDes); EXPECT_EQ(0.5, sd_airterminal(SysNum).ZoneTurndownMinAirFrac); @@ -1221,28 +1221,28 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFanAirTerminal_MinFlowTurnDownTes bool ErrorsFound = false; bool FirstHVACIteration = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(state); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); + ScheduleManager::UpdateScheduleValues(*state); DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); EXPECT_TRUE(compare_err_stream("")); // check VAV reheat air terminal inputs EXPECT_EQ("AirTerminal:SingleDuct:VAV:Reheat:VariableSpeedFan", sd_airterminal(SysNum).SysType); // VAV Reheat Type @@ -1261,13 +1261,13 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFanAirTerminal_MinFlowTurnDownTes SingleDuct::sd_airterminal(SysNum).ZoneTurndownMinAirFracSchPtr = 1; // DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); // check inputs and calculated values for turndown fraction set to 1.0 EXPECT_EQ(0.1, sd_airterminal(SysNum).ZoneMinAirFracDes); EXPECT_EQ(1.0, sd_airterminal(SysNum).ZoneTurndownMinAirFrac); @@ -1285,13 +1285,13 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFanAirTerminal_MinFlowTurnDownTes SysMinMassFlowRes = 1.0 * DataEnvironment::StdRhoAir * 0.10 * 0.5; // min flow rate at 0.5 turndown fraction DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); // check inputs and calculated values for turndown fraction set to 0.5 EXPECT_EQ(0.1, sd_airterminal(SysNum).ZoneMinAirFracDes); EXPECT_EQ(0.5, sd_airterminal(SysNum).ZoneTurndownMinAirFrac); @@ -1393,28 +1393,28 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVHeatCoolReheatAirTerminal_MinFlowTurnDown bool ErrorsFound = false; bool FirstHVACIteration = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(state); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); + ScheduleManager::UpdateScheduleValues(*state); DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); EXPECT_TRUE(compare_err_stream("")); // check VAV heatcool reheat air terminal inputs EXPECT_EQ("AirTerminal:SingleDuct:VAV:HeatAndCool:Reheat", sd_airterminal(SysNum).SysType); // VAV HeatCool Reheat Type @@ -1433,13 +1433,13 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVHeatCoolReheatAirTerminal_MinFlowTurnDown SingleDuct::sd_airterminal(SysNum).ZoneTurndownMinAirFracSchPtr = 1; // DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); // check inputs and calculated values for turndown fraction set to 1.0 EXPECT_EQ(0.2, sd_airterminal(SysNum).ZoneMinAirFracDes); EXPECT_EQ(1.0, sd_airterminal(SysNum).ZoneTurndownMinAirFrac); @@ -1457,13 +1457,13 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVHeatCoolReheatAirTerminal_MinFlowTurnDown SysMinMassFlowRes = 1.0 * DataEnvironment::StdRhoAir * 0.20 * 0.5; // min flow rate at 0.5 turndown fraction DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); // check inputs and calculated values for turndown fraction set to 0.5 EXPECT_EQ(0.2, sd_airterminal(SysNum).ZoneMinAirFracDes); EXPECT_EQ(0.5, sd_airterminal(SysNum).ZoneTurndownMinAirFrac); @@ -1576,28 +1576,28 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFan_DamperPositionTest) bool ErrorsFound = false; bool FirstHVACIteration = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(state); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); + ScheduleManager::UpdateScheduleValues(*state); DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); EXPECT_TRUE(compare_err_stream("")); auto &thisAirTerminal = SingleDuct::sd_airterminal(SysNum); @@ -1621,13 +1621,13 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFan_DamperPositionTest) DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; CurDeadBandOrSetback.allocate(1); CurDeadBandOrSetback(1) = false; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - thisAirTerminal.InitSys(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + thisAirTerminal.InitSys(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - thisAirTerminal.InitSys(state, FirstHVACIteration); - thisAirTerminal.SimVAVVS(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + thisAirTerminal.InitSys(*state, FirstHVACIteration); + thisAirTerminal.SimVAVVS(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); // check inputs and calculated values for zone air fraction 0.05 EXPECT_EQ(0.05, thisAirTerminal.ZoneMinAirFrac); // user input EXPECT_EQ(0.05, thisAirTerminal.DamperPosition); @@ -1640,13 +1640,13 @@ TEST_F(EnergyPlusFixture, SingleDuctVAVReheatVSFan_DamperPositionTest) DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputRequired = 0.0; DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - thisAirTerminal.InitSys(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + thisAirTerminal.InitSys(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - thisAirTerminal.InitSys(state, FirstHVACIteration); - thisAirTerminal.SimVAVVS(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + thisAirTerminal.InitSys(*state, FirstHVACIteration); + thisAirTerminal.SimVAVVS(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); // check inputs and calculated values for zone air fraction 0.10 EXPECT_EQ(0.10, thisAirTerminal.ZoneMinAirFracDes); EXPECT_EQ(0.10, thisAirTerminal.ZoneMinAirFrac); @@ -1721,28 +1721,28 @@ TEST_F(EnergyPlusFixture, VAVHeatCoolReheatAirTerminal_ZoneOAVolumeFlowRateTest) bool ErrorsFound = false; bool FirstHVACIteration = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(state); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); + ScheduleManager::UpdateScheduleValues(*state); DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); auto &thisHeatCoolAT = SingleDuct::sd_airterminal(SysNum); @@ -1769,21 +1769,21 @@ TEST_F(EnergyPlusFixture, VAVHeatCoolReheatAirTerminal_ZoneOAVolumeFlowRateTest) // Needs an airloop, assume 20% outdoor air Real64 const AirLoopOAFraction = 0.20; thisHeatCoolAT.AirLoopNum = 1; - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirLoop->AirLoopFlow(thisHeatCoolAT.AirLoopNum).OAFrac = AirLoopOAFraction; + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow(thisHeatCoolAT.AirLoopNum).OAFrac = AirLoopOAFraction; // test 1: heating load at minimum supply air flow rate DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputRequired = 2000.0; DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - thisHeatCoolAT.InitSys(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + thisHeatCoolAT.InitSys(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - thisHeatCoolAT.InitSys(state, FirstHVACIteration); - thisHeatCoolAT.SimCBVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); - thisHeatCoolAT.ReportSys(state); + thisHeatCoolAT.InitSys(*state, FirstHVACIteration); + thisHeatCoolAT.SimCBVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + thisHeatCoolAT.ReportSys(*state); Real64 expect_OutdoorAirFlowRate = (SysMinMassFlowRes / DataEnvironment::StdRhoAir) * AirLoopOAFraction; EXPECT_EQ(SysMaxMassFlowRes, thisHeatCoolAT.sd_airterminalOutlet.AirMassFlowRateMaxAvail); EXPECT_EQ(SysMinMassFlowRes, thisHeatCoolAT.sd_airterminalOutlet.AirMassFlowRate); @@ -1802,14 +1802,14 @@ TEST_F(EnergyPlusFixture, VAVHeatCoolReheatAirTerminal_ZoneOAVolumeFlowRateTest) DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputRequired = -12000.0; DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlowRes; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - thisHeatCoolAT.InitSys(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + thisHeatCoolAT.InitSys(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - thisHeatCoolAT.InitSys(state, FirstHVACIteration); - thisHeatCoolAT.SimCBVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); - thisHeatCoolAT.ReportSys(state); + thisHeatCoolAT.InitSys(*state, FirstHVACIteration); + thisHeatCoolAT.SimCBVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + thisHeatCoolAT.ReportSys(*state); expect_OutdoorAirFlowRate = (SysMaxMassFlowRes / DataEnvironment::StdRhoAir) * AirLoopOAFraction; EXPECT_EQ(SysMaxMassFlowRes, thisHeatCoolAT.sd_airterminalOutlet.AirMassFlowRateMaxAvail); EXPECT_EQ(SysMaxMassFlowRes, thisHeatCoolAT.sd_airterminalOutlet.AirMassFlowRate); diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuctConstantVolumeNoReheat.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuctConstantVolumeNoReheat.unit.cc index 766d2e28b12..1dfb5cc9982 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuctConstantVolumeNoReheat.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuctConstantVolumeNoReheat.unit.cc @@ -54,6 +54,7 @@ // ObjexxFCL Headers #include "Fixtures/EnergyPlusFixture.hh" +#include #include #include #include @@ -150,16 +151,16 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_GetInput) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); EXPECT_EQ("AirTerminal:SingleDuct:ConstantVolume:NoReheat", sd_airterminal(1).SysType); // AT SD constant volume no reheat object type EXPECT_EQ("SDCVNOREHEATAT1", sd_airterminal(1).SysName); // AT SD constant volume no reheat name @@ -230,16 +231,16 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_SimConstVolNoReheat) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); DataEnvironment::StdRhoAir = 1.0; int const SysNum(1); Real64 MassFlowRateMaxAvail = sd_airterminal(SysNum).MaxAirVolFlowRate * DataEnvironment::StdRhoAir; @@ -313,19 +314,19 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_Sim) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); - state.dataGlobal->SysSizingCalc = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->SysSizingCalc = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::StdRhoAir = 1.0; DataEnvironment::OutBaroPress = 101325.0; @@ -354,8 +355,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_Sim) Node(InletNode).MassFlowRateMaxAvail = 0.0; FirstHVACIteration = true; SingleDuct::GetInputFlag = false; - // run SimulateSingleDuct(state, ) function - SimulateSingleDuct(state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); + // run SimulateSingleDuct(*state, ) function + SimulateSingleDuct(*state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); // check AT air mass flow rates EXPECT_EQ(MassFlowRateMaxAvail, sd_airterminal(SysNum).AirMassFlowRateMax); // design maximum mass flow rate EXPECT_EQ(0.0, sd_airterminal(SysNum).sd_airterminalInlet.AirMassFlowRateMaxAvail); // maximum available mass flow rate @@ -365,8 +366,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_Sim) FirstHVACIteration = false; Node(InletNode).MassFlowRateMaxAvail = MassFlowRateMaxAvail; EXPECT_EQ(1.0, MassFlowRateMaxAvail); - // run SimulateSingleDuct(state, ) function - SimulateSingleDuct(state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); + // run SimulateSingleDuct(*state, ) function + SimulateSingleDuct(*state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); // check AT air mass flow rates EXPECT_EQ(MassFlowRateMaxAvail, sd_airterminal(SysNum).sd_airterminalInlet.AirMassFlowRate); EXPECT_EQ(MassFlowRateMaxAvail, sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -487,21 +488,21 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OASpecification) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - SizingManager::GetOARequirements(state); - InternalHeatGains::GetInternalHeatGainsInput(state); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetSysInput(state); + SizingManager::GetOARequirements(*state); + InternalHeatGains::GetInternalHeatGainsInput(*state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); - state.dataGlobal->SysSizingCalc = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->SysSizingCalc = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::StdRhoAir = 1.0; DataEnvironment::OutBaroPress = 101325.0; @@ -529,20 +530,20 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OASpecification) Node(InletNode).MassFlowRateMaxAvail = 0.0; FirstHVACIteration = true; SingleDuct::GetInputFlag = false; - // run SimulateSingleDuct(state, ) function - SimulateSingleDuct(state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); + // run SimulateSingleDuct(*state, ) function + SimulateSingleDuct(*state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); // check AT air mass flow rates EXPECT_EQ(MassFlowRateMaxAvail, sd_airterminal(SysNum).AirMassFlowRateMax); // design maximum mass flow rate EXPECT_EQ(0.0, sd_airterminal(SysNum).sd_airterminalInlet.AirMassFlowRateMaxAvail); // maximum available mass flow rate EXPECT_EQ(0.0, sd_airterminal(SysNum).sd_airterminalInlet.AirMassFlowRate); // outlet mass flow rate is zero EXPECT_EQ(0.0, sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); // outlet mass flow rate is zero - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; // Needs an airloop, assume 100% OA sd_airterminal(SysNum).AirLoopNum = 1; - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirLoop->AirLoopFlow(sd_airterminal(SysNum).AirLoopNum).OAFrac = 1.0; + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow(sd_airterminal(SysNum).AirLoopNum).OAFrac = 1.0; Node(InletNode).MassFlowRateMaxAvail = MassFlowRateMaxAvail; EXPECT_EQ(3.0, MassFlowRateMaxAvail); @@ -550,39 +551,39 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OASpecification) DataEnvironment::DayOfYear_Schedule = 1; DataEnvironment::DayOfWeek = 1; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStep = 1; // Full occupancy 3 people, OA/person = 0.1, OA/zone = 0.5, OA Sched = 1.0 - state.dataGlobal->HourOfDay = 12; - ScheduleManager::UpdateScheduleValues(state); + state->dataGlobal->HourOfDay = 12; + ScheduleManager::UpdateScheduleValues(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() DataHeatBalance::ZoneIntGain(1).NOFOCC = 3.0; Real64 expectedMassFlow = 1.0 * ((3.0 * 0.1) + 0.5); // run SimulateSingleDuct() function - SimulateSingleDuct(state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); + SimulateSingleDuct(*state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); // check AT air mass flow rates EXPECT_EQ(expectedMassFlow, sd_airterminal(SysNum).sd_airterminalInlet.AirMassFlowRate); EXPECT_EQ(expectedMassFlow, sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); // 50% occupancy 1.5 people, OA/person = 0.1, OA/zone = 0.5, OA Sched = 1.0 - state.dataGlobal->HourOfDay = 12; - ScheduleManager::UpdateScheduleValues(state); + state->dataGlobal->HourOfDay = 12; + ScheduleManager::UpdateScheduleValues(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() DataHeatBalance::ZoneIntGain(1).NOFOCC = 1.5; expectedMassFlow = 1.0 * ((1.5 * 0.1) + 0.5); - SimulateSingleDuct(state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); + SimulateSingleDuct(*state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); // check AT air mass flow rates EXPECT_EQ(expectedMassFlow, sd_airterminal(SysNum).sd_airterminalInlet.AirMassFlowRate); EXPECT_EQ(expectedMassFlow, sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); // Nighttime OA Sched = 0.0 - state.dataGlobal->HourOfDay = 24; - ScheduleManager::UpdateScheduleValues(state); + state->dataGlobal->HourOfDay = 24; + ScheduleManager::UpdateScheduleValues(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() DataHeatBalance::ZoneIntGain(1).NOFOCC = 1.5; expectedMassFlow = 0.0 * ((1.5 * 0.1) + 0.5); - SimulateSingleDuct(state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); + SimulateSingleDuct(*state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); // check AT air mass flow rates EXPECT_EQ(expectedMassFlow, sd_airterminal(SysNum).sd_airterminalInlet.AirMassFlowRate); EXPECT_EQ(expectedMassFlow, sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -650,19 +651,19 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_EMSOverrideAirFlow) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); - state.dataGlobal->SysSizingCalc = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->SysSizingCalc = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::StdRhoAir = 1.0; DataEnvironment::OutBaroPress = 101325.0; @@ -690,8 +691,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_EMSOverrideAirFlow) FirstHVACIteration = false; Node(InletNode).MassFlowRateMaxAvail = MassFlowRateMaxAvail; EXPECT_EQ(1.0, MassFlowRateMaxAvail); - // run SimulateSingleDuct(state, ) function - SimulateSingleDuct(state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); + // run SimulateSingleDuct(*state, ) function + SimulateSingleDuct(*state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); // check AT air mass flow rates EXPECT_EQ(MassFlowRateMaxAvail, sd_airterminal(SysNum).sd_airterminalInlet.AirMassFlowRate); EXPECT_EQ(MassFlowRateMaxAvail, sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -703,8 +704,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_EMSOverrideAirFlow) // sets EMS actuators sd_airterminal(SysNum).EMSOverrideAirFlow = true; sd_airterminal(SysNum).EMSMassFlowRateValue = 0.5; - // run SimulateSingleDuct(state, ) function - SimulateSingleDuct(state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); + // run SimulateSingleDuct(*state, ) function + SimulateSingleDuct(*state, AirDistUnit(1).EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, AirDistUnit(1).EquipIndex(1)); // check AT air mass flow rates EXPECT_EQ(sd_airterminal(SysNum).EMSMassFlowRateValue, sd_airterminal(SysNum).sd_airterminalInlet.AirMassFlowRate); EXPECT_EQ(sd_airterminal(SysNum).EMSMassFlowRateValue, sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -822,31 +823,31 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OAVolumeFlowRateReport ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - SizingManager::GetOARequirements(state); - InternalHeatGains::GetInternalHeatGainsInput(state); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetSysInput(state); + SizingManager::GetOARequirements(*state); + InternalHeatGains::GetInternalHeatGainsInput(*state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); - state.dataGlobal->SysSizingCalc = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->SysSizingCalc = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::StdRhoAir = 1.0; DataEnvironment::OutBaroPress = 101325.0; - state.dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow.allocate(1); int const SysNum(1); auto &thisAirTerminal = SingleDuct::sd_airterminal(SysNum); auto &thisAirTerminalInlet = thisAirTerminal.sd_airterminalInlet; auto &thisAirTerminalOutlet = thisAirTerminal.sd_airterminalOutlet; auto &thisAirDisUnit = AirDistUnit(1); - auto &thisAirLoop = state.dataAirLoop->AirLoopFlow(1); + auto &thisAirLoop = state->dataAirLoop->AirLoopFlow(1); int const InletNode = thisAirTerminal.InletNodeNum; int const ZonePtr = thisAirTerminal.ActualZoneNum; @@ -873,8 +874,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OAVolumeFlowRateReport Node(InletNode).MassFlowRateMaxAvail = 0.0; FirstHVACIteration = true; SingleDuct::GetInputFlag = false; - // run SimulateSingleDuct(state, ) function - SimulateSingleDuct(state, thisAirDisUnit.EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, thisAirDisUnit.EquipIndex(1)); + // run SimulateSingleDuct(*state, ) function + SimulateSingleDuct(*state, thisAirDisUnit.EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, thisAirDisUnit.EquipIndex(1)); // check AT air mass flow rates EXPECT_EQ(MassFlowRateMaxAvail, thisAirTerminal.AirMassFlowRateMax); // design maximum mass flow rate EXPECT_EQ(0.0, thisAirTerminalInlet.AirMassFlowRateMaxAvail); // maximum available mass flow rate @@ -882,7 +883,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OAVolumeFlowRateReport EXPECT_EQ(0.0, thisAirTerminalOutlet.AirMassFlowRate); // outlet mass flow rate is zero EXPECT_EQ(0.0, thisAirTerminal.OutdoorAirFlowRate); // OA volume flow rate is zero - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; // Needs an airloop, assume 100% OA thisAirLoop.OAFrac = 1.0; @@ -893,17 +894,17 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OAVolumeFlowRateReport DataEnvironment::DayOfYear_Schedule = 1; DataEnvironment::DayOfWeek = 1; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStep = 1; // Full occupancy 3 people, OA/person = 0.1, OA/zone = 0.5, OA Sched = 1.0 - state.dataGlobal->HourOfDay = 12; - ScheduleManager::UpdateScheduleValues(state); + state->dataGlobal->HourOfDay = 12; + ScheduleManager::UpdateScheduleValues(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() DataHeatBalance::ZoneIntGain(1).NOFOCC = 3.0; Real64 expectedMassFlow = 1.0 * ((3.0 * 0.1) + 0.5); - // run SimulateSingleDuct(state, ) function - SimulateSingleDuct(state, thisAirDisUnit.EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, thisAirDisUnit.EquipIndex(1)); + // run SimulateSingleDuct(*state, ) function + SimulateSingleDuct(*state, thisAirDisUnit.EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, thisAirDisUnit.EquipIndex(1)); Real64 expected_OAVolFlowRate = thisAirTerminalOutlet.AirMassFlowRate * thisAirLoop.OAFrac / DataEnvironment::StdRhoAir; // check AT air mass flow rates EXPECT_EQ(expectedMassFlow, thisAirTerminalInlet.AirMassFlowRate); @@ -911,12 +912,12 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OAVolumeFlowRateReport EXPECT_EQ(expected_OAVolFlowRate, thisAirTerminal.OutdoorAirFlowRate); // OA volume flow rate // 50% occupancy 1.5 people, OA/person = 0.1, OA/zone = 0.5, OA Sched = 1.0 - state.dataGlobal->HourOfDay = 12; - ScheduleManager::UpdateScheduleValues(state); + state->dataGlobal->HourOfDay = 12; + ScheduleManager::UpdateScheduleValues(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() DataHeatBalance::ZoneIntGain(1).NOFOCC = 1.5; expectedMassFlow = 1.0 * ((1.5 * 0.1) + 0.5); - SimulateSingleDuct(state, thisAirDisUnit.EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, thisAirDisUnit.EquipIndex(1)); + SimulateSingleDuct(*state, thisAirDisUnit.EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, thisAirDisUnit.EquipIndex(1)); expected_OAVolFlowRate = thisAirTerminalOutlet.AirMassFlowRate * thisAirLoop.OAFrac / DataEnvironment::StdRhoAir; // check AT air mass flow rates EXPECT_EQ(expectedMassFlow, thisAirTerminalInlet.AirMassFlowRate); @@ -924,12 +925,12 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_OAVolumeFlowRateReport EXPECT_EQ(expected_OAVolFlowRate, thisAirTerminal.OutdoorAirFlowRate); // OA volume flow rate // Nighttime OA Sched = 0.0 - state.dataGlobal->HourOfDay = 24; - ScheduleManager::UpdateScheduleValues(state); + state->dataGlobal->HourOfDay = 24; + ScheduleManager::UpdateScheduleValues(*state); // Just set number of people directly, too many other things that have to be in place to call ManagerInternalHeatGains() DataHeatBalance::ZoneIntGain(1).NOFOCC = 1.5; expectedMassFlow = 0.0 * ((1.5 * 0.1) + 0.5); - SimulateSingleDuct(state, thisAirDisUnit.EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, thisAirDisUnit.EquipIndex(1)); + SimulateSingleDuct(*state, thisAirDisUnit.EquipName(1), FirstHVACIteration, ZonePtr, ZoneAirNodeNum, thisAirDisUnit.EquipIndex(1)); expected_OAVolFlowRate = thisAirTerminalOutlet.AirMassFlowRate * thisAirLoop.OAFrac / DataEnvironment::StdRhoAir; // check AT air mass flow rates EXPECT_EQ(expectedMassFlow, thisAirTerminalInlet.AirMassFlowRate); @@ -999,19 +1000,19 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_SimSensibleOutPutTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); - state.dataGlobal->SysSizingCalc = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->SysSizingCalc = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::StdRhoAir = 1.0; DataEnvironment::OutBaroPress = 101325.0; @@ -1053,7 +1054,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_SimSensibleOutPutTest) Real64 NonAirSysOutput = 0.0; Real64 LatOutputProvided = 0.0; // run single duct simulation - SimZoneAirLoopEquipment(state, AirDistUnitNum, SysOutputProvided, NonAirSysOutput, LatOutputProvided, FirstHVACIteration, ZonePtr, ZonePtr); + SimZoneAirLoopEquipment(*state, AirDistUnitNum, SysOutputProvided, NonAirSysOutput, LatOutputProvided, FirstHVACIteration, ZonePtr, ZonePtr); // check AT air mass flow rates EXPECT_EQ(MassFlowRateMaxAvail, thisAirTerminal.AirMassFlowRateMax); // design maximum mass flow rate EXPECT_EQ(0.0, thisAirTerminal.sd_airterminalInlet.AirMassFlowRateMaxAvail); // maximum available mass flow rate @@ -1067,7 +1068,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_SimSensibleOutPutTest) Real64 CpAir = PsyCpAirFnW(min(Node(OutletNode).HumRat, Node(ZoneAirNodeNum).HumRat)); Real64 SensHeatRateProvided = MassFlowRateMaxAvail * CpAir * (Node(OutletNode).Temp - Node(ZoneAirNodeNum).Temp); // run SimulateSingleDuct() function - SimZoneAirLoopEquipment(state, AirDistUnitNum, SysOutputProvided, NonAirSysOutput, LatOutputProvided, FirstHVACIteration, ZonePtr, ZonePtr); + SimZoneAirLoopEquipment(*state, AirDistUnitNum, SysOutputProvided, NonAirSysOutput, LatOutputProvided, FirstHVACIteration, ZonePtr, ZonePtr); // check air terminal unit air mass flow rates and delivered sensible heating rate EXPECT_EQ(MassFlowRateMaxAvail, thisAirTerminal.sd_airterminalInlet.AirMassFlowRate); EXPECT_EQ(MassFlowRateMaxAvail, thisAirTerminal.sd_airterminalOutlet.AirMassFlowRate); @@ -1098,7 +1099,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_SimSensibleOutPutTest) NonAirSysOutput = 0.0; LatOutputProvided = 0.0; // run single duct simulation - SimZoneAirLoopEquipment(state, AirDistUnitNum, SysOutputProvided, NonAirSysOutput, LatOutputProvided, FirstHVACIteration, ZonePtr, ZonePtr); + SimZoneAirLoopEquipment(*state, AirDistUnitNum, SysOutputProvided, NonAirSysOutput, LatOutputProvided, FirstHVACIteration, ZonePtr, ZonePtr); // check AT air mass flow rates EXPECT_EQ(MassFlowRateMaxAvail, thisAirTerminal.AirMassFlowRateMax); // design maximum mass flow rate EXPECT_EQ(0.0, thisAirTerminal.sd_airterminalInlet.AirMassFlowRateMaxAvail); // maximum available mass flow rate @@ -1113,7 +1114,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctCVNoReheat_SimSensibleOutPutTest) CpAir = PsyCpAirFnW(min(Node(OutletNode).HumRat, Node(ZoneAirNodeNum).HumRat)); Real64 SensCoolRateProvided = MassFlowRateMaxAvail * CpAir * (Node(OutletNode).Temp - Node(ZoneAirNodeNum).Temp); // run SimulateSingleDuct() function - SimZoneAirLoopEquipment(state, AirDistUnitNum, SysOutputProvided, NonAirSysOutput, LatOutputProvided, FirstHVACIteration, ZonePtr, ZonePtr); + SimZoneAirLoopEquipment(*state, AirDistUnitNum, SysOutputProvided, NonAirSysOutput, LatOutputProvided, FirstHVACIteration, ZonePtr, ZonePtr); // check air terminal unit air mass flow rates and delivered sensible cooling rate EXPECT_EQ(MassFlowRateMaxAvail, thisAirTerminal.sd_airterminalInlet.AirMassFlowRate); EXPECT_EQ(MassFlowRateMaxAvail, thisAirTerminal.sd_airterminalOutlet.AirMassFlowRate); diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc index 9379009c988..b4b44035509 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuctMixer.unit.cc @@ -53,7 +53,8 @@ // ObjexxFCL Headers #include "Fixtures/EnergyPlusFixture.hh" - +#include +#include #include #include #include @@ -83,6 +84,7 @@ #include #include #include +#include // EnergyPlus Headers using namespace EnergyPlus::BranchInputManager; @@ -345,16 +347,16 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_GetInputPTAC_InletSide) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetPTUnit(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetPTUnit(*state); ASSERT_EQ(1, NumATMixers); EXPECT_EQ("SPACE1-1 DOAS AIR TERMINAL", SysATMixer(1).Name); // single duct air terminal mixer name @@ -592,19 +594,19 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMInletSide) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetPTUnit(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetPTUnit(*state); GetPTUnitInputFlag = false; // get input test for terminal air single duct mixer on inlet side of PTAC @@ -614,7 +616,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMInletSide) EXPECT_EQ("AIRTERMINAL:SINGLEDUCT:MIXER", AirDistUnit(1).EquipType(1)); // Air distribution unit equipment type EXPECT_EQ("ZoneHVAC:PackagedTerminalAirConditioner", PTUnit(1).UnitType); // zoneHVAC equipment type - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // set input variables DataEnvironment::OutBaroPress = 101325.0; @@ -670,7 +672,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMInletSide) PTUnit(1).ControlZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; ZoneSysEnergyDemand.allocate(1); ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; @@ -683,7 +685,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMInletSide) // set secondary air mass flow rate to zero Node(SysATMixer(1).SecInNode).MassFlowRate = 0.0; // simulate PTAC zoneHVAC equipment - SimPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); + SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); // apply mass conservation to determine secondary air mass flow rate SecondaryAirMassFlowRate = Node(PTUnit(PTUnitNum).AirInNode).MassFlowRate - PrimaryAirMassFlowRate; // check the terminal air mixer secondary air mass flow rate @@ -923,19 +925,19 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMSupplySide) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetPTUnit(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetPTUnit(*state); GetPTUnitInputFlag = false; // get input test for terminal air single duct mixer on supply side of PTAC @@ -954,7 +956,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMSupplySide) HVACInletMassFlowRate = 0.50; PrimaryAirMassFlowRate = 0.1; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // set zoneNode air condition Node(ZoneEquipConfig(1).ZoneNode).Temp = 24.0; @@ -1001,7 +1003,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMSupplySide) PTUnit(1).ControlZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; ZoneSysEnergyDemand.allocate(1); ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; @@ -1014,7 +1016,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_ATMSupplySide) // set secondary air mass flow rate to zero Node(SysATMixer(1).SecInNode).MassFlowRate = 0.0; // simulate PTAC zoneHVAC equipment - SimPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); + SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); // apply mass conservation to determine secondary mass flow rate SecondaryAirMassFlowRate = Node(SysATMixer(1).SecInNode).MassFlowRate; // check the terminal air mixer secondary air mass flow rate @@ -1337,19 +1339,19 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMInletSide) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetPTUnit(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetPTUnit(*state); GetPTUnitInputFlag = false; // get input test for terminal air single duct mixer on inlet side of PTHP @@ -1359,7 +1361,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMInletSide) EXPECT_EQ("AIRTERMINAL:SINGLEDUCT:MIXER", AirDistUnit(1).EquipType(1)); // Air distribution unit equipment type EXPECT_EQ("ZoneHVAC:PackagedTerminalHeatPump", PTUnit(1).UnitType); // zoneHVAC equipment type - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // set input variables DataEnvironment::OutBaroPress = 101325.0; @@ -1415,7 +1417,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMInletSide) PTUnit(1).ControlZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; ZoneSysEnergyDemand.allocate(1); ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; @@ -1428,7 +1430,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMInletSide) // set secondary air mass flow rate to zero Node(SysATMixer(1).SecInNode).MassFlowRate = 0.0; // simulate PTHP zoneHVAC equipment - SimPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); + SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); // apply mass conservation to determine secondary air mass flow rate SecondaryAirMassFlowRate = Node(PTUnit(PTUnitNum).AirInNode).MassFlowRate - PrimaryAirMassFlowRate; // check the terminal air mixer secondary air mass flow rate @@ -1750,19 +1752,19 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMSupplySide) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetPTUnit(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetPTUnit(*state); GetPTUnitInputFlag = false; // get input test for terminal air single duct mixer on supply side of PTHP @@ -1781,7 +1783,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMSupplySide) HVACInletMassFlowRate = 0.50; PrimaryAirMassFlowRate = 0.1; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // set zoneNode air condition Node(ZoneEquipConfig(1).ZoneNode).Temp = 24.0; @@ -1828,7 +1830,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMSupplySide) PTUnit(1).ControlZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; ZoneSysEnergyDemand.allocate(1); ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; @@ -1841,7 +1843,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTHP_ATMSupplySide) // set secondary air mass flow rate to zero Node(SysATMixer(1).SecInNode).MassFlowRate = 0.0; // simulate PTHP zoneHVAC equipment - SimPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); + SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); // apply mass conservation to determine secondary mass flow rate SecondaryAirMassFlowRate = Node(SysATMixer(1).SecInNode).MassFlowRate; // check the terminal air mixer secondary air mass flow rate @@ -2422,20 +2424,20 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); - GetVRFInput(state); + GetVRFInput(*state); GetVRFInputFlag = false; // get input test for terminal air single duct mixer on inlet side of VRF terminal unit @@ -2446,7 +2448,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) EXPECT_EQ("TU1", VRFTU(1).Name); // zoneHVAC equipment name // EXPECT_EQ( "ZoneHVAC:TerminalUnit:VariableRefrigerantFlow", VRFTU( 1 ).Name ); // zoneHVAC equipment type - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // set input variables DataEnvironment::OutBaroPress = 101325.0; @@ -2509,7 +2511,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) VRFTU(1).ZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; ZoneSysEnergyDemand.allocate(1); ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; @@ -2522,7 +2524,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMInletSide) // set secondary air mass flow rate to zero Node(SysATMixer(1).SecInNode).MassFlowRate = 0.0; // Simulate zoneHVAC equipment (VRF terminal unit) - SimVRF(state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, QUnitOutVRFTU, LatOutputProvided, QZnReq); + SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, QUnitOutVRFTU, LatOutputProvided, QZnReq); // check the terminal air mixer secondary air mass flow rate ASSERT_EQ(SecondaryAirMassFlowRate, Node(SysATMixer(1).SecInNode).MassFlowRate); // check the terminal air mixer outlet flow rate must be equal to VRFTU mass flow rate @@ -3101,20 +3103,20 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); - GetVRFInput(state); + GetVRFInput(*state); GetVRFInputFlag = false; // get input test for terminal air single duct mixer on inlet side of VRF terminal unit @@ -3124,7 +3126,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) EXPECT_EQ("AIRTERMINAL:SINGLEDUCT:MIXER", AirDistUnit(1).EquipType(1)); // Air distribution unit equipment type EXPECT_EQ("TU1", VRFTU(1).Name); // zoneHVAC equipment name - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // set input variables DataEnvironment::OutBaroPress = 101325.0; @@ -3185,7 +3187,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) VRFTU(1).ZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; ZoneSysEnergyDemand.allocate(1); ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; @@ -3198,7 +3200,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRF_ATMSupplySide) // set secondary air mass flow rate to zero Node(SysATMixer(1).SecInNode).MassFlowRate = 0.0; // simulate zoneHVAC equipment (VRF terminal unit) - SimVRF(state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, QUnitOutVRFTU, LatOutputProvided, QZnReq); + SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, QUnitOutVRFTU, LatOutputProvided, QZnReq); // check the terminal air mixer secondary air mass flow rate ASSERT_EQ(SecondaryAirMassFlowRate, Node(SysATMixer(1).SecInNode).MassFlowRate); @@ -4851,20 +4853,20 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); - GetVRFInput(state); + GetVRFInput(*state); GetVRFInputFlag = false; // get input test for terminal air single duct mixer on inlet side of VRF terminal unit @@ -4874,14 +4876,14 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi EXPECT_EQ("AIRTERMINAL:SINGLEDUCT:MIXER", AirDistUnit(1).EquipType(1)); // Air distribution unit equipment type EXPECT_EQ("TU1", VRFTU(1).Name); // zoneHVAC equipment name - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // set input variables DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::OutDryBulbTemp = 35.0; DataEnvironment::OutHumRat = 0.0098; DataEnvironment::OutEnthalpy = Psychrometrics::PsyHFnTdbW(DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); - DataEnvironment::OutWetBulbTemp = PsyTwbFnTdbWPb(state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat, DataEnvironment::OutBaroPress); + DataEnvironment::OutWetBulbTemp = PsyTwbFnTdbWPb(*state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat, DataEnvironment::OutBaroPress); DataEnvironment::StdRhoAir = 1.20; HVACInletMassFlowRate = 0.50; PrimaryAirMassFlowRate = 0.1; @@ -4937,7 +4939,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi VRFTU(1).ZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; ZoneSysEnergyDemand.allocate(1); ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; @@ -4950,7 +4952,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMInletSi // set secondary air mass flow rate to zero Node(SysATMixer(1).SecInNode).MassFlowRate = 0.0; // Simulate zoneHVAC equipment (VRF terminal unit) - SimVRF(state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, QUnitOutVRFTU, LatOutputProvided, QZnReq); + SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, QUnitOutVRFTU, LatOutputProvided, QZnReq); // check the terminal air mixer secondary air mass flow rate, requires updating the secondary flow SecondaryAirMassFlowRate = Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate - PrimaryAirMassFlowRate; @@ -6605,20 +6607,20 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); - GetVRFInput(state); + GetVRFInput(*state); GetVRFInputFlag = false; // get input test for terminal air single duct mixer on supply side of VRF terminal unit @@ -6628,7 +6630,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS EXPECT_EQ("AIRTERMINAL:SINGLEDUCT:MIXER", AirDistUnit(1).EquipType(1)); // Air distribution unit equipment type EXPECT_EQ("TU1", VRFTU(1).Name); // zoneHVAC equipment name - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // set input variables DataEnvironment::OutBaroPress = 101325.0; @@ -6689,7 +6691,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS VRFTU(1).ZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; ZoneSysEnergyDemand.allocate(1); ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; @@ -6702,7 +6704,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimVRFfluidCntrl_ATMSupplyS // set secondary air mass flow rate to zero Node(SysATMixer(1).SecInNode).MassFlowRate = 0.0; // Simulate zoneHVAC equipment (VRF terminal unit) - SimVRF(state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, QUnitOutVRFTU, LatOutputProvided, QZnReq); + SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, QUnitOutVRFTU, LatOutputProvided, QZnReq); // check the terminal air mixer secondary air mass flow rate, requires updating the secondary flow SecondaryAirMassFlowRate = Node(VRFTU(VRFTUNum).VRFTUInletNodeNum).MassFlowRate; @@ -6724,7 +6726,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMInletSide) Real64 SecondaryAirMassFlowRate(0.0); Real64 LatOutputProvided(0.0); Real64 QUnitOut(0.0); - state.dataUnitVentilators->QZnReq = 0.0; + state->dataUnitVentilators->QZnReq = 0.0; int ZoneNum(1); int UnitVentNum(1); @@ -6852,20 +6854,20 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMInletSide) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetUnitVentilatorInput(state); - state.dataUnitVentilators->GetUnitVentilatorInputFlag = false; + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetUnitVentilatorInput(*state); + state->dataUnitVentilators->GetUnitVentilatorInputFlag = false; // get input test for terminal air single duct mixer on inlet side of PTHP ASSERT_EQ(1, NumATMixers); @@ -6873,7 +6875,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMInletSide) EXPECT_EQ(DataHVACGlobals::ATMixer_InletSide, SysATMixer(1).MixerType); // air terminal mixer connection type EXPECT_EQ("AIRTERMINAL:SINGLEDUCT:MIXER", AirDistUnit(1).EquipType(1)); // Air distribution unit equipment type - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // set input variables DataEnvironment::OutBaroPress = 101325.0; @@ -6895,16 +6897,16 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMInletSide) UnitVentNum = 1; // set the mass flow rates from the input volume flow rates - state.dataUnitVentilators->UnitVent(UnitVentNum).MaxAirMassFlow = DataEnvironment::StdRhoAir * state.dataUnitVentilators->UnitVent(UnitVentNum).MaxAirVolFlow; - state.dataUnitVentilators->UnitVent(UnitVentNum).OutAirMassFlow = DataEnvironment::StdRhoAir * state.dataUnitVentilators->UnitVent(UnitVentNum).OutAirVolFlow; - state.dataUnitVentilators->UnitVent(UnitVentNum).MinOutAirMassFlow = DataEnvironment::StdRhoAir * state.dataUnitVentilators->UnitVent(UnitVentNum).MinOutAirVolFlow; + state->dataUnitVentilators->UnitVent(UnitVentNum).MaxAirMassFlow = DataEnvironment::StdRhoAir * state->dataUnitVentilators->UnitVent(UnitVentNum).MaxAirVolFlow; + state->dataUnitVentilators->UnitVent(UnitVentNum).OutAirMassFlow = DataEnvironment::StdRhoAir * state->dataUnitVentilators->UnitVent(UnitVentNum).OutAirVolFlow; + state->dataUnitVentilators->UnitVent(UnitVentNum).MinOutAirMassFlow = DataEnvironment::StdRhoAir * state->dataUnitVentilators->UnitVent(UnitVentNum).MinOutAirVolFlow; - state.dataUnitVentilators->UnitVent(UnitVentNum).OpMode = CycFanCycCoil; + state->dataUnitVentilators->UnitVent(UnitVentNum).OpMode = CycFanCycCoil; // initialize mass flow rates - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).MassFlowRate = HVACInletMassFlowRate; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).MassFlowRateMax = HVACInletMassFlowRate; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).MassFlowRate = HVACInletMassFlowRate; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).MassFlowRateMax = HVACInletMassFlowRate; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; @@ -6914,40 +6916,40 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMInletSide) Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // primary air condition set at outdoor air condition - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).Temp = DataEnvironment::OutDryBulbTemp; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).HumRat = DataEnvironment::OutHumRat; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).Enthalpy = DataEnvironment::OutEnthalpy; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).Temp = DataEnvironment::OutDryBulbTemp; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).HumRat = DataEnvironment::OutHumRat; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).Enthalpy = DataEnvironment::OutEnthalpy; // set secondary air (recirculating air) conditions to zone air node Node(SysATMixer(1).SecInNode).Temp = Node(ZoneEquipConfig(1).ZoneNode).Temp; Node(SysATMixer(1).SecInNode).HumRat = Node(ZoneEquipConfig(1).ZoneNode).HumRat; Node(SysATMixer(1).SecInNode).Enthalpy = Node(ZoneEquipConfig(1).ZoneNode).Enthalpy; - state.dataUnitVentilators->UnitVent(1).ZonePtr = 1; + state->dataUnitVentilators->UnitVent(1).ZonePtr = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; CurDeadBandOrSetback.allocate(1); CurDeadBandOrSetback(1) = false; ZoneSysEnergyDemand.allocate(1); ZoneSysEnergyDemand(1).RemainingOutputRequired = 5000.0; - state.dataUnitVentilators->QZnReq = ZoneSysEnergyDemand(1).RemainingOutputRequired; + state->dataUnitVentilators->QZnReq = ZoneSysEnergyDemand(1).RemainingOutputRequired; - Schedule(state.dataUnitVentilators->UnitVent(UnitVentNum).SchedPtr).CurrentValue = 1.0; // unit is always available - Schedule(state.dataUnitVentilators->UnitVent(UnitVentNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available - Schedule(state.dataUnitVentilators->UnitVent(UnitVentNum).MinOASchedPtr).CurrentValue = 0.5; // min OA fraction is always available + Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).SchedPtr).CurrentValue = 1.0; // unit is always available + Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).MinOASchedPtr).CurrentValue = 0.5; // min OA fraction is always available // set secondary air mass flow rate to zero Node(SysATMixer(1).SecInNode).MassFlowRate = 0.0; // simulate Unit Ventilator zoneHVAC equipment - SimUnitVentilator(state, state.dataUnitVentilators->UnitVent(UnitVentNum).Name, ZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided, UnitVentNum); + SimUnitVentilator(*state, state->dataUnitVentilators->UnitVent(UnitVentNum).Name, ZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided, UnitVentNum); // apply mass conservation to determine secondary air mass flow rate - SecondaryAirMassFlowRate = Node(state.dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).MassFlowRate - PrimaryAirMassFlowRate; + SecondaryAirMassFlowRate = Node(state->dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).MassFlowRate - PrimaryAirMassFlowRate; // check the air mixer secondary air mass flow rate ASSERT_EQ(SecondaryAirMassFlowRate, Node(SysATMixer(1).SecInNode).MassFlowRate); // check the cooling output delivered is within 2.0 Watt of zone cooling load - ASSERT_NEAR(state.dataUnitVentilators->QZnReq, QUnitOut, 0.001); + ASSERT_NEAR(state->dataUnitVentilators->QZnReq, QUnitOut, 0.001); } TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMSupplySide) @@ -7089,20 +7091,20 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMSupplySide) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetUnitVentilatorInput(state); - state.dataUnitVentilators->GetUnitVentilatorInputFlag = false; + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetUnitVentilatorInput(*state); + state->dataUnitVentilators->GetUnitVentilatorInputFlag = false; // get input test for terminal air single duct mixer on supply side of PTHP ASSERT_EQ(1, NumATMixers); @@ -7119,7 +7121,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMSupplySide) HVACInletMassFlowRate = 0.50; PrimaryAirMassFlowRate = 0.1; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // set zoneNode air condition Node(ZoneEquipConfig(1).ZoneNode).Temp = 24.0; @@ -7132,16 +7134,16 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMSupplySide) UnitVentNum = 1; // set the mass flow rates from the input volume flow rates - state.dataUnitVentilators->UnitVent(UnitVentNum).MaxAirMassFlow = DataEnvironment::StdRhoAir * state.dataUnitVentilators->UnitVent(UnitVentNum).MaxAirVolFlow; - state.dataUnitVentilators->UnitVent(UnitVentNum).OutAirMassFlow = DataEnvironment::StdRhoAir * state.dataUnitVentilators->UnitVent(UnitVentNum).OutAirVolFlow; - state.dataUnitVentilators->UnitVent(UnitVentNum).MinOutAirMassFlow = DataEnvironment::StdRhoAir * state.dataUnitVentilators->UnitVent(UnitVentNum).MinOutAirVolFlow; + state->dataUnitVentilators->UnitVent(UnitVentNum).MaxAirMassFlow = DataEnvironment::StdRhoAir * state->dataUnitVentilators->UnitVent(UnitVentNum).MaxAirVolFlow; + state->dataUnitVentilators->UnitVent(UnitVentNum).OutAirMassFlow = DataEnvironment::StdRhoAir * state->dataUnitVentilators->UnitVent(UnitVentNum).OutAirVolFlow; + state->dataUnitVentilators->UnitVent(UnitVentNum).MinOutAirMassFlow = DataEnvironment::StdRhoAir * state->dataUnitVentilators->UnitVent(UnitVentNum).MinOutAirVolFlow; - state.dataUnitVentilators->UnitVent(UnitVentNum).OpMode = CycFanCycCoil; + state->dataUnitVentilators->UnitVent(UnitVentNum).OpMode = CycFanCycCoil; // initialize mass flow rates - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).MassFlowRate = HVACInletMassFlowRate; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).MassFlowRateMax = HVACInletMassFlowRate; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).MassFlowRate = HVACInletMassFlowRate; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).MassFlowRateMax = HVACInletMassFlowRate; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).MassFlowRate = PrimaryAirMassFlowRate; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).MassFlowRateMaxAvail = PrimaryAirMassFlowRate; // set fan parameters Fan(1).MaxAirMassFlowRate = HVACInletMassFlowRate; @@ -7151,19 +7153,19 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMSupplySide) Node(Fan(1).OutletNodeNum).MassFlowRateMax = HVACInletMassFlowRate; // primary air condition at outside air condition - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).Temp = DataEnvironment::OutDryBulbTemp; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).HumRat = DataEnvironment::OutHumRat; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).Enthalpy = DataEnvironment::OutEnthalpy; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).Temp = DataEnvironment::OutDryBulbTemp; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).HumRat = DataEnvironment::OutHumRat; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).ATMixerPriNode).Enthalpy = DataEnvironment::OutEnthalpy; // set UnitVent inlet condition to zone air node - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).Temp = Node(ZoneEquipConfig(1).ZoneNode).Temp; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).HumRat = Node(ZoneEquipConfig(1).ZoneNode).HumRat; - Node(state.dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).Enthalpy = Node(ZoneEquipConfig(1).ZoneNode).Enthalpy; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).Temp = Node(ZoneEquipConfig(1).ZoneNode).Temp; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).HumRat = Node(ZoneEquipConfig(1).ZoneNode).HumRat; + Node(state->dataUnitVentilators->UnitVent(UnitVentNum).AirInNode).Enthalpy = Node(ZoneEquipConfig(1).ZoneNode).Enthalpy; - state.dataUnitVentilators->UnitVent(1).ZonePtr = 1; + state->dataUnitVentilators->UnitVent(1).ZonePtr = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; CurDeadBandOrSetback.allocate(1); CurDeadBandOrSetback(1) = false; @@ -7171,14 +7173,14 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimUnitVent_ATMSupplySide) ZoneSysEnergyDemand(ZoneNum).RemainingOutputRequired = 5000.0; QZnReq = ZoneSysEnergyDemand(1).RemainingOutputRequired; - Schedule(state.dataUnitVentilators->UnitVent(UnitVentNum).SchedPtr).CurrentValue = 1.0; // unit is always available - Schedule(state.dataUnitVentilators->UnitVent(UnitVentNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available - Schedule(state.dataUnitVentilators->UnitVent(UnitVentNum).MinOASchedPtr).CurrentValue = 0.5; // min OA fraction is always available + Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).SchedPtr).CurrentValue = 1.0; // unit is always available + Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).FanAvailSchedPtr).CurrentValue = 1.0; // fan is always available + Schedule(state->dataUnitVentilators->UnitVent(UnitVentNum).MinOASchedPtr).CurrentValue = 0.5; // min OA fraction is always available // set secondary air mass flow rate to zero Node(SysATMixer(1).SecInNode).MassFlowRate = 0.0; // simulate Unit Ventilator ZoneHVAC equipment - SimUnitVentilator(state, state.dataUnitVentilators->UnitVent(UnitVentNum).Name, ZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided, UnitVentNum); + SimUnitVentilator(*state, state->dataUnitVentilators->UnitVent(UnitVentNum).Name, ZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided, UnitVentNum); // apply mass conservation to determine secondary mass flow rate SecondaryAirMassFlowRate = Node(SysATMixer(1).SecInNode).MassFlowRate; // check the terminal air mixer secondary air mass flow rate @@ -7335,15 +7337,15 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_GetInputDOASpecs) ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - SizingManager::GetOARequirements(state); - SizingManager::GetZoneSizingInput(state); - GetZoneEquipmentData1(state); - ZoneEquipmentManager::SetUpZoneSizingArrays(state); - GetZoneAirLoopEquipment(state); - GetATMixers(state); + SizingManager::GetOARequirements(*state); + SizingManager::GetZoneSizingInput(*state); + GetZoneEquipmentData1(*state); + ZoneEquipmentManager::SetUpZoneSizingArrays(*state); + GetZoneAirLoopEquipment(*state); + GetATMixers(*state); ASSERT_EQ(2, NumATMixers); EXPECT_EQ("SPACE1-1 DOAS AIR TERMINAL", SysATMixer(1).Name); // single duct air terminal mixer name @@ -7527,21 +7529,21 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) DataSizing::CurZoneEqNum = 1; DataEnvironment::OutBaroPress = 101325.0; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, OutBaroPress, 20.0, 0.0); - state.dataWaterCoils->GetWaterCoilsInputFlag = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, OutBaroPress, 20.0, 0.0); + state->dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); - GetZoneData(state, ErrorsFound); + OutputReportPredefined::SetPredefinedTables(*state); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanCoilUnits(state); + GetFanCoilUnits(*state); auto &thisFanCoil(FanCoil(1)); auto &thisATMixer(SysATMixer(1)); @@ -7563,7 +7565,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) NumPltSizInput = 2; PlantSizData.allocate(NumPltSizInput); // chilled water coil - auto &CWCoil(state.dataWaterCoils->WaterCoil(2)); + auto &CWCoil(state->dataWaterCoils->WaterCoil(2)); thisFanCoil.CCoilName_Index = 2; Node(CWCoil.WaterInletNodeNum).Temp = 6.0; CWCoil.WaterLoopNum = 2; @@ -7571,7 +7573,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) CWCoil.WaterLoopBranchNum = 1; CWCoil.WaterLoopCompNum = 1; // hot water coil - auto &HWCoil(state.dataWaterCoils->WaterCoil(1)); + auto &HWCoil(state->dataWaterCoils->WaterCoil(1)); thisFanCoil.HCoilName_Index = 1; Node(HWCoil.WaterInletNodeNum).Temp = 60.0; HWCoil.WaterLoopNum = 1; @@ -7595,7 +7597,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; auto &CWLoopSizingData(DataSizing::PlantSizData(2)); @@ -7612,7 +7614,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) HWLoop.FluidIndex = 1; HWLoop.FluidName = "WATER"; HWLoop.LoopSide(1).Branch(1).Comp(1).Name = HWCoil.Name; - HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; + HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = HWCoil.WaterInletNodeNum; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = HWCoil.WaterOutletNodeNum; auto &HWLoopSizingData(DataSizing::PlantSizData(1)); @@ -7622,18 +7624,18 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) HWLoopSizingData.DesVolFlowRate = 1.0; HWLoopSizingData.DeltaT = 10.0; DataPlant::PlantFirstSizesOkayToFinalize = true; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->DoingSizing = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); auto &zoneEqSizing(ZoneEqSizing(1)); @@ -7695,7 +7697,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) Node(thisATMixer.SecInNode).HumRat = Node(zoneEquipConfig.ZoneNode).HumRat; Node(thisATMixer.SecInNode).Enthalpy = Node(zoneEquipConfig.ZoneNode).Enthalpy; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; ZoneEqFanCoil = true; // set predicted heating load @@ -7706,9 +7708,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) QUnitOut = 0.0; QLatOut = 0.0; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); EXPECT_EQ(Node(thisFanCoil.AirInNode).MassFlowRateMinAvail, 0.0); // check init value - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); SecondaryAirMassFlowRate = Node(thisFanCoil.AirInNode).MassFlowRate - PrimaryAirMassFlowRate; // check results in heating mode operation EXPECT_NEAR(QZnReq, QUnitOut, 5.0); @@ -7740,8 +7742,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->SysSizingCalc = true; + state->dataGlobal->BeginEnvrnFlag = true; // set predicted cooling load zoneSysEnergyDemand.RemainingOutputReqToHeatSP = 0.0; zoneSysEnergyDemand.RemainingOutputReqToCoolSP = -5000.0; @@ -7749,9 +7751,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimFCU_ATMInletSideTest) QZnReq = zoneSysEnergyDemand.RemainingOutputRequired; QUnitOut = 0.0; QLatOut = 0.0; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); EXPECT_EQ(Node(thisFanCoil.AirInNode).MassFlowRateMinAvail, 0.0); // check init value - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); SecondaryAirMassFlowRate = Node(thisFanCoil.AirInNode).MassFlowRate - PrimaryAirMassFlowRate; // check results in cooling mode operation EXPECT_NEAR(QZnReq, QUnitOut, 5.0); @@ -7955,26 +7957,26 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) DataSizing::CurZoneEqNum = 1; DataEnvironment::OutBaroPress = 101325.0; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, OutBaroPress, 20.0, 0.0); - state.dataWaterCoils->GetWaterCoilsInputFlag = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, OutBaroPress, 20.0, 0.0); + state->dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); - GetZoneData(state, ErrorsFound); + OutputReportPredefined::SetPredefinedTables(*state); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanCoilUnits(state); - SystemAvailabilityManager::GetSysAvailManagerInputs(state); + GetFanCoilUnits(*state); + SystemAvailabilityManager::GetSysAvailManagerInputs(*state); auto &thisFanCoil(FanCoil(1)); auto &thisATMixer(SysATMixer(1)); - auto &thisAvaiManager(state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1)); + auto &thisAvaiManager(state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1)); // get input test for terminal air single duct mixer on inlet side of PTAC ASSERT_EQ(1, NumATMixers); @@ -7987,14 +7989,14 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) EXPECT_EQ("COIL:HEATING:WATER", thisFanCoil.HCoilType); EXPECT_EQ("FCU HEATING COIL", thisFanCoil.HCoilName); EXPECT_EQ("NIGHTCYCLE AVAILMGR", thisAvaiManager.Name); - EXPECT_EQ(state.dataSystemAvailabilityManager->SysAvailMgr_NightCycle, thisAvaiManager.MgrType); + EXPECT_EQ(state->dataSystemAvailabilityManager->SysAvailMgr_NightCycle, thisAvaiManager.MgrType); TotNumLoops = 2; PlantLoop.allocate(TotNumLoops); NumPltSizInput = 2; PlantSizData.allocate(NumPltSizInput); // chilled water coil - auto &CWCoil(state.dataWaterCoils->WaterCoil(2)); + auto &CWCoil(state->dataWaterCoils->WaterCoil(2)); thisFanCoil.CCoilName_Index = 2; Node(CWCoil.WaterInletNodeNum).Temp = 6.0; CWCoil.WaterLoopNum = 2; @@ -8002,7 +8004,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) CWCoil.WaterLoopBranchNum = 1; CWCoil.WaterLoopCompNum = 1; // hot water coil - auto &HWCoil(state.dataWaterCoils->WaterCoil(1)); + auto &HWCoil(state->dataWaterCoils->WaterCoil(1)); thisFanCoil.HCoilName_Index = 1; Node(HWCoil.WaterInletNodeNum).Temp = 60.0; HWCoil.WaterLoopNum = 1; @@ -8026,7 +8028,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; auto &CWLoopSizingData(DataSizing::PlantSizData(2)); @@ -8043,7 +8045,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) HWLoop.FluidIndex = 1; HWLoop.FluidName = "WATER"; HWLoop.LoopSide(1).Branch(1).Comp(1).Name = HWCoil.Name; - HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; + HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = HWCoil.WaterInletNodeNum; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = HWCoil.WaterOutletNodeNum; auto &HWLoopSizingData(DataSizing::PlantSizData(1)); @@ -8053,18 +8055,18 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) HWLoopSizingData.DesVolFlowRate = 1.0; HWLoopSizingData.DeltaT = 10.0; DataPlant::PlantFirstSizesOkayToFinalize = true; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->DoingSizing = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); auto &zoneEqSizing(ZoneEqSizing(1)); @@ -8126,11 +8128,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) Node(thisATMixer.SecInNode).HumRat = Node(zoneEquipConfig.ZoneNode).HumRat; Node(thisATMixer.SecInNode).Enthalpy = Node(zoneEquipConfig.ZoneNode).Enthalpy; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; ZoneEqFanCoil = true; // check availability manager Night Cycle parameters - EXPECT_EQ(state.dataSystemAvailabilityManager->ThermostatWithMinimumRunTime, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType); - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(state->dataSystemAvailabilityManager->ThermostatWithMinimumRunTime, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType); + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // set predicted heating load zoneSysEnergyDemand.RemainingOutputReqToCoolSP = 4000.0; @@ -8139,8 +8141,8 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) QZnReq = zoneSysEnergyDemand.RemainingOutputRequired; QUnitOut = 0.0; QLatOut = 0.0; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // check results when the fan coil unit is not available EXPECT_NEAR(0.0, QUnitOut, 0.1); // fan coil unit is off EXPECT_NEAR(thisFanCoil.PLR, 0.0, 0.00001); @@ -8152,22 +8154,22 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_FCU_NightCycleTest) int const ZoneEquipType = 1; int const CompNum = 1; // current time is within the run time period, starting time is less than stopping time - state.dataGlobal->SimTimeSteps = 0; + state->dataGlobal->SimTimeSteps = 0; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StartTime = 0.0; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; // run CalcNCycSysAvailMgr to the availability of the fan coil unit on - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); // check that the NightCycle has turned on the equipment EXPECT_EQ(DataHVACGlobals::CycleOn, AvailStatus); - EXPECT_EQ(DataHVACGlobals::CycleOn, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::CycleOn, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // set zone equipment is CyclOn based on night cycle manager status - if (state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus) { + if (state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus) { ZoneCompTurnFansOn = true; ZoneCompTurnFansOff = false; } - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); EXPECT_NEAR(QZnReq, QUnitOut, 3.0); EXPECT_NEAR(thisFanCoil.PLR, 0.187, 0.001); EXPECT_NEAR(Node(thisFanCoil.AirInNode).MassFlowRate, thisFanCoil.PLR * Node(thisFanCoil.AirInNode).MassFlowRateMax, 0.000001); diff --git a/tst/EnergyPlus/unit/AirTerminalSingleDuctPIUReheat.unit.cc b/tst/EnergyPlus/unit/AirTerminalSingleDuctPIUReheat.unit.cc index a977676ad3e..7f0ec78ebd5 100644 --- a/tst/EnergyPlus/unit/AirTerminalSingleDuctPIUReheat.unit.cc +++ b/tst/EnergyPlus/unit/AirTerminalSingleDuctPIUReheat.unit.cc @@ -53,7 +53,7 @@ // ObjexxFCL Headers #include "Fixtures/EnergyPlusFixture.hh" - +#include #include #include #include @@ -180,17 +180,17 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctSeriesPIUReheat_GetInputtest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); - GetPIUs(state); + GetPIUs(*state); ASSERT_EQ(1, NumSeriesPIUs); EXPECT_EQ("SPACE1-1 ZONE COIL", PIU(1).HCoil); // heating coil name @@ -289,17 +289,17 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctSeriesPIU_SetADUInletNodeTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); - GetPIUs(state); + GetPIUs(*state); int const PIUNum = 1; int const ADUNum = 1; @@ -1473,9 +1473,9 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctSeriesPIU_SimTest) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - state.dataGlobal->DDOnlySimulation = true; + state->dataGlobal->DDOnlySimulation = true; - ManageSimulation(state); // run the design day over the warmup period (24 hrs, 25 days) + ManageSimulation(*state); // run the design day over the warmup period (24 hrs, 25 days) int const PIUNum = 1; int const ADUNum = 1; diff --git a/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc index b7a2a16a5d4..57b9aae8183 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkBalanceManager.unit.cc @@ -58,9 +58,9 @@ #include #include #include - +#include #include - +#include #include #include #include @@ -97,7 +97,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestOtherSideCoefficients int i = 2; - state.dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtSurfaces = 2; + state->dataAirflowNetworkBalanceManager->AirflowNetworkNumOfExtSurfaces = 2; AirflowNetwork::AirflowNetworkNumOfSurfaces = 2; AirflowNetwork::MultizoneSurfaceData.allocate(i); @@ -114,7 +114,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestOtherSideCoefficients AirflowNetwork::MultizoneSurfaceData(1).SurfNum = 1; AirflowNetwork::MultizoneSurfaceData(2).SurfNum = 2; - state.dataAirflowNetworkBalanceManager->calculateWindPressureCoeffs(state); + state->dataAirflowNetworkBalanceManager->calculateWindPressureCoeffs(*state); EXPECT_EQ(1, AirflowNetwork::MultizoneSurfaceData(1).NodeNums[1]); EXPECT_EQ(2, AirflowNetwork::MultizoneSurfaceData(2).NodeNums[1]); EXPECT_EQ(1, AirflowNetwork::MultizoneExternalNodeData(1).curve); @@ -154,7 +154,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingSch) SurfaceGeometry::AllocateSurfaceWindows(2); SurfWinOriginalClass(1) = DataSurfaces::SurfaceClass::Window; SurfWinOriginalClass(2) = DataSurfaces::SurfaceClass::Window; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; std::string const idf_objects = delimited_string({ "Schedule:Constant,OnSch,,1.0;", @@ -219,7 +219,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingSch) }); ASSERT_TRUE(process_idf(idf_objects)); - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); // MultizoneZoneData has only 1 element so may be hardcoded auto GetIndex = UtilityRoutines::FindItemInList(AirflowNetwork::MultizoneZoneData(1).VentingSchName, Schedule({1, NumSchedules})); @@ -278,7 +278,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestTriangularWindowWarni SurfWinOriginalClass(1) = DataSurfaces::SurfaceClass::Window; SurfWinOriginalClass(2) = DataSurfaces::SurfaceClass::Window; SurfWinOriginalClass(3) = DataSurfaces::SurfaceClass::Window; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; std::string const idf_objects = delimited_string({ "Schedule:Constant,OnSch,,1.0;", @@ -342,7 +342,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestTriangularWindowWarni }); ASSERT_TRUE(process_idf(idf_objects)); - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); std::string const error_string = delimited_string({ " ** Warning ** GetAirflowNetworkInput: AirflowNetwork:MultiZone:Surface=\"WINDOW1\".", " ** ~~~ ** The opening is a Triangular subsurface. A rectangular subsurface will be used with equivalent width and height.", @@ -2234,26 +2234,26 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(state, ErrorsFound); + HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Read AirflowNetwork inputs - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); Real64 PressureSet = 0.5; @@ -2278,7 +2278,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) AirflowNetwork::AirflowNetworkNodeSimu(i).WZ = 0.0008400; if ((i > 4 && i < 10) || i == index) { // NFACADE, EFACADE, SFACADE, WFACADE, HORIZONTAL are always at indexes 5 through 9 AirflowNetwork::AirflowNetworkNodeSimu(i).TZ = - DataEnvironment::OutDryBulbTempAt(state, AirflowNetwork::AirflowNetworkNodeData(i).NodeHeight); // AirflowNetworkNodeData vals differ + DataEnvironment::OutDryBulbTempAt(*state, AirflowNetwork::AirflowNetworkNodeData(i).NodeHeight); // AirflowNetworkNodeData vals differ AirflowNetwork::AirflowNetworkNodeSimu(i).WZ = DataEnvironment::OutHumRat; } } @@ -2310,13 +2310,13 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) AirflowNetwork::AirflowNetworkNodeData(3).AirLoopNum = 1; AirflowNetwork::AirflowNetworkLinkageData(46).AirLoopNum = 1; - state.dataAirLoop->AirLoopAFNInfo.allocate(1); - // state.dataAirLoop->LoopOnOffFanPartLoadRatio.allocate(1); - state.dataAirLoop->AirLoopAFNInfo(1).LoopFanOperationMode = 0.0; - state.dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio = 0.0; + state->dataAirLoop->AirLoopAFNInfo.allocate(1); + // state->dataAirLoop->LoopOnOffFanPartLoadRatio.allocate(1); + state->dataAirLoop->AirLoopAFNInfo(1).LoopFanOperationMode = 0.0; + state->dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio = 0.0; // Calculate mass flow rate based on pressure setpoint AirflowNetwork::PressureControllerData(1).OANodeNum = AirflowNetwork::DisSysCompReliefAirData(1).OutletNode; - CalcAirflowNetworkAirBalance(state); + CalcAirflowNetworkAirBalance(*state); // Check indoor pressure and mass flow rate EXPECT_NEAR(PressureSet, AirflowNetwork::AirflowNetworkNodeSimu(3).PZ, 0.0001); @@ -2325,21 +2325,21 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) // Start a test for #5687 to report zero values of AirflowNetwork:Distribution airflow and pressure outputs when a system is off AirflowNetwork::AirflowNetworkFanActivated = false; - state.dataAirflowNetworkBalanceManager->exchangeData.allocate(state.dataGlobal->NumOfZones); + state->dataAirflowNetworkBalanceManager->exchangeData.allocate(state->dataGlobal->NumOfZones); - UpdateAirflowNetwork(state); + UpdateAirflowNetwork(*state); EXPECT_NEAR(0.0, AirflowNetwork::AirflowNetworkNodeSimu(10).PZ, 0.0001); EXPECT_NEAR(0.0, AirflowNetwork::AirflowNetworkNodeSimu(20).PZ, 0.0001); - EXPECT_NEAR(0.0, state.dataAirflowNetworkBalanceManager->linkReport(20).FLOW, 0.0001); - EXPECT_NEAR(0.0, state.dataAirflowNetworkBalanceManager->linkReport(50).FLOW, 0.0001); + EXPECT_NEAR(0.0, state->dataAirflowNetworkBalanceManager->linkReport(20).FLOW, 0.0001); + EXPECT_NEAR(0.0, state->dataAirflowNetworkBalanceManager->linkReport(50).FLOW, 0.0001); // Start a test for #6005 AirflowNetwork::ANZT = 26.0; AirflowNetwork::MultizoneSurfaceData(2).HybridVentClose = true; AirflowNetwork::MultizoneSurfaceData(5).HybridVentClose = true; AirflowNetwork::MultizoneSurfaceData(14).HybridVentClose = true; - CalcAirflowNetworkAirBalance(state); + CalcAirflowNetworkAirBalance(*state); EXPECT_EQ(0.0, AirflowNetwork::MultizoneSurfaceData(2).OpenFactor); EXPECT_EQ(0.0, AirflowNetwork::MultizoneSurfaceData(5).OpenFactor); EXPECT_EQ(0.0, AirflowNetwork::MultizoneSurfaceData(14).OpenFactor); @@ -2350,7 +2350,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) // Test for #7162 DataHeatBalFanSys::ZoneAirHumRat.allocate(4); DataHeatBalFanSys::MAT.allocate(4); - DataHeatBalFanSys::ZoneAirHumRatAvg.allocate(state.dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneAirHumRatAvg.allocate(state->dataGlobal->NumOfZones); DataHeatBalFanSys::MAT(1) = 23.0; DataHeatBalFanSys::MAT(2) = 23.0; @@ -2372,7 +2372,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPressureStat) AirflowNetwork::AirflowNetworkLinkSimu(10).FLOW2 = 0.15; AirflowNetwork::AirflowNetworkLinkSimu(13).FLOW2 = 0.1; - ReportAirflowNetwork(state); + ReportAirflowNetwork(*state); // Original results // EXPECT_NEAR(34.3673036, AirflowNetwork::AirflowNetworkReportData(1).MultiZoneInfiLatGainW, 0.0001); @@ -2426,7 +2426,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingSchWithAdaptiveCtrl) SurfaceGeometry::AllocateSurfaceWindows(2); SurfWinOriginalClass(1) = DataSurfaces::SurfaceClass::Window; SurfWinOriginalClass(2) = DataSurfaces::SurfaceClass::Window; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; TotPeople = 1; // Total number of people statements People.allocate(TotPeople); @@ -2484,7 +2484,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingSchWithAdaptiveCtrl) ASSERT_TRUE(process_idf(idf_objects)); - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); // The original value before fix is zero. After the fix, the correct schedule number is assigned. @@ -2850,7 +2850,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestPolygonalWindows) SurfWinOriginalClass(12) = DataSurfaces::SurfaceClass::Window; SurfWinOriginalClass(13) = DataSurfaces::SurfaceClass::Window; SurfWinOriginalClass(14) = DataSurfaces::SurfaceClass::Window; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; std::string const idf_objects = delimited_string({ "Schedule:Constant,OnSch,,1.0;", @@ -3026,7 +3026,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_TestPolygonalWindows) ASSERT_TRUE(process_idf(idf_objects)); - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); // Choice: Height; Base Surface: Vertical Rectangular EXPECT_NEAR(1.0, AirflowNetwork::MultizoneSurfaceData(1).Width, 0.0001); @@ -4415,32 +4415,32 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_UserDefinedDuctViewFactor bool ErrorsFound = false; // Read objects - SimulationManager::GetProjectData(state); - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + SimulationManager::GetProjectData(*state); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(state, ErrorsFound); + HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetHeatBalanceInput(state); - HeatBalanceManager::AllocateHeatBalArrays(state); + HeatBalanceManager::GetHeatBalanceInput(*state); + HeatBalanceManager::AllocateHeatBalArrays(*state); DataEnvironment::OutBaroPress = 101000; - DataHVACGlobals::TimeStepSys = state.dataGlobal->TimeStepZone; - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + DataHVACGlobals::TimeStepSys = state->dataGlobal->TimeStepZone; + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Read AirflowNetwork inputs - GetAirflowNetworkInput(state); - state.dataAirflowNetworkBalanceManager->initialize(state); + GetAirflowNetworkInput(*state); + state->dataAirflowNetworkBalanceManager->initialize(*state); // Check inputs EXPECT_EQ(AirflowNetwork::AirflowNetworkLinkageViewFactorData(1).LinkageName, "ZONESUPPLYLINK1"); @@ -4461,18 +4461,18 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_UserDefinedDuctViewFactor // Outside convection coefficients // Calculate convection resistance given a convection coefficient - EXPECT_NEAR(CalcDuctOutsideConvResist(state, 20, 10, 0.001, 101000, 1, 2, 5), 0.2, tol); - EXPECT_NEAR(CalcDuctOutsideConvResist(state, 20, 10, 0.001, 101000, 1, 2, 20), 0.05, tol); - EXPECT_NEAR(CalcDuctOutsideConvResist(state, 20, 10, 0.001, 101000, 1, 2, 0.1), 10, tol); + EXPECT_NEAR(CalcDuctOutsideConvResist(*state, 20, 10, 0.001, 101000, 1, 2, 5), 0.2, tol); + EXPECT_NEAR(CalcDuctOutsideConvResist(*state, 20, 10, 0.001, 101000, 1, 2, 20), 0.05, tol); + EXPECT_NEAR(CalcDuctOutsideConvResist(*state, 20, 10, 0.001, 101000, 1, 2, 0.1), 10, tol); //// Calculate convection resistance from correlation - EXPECT_NEAR(CalcDuctOutsideConvResist(state, 20, 10, 0.001, 101000, 0.1, 2, 0), 0.2297, tol); - EXPECT_NEAR(CalcDuctOutsideConvResist(state, 20, 10, 0.001, 101000, 1.0, 2, 0), 0.4093, tol); - EXPECT_NEAR(CalcDuctOutsideConvResist(state, 20, 10, 0.001, 101000, 1.5, 2, 0), 0.4531, tol); + EXPECT_NEAR(CalcDuctOutsideConvResist(*state, 20, 10, 0.001, 101000, 0.1, 2, 0), 0.2297, tol); + EXPECT_NEAR(CalcDuctOutsideConvResist(*state, 20, 10, 0.001, 101000, 1.0, 2, 0), 0.4093, tol); + EXPECT_NEAR(CalcDuctOutsideConvResist(*state, 20, 10, 0.001, 101000, 1.5, 2, 0), 0.4531, tol); - EXPECT_NEAR(CalcDuctOutsideConvResist(state, 10, 20, 0.001, 101000, 0.1, 2, 0), 0.2368, tol); - EXPECT_NEAR(CalcDuctOutsideConvResist(state, 10, 20, 0.001, 101000, 1.0, 2, 0), 0.4218, tol); - EXPECT_NEAR(CalcDuctOutsideConvResist(state, 10, 20, 0.001, 101000, 1.5, 2, 0), 0.4670, tol); + EXPECT_NEAR(CalcDuctOutsideConvResist(*state, 10, 20, 0.001, 101000, 0.1, 2, 0), 0.2368, tol); + EXPECT_NEAR(CalcDuctOutsideConvResist(*state, 10, 20, 0.001, 101000, 1.0, 2, 0), 0.4218, tol); + EXPECT_NEAR(CalcDuctOutsideConvResist(*state, 10, 20, 0.001, 101000, 1.5, 2, 0), 0.4670, tol); // Calculate convection resistance given a convection coefficient EXPECT_NEAR(CalcDuctInsideConvResist(20, 0.1, 1, 5), 0.2, tol); @@ -4491,14 +4491,14 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_AirThermConductivity) Real64 const tol = 0.00001; - EXPECT_NEAR(AirflowNetwork::airThermConductivity(state, -30), 0.02212, tol); - EXPECT_NEAR(AirflowNetwork::airThermConductivity(state, -20), 0.02212, tol); - EXPECT_NEAR(AirflowNetwork::airThermConductivity(state, 0), 0.02364, tol); - EXPECT_NEAR(AirflowNetwork::airThermConductivity(state, 20), 0.02514, tol); - EXPECT_NEAR(AirflowNetwork::airThermConductivity(state, 40), 0.02662, tol); - EXPECT_NEAR(AirflowNetwork::airThermConductivity(state, 60), 0.02808, tol); - EXPECT_NEAR(AirflowNetwork::airThermConductivity(state, 70), 0.02881, tol); - EXPECT_NEAR(AirflowNetwork::airThermConductivity(state, 80), 0.02881, tol); + EXPECT_NEAR(AirflowNetwork::airThermConductivity(*state, -30), 0.02212, tol); + EXPECT_NEAR(AirflowNetwork::airThermConductivity(*state, -20), 0.02212, tol); + EXPECT_NEAR(AirflowNetwork::airThermConductivity(*state, 0), 0.02364, tol); + EXPECT_NEAR(AirflowNetwork::airThermConductivity(*state, 20), 0.02514, tol); + EXPECT_NEAR(AirflowNetwork::airThermConductivity(*state, 40), 0.02662, tol); + EXPECT_NEAR(AirflowNetwork::airThermConductivity(*state, 60), 0.02808, tol); + EXPECT_NEAR(AirflowNetwork::airThermConductivity(*state, 70), 0.02881, tol); + EXPECT_NEAR(AirflowNetwork::airThermConductivity(*state, 80), 0.02881, tol); } TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_AirDynamicVisc) @@ -4521,14 +4521,14 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_AirKinematicVisc) Real64 const tol = 0.000001; - EXPECT_NEAR(AirflowNetwork::airKinematicVisc(state, -30, 0.001, 101000), 1.169e-5, tol); - EXPECT_NEAR(AirflowNetwork::airKinematicVisc(state, -20, 0.001, 101000), 1.169e-5, tol); - EXPECT_NEAR(AirflowNetwork::airKinematicVisc(state, 0, 0.001, 101000), 1.338e-5, tol); - EXPECT_NEAR(AirflowNetwork::airKinematicVisc(state, 20, 0.001, 101000), 1.516e-5, tol); - EXPECT_NEAR(AirflowNetwork::airKinematicVisc(state, 40, 0.001, 101000), 1.702e-5, tol); - EXPECT_NEAR(AirflowNetwork::airKinematicVisc(state, 60, 0.001, 101000), 1.896e-5, tol); - EXPECT_NEAR(AirflowNetwork::airKinematicVisc(state, 70, 0.001, 101000), 1.995e-5, tol); - EXPECT_NEAR(AirflowNetwork::airKinematicVisc(state, 80, 0.001, 101000), 1.995e-5, tol); + EXPECT_NEAR(AirflowNetwork::airKinematicVisc(*state, -30, 0.001, 101000), 1.169e-5, tol); + EXPECT_NEAR(AirflowNetwork::airKinematicVisc(*state, -20, 0.001, 101000), 1.169e-5, tol); + EXPECT_NEAR(AirflowNetwork::airKinematicVisc(*state, 0, 0.001, 101000), 1.338e-5, tol); + EXPECT_NEAR(AirflowNetwork::airKinematicVisc(*state, 20, 0.001, 101000), 1.516e-5, tol); + EXPECT_NEAR(AirflowNetwork::airKinematicVisc(*state, 40, 0.001, 101000), 1.702e-5, tol); + EXPECT_NEAR(AirflowNetwork::airKinematicVisc(*state, 60, 0.001, 101000), 1.896e-5, tol); + EXPECT_NEAR(AirflowNetwork::airKinematicVisc(*state, 70, 0.001, 101000), 1.995e-5, tol); + EXPECT_NEAR(AirflowNetwork::airKinematicVisc(*state, 80, 0.001, 101000), 1.995e-5, tol); } TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_AirThermalDiffusivity) @@ -4536,14 +4536,14 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_AirThermalDiffusivity) Real64 const tol = 0.000001; - EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(state, -30, 0.001, 101000), 1.578e-5, tol); - EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(state, -20, 0.001, 101000), 1.578e-5, tol); - EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(state, 0, 0.001, 101000), 1.818e-5, tol); - EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(state, 20, 0.001, 101000), 2.074e-5, tol); - EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(state, 40, 0.001, 101000), 2.346e-5, tol); - EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(state, 60, 0.001, 101000), 2.632e-5, tol); - EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(state, 70, 0.001, 101000), 2.780e-5, tol); - EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(state, 80, 0.001, 101000), 2.780e-5, tol); + EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(*state, -30, 0.001, 101000), 1.578e-5, tol); + EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(*state, -20, 0.001, 101000), 1.578e-5, tol); + EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(*state, 0, 0.001, 101000), 1.818e-5, tol); + EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(*state, 20, 0.001, 101000), 2.074e-5, tol); + EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(*state, 40, 0.001, 101000), 2.346e-5, tol); + EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(*state, 60, 0.001, 101000), 2.632e-5, tol); + EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(*state, 70, 0.001, 101000), 2.780e-5, tol); + EXPECT_NEAR(AirflowNetwork::airThermalDiffusivity(*state, 80, 0.001, 101000), 2.780e-5, tol); } TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_AirPrandtl) @@ -4551,14 +4551,14 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_AirPrandtl) Real64 const tol = 0.0001; - EXPECT_NEAR(AirflowNetwork::airPrandtl(state, -30, 0.001, 101000), 0.7362, tol); - EXPECT_NEAR(AirflowNetwork::airPrandtl(state, -20, 0.001, 101000), 0.7362, tol); - EXPECT_NEAR(AirflowNetwork::airPrandtl(state, 0, 0.001, 101000), 0.7300, tol); - EXPECT_NEAR(AirflowNetwork::airPrandtl(state, 20, 0.001, 101000), 0.7251, tol); - EXPECT_NEAR(AirflowNetwork::airPrandtl(state, 40, 0.001, 101000), 0.7213, tol); - EXPECT_NEAR(AirflowNetwork::airPrandtl(state, 60, 0.001, 101000), 0.7184, tol); - EXPECT_NEAR(AirflowNetwork::airPrandtl(state, 70, 0.001, 101000), 0.7172, tol); - EXPECT_NEAR(AirflowNetwork::airPrandtl(state, 80, 0.001, 101000), 0.7172, tol); + EXPECT_NEAR(AirflowNetwork::airPrandtl(*state, -30, 0.001, 101000), 0.7362, tol); + EXPECT_NEAR(AirflowNetwork::airPrandtl(*state, -20, 0.001, 101000), 0.7362, tol); + EXPECT_NEAR(AirflowNetwork::airPrandtl(*state, 0, 0.001, 101000), 0.7300, tol); + EXPECT_NEAR(AirflowNetwork::airPrandtl(*state, 20, 0.001, 101000), 0.7251, tol); + EXPECT_NEAR(AirflowNetwork::airPrandtl(*state, 40, 0.001, 101000), 0.7213, tol); + EXPECT_NEAR(AirflowNetwork::airPrandtl(*state, 60, 0.001, 101000), 0.7184, tol); + EXPECT_NEAR(AirflowNetwork::airPrandtl(*state, 70, 0.001, 101000), 0.7172, tol); + EXPECT_NEAR(AirflowNetwork::airPrandtl(*state, 80, 0.001, 101000), 0.7172, tol); } TEST_F(EnergyPlusFixture, AirflowNetwork_TestWindPressureTable) @@ -4620,18 +4620,18 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestWindPressureTable) // Load and verify the table ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_EQ(0, state.dataCurveManager->NumCurves); - CurveManager::GetCurveInput(state); - state.dataCurveManager->GetCurvesInputFlag = false; - ASSERT_EQ(1, state.dataCurveManager->NumCurves); - EXPECT_EQ(1, state.dataCurveManager->PerfCurve(1).NumDims); - EXPECT_EQ("EFACADE_WPCCURVE", CurveManager::GetCurveName(state, 1)); - EXPECT_EQ(1, CurveManager::GetCurveIndex(state, "EFACADE_WPCCURVE")); - EXPECT_EQ("Table:Lookup", state.dataCurveManager->PerfCurve(1).ObjectType); - EXPECT_DOUBLE_EQ(-0.56, CurveManager::CurveValue(state, 1, 0.0)); // In-range value - EXPECT_DOUBLE_EQ(0.54, CurveManager::CurveValue(state, 1, 105.0)); // In-range value - EXPECT_DOUBLE_EQ(-0.56, CurveManager::CurveValue(state, 1, -10.0)); // Minimum x - EXPECT_DOUBLE_EQ(-0.56, CurveManager::CurveValue(state, 1, 5000)); // Maximum x + EXPECT_EQ(0, state->dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + ASSERT_EQ(1, state->dataCurveManager->NumCurves); + EXPECT_EQ(1, state->dataCurveManager->PerfCurve(1).NumDims); + EXPECT_EQ("EFACADE_WPCCURVE", CurveManager::GetCurveName(*state, 1)); + EXPECT_EQ(1, CurveManager::GetCurveIndex(*state, "EFACADE_WPCCURVE")); + EXPECT_EQ("Table:Lookup", state->dataCurveManager->PerfCurve(1).ObjectType); + EXPECT_DOUBLE_EQ(-0.56, CurveManager::CurveValue(*state, 1, 0.0)); // In-range value + EXPECT_DOUBLE_EQ(0.54, CurveManager::CurveValue(*state, 1, 105.0)); // In-range value + EXPECT_DOUBLE_EQ(-0.56, CurveManager::CurveValue(*state, 1, -10.0)); // Minimum x + EXPECT_DOUBLE_EQ(-0.56, CurveManager::CurveValue(*state, 1, 5000)); // Maximum x EXPECT_FALSE(has_err_output()); // Set up some environmental parameters @@ -4642,7 +4642,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestWindPressureTable) DataEnvironment::SiteTempGradient = 0.0; // Disconnect z from testing // Make sure we can compute the right density - Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); + Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(1.1841123742118911, rho); // CalcWindPressure(MultizoneExternalNodeData(i).curve, 1 // Vref, 1 @@ -4651,19 +4651,19 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestWindPressureTable) // MultizoneExternalNodeData(i).symmetricCurve, MultizoneExternalNodeData(i).useRelativeAngle); // Compute wind pressure with current defaults Real64 windSpeed = 1.0; - Real64 dryBulb = DataEnvironment::OutDryBulbTempAt(state, 10.0); + Real64 dryBulb = DataEnvironment::OutDryBulbTempAt(*state, 10.0); Real64 azimuth = 0.0; Real64 windDir = DataEnvironment::WindDir; Real64 humRat = DataEnvironment::OutHumRat; - Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(state, 1, false, false, azimuth, windSpeed, windDir, dryBulb, humRat); + Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(*state, 1, false, false, azimuth, windSpeed, windDir, dryBulb, humRat); EXPECT_DOUBLE_EQ(0.54 * 0.5 * 1.1841123742118911, p); // Test on an east wall, which has a relative angle of 15 (for wind direction 105) azimuth = 90.0; - p = AirflowNetworkBalanceManager::CalcWindPressure(state, 1, false, true, azimuth, windSpeed, windDir, dryBulb, humRat); + p = AirflowNetworkBalanceManager::CalcWindPressure(*state, 1, false, true, azimuth, windSpeed, windDir, dryBulb, humRat); EXPECT_DOUBLE_EQ(-0.26 * 0.5 * 1.1841123742118911, p); // Test on a wall with azimuth 105, for a zero relative angle azimuth = 105.0; - p = AirflowNetworkBalanceManager::CalcWindPressure(state, 1, false, true, azimuth, windSpeed, windDir, dryBulb, humRat); + p = AirflowNetworkBalanceManager::CalcWindPressure(*state, 1, false, true, azimuth, windSpeed, windDir, dryBulb, humRat); EXPECT_DOUBLE_EQ(-0.56 * 0.5 * 1.1841123742118911, p); } @@ -4702,18 +4702,18 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestWPCValue) // Load and verify the table ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_EQ(0, state.dataCurveManager->NumCurves); - CurveManager::GetCurveInput(state); - state.dataCurveManager->GetCurvesInputFlag = false; - ASSERT_EQ(1, state.dataCurveManager->NumCurves); - EXPECT_EQ(1, state.dataCurveManager->PerfCurve(1).NumDims); - EXPECT_EQ("NFACADE_WPCVALUE", CurveManager::GetCurveName(state, 1)); - EXPECT_EQ(1, CurveManager::GetCurveIndex(state, "NFACADE_WPCVALUE")); - EXPECT_EQ("AirflowNetwork:MultiZone:WindPressureCoefficientValues", state.dataCurveManager->PerfCurve(1).ObjectType); - EXPECT_DOUBLE_EQ(0.6, CurveManager::CurveValue(state, 1, 0.0)); // In-range value - EXPECT_DOUBLE_EQ(-0.56, CurveManager::CurveValue(state, 1, 105.0)); // In-range value - EXPECT_DOUBLE_EQ(0.6, CurveManager::CurveValue(state, 1, -10.0)); // Minimum x - EXPECT_DOUBLE_EQ(0.6, CurveManager::CurveValue(state, 1, 5000)); // Maximum x + EXPECT_EQ(0, state->dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + ASSERT_EQ(1, state->dataCurveManager->NumCurves); + EXPECT_EQ(1, state->dataCurveManager->PerfCurve(1).NumDims); + EXPECT_EQ("NFACADE_WPCVALUE", CurveManager::GetCurveName(*state, 1)); + EXPECT_EQ(1, CurveManager::GetCurveIndex(*state, "NFACADE_WPCVALUE")); + EXPECT_EQ("AirflowNetwork:MultiZone:WindPressureCoefficientValues", state->dataCurveManager->PerfCurve(1).ObjectType); + EXPECT_DOUBLE_EQ(0.6, CurveManager::CurveValue(*state, 1, 0.0)); // In-range value + EXPECT_DOUBLE_EQ(-0.56, CurveManager::CurveValue(*state, 1, 105.0)); // In-range value + EXPECT_DOUBLE_EQ(0.6, CurveManager::CurveValue(*state, 1, -10.0)); // Minimum x + EXPECT_DOUBLE_EQ(0.6, CurveManager::CurveValue(*state, 1, 5000)); // Maximum x EXPECT_FALSE(has_err_output()); // Set up some environmental parameters @@ -4724,25 +4724,25 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestWPCValue) DataEnvironment::SiteTempGradient = 0.0; // Disconnect z from testing Real64 windSpeed = 1.0; - Real64 dryBulb = DataEnvironment::OutDryBulbTempAt(state, 10.0); + Real64 dryBulb = DataEnvironment::OutDryBulbTempAt(*state, 10.0); Real64 azimuth = 0.0; Real64 windDir = DataEnvironment::WindDir; Real64 humRat = DataEnvironment::OutHumRat; // Make sure we can compute the right density - Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); + Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(1.1841123742118911, rho); // Compute wind pressure with current defaults - Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(state, 1, false, false, azimuth, windSpeed, windDir, dryBulb, humRat); + Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(*state, 1, false, false, azimuth, windSpeed, windDir, dryBulb, humRat); EXPECT_DOUBLE_EQ(-0.56 * 0.5 * 1.1841123742118911, p); // Test on an east wall, which has a relative angle of 15 (for wind direction 105) azimuth = 90.0; - p = AirflowNetworkBalanceManager::CalcWindPressure(state, 1, false, true, azimuth, windSpeed, windDir, dryBulb, humRat); + p = AirflowNetworkBalanceManager::CalcWindPressure(*state, 1, false, true, azimuth, windSpeed, windDir, dryBulb, humRat); EXPECT_DOUBLE_EQ(0.54 * 0.5 * 1.1841123742118911, p); // Test on a wall with azimuth 105, for a zero relative angle azimuth = 105.0; - p = AirflowNetworkBalanceManager::CalcWindPressure(state, 1, false, true, azimuth, windSpeed, windDir, dryBulb, humRat); + p = AirflowNetworkBalanceManager::CalcWindPressure(*state, 1, false, true, azimuth, windSpeed, windDir, dryBulb, humRat); EXPECT_DOUBLE_EQ(0.6 * 0.5 * 1.1841123742118911, p); } @@ -5691,27 +5691,27 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodes) bool errors = false; - HeatBalanceManager::GetMaterialData(state, errors); // read material data + HeatBalanceManager::GetMaterialData(*state, errors); // read material data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetConstructData(state, errors); // read construction data + HeatBalanceManager::GetConstructData(*state, errors); // read construction data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetZoneData(state, errors); // read zone data + HeatBalanceManager::GetZoneData(*state, errors); // read zone data EXPECT_FALSE(errors); // expect no errors // Magic to get surfaces read in correctly DataHeatBalance::AnyCTF = true; - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, errors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, errors); // setup zone geometry and get zone data EXPECT_FALSE(errors); // expect no errors - CurveManager::GetCurveInput(state); - EXPECT_EQ(state.dataCurveManager->NumCurves, 2); + CurveManager::GetCurveInput(*state); + EXPECT_EQ(state->dataCurveManager->NumCurves, 2); - AirflowNetworkBalanceManager::GetAirflowNetworkInput(state); + AirflowNetworkBalanceManager::GetAirflowNetworkInput(*state); // Check the airflow elements EXPECT_EQ(2u, AirflowNetwork::MultizoneExternalNodeData.size()); @@ -5739,15 +5739,15 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodes) DataEnvironment::WindSpeed = 10.0; // Make sure we can compute the right wind pressure - Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); + Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(1.1841123742118911, rho); - Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(state, AirflowNetwork::MultizoneExternalNodeData(1).curve, + Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(*state, AirflowNetwork::MultizoneExternalNodeData(1).curve, false, false, 0.0, 1.0, DataEnvironment::WindDir, - DataEnvironment::OutDryBulbTempAt(state, 10.0), + DataEnvironment::OutDryBulbTempAt(*state, 10.0), DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(-0.56 * 0.5 * 1.1841123742118911, p); @@ -5757,7 +5757,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodes) EXPECT_EQ(5u, AirflowNetwork::AirflowNetworkNodeSimu.size()); // Run the balance routine, for now only to get the pressure set at the external nodes - AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(state); + AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(*state); EXPECT_DOUBLE_EQ(-0.56 * 0.5 * 118.41123742118911, AirflowNetwork::AirflowNetworkNodeSimu(4).PZ); EXPECT_DOUBLE_EQ(-0.26 * 0.5 * 118.41123742118911, AirflowNetwork::AirflowNetworkNodeSimu(5).PZ); @@ -6395,27 +6395,27 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithTables) bool errors = false; - HeatBalanceManager::GetMaterialData(state, errors); // read material data + HeatBalanceManager::GetMaterialData(*state, errors); // read material data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetConstructData(state, errors); // read construction data + HeatBalanceManager::GetConstructData(*state, errors); // read construction data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetZoneData(state, errors); // read zone data + HeatBalanceManager::GetZoneData(*state, errors); // read zone data EXPECT_FALSE(errors); // expect no errors // Magic to get surfaces read in correctly DataHeatBalance::AnyCTF = true; - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, errors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, errors); // setup zone geometry and get zone data EXPECT_FALSE(errors); // expect no errors - CurveManager::GetCurveInput(state); - EXPECT_EQ(state.dataCurveManager->NumCurves, 2); + CurveManager::GetCurveInput(*state); + EXPECT_EQ(state->dataCurveManager->NumCurves, 2); - AirflowNetworkBalanceManager::GetAirflowNetworkInput(state); + AirflowNetworkBalanceManager::GetAirflowNetworkInput(*state); // Check the airflow elements EXPECT_EQ(2u, AirflowNetwork::MultizoneExternalNodeData.size()); @@ -6443,15 +6443,15 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithTables) DataEnvironment::WindSpeed = 10.0; // Make sure we can compute the right wind pressure - Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); + Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(1.1841123742118911, rho); - Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(state, AirflowNetwork::MultizoneExternalNodeData(1).curve, + Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(*state, AirflowNetwork::MultizoneExternalNodeData(1).curve, false, false, 0.0, 1.0, DataEnvironment::WindDir, - DataEnvironment::OutDryBulbTempAt(state, 10.0), + DataEnvironment::OutDryBulbTempAt(*state, 10.0), DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(-0.56 * 0.5 * 1.1841123742118911, p); @@ -6461,7 +6461,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithTables) EXPECT_EQ(5u, AirflowNetwork::AirflowNetworkNodeSimu.size()); // Run the balance routine, for now only to get the pressure set at the external nodes - AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(state); + AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(*state); EXPECT_DOUBLE_EQ(-0.56 * 0.5 * 118.41123742118911, AirflowNetwork::AirflowNetworkNodeSimu(4).PZ); EXPECT_DOUBLE_EQ(-0.26 * 0.5 * 118.41123742118911, AirflowNetwork::AirflowNetworkNodeSimu(5).PZ); @@ -7018,39 +7018,39 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithNoInput) bool errors = false; - HeatBalanceManager::GetMaterialData(state, errors); // read material data + HeatBalanceManager::GetMaterialData(*state, errors); // read material data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetConstructData(state, errors); // read construction data + HeatBalanceManager::GetConstructData(*state, errors); // read construction data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetZoneData(state, errors); // read zone data + HeatBalanceManager::GetZoneData(*state, errors); // read zone data EXPECT_FALSE(errors); // expect no errors // Magic to get surfaces read in correctly DataHeatBalance::AnyCTF = true; - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, errors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, errors); // setup zone geometry and get zone data EXPECT_FALSE(errors); // expect no errors - CurveManager::GetCurveInput(state); - EXPECT_EQ(state.dataCurveManager->NumCurves, 1); + CurveManager::GetCurveInput(*state); + EXPECT_EQ(state->dataCurveManager->NumCurves, 1); - AirflowNetworkBalanceManager::GetAirflowNetworkInput(state); + AirflowNetworkBalanceManager::GetAirflowNetworkInput(*state); - EXPECT_EQ(state.dataCurveManager->NumCurves, 6); + EXPECT_EQ(state->dataCurveManager->NumCurves, 6); // Check the curves Real64 cp105N = -0.5 * (0.44267457181949038 + 0.68051108580039887); Real64 cp105S = 0.5 * (0.11880548415819636 - 0.44267457181949038); - EXPECT_DOUBLE_EQ(0.60345944298105458, CurveManager::CurveValue(state, 2, 0)); // In-range value - EXPECT_DOUBLE_EQ(cp105N, CurveManager::CurveValue(state, 2, 105)); // In-range value - EXPECT_DOUBLE_EQ(0.60345944298105458, CurveManager::CurveValue(state, 2, -10.0)); // Minimum x - EXPECT_DOUBLE_EQ(0.60345944298105458, CurveManager::CurveValue(state, 2, 5000)); // Maximum x + EXPECT_DOUBLE_EQ(0.60345944298105458, CurveManager::CurveValue(*state, 2, 0)); // In-range value + EXPECT_DOUBLE_EQ(cp105N, CurveManager::CurveValue(*state, 2, 105)); // In-range value + EXPECT_DOUBLE_EQ(0.60345944298105458, CurveManager::CurveValue(*state, 2, -10.0)); // Minimum x + EXPECT_DOUBLE_EQ(0.60345944298105458, CurveManager::CurveValue(*state, 2, 5000)); // Maximum x // Check the other curve - EXPECT_DOUBLE_EQ(0.592, CurveManager::CurveValue(state, 1, 0)); // In-range value + EXPECT_DOUBLE_EQ(0.592, CurveManager::CurveValue(*state, 1, 0)); // In-range value // Check the airflow elements EXPECT_EQ(2u, AirflowNetwork::MultizoneExternalNodeData.size()); @@ -7078,24 +7078,24 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithNoInput) DataEnvironment::WindSpeed = 10.0; // Make sure we can compute the right wind pressure - Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); + Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(1.1841123742118911, rho); - Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(state, AirflowNetwork::MultizoneExternalNodeData(2).curve, + Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(*state, AirflowNetwork::MultizoneExternalNodeData(2).curve, false, false, 0.0, 1.0, DataEnvironment::WindDir, - DataEnvironment::OutDryBulbTempAt(state, 10.0), + DataEnvironment::OutDryBulbTempAt(*state, 10.0), DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(cp105N * 0.5 * 1.1841123742118911, p); - p = AirflowNetworkBalanceManager::CalcWindPressure(state, AirflowNetwork::MultizoneExternalNodeData(1).curve, + p = AirflowNetworkBalanceManager::CalcWindPressure(*state, AirflowNetwork::MultizoneExternalNodeData(1).curve, false, false, 0.0, 1.0, DataEnvironment::WindDir, - DataEnvironment::OutDryBulbTempAt(state, 10.0), + DataEnvironment::OutDryBulbTempAt(*state, 10.0), DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(cp105S * 0.5 * 1.1841123742118911, p); @@ -7105,7 +7105,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithNoInput) EXPECT_EQ(5u, AirflowNetwork::AirflowNetworkNodeSimu.size()); // Run the balance routine, for now only to get the pressure set at the external nodes - AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(state); + AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(*state); EXPECT_DOUBLE_EQ(cp105N * 0.5 * 118.41123742118911, AirflowNetwork::AirflowNetworkNodeSimu(5).PZ); EXPECT_DOUBLE_EQ(cp105S * 0.5 * 118.41123742118911, AirflowNetwork::AirflowNetworkNodeSimu(4).PZ); @@ -7707,27 +7707,27 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithSymmetricTable) bool errors = false; - HeatBalanceManager::GetMaterialData(state, errors); // read material data + HeatBalanceManager::GetMaterialData(*state, errors); // read material data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetConstructData(state, errors); // read construction data + HeatBalanceManager::GetConstructData(*state, errors); // read construction data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetZoneData(state, errors); // read zone data + HeatBalanceManager::GetZoneData(*state, errors); // read zone data EXPECT_FALSE(errors); // expect no errors // Magic to get surfaces read in correctly DataHeatBalance::AnyCTF = true; - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, errors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, errors); // setup zone geometry and get zone data EXPECT_FALSE(errors); // expect no errors - CurveManager::GetCurveInput(state); - EXPECT_EQ(state.dataCurveManager->NumCurves, 1); + CurveManager::GetCurveInput(*state); + EXPECT_EQ(state->dataCurveManager->NumCurves, 1); - AirflowNetworkBalanceManager::GetAirflowNetworkInput(state); + AirflowNetworkBalanceManager::GetAirflowNetworkInput(*state); // Check the airflow elements EXPECT_EQ(2u, AirflowNetwork::MultizoneExternalNodeData.size()); @@ -7755,15 +7755,15 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithSymmetricTable) DataEnvironment::WindSpeed = 10.0; // Make sure we can compute the right wind pressure - Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); + Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(1.1841123742118911, rho); - Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(state, AirflowNetwork::MultizoneExternalNodeData(1).curve, + Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(*state, AirflowNetwork::MultizoneExternalNodeData(1).curve, false, false, 0.0, 1.0, DataEnvironment::WindDir, - DataEnvironment::OutDryBulbTempAt(state, 10.0), + DataEnvironment::OutDryBulbTempAt(*state, 10.0), DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(-0.56 * 0.5 * 1.1841123742118911, p); @@ -7773,7 +7773,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithSymmetricTable) EXPECT_EQ(5u, AirflowNetwork::AirflowNetworkNodeSimu.size()); // Run the balance routine, for now only to get the pressure set at the external nodes - AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(state); + AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(*state); EXPECT_DOUBLE_EQ(-0.56 * 0.5 * 118.41123742118911, AirflowNetwork::AirflowNetworkNodeSimu(4).PZ); EXPECT_DOUBLE_EQ(-0.26 * 0.5 * 118.41123742118911, AirflowNetwork::AirflowNetworkNodeSimu(5).PZ); @@ -8341,27 +8341,27 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithSymmetricCurve) bool errors = false; - HeatBalanceManager::GetMaterialData(state, errors); // read material data + HeatBalanceManager::GetMaterialData(*state, errors); // read material data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetConstructData(state, errors); // read construction data + HeatBalanceManager::GetConstructData(*state, errors); // read construction data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetZoneData(state, errors); // read zone data + HeatBalanceManager::GetZoneData(*state, errors); // read zone data EXPECT_FALSE(errors); // expect no errors // Magic to get surfaces read in correctly DataHeatBalance::AnyCTF = true; - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, errors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, errors); // setup zone geometry and get zone data EXPECT_FALSE(errors); // expect no errors - CurveManager::GetCurveInput(state); - EXPECT_EQ(state.dataCurveManager->NumCurves, 1); + CurveManager::GetCurveInput(*state); + EXPECT_EQ(state->dataCurveManager->NumCurves, 1); - AirflowNetworkBalanceManager::GetAirflowNetworkInput(state); + AirflowNetworkBalanceManager::GetAirflowNetworkInput(*state); // Check the airflow elements EXPECT_EQ(2u, AirflowNetwork::MultizoneExternalNodeData.size()); @@ -8382,11 +8382,11 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithSymmetricCurve) // Check the curves Real64 cp105N = -0.590653062499999; Real64 cp105S = -0.298039062499999; - EXPECT_DOUBLE_EQ(0.592, CurveManager::CurveValue(state, 1, 0)); // In-range value - EXPECT_NEAR(cp105N, CurveManager::CurveValue(state, 1, 105), 1e-14); // In-range value - EXPECT_NEAR(cp105S, CurveManager::CurveValue(state, 1, 75), 1e-14); // In-range value - EXPECT_DOUBLE_EQ(0.592, CurveManager::CurveValue(state, 1, -10.0)); // Minimum x - EXPECT_NEAR(-0.403903999999994, CurveManager::CurveValue(state, 1, 5000), 1e-14); // Maximum x + EXPECT_DOUBLE_EQ(0.592, CurveManager::CurveValue(*state, 1, 0)); // In-range value + EXPECT_NEAR(cp105N, CurveManager::CurveValue(*state, 1, 105), 1e-14); // In-range value + EXPECT_NEAR(cp105S, CurveManager::CurveValue(*state, 1, 75), 1e-14); // In-range value + EXPECT_DOUBLE_EQ(0.592, CurveManager::CurveValue(*state, 1, -10.0)); // Minimum x + EXPECT_NEAR(-0.403903999999994, CurveManager::CurveValue(*state, 1, 5000), 1e-14); // Maximum x // Set up some environmental parameters DataEnvironment::OutBaroPress = 101325.0; @@ -8398,15 +8398,15 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithSymmetricCurve) DataEnvironment::WindSpeed = 10.0; // Make sure we can compute the right wind pressure - Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); + Real64 rho = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(1.1841123742118911, rho); - Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(state, AirflowNetwork::MultizoneExternalNodeData(1).curve, + Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(*state, AirflowNetwork::MultizoneExternalNodeData(1).curve, false, false, 0.0, 1.0, DataEnvironment::WindDir, - DataEnvironment::OutDryBulbTempAt(state, 10.0), + DataEnvironment::OutDryBulbTempAt(*state, 10.0), DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(cp105N * 0.5 * 1.1841123742118911, p); @@ -8416,7 +8416,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithSymmetricCurve) EXPECT_EQ(5u, AirflowNetwork::AirflowNetworkNodeSimu.size()); // Run the balance routine, for now only to get the pressure set at the external nodes - AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(state); + AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(*state); EXPECT_NEAR(cp105N * 0.5 * 118.41123742118911, AirflowNetwork::AirflowNetworkNodeSimu(4).PZ, 1e-13); EXPECT_NEAR(cp105S * 0.5 * 118.41123742118911, AirflowNetwork::AirflowNetworkNodeSimu(5).PZ, 1e-13); @@ -9067,36 +9067,36 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithLocalAirNode) bool ErrorsFound = false; // Read objects - SimulationManager::GetProjectData(state); - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + SimulationManager::GetProjectData(*state); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(state, ErrorsFound); + HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetHeatBalanceInput(state); - HeatBalanceManager::AllocateHeatBalArrays(state); - DataHVACGlobals::TimeStepSys = state.dataGlobal->TimeStepZone; - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + HeatBalanceManager::GetHeatBalanceInput(*state); + HeatBalanceManager::AllocateHeatBalArrays(*state); + DataHVACGlobals::TimeStepSys = state->dataGlobal->TimeStepZone; + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Magic to get surfaces read in correctly DataHeatBalance::AnyCTF = true; - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, errors); // setup zone geometry and get zone data + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::GetSurfaceData(*state, errors); // setup zone geometry and get zone data EXPECT_FALSE(errors); // expect no errors - CurveManager::GetCurveInput(state); - EXPECT_EQ(state.dataCurveManager->NumCurves, 2); + CurveManager::GetCurveInput(*state); + EXPECT_EQ(state->dataCurveManager->NumCurves, 2); - state.dataGlobal->AnyLocalEnvironmentsInModel = true; - OutAirNodeManager::SetOutAirNodes(state); - GetAirflowNetworkInput(state); + state->dataGlobal->AnyLocalEnvironmentsInModel = true; + OutAirNodeManager::SetOutAirNodes(*state); + GetAirflowNetworkInput(*state); // Issue 7656 std::string const error_string = delimited_string({ " ** Warning ** No Timestep object found. Number of TimeSteps in Hour defaulted to 4.", @@ -9104,7 +9104,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithLocalAirNode) " ** ~~~ ** For explicit details on each unused construction, use Output:Diagnostics,DisplayExtraWarnings;", }); EXPECT_TRUE(compare_err_stream(error_string, true)); - state.dataAirflowNetworkBalanceManager->initialize(state); + state->dataAirflowNetworkBalanceManager->initialize(*state); // Check the airflow elements EXPECT_EQ(2u, AirflowNetwork::MultizoneExternalNodeData.size()); @@ -9126,12 +9126,12 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithLocalAirNode) Node(1).OutAirWindSpeed = 1.0; Node(1).OutAirDryBulb = 15.0; Real64 rho_1 = - Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, DataLoopNode::Node(1).OutAirDryBulb, DataLoopNode::Node(1).HumRat); - Real64 rho_2 = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); + Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, DataLoopNode::Node(1).OutAirDryBulb, DataLoopNode::Node(1).HumRat); + Real64 rho_2 = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat); EXPECT_DOUBLE_EQ(1.2252059842834473, rho_1); EXPECT_DOUBLE_EQ(1.1841123742118911, rho_2); - Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(state, AirflowNetwork::MultizoneExternalNodeData(1).curve, + Real64 p = AirflowNetworkBalanceManager::CalcWindPressure(*state, AirflowNetwork::MultizoneExternalNodeData(1).curve, false, false, 0.0, @@ -9143,7 +9143,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestExternalNodesWithLocalAirNode) // Run the balance routine, for now only to get the pressure set at the external nodes - AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(state); + AirflowNetworkBalanceManager::CalcAirflowNetworkAirBalance(*state); // Make sure we set the right temperature EXPECT_DOUBLE_EQ(25.0, AirflowNetwork::AirflowNetworkNodeSimu(4).TZ); EXPECT_DOUBLE_EQ(15.0, AirflowNetwork::AirflowNetworkNodeSimu(5).TZ); @@ -9549,30 +9549,30 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_BasicAdvancedSingleSided) bool errors = false; - HeatBalanceManager::GetMaterialData(state, errors); // read material data + HeatBalanceManager::GetMaterialData(*state, errors); // read material data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetConstructData(state, errors); // read construction data + HeatBalanceManager::GetConstructData(*state, errors); // read construction data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetZoneData(state, errors); // read zone data + HeatBalanceManager::GetZoneData(*state, errors); // read zone data EXPECT_FALSE(errors); // expect no errors // Magic to get surfaces read in correctly DataHeatBalance::AnyCTF = true; - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, errors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, errors); // setup zone geometry and get zone data EXPECT_FALSE(errors); // expect no errors - CurveManager::GetCurveInput(state); - EXPECT_EQ(0, state.dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); - AirflowNetworkBalanceManager::GetAirflowNetworkInput(state); + AirflowNetworkBalanceManager::GetAirflowNetworkInput(*state); // Check that the correct number of curves has been generated (5 facade directions + 2 windows) - EXPECT_EQ(7, state.dataCurveManager->NumCurves); + EXPECT_EQ(7, state->dataCurveManager->NumCurves); // Check the airflow elements ASSERT_EQ(3u, AirflowNetwork::MultizoneExternalNodeData.size()); @@ -9588,14 +9588,14 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_BasicAdvancedSingleSided) // Check the curve values for the left window, taken from v8.6.0 on Windows for (unsigned i = 0; i <= 36; i++) { Real64 angle = i * 10.0; - Real64 value = CurveManager::CurveValue(state, 7, angle); + Real64 value = CurveManager::CurveValue(*state, 7, angle); EXPECT_NEAR(valsForLeftWindow[i], value, 1.0e-12) << ("Issue at index: " + std::to_string(i)); } // Check the curve values for the left window, taken from v8.6.0 on Windows for (unsigned i = 0; i <= 36; i++) { Real64 angle = i * 10.0; - Real64 value = CurveManager::CurveValue(state, 6, angle); + Real64 value = CurveManager::CurveValue(*state, 6, angle); EXPECT_NEAR(valsForRightWindow[i], value, 1.0e-12) << ("Issue at index: " + std::to_string(i)); } } @@ -13093,26 +13093,26 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(state, ErrorsFound); + HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Read AirflowNetwork inputs - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); Real64 PresssureSet = 0.5; // Assign values @@ -13134,7 +13134,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) AirflowNetwork::AirflowNetworkNodeSimu(i).TZ = 23.0; AirflowNetwork::AirflowNetworkNodeSimu(i).WZ = 0.0008400; if ((i > 4 && i < 10) || i == 32) { - AirflowNetwork::AirflowNetworkNodeSimu(i).TZ = DataEnvironment::OutDryBulbTempAt(state, AirflowNetwork::AirflowNetworkNodeData(i).NodeHeight); + AirflowNetwork::AirflowNetworkNodeSimu(i).TZ = DataEnvironment::OutDryBulbTempAt(*state, AirflowNetwork::AirflowNetworkNodeData(i).NodeHeight); AirflowNetwork::AirflowNetworkNodeSimu(i).WZ = DataEnvironment::OutHumRat; } } @@ -13164,14 +13164,14 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) AirflowNetwork::AirflowNetworkLinkageData(42).AirLoopNum = 1; AirflowNetwork::AirflowNetworkLinkageData(67).AirLoopNum = 2; - state.dataAirLoop->AirLoopAFNInfo.allocate(2); - state.dataAirLoop->AirLoopAFNInfo(1).LoopFanOperationMode = 0.0; - state.dataAirLoop->AirLoopAFNInfo(2).LoopFanOperationMode = 1.0; - state.dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio = 0.0; - state.dataAirLoop->AirLoopAFNInfo(2).LoopOnOffFanPartLoadRatio = 1.0; - state.dataAirLoop->AirLoopAFNInfo(2).LoopSystemOnMassFlowrate = 0.52; + state->dataAirLoop->AirLoopAFNInfo.allocate(2); + state->dataAirLoop->AirLoopAFNInfo(1).LoopFanOperationMode = 0.0; + state->dataAirLoop->AirLoopAFNInfo(2).LoopFanOperationMode = 1.0; + state->dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio = 0.0; + state->dataAirLoop->AirLoopAFNInfo(2).LoopOnOffFanPartLoadRatio = 1.0; + state->dataAirLoop->AirLoopAFNInfo(2).LoopSystemOnMassFlowrate = 0.52; - CalcAirflowNetworkAirBalance(state); + CalcAirflowNetworkAirBalance(*state); // Check mass flow rate EXPECT_NEAR(1.40, AirflowNetwork::AirflowNetworkLinkSimu(42).FLOW, 0.0001); @@ -13182,7 +13182,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) AirflowNetwork::AirflowNetworkFanActivated = false; // #7977 - CalcAirflowNetworkAirBalance(state); + CalcAirflowNetworkAirBalance(*state); DataHeatBalFanSys::ZoneAirHumRat.allocate(5); DataHeatBalFanSys::MAT.allocate(5); DataHeatBalFanSys::ZoneAirHumRatAvg.allocate(5); @@ -13200,15 +13200,15 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) DataZoneEquipment::ZoneEquipConfig(3).IsControlled = false; DataZoneEquipment::ZoneEquipConfig(4).IsControlled = false; DataZoneEquipment::ZoneEquipConfig(5).IsControlled = false; - state.dataAirflowNetworkBalanceManager->exchangeData.allocate(5); + state->dataAirflowNetworkBalanceManager->exchangeData.allocate(5); AirflowNetwork::AirflowNetworkLinkSimu(3).FLOW2 = 0.002364988; - ReportAirflowNetwork(state); + ReportAirflowNetwork(*state); EXPECT_NEAR(AirflowNetwork::AirflowNetworkReportData(1).MultiZoneInfiSenLossW, 95.89575, 0.001); EXPECT_NEAR(AirflowNetwork::AirflowNetworkReportData(1).MultiZoneInfiLatLossW, 0.969147, 0.001); AirflowNetwork::AirflowNetworkCompData(AirflowNetwork::AirflowNetworkLinkageData(2).CompNum).CompTypeNum = 1; - ReportAirflowNetwork(state); + ReportAirflowNetwork(*state); EXPECT_NEAR(AirflowNetwork::AirflowNetworkReportData(1).MultiZoneVentSenLossW, 95.89575, 0.001); EXPECT_NEAR(AirflowNetwork::AirflowNetworkReportData(1).MultiZoneVentLatLossW, 0.969147, 0.001); @@ -13216,17 +13216,17 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) TEST_F(EnergyPlusFixture, AirflowNetwork_CheckNumOfFansInAirLoopTest) { - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 3; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(3); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "Fan:ConstantVolume"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).TypeOf = "Fan:VariableVolume"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "CVF"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).Name = "VAV"; - - ASSERT_THROW(ValidateDistributionSystem(state), std::runtime_error); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 3; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(3); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "Fan:ConstantVolume"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).TypeOf = "Fan:VariableVolume"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "CVF"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).Name = "VAV"; + + ASSERT_THROW(ValidateDistributionSystem(*state), std::runtime_error); std::string const error_string = delimited_string({ " ** Severe ** ValidateDistributionSystem: An AirLoop branch, , has two or more fans: CVF,VAV", @@ -13638,25 +13638,25 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_BasicAdvancedSingleSidedAvoidCrashTest) bool errors = false; - HeatBalanceManager::GetMaterialData(state, errors); // read material data + HeatBalanceManager::GetMaterialData(*state, errors); // read material data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetConstructData(state, errors); // read construction data + HeatBalanceManager::GetConstructData(*state, errors); // read construction data EXPECT_FALSE(errors); // expect no errors - HeatBalanceManager::GetZoneData(state, errors); // read zone data + HeatBalanceManager::GetZoneData(*state, errors); // read zone data EXPECT_FALSE(errors); // expect no errors // Magic to get surfaces read in correctly DataHeatBalance::AnyCTF = true; - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, errors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, errors); // setup zone geometry and get zone data EXPECT_FALSE(errors); // expect no errors - CurveManager::GetCurveInput(state); - EXPECT_EQ(0, state.dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); // #6912 DataHeatBalFanSys::MAT.allocate(1); @@ -13673,10 +13673,10 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_BasicAdvancedSingleSidedAvoidCrashTest) bool resimu = false; Zone(1).OutDryBulbTemp = DataEnvironment::OutDryBulbTemp; - AirflowNetworkBalanceManager::GetAirflowNetworkInput(state); - state.dataAirflowNetworkBalanceManager->AirflowNetworkGetInputFlag = false; - state.dataAirflowNetworkBalanceManager->exchangeData.allocate(1); - ManageAirflowNetworkBalance(state, First, iter, resimu); + AirflowNetworkBalanceManager::GetAirflowNetworkInput(*state); + state->dataAirflowNetworkBalanceManager->AirflowNetworkGetInputFlag = false; + state->dataAirflowNetworkBalanceManager->exchangeData.allocate(1); + ManageAirflowNetworkBalance(*state, First, iter, resimu); EXPECT_FALSE(resimu); } @@ -15566,26 +15566,26 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestFanModel) bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(state, ErrorsFound); + HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Read AirflowNetwork inputs - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); Schedule(1).CurrentValue = 1.0; Schedule(2).CurrentValue = 100.0; @@ -15614,18 +15614,18 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestFanModel) AirflowNetwork::AirflowNetworkNodeSimu(i).WZ = 0.0008400; if ((i >= 4 && i <= 7)) { AirflowNetwork::AirflowNetworkNodeSimu(i).TZ = - DataEnvironment::OutDryBulbTempAt(state, AirflowNetwork::AirflowNetworkNodeData(i).NodeHeight); // AirflowNetworkNodeData vals differ + DataEnvironment::OutDryBulbTempAt(*state, AirflowNetwork::AirflowNetworkNodeData(i).NodeHeight); // AirflowNetworkNodeData vals differ AirflowNetwork::AirflowNetworkNodeSimu(i).WZ = DataEnvironment::OutHumRat; } } - state.dataAirLoop->AirLoopAFNInfo.allocate(1); - state.dataAirLoop->AirLoopAFNInfo(1).LoopFanOperationMode = 1; - state.dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio = 0.0; - state.dataAirLoop->AirLoopAFNInfo(1).LoopSystemOnMassFlowrate = 1.23; + state->dataAirLoop->AirLoopAFNInfo.allocate(1); + state->dataAirLoop->AirLoopAFNInfo(1).LoopFanOperationMode = 1; + state->dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio = 0.0; + state->dataAirLoop->AirLoopAFNInfo(1).LoopSystemOnMassFlowrate = 1.23; AirflowNetwork::AirflowNetworkLinkageData(17).AirLoopNum = 1; Node(4).MassFlowRate = 1.23; - CalcAirflowNetworkAirBalance(state); + CalcAirflowNetworkAirBalance(*state); // Fan:SystemModel EXPECT_NEAR(1.23, AirflowNetwork::AirflowNetworkLinkSimu(20).FLOW, 0.0001); EXPECT_TRUE(AirflowNetwork::DisSysCompCVFData(1).FanModelFlag); @@ -15635,22 +15635,22 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestFanModel) AirflowNetwork::AirflowNetworkNodeSimu(i).WZ = 0.0008400; if ((i >= 4 && i <= 7)) { AirflowNetwork::AirflowNetworkNodeSimu(i).TZ = - DataEnvironment::OutDryBulbTempAt(state, AirflowNetwork::AirflowNetworkNodeData(i).NodeHeight); // AirflowNetworkNodeData vals differ + DataEnvironment::OutDryBulbTempAt(*state, AirflowNetwork::AirflowNetworkNodeData(i).NodeHeight); // AirflowNetworkNodeData vals differ AirflowNetwork::AirflowNetworkNodeSimu(i).WZ = DataEnvironment::OutHumRat; } } // Fan:OnOff AirflowNetwork::DisSysCompCVFData(1).FanModelFlag = false; - CalcAirflowNetworkAirBalance(state); + CalcAirflowNetworkAirBalance(*state); EXPECT_NEAR(1.23, AirflowNetwork::AirflowNetworkLinkSimu(20).FLOW, 0.0001); - state.dataAirLoop->AirLoopAFNInfo.deallocate(); + state->dataAirLoop->AirLoopAFNInfo.deallocate(); } // Missing an AirflowNetwork:Distribution:Node for the Zone Air Node TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultiZoneNodes_NoZoneNode) { - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataHeatBalance::Zone.allocate(1); DataHeatBalance::Zone(1).Name = "ATTIC ZONE"; @@ -15675,12 +15675,12 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultiZoneNodes_NoZoneNode) DataSurfaces::SurfWinOriginalClass.allocate(1); DataSurfaces::SurfWinOriginalClass(1) = DataSurfaces::SurfaceClass::Window; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "Fan:ConstantVolume"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "Fan:ConstantVolume"; DataLoopNode::NumOfNodes = 1; DataLoopNode::Node.allocate(1); @@ -15688,7 +15688,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultiZoneNodes_NoZoneNode) DataLoopNode::NodeID.allocate(1); DataLoopNode::NodeID(1) = "ATTIC ZONE AIR NODE"; bool errFlag{false}; - BranchNodeConnections::RegisterNodeConnection(state, 1, "ATTIC ZONE AIR NODE", "Type1", "Object1", "ZoneNode", 1, false, errFlag); + BranchNodeConnections::RegisterNodeConnection(*state, 1, "ATTIC ZONE AIR NODE", "Type1", "Object1", "ZoneNode", 1, false, errFlag); EXPECT_FALSE(errFlag); DataZoneEquipment::ZoneEquipConfig.allocate(1); @@ -15700,7 +15700,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultiZoneNodes_NoZoneNode) DataZoneEquipment::ZoneEquipConfig(1).NumReturnNodes = 0; DataZoneEquipment::ZoneEquipConfig(1).IsControlled = true; - ASSERT_THROW(ValidateDistributionSystem(state), std::runtime_error); + ASSERT_THROW(ValidateDistributionSystem(*state), std::runtime_error); std::string const error_string = delimited_string({ " ** Severe ** ValidateDistributionSystem: 'ATTIC ZONE AIR NODE' is not defined as an AirflowNetwork:Distribution:Node object.", @@ -15718,7 +15718,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultiZoneNodes_NoZoneNode) // Can't find an inlet node for a Zone referenced in AirflowNetwork:MultiZone:Zone object TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultiZoneNodes_NoInletNode) { - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataHeatBalance::Zone.allocate(1); DataHeatBalance::Zone(1).Name = "ATTIC ZONE"; @@ -15743,12 +15743,12 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultiZoneNodes_NoInletNode) DataSurfaces::SurfWinOriginalClass.allocate(1); DataSurfaces::SurfWinOriginalClass(1) = DataSurfaces::SurfaceClass::Window; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "Fan:ConstantVolume"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "Fan:ConstantVolume"; DataLoopNode::NumOfNodes = 1; DataLoopNode::Node.allocate(2); @@ -15756,7 +15756,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultiZoneNodes_NoInletNode) DataLoopNode::NodeID.allocate(1); DataLoopNode::NodeID(1) = "ATTIC ZONE AIR NODE"; bool errFlag{false}; - BranchNodeConnections::RegisterNodeConnection(state, 1, "ATTIC ZONE AIR NODE", "Type1", "Object1", "ZoneNode", 1, false, errFlag); + BranchNodeConnections::RegisterNodeConnection(*state, 1, "ATTIC ZONE AIR NODE", "Type1", "Object1", "ZoneNode", 1, false, errFlag); EXPECT_FALSE(errFlag); DataZoneEquipment::ZoneEquipConfig.allocate(1); @@ -15780,12 +15780,12 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_CheckMultiZoneNodes_NoInletNode) AirflowNetwork::AirflowNetworkNodeData(1).Name = "ATTIC ZONE"; AirflowNetwork::AirflowNetworkNodeData(1).EPlusZoneNum = 1; - state.dataAirflowNetworkBalanceManager->SplitterNodeNumbers.allocate(2); - state.dataAirflowNetworkBalanceManager->SplitterNodeNumbers(1) = 0; - state.dataAirflowNetworkBalanceManager->SplitterNodeNumbers(2) = 0; + state->dataAirflowNetworkBalanceManager->SplitterNodeNumbers.allocate(2); + state->dataAirflowNetworkBalanceManager->SplitterNodeNumbers(1) = 0; + state->dataAirflowNetworkBalanceManager->SplitterNodeNumbers(2) = 0; // MixedAir::NumOAMixers.allocate(1); - ValidateDistributionSystem(state); + ValidateDistributionSystem(*state); EXPECT_TRUE(compare_err_stream("", true)); } @@ -17144,31 +17144,31 @@ TEST_F(EnergyPlusFixture, AirflowNetworkBalanceManager_DuplicatedNodeNameTest) bool ErrorsFound = false; // Read objects - SimulationManager::GetProjectData(state); - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + SimulationManager::GetProjectData(*state); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(state, ErrorsFound); + HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetHeatBalanceInput(state); - HeatBalanceManager::AllocateHeatBalArrays(state); + HeatBalanceManager::GetHeatBalanceInput(*state); + HeatBalanceManager::AllocateHeatBalArrays(*state); DataEnvironment::OutBaroPress = 101000; - DataHVACGlobals::TimeStepSys = state.dataGlobal->TimeStepZone; - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + DataHVACGlobals::TimeStepSys = state->dataGlobal->TimeStepZone; + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Read AirflowNetwork inputs - ASSERT_THROW(GetAirflowNetworkInput(state), std::runtime_error); + ASSERT_THROW(GetAirflowNetworkInput(*state), std::runtime_error); std::string const error_string = delimited_string({ " ** Warning ** GetHTSurfaceData: Surfaces with interface to Ground found but no \"Ground Temperatures\" were input.", @@ -19923,26 +19923,26 @@ std::string const idf_objects = delimited_string({ bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(state, ErrorsFound); + HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Read AirflowNetwork inputs - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); AirflowNetwork::AirflowNetworkFanActivated = true; DataEnvironment::OutDryBulbTemp = -17.29025; @@ -19955,7 +19955,7 @@ std::string const idf_objects = delimited_string({ AirflowNetwork::AirflowNetworkNodeSimu(i).TZ = 23.0; AirflowNetwork::AirflowNetworkNodeSimu(i).WZ = 0.0008400; if ((i > 4 && i < 10) || i == 32) { - AirflowNetwork::AirflowNetworkNodeSimu(i).TZ = DataEnvironment::OutDryBulbTempAt(state, AirflowNetwork::AirflowNetworkNodeData(i).NodeHeight); + AirflowNetwork::AirflowNetworkNodeSimu(i).TZ = DataEnvironment::OutDryBulbTempAt(*state, AirflowNetwork::AirflowNetworkNodeData(i).NodeHeight); AirflowNetwork::AirflowNetworkNodeSimu(i).WZ = DataEnvironment::OutHumRat; } } @@ -19973,9 +19973,9 @@ std::string const idf_objects = delimited_string({ AirflowNetwork::DisSysCompReliefAirData(1).OutletNode = 1; } - state.dataAirLoop->AirLoopAFNInfo.allocate(1); - state.dataAirLoop->AirLoopAFNInfo(1).LoopFanOperationMode = 0.0; - state.dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio = 0.0; + state->dataAirLoop->AirLoopAFNInfo.allocate(1); + state->dataAirLoop->AirLoopAFNInfo(1).LoopFanOperationMode = 0.0; + state->dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio = 0.0; AirflowNetwork::AirflowNetworkFanActivated = false; @@ -19992,21 +19992,21 @@ std::string const idf_objects = delimited_string({ DataHeatBalFanSys::ZoneAirHumRat(4) = 0.001; DataHeatBalFanSys::ZoneAirHumRat(5) = 0.001; - DataZoneEquipment::GetZoneEquipmentData(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - SimAirServingZones::GetAirPathData(state); + DataZoneEquipment::GetZoneEquipmentData(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + SimAirServingZones::GetAirPathData(*state); // Read AirflowNetwork inputs - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); - state.dataAirflowNetworkBalanceManager->AirflowNetworkGetInputFlag = false; + state->dataAirflowNetworkBalanceManager->AirflowNetworkGetInputFlag = false; DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum(1) = 1; DataZoneEquipment::ZoneEquipConfig(1).ReturnNodeAirLoopNum(1) = 1; DataZoneEquipment::ZoneEquipConfig(2).InletNodeAirLoopNum(1) = 1; DataZoneEquipment::ZoneEquipConfig(2).ReturnNodeAirLoopNum(1) = 1; AirflowNetwork::DisSysNodeData(9).EPlusNodeNum = 50; // AirflowNetwork::AirflowNetworkExchangeData.allocate(5); - ManageAirflowNetworkBalance(state, true); + ManageAirflowNetworkBalance(*state, true); EXPECT_EQ(AirflowNetwork::DisSysCompCVFData(1).AirLoopNum,1); } @@ -20050,7 +20050,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingAirBoundary) SurfaceGeometry::AllocateSurfaceWindows(2); SurfWinOriginalClass(1) = DataSurfaces::SurfaceClass::Window; SurfWinOriginalClass(2) = DataSurfaces::SurfaceClass::Window; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; std::string const idf_objects = delimited_string({ "Schedule:Constant,OnSch,,1.0;", @@ -20115,7 +20115,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingAirBoundary) }); ASSERT_TRUE(process_idf(idf_objects)); - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); // Expect warnings about the air boundary surface EXPECT_TRUE(has_err_output(false)); std::string const expectedErrString = delimited_string({ diff --git a/tst/EnergyPlus/unit/AirflowNetworkSimulationControl.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkSimulationControl.unit.cc index 20257229b36..1eb9acf5772 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkSimulationControl.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkSimulationControl.unit.cc @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -106,7 +107,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkSimulationControl_DefaultSolver) SurfaceGeometry::AllocateSurfaceWindows(2); SurfWinOriginalClass(1) = DataSurfaces::SurfaceClass::Window; SurfWinOriginalClass(2) = DataSurfaces::SurfaceClass::Window; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; TotPeople = 1; // Total number of people statements People.allocate(TotPeople); @@ -164,7 +165,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkSimulationControl_DefaultSolver) ASSERT_TRUE(process_idf(idf_objects)); - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); EXPECT_EQ(AirflowNetwork::AirflowNetworkSimuProp::Solver::SkylineLU, AirflowNetwork::AirflowNetworkSimu.solver); @@ -200,7 +201,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkSimulationControl_SetSolver) SurfaceGeometry::AllocateSurfaceWindows(2); SurfWinOriginalClass(1) = DataSurfaces::SurfaceClass::Window;; SurfWinOriginalClass(2) = DataSurfaces::SurfaceClass::Window;; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; TotPeople = 1; // Total number of people statements People.allocate(TotPeople); @@ -260,7 +261,7 @@ TEST_F(EnergyPlusFixture, AirflowNetworkSimulationControl_SetSolver) ASSERT_TRUE(process_idf(idf_objects)); - GetAirflowNetworkInput(state); + GetAirflowNetworkInput(*state); EXPECT_EQ(AirflowNetwork::AirflowNetworkSimuProp::Solver::SkylineLU, AirflowNetwork::AirflowNetworkSimu.solver); diff --git a/tst/EnergyPlus/unit/AirflowNetworkSolver.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkSolver.unit.cc index 27776dd776e..33c3ef622ac 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkSolver.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkSolver.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -84,7 +85,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_SolverTest_HorizontalOpening) MultizoneSurfaceData(i).OpenFactor = 1.0; solver.properties.clear(); - for (int it = 0; it < 2; ++it) solver.properties.emplace_back(AirProperties(AIRDENSITY(state, 20.0, 101325.0, 0.0))); + for (int it = 0; it < 2; ++it) solver.properties.emplace_back(AirProperties(AIRDENSITY(*state, 20.0, 101325.0, 0.0))); solver.properties[0].density = 1.2; solver.properties[1].density = 1.18; @@ -101,13 +102,13 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_SolverTest_HorizontalOpening) Real64 multiplier = 1.0; Real64 control = 1.0; - NF = MultizoneCompHorOpeningData(1).calculate(state, 1, 0.05, 1, multiplier, control, solver.properties[0], solver.properties[1], F, DF); + NF = MultizoneCompHorOpeningData(1).calculate(*state, 1, 0.05, 1, multiplier, control, solver.properties[0], solver.properties[1], F, DF); EXPECT_NEAR(3.47863, F[0], 0.00001); EXPECT_NEAR(34.7863, DF[0], 0.0001); EXPECT_NEAR(2.96657, F[1], 0.00001); EXPECT_EQ(0.0, DF[1]); - NF = MultizoneCompHorOpeningData(1).calculate(state, 1, -0.05, 1, multiplier, control, solver.properties[0], solver.properties[1], F, DF); + NF = MultizoneCompHorOpeningData(1).calculate(*state, 1, -0.05, 1, multiplier, control, solver.properties[0], solver.properties[1], F, DF); EXPECT_NEAR(-3.42065, F[0], 0.00001); EXPECT_NEAR(34.20649, DF[0], 0.0001); EXPECT_NEAR(2.96657, F[1], 0.00001); @@ -135,7 +136,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_SolverTest_Coil) DisSysCompCoilData[0].L = 1.0; solver.properties.clear(); - for (int it = 0; it < 2; ++it) solver.properties.emplace_back(AirProperties(AIRDENSITY(state, 20.0, 101325.0, 0.0))); + for (int it = 0; it < 2; ++it) solver.properties.emplace_back(AirProperties(AIRDENSITY(*state, 20.0, 101325.0, 0.0))); solver.properties[0].density = 1.2; solver.properties[1].density = 1.2; @@ -147,13 +148,13 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_SolverTest_Coil) Real64 multiplier = 1.0; Real64 control = 1.0; - NF = DisSysCompCoilData[0].calculate(state, 1, 0.05, 1, multiplier, control, solver.properties[0], solver.properties[1], F, DF); + NF = DisSysCompCoilData[0].calculate(*state, 1, 0.05, 1, multiplier, control, solver.properties[0], solver.properties[1], F, DF); EXPECT_NEAR(-294.5243112740431, F[0], 0.00001); EXPECT_NEAR(5890.4862254808613, DF[0], 0.0001); EXPECT_EQ(0.0, F[1]); EXPECT_EQ(0.0, DF[1]); - NF = DisSysCompCoilData[0].calculate(state, 1, -0.05, 1, multiplier, control, solver.properties[0], solver.properties[1], F, DF); + NF = DisSysCompCoilData[0].calculate(*state, 1, -0.05, 1, multiplier, control, solver.properties[0], solver.properties[1], F, DF); EXPECT_NEAR( 294.5243112740431, F[0], 0.00001); EXPECT_NEAR(5890.4862254808613, DF[0], 0.0001); EXPECT_EQ(0.0, F[1]); diff --git a/tst/EnergyPlus/unit/Autosizing/All_Simple_Sizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/All_Simple_Sizing.unit.cc index 3c3a7a72f9e..b7885136cc2 100644 --- a/tst/EnergyPlus/unit/Autosizing/All_Simple_Sizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/All_Simple_Sizing.unit.cc @@ -50,6 +50,7 @@ #include #include +#include #include #include @@ -66,7 +67,7 @@ TEST_F(AutoSizingFixture, AutoCalculateSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -75,10 +76,10 @@ TEST_F(AutoSizingFixture, AutoCalculateSizingGauntlet) // ZONE EQUIPMENT TESTING DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.0001); // returns 0 since Data* variables are not set @@ -94,8 +95,8 @@ TEST_F(AutoSizingFixture, AutoCalculateSizingGauntlet) std::string sizingString = "Any sizing that requires AutoCalculate []"; sizer.overrideSizingString(sizingString); - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(37.5, sizedValue, 0.001); // hard-sized value @@ -115,8 +116,8 @@ TEST_F(AutoSizingFixture, AutoCalculateSizingGauntlet) // Test 2 - start with autosized value sizer.wasAutoSized = false; inputValue = DataSizing::AutoSize; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(30.0, sizedValue, 0.0001); @@ -125,8 +126,8 @@ TEST_F(AutoSizingFixture, AutoCalculateSizingGauntlet) // Test 3 - start with autosized value, Data globals were not set again sizer.wasAutoSized = false; inputValue = DataSizing::AutoSize; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); // Data globals weren't set EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.0001); // result is 0 since Data globals are 0 @@ -140,8 +141,8 @@ TEST_F(AutoSizingFixture, AutoCalculateSizingGauntlet) DataSizing::DataEMSOverride = 33.4; sizer.wasAutoSized = false; inputValue = 28.8; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(33.4, sizedValue, 0.0001); // EMS overrides input value @@ -157,8 +158,8 @@ TEST_F(AutoSizingFixture, AutoCalculateSizingGauntlet) // Test 5 - EMS override on, autosized input sizer.wasAutoSized = false; inputValue = DataSizing::AutoSize; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(33.4, sizedValue, 0.0001); // EMS overrides input value @@ -180,7 +181,7 @@ TEST_F(AutoSizingFixture, MaxHeaterOutletTempSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -189,10 +190,10 @@ TEST_F(AutoSizingFixture, MaxHeaterOutletTempSizingGauntlet) // ZONE EQUIPMENT TESTING DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(37.5, sizedValue, 0.0001); // hard-sized value @@ -202,8 +203,8 @@ TEST_F(AutoSizingFixture, MaxHeaterOutletTempSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(37.5, sizedValue, 0.001); // hard-sized value @@ -225,8 +226,8 @@ TEST_F(AutoSizingFixture, MaxHeaterOutletTempSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(32.6, sizedValue, 0.001); @@ -253,8 +254,8 @@ TEST_F(AutoSizingFixture, MaxHeaterOutletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(27.8, sizedValue, 0.0001); // hard-sized value @@ -274,8 +275,8 @@ TEST_F(AutoSizingFixture, MaxHeaterOutletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(25.8, sizedValue, 0.0001); @@ -290,8 +291,8 @@ TEST_F(AutoSizingFixture, MaxHeaterOutletTempSizingGauntlet) // Test 5 - Airloop Equipment sizer.wasAutoSized = false; inputValue = 28.8; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(28.8, sizedValue, 0.0001); @@ -314,7 +315,7 @@ TEST_F(AutoSizingFixture, ZoneCoolingLoadSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -323,10 +324,10 @@ TEST_F(AutoSizingFixture, ZoneCoolingLoadSizingGauntlet) // ZONE EQUIPMENT TESTING DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(3007.5, sizedValue, 0.0001); // hard-sized value @@ -336,8 +337,8 @@ TEST_F(AutoSizingFixture, ZoneCoolingLoadSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(3007.5, sizedValue, 0.001); // hard-sized value @@ -359,8 +360,8 @@ TEST_F(AutoSizingFixture, ZoneCoolingLoadSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2500.0, sizedValue, 0.001); @@ -387,8 +388,8 @@ TEST_F(AutoSizingFixture, ZoneCoolingLoadSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2007.8, sizedValue, 0.0001); // hard-sized value @@ -408,8 +409,8 @@ TEST_F(AutoSizingFixture, ZoneCoolingLoadSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.0001); @@ -423,8 +424,8 @@ TEST_F(AutoSizingFixture, ZoneCoolingLoadSizingGauntlet) // Test 5 - Airloop Equipment sizer.wasAutoSized = false; inputValue = 2880.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2880.0, sizedValue, 0.0001); @@ -448,7 +449,7 @@ TEST_F(AutoSizingFixture, ZoneHeatingLoadSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -457,10 +458,10 @@ TEST_F(AutoSizingFixture, ZoneHeatingLoadSizingGauntlet) // ZONE EQUIPMENT TESTING DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(3007.5, sizedValue, 0.0001); // hard-sized value @@ -470,8 +471,8 @@ TEST_F(AutoSizingFixture, ZoneHeatingLoadSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(3007.5, sizedValue, 0.001); // hard-sized value @@ -493,8 +494,8 @@ TEST_F(AutoSizingFixture, ZoneHeatingLoadSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2500.0, sizedValue, 0.001); @@ -521,8 +522,8 @@ TEST_F(AutoSizingFixture, ZoneHeatingLoadSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2007.8, sizedValue, 0.0001); // hard-sized value @@ -541,8 +542,8 @@ TEST_F(AutoSizingFixture, ZoneHeatingLoadSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.0001); @@ -556,8 +557,8 @@ TEST_F(AutoSizingFixture, ZoneHeatingLoadSizingGauntlet) // Test 5 - Airloop Equipment sizer.wasAutoSized = false; inputValue = 2880.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2880.0, sizedValue, 0.0001); @@ -581,7 +582,7 @@ TEST_F(AutoSizingFixture, ASHRAEMinSATCoolingSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -590,10 +591,10 @@ TEST_F(AutoSizingFixture, ASHRAEMinSATCoolingSizingGauntlet) // ZONE EQUIPMENT TESTING DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(16.5, sizedValue, 0.0001); // hard-sized value @@ -603,8 +604,8 @@ TEST_F(AutoSizingFixture, ASHRAEMinSATCoolingSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(16.5, sizedValue, 0.001); // hard-sized value @@ -629,8 +630,8 @@ TEST_F(AutoSizingFixture, ASHRAEMinSATCoolingSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(7.585, sizedValue, 0.001); @@ -641,8 +642,8 @@ TEST_F(AutoSizingFixture, ASHRAEMinSATCoolingSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.001); @@ -666,8 +667,8 @@ TEST_F(AutoSizingFixture, ASHRAEMinSATCoolingSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(14.8, sizedValue, 0.001); // hard-sized value @@ -687,8 +688,8 @@ TEST_F(AutoSizingFixture, ASHRAEMinSATCoolingSizingGauntlet) // do sizing, DataAirFlowUsedForSizing = 0 sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_TRUE(errorsFound); EXPECT_TRUE(sizer.wasAutoSized); @@ -707,8 +708,8 @@ TEST_F(AutoSizingFixture, ASHRAEMinSATCoolingSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(7.585, sizedValue, 0.001); @@ -723,8 +724,8 @@ TEST_F(AutoSizingFixture, ASHRAEMinSATCoolingSizingGauntlet) // Test 7 - Airloop Equipment sizer.wasAutoSized = false; inputValue = 9.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(9.0, sizedValue, 0.001); @@ -748,7 +749,7 @@ TEST_F(AutoSizingFixture, ASHRAEMaxSATHeatingSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -757,10 +758,10 @@ TEST_F(AutoSizingFixture, ASHRAEMaxSATHeatingSizingGauntlet) // ZONE EQUIPMENT TESTING DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(26.5, sizedValue, 0.0001); // hard-sized value @@ -770,8 +771,8 @@ TEST_F(AutoSizingFixture, ASHRAEMaxSATHeatingSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(26.5, sizedValue, 0.001); // hard-sized value @@ -796,8 +797,8 @@ TEST_F(AutoSizingFixture, ASHRAEMaxSATHeatingSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(38.274, sizedValue, 0.001); @@ -808,8 +809,8 @@ TEST_F(AutoSizingFixture, ASHRAEMaxSATHeatingSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.001); @@ -834,8 +835,8 @@ TEST_F(AutoSizingFixture, ASHRAEMaxSATHeatingSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(32.8, sizedValue, 0.001); // hard-sized value @@ -855,8 +856,8 @@ TEST_F(AutoSizingFixture, ASHRAEMaxSATHeatingSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(38.274, sizedValue, 0.001); @@ -871,8 +872,8 @@ TEST_F(AutoSizingFixture, ASHRAEMaxSATHeatingSizingGauntlet) // Test 5 - Airloop Equipment sizer.wasAutoSized = false; inputValue = 32.3; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(32.3, sizedValue, 0.001); @@ -889,8 +890,8 @@ TEST_F(AutoSizingFixture, ASHRAEMaxSATHeatingSizingGauntlet) sizer.wasAutoSized = false; DataSizing::DataCapacityUsedForSizing = 0.0; inputValue = DataSizing::AutoSize; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.001); @@ -909,7 +910,7 @@ TEST_F(AutoSizingFixture, DesiccantDehumidifierBFPerfDataFaceVelocitySizingGaunt bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -918,10 +919,10 @@ TEST_F(AutoSizingFixture, DesiccantDehumidifierBFPerfDataFaceVelocitySizingGaunt // ZONE EQUIPMENT TESTING DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, compType, "MyDesiccantHX", printFlag, routineName); + sizer.initializeWithinEP(*this->state, compType, "MyDesiccantHX", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(4.5, sizedValue, 0.0001); // hard-sized value @@ -931,8 +932,8 @@ TEST_F(AutoSizingFixture, DesiccantDehumidifierBFPerfDataFaceVelocitySizingGaunt has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, compType, "MyDesiccantHX", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, compType, "MyDesiccantHX", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(4.5, sizedValue, 0.001); // hard-sized value @@ -953,8 +954,8 @@ TEST_F(AutoSizingFixture, DesiccantDehumidifierBFPerfDataFaceVelocitySizingGaunt // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, compType, "MyDesiccantHX", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, compType, "MyDesiccantHX", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4.307, sizedValue, 0.001); @@ -968,8 +969,8 @@ TEST_F(AutoSizingFixture, DesiccantDehumidifierBFPerfDataFaceVelocitySizingGaunt // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, compType, "MyDesiccantHX", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, compType, "MyDesiccantHX", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2.887, sizedValue, 0.001); @@ -994,8 +995,8 @@ TEST_F(AutoSizingFixture, DesiccantDehumidifierBFPerfDataFaceVelocitySizingGaunt // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, compType, "MyDesiccantHX", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, compType, "MyDesiccantHX", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(3.2, sizedValue, 0.001); // hard-sized value @@ -1015,8 +1016,8 @@ TEST_F(AutoSizingFixture, DesiccantDehumidifierBFPerfDataFaceVelocitySizingGaunt // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, compType, "MyDesiccantHX", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, compType, "MyDesiccantHX", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4.307, sizedValue, 0.001); @@ -1030,8 +1031,8 @@ TEST_F(AutoSizingFixture, DesiccantDehumidifierBFPerfDataFaceVelocitySizingGaunt // Test 6 - Airloop Equipment sizer.wasAutoSized = false; inputValue = 3.2; - sizer.initializeWithinEP(this->state, compType, "MyDesiccantHX", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, compType, "MyDesiccantHX", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(3.2, sizedValue, 0.001); @@ -1055,7 +1056,7 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletTempSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -1064,10 +1065,10 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletTempSizingGauntlet) // ZONE EQUIPMENT TESTING - Zone equipment not supported DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(17.5, sizedValue, 0.0001); // hard-sized value @@ -1086,8 +1087,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(17.8, sizedValue, 0.0001); // hard-sized value @@ -1105,8 +1106,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // DataDesicRegCoil not set - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.0001); @@ -1119,8 +1120,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletTempSizingGauntlet) DesiccantDehumidifiers::DesicDehum.allocate(1); sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.8, sizedValue, 0.0001); @@ -1134,8 +1135,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletTempSizingGauntlet) // Test 5 - Airloop Equipment w/ desiccant regen coil in OA system DesiccantDehumidifiers::DesicDehum(1).RegenInletIsOutsideAirNode = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(13.8, sizedValue, 0.0001); @@ -1148,8 +1149,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletTempSizingGauntlet) // Test 6 - Airloop Equipment - hard-sized desiccant regen coil in OA system sizer.wasAutoSized = false; inputValue = 19.8; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(19.8, sizedValue, 0.0001); @@ -1171,7 +1172,7 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirOutletTempSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -1180,10 +1181,10 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirOutletTempSizingGauntlet) // ZONE EQUIPMENT TESTING - Zone equipment not supported DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(37.5, sizedValue, 0.0001); // hard-sized value @@ -1202,8 +1203,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirOutletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(27.8, sizedValue, 0.0001); // hard-sized value @@ -1221,8 +1222,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirOutletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // DataDesicRegCoil not set - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.0001); @@ -1236,8 +1237,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirOutletTempSizingGauntlet) DesiccantDehumidifiers::DesicDehum(1).RegenSetPointTemp = 26.4; sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(26.4, sizedValue, 0.0001); @@ -1252,8 +1253,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirOutletTempSizingGauntlet) // Test 5 - Airloop Equipment - hard-sized desiccant regen coil in OA system sizer.wasAutoSized = false; inputValue = 32.8; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(32.8, sizedValue, 0.0001); @@ -1276,7 +1277,7 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletHumRatSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -1285,10 +1286,10 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletHumRatSizingGauntlet) // ZONE EQUIPMENT TESTING - Zone equipment not supported DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.005, sizedValue, 0.0001); // hard-sized value @@ -1307,8 +1308,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.008, sizedValue, 0.0001); // hard-sized value @@ -1326,8 +1327,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // DataDesicRegCoil not set - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.0001); @@ -1340,8 +1341,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletHumRatSizingGauntlet) DesiccantDehumidifiers::DesicDehum.allocate(1); sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.008, sizedValue, 0.0001); @@ -1355,8 +1356,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletHumRatSizingGauntlet) // Test 5 - Airloop Equipment w/ desiccant regen coil in OA system DesiccantDehumidifiers::DesicDehum(1).RegenInletIsOutsideAirNode = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.004, sizedValue, 0.0001); @@ -1369,8 +1370,8 @@ TEST_F(AutoSizingFixture, HeatingCoilDesAirInletHumRatSizingGauntlet) // Test 6 - Airloop Equipment - hard-sized desiccant regen coil in OA system sizer.wasAutoSized = false; inputValue = 0.009; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.009, sizedValue, 0.0001); diff --git a/tst/EnergyPlus/unit/Autosizing/AutosizingFixture.hh b/tst/EnergyPlus/unit/Autosizing/AutosizingFixture.hh index 6d93ee85136..fc51227a9ea 100644 --- a/tst/EnergyPlus/unit/Autosizing/AutosizingFixture.hh +++ b/tst/EnergyPlus/unit/Autosizing/AutosizingFixture.hh @@ -47,5 +47,6 @@ #include #include "../Fixtures/EnergyPlusFixture.hh" +#include class AutoSizingFixture : public EnergyPlus::EnergyPlusFixture {}; diff --git a/tst/EnergyPlus/unit/Autosizing/BaseClassSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/BaseClassSizing.unit.cc index e2453ee7c61..d0ac3b08bc4 100644 --- a/tst/EnergyPlus/unit/Autosizing/BaseClassSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/BaseClassSizing.unit.cc @@ -66,6 +66,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace ObjexxFCL; @@ -118,14 +119,14 @@ TEST_F(EnergyPlusFixture, BaseSizer_GetCoilDesFlowT) // Single path for VAV DataSizing::SysSizInput(1).CoolCapControl = DataSizing::VAV; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); EXPECT_FALSE(has_err_output(true)); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).CoolSupTemp, designExitTemp); EXPECT_DOUBLE_EQ(0.002, designFlowValue); // Single path for OnOff DataSizing::SysSizInput(1).CoolCapControl = DataSizing::OnOff; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); EXPECT_FALSE(has_err_output(true)); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).CoolSupTemp, designExitTemp); EXPECT_DOUBLE_EQ(0.2, designFlowValue); @@ -134,14 +135,14 @@ TEST_F(EnergyPlusFixture, BaseSizer_GetCoilDesFlowT) // CoolSupTemp > calculated value DataSizing::SysSizInput(1).CoolCapControl = DataSizing::VT; DataSizing::CalcSysSizing(1).CoolZoneAvgTempSeq(1) = 10; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); EXPECT_FALSE(has_err_output(true)); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).CoolSupTemp, designExitTemp); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).DesCoolVolFlow, designFlowValue); // CoolSupTemp < calculated value DataSizing::SysSizInput(1).CoolCapControl = DataSizing::VT; DataSizing::CalcSysSizing(1).CoolZoneAvgTempSeq(1) = 15; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); EXPECT_FALSE(has_err_output(true)); EXPECT_NEAR(13.00590, designExitTemp, 0.0001); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).DesCoolVolFlow, designFlowValue); @@ -151,13 +152,13 @@ TEST_F(EnergyPlusFixture, BaseSizer_GetCoilDesFlowT) DataSizing::SysSizInput(1).CoolCapControl = DataSizing::Bypass; DataSizing::CalcSysSizing(1).CoolZoneAvgTempSeq(1) = 13; DataSizing::CalcSysSizing(1).MixTempAtCoolPeak = 15; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); EXPECT_FALSE(has_err_output(true)); EXPECT_DOUBLE_EQ(10, designExitTemp); EXPECT_NEAR(0.119823, designFlowValue, 0.0001); // MixTemp < DesExitTemp DataSizing::CalcSysSizing(1).MixTempAtCoolPeak = 5; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); EXPECT_FALSE(has_err_output(true)); EXPECT_DOUBLE_EQ(10, designExitTemp); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).DesCoolVolFlow, designFlowValue); @@ -168,7 +169,7 @@ TEST_F(EnergyPlusFixture, BaseSizer_GetCoilDesFlowT) // Repeat a VT case DataSizing::SysSizInput(1).CoolCapControl = DataSizing::VT; DataSizing::CalcSysSizing(1).CoolZoneAvgTempSeq(1) = 10; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); EXPECT_FALSE(has_err_output(true)); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).CoolSupTemp, designExitTemp); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).DesCoolVolFlow, designFlowValue); @@ -176,7 +177,7 @@ TEST_F(EnergyPlusFixture, BaseSizer_GetCoilDesFlowT) DataSizing::SysSizInput(1).CoolCapControl = DataSizing::Bypass; DataSizing::CalcSysSizing(1).CoolZoneAvgTempSeq(1) = 13; DataSizing::CalcSysSizing(1).MixTempAtCoolPeak = 15; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); EXPECT_FALSE(has_err_output(true)); EXPECT_DOUBLE_EQ(10, designExitTemp); EXPECT_NEAR(0.119823, designFlowValue, 0.0001); @@ -220,14 +221,14 @@ TEST_F(EnergyPlusFixture, BaseSizer_GetCoilDesFlowT_NoPeak) // Single path for VAV DataSizing::SysSizInput(1).CoolCapControl = DataSizing::VAV; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); EXPECT_FALSE(has_err_output(true)); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).CoolSupTemp, designExitTemp); EXPECT_DOUBLE_EQ(0.002, designFlowValue); // Single path for OnOff DataSizing::SysSizInput(1).CoolCapControl = DataSizing::OnOff; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); EXPECT_FALSE(has_err_output(true)); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).CoolSupTemp, designExitTemp); EXPECT_DOUBLE_EQ(0.2, designFlowValue); @@ -235,7 +236,7 @@ TEST_F(EnergyPlusFixture, BaseSizer_GetCoilDesFlowT_NoPeak) // VT // CoolSupTemp > calculated value DataSizing::SysSizInput(1).CoolCapControl = DataSizing::VT; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); // Expect warning and same result as VAV EXPECT_TRUE(has_err_output(true)); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).CoolSupTemp, designExitTemp); @@ -243,7 +244,7 @@ TEST_F(EnergyPlusFixture, BaseSizer_GetCoilDesFlowT_NoPeak) // Bypass DataSizing::SysSizInput(1).CoolCapControl = DataSizing::Bypass; - DataSizing::GetCoilDesFlowT(state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); + DataSizing::GetCoilDesFlowT(*state, sysNum, CpAir, designFlowValue, designExitTemp, designExitHumRat); // Expect warning and same result as VAV EXPECT_TRUE(has_err_output(true)); EXPECT_DOUBLE_EQ(DataSizing::FinalSysSizing(1).CoolSupTemp, designExitTemp); @@ -274,10 +275,10 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystem) FinalSysSizing(CurSysNum).DesCoolVolFlow = 1.00; FinalSysSizing(CurSysNum).DesOutAirVolFlow = 0.2; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; SysSizingRunDone = true; SysSizInput.allocate(1); @@ -305,8 +306,8 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystem) bool errorsFound = false; CoolingCapacitySizer sizerCoolingCapacity; sizerCoolingCapacity.overrideSizingString(SizingString); - sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintWarning, CallingRoutine); - SizingResult = sizerCoolingCapacity.size(state, SizingResult, errorsFound); + sizerCoolingCapacity.initializeWithinEP(*state, CompType, CompName, PrintWarning, CallingRoutine); + SizingResult = sizerCoolingCapacity.size(*state, SizingResult, errorsFound); EXPECT_NEAR(18882.0, SizingResult, 0.1); // confirm that sizing data is saved for use by parent object @@ -324,8 +325,8 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystem) DataIsDXCoil = false; // chilled water cooling coil capacity sizing - sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintWarning, CallingRoutine); - SizingResult = sizerCoolingCapacity.size(state, SizingResult, errorsFound); + sizerCoolingCapacity.initializeWithinEP(*state, CompType, CompName, PrintWarning, CallingRoutine); + SizingResult = sizerCoolingCapacity.size(*state, SizingResult, errorsFound); EXPECT_NEAR(19234.6, SizingResult, 0.1); } @@ -399,33 +400,33 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystemWithFans) ASSERT_TRUE(process_idf(idf_objects)); std::string fanName = "TEST FAN 1"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 0; DataSizing::CurOASysNum = 0; DataEnvironment::StdRhoAir = 1.2; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _); // triggers sizing call + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _); // triggers sizing call Real64 locFanSizeVdot = HVACFan::fanObjs[0]->designAirVolFlowRate; // get function - Real64 locDesignHeatGain1 = HVACFan::fanObjs[0]->getFanDesignHeatGain(state, locFanSizeVdot); + Real64 locDesignHeatGain1 = HVACFan::fanObjs[0]->getFanDesignHeatGain(*state, locFanSizeVdot); EXPECT_NEAR(locDesignHeatGain1, 100.0, 0.1); fanName = "TEST FAN 2"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor - HVACFan::fanObjs[1]->simulate(state, _, _, _, _); // triggers sizing call + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor + HVACFan::fanObjs[1]->simulate(*state, _, _, _, _); // triggers sizing call locFanSizeVdot = HVACFan::fanObjs[1]->designAirVolFlowRate; // get function - Real64 locDesignHeatGain2 = HVACFan::fanObjs[1]->getFanDesignHeatGain(state, locFanSizeVdot); + Real64 locDesignHeatGain2 = HVACFan::fanObjs[1]->getFanDesignHeatGain(*state, locFanSizeVdot); EXPECT_NEAR(locDesignHeatGain2, 200.0, 0.1); fanName = "TEST FAN 3"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor DataEnvironment::StdRhoAir = 1.2; - HVACFan::fanObjs[2]->simulate(state, _, _, _, _); // triggers sizing call + HVACFan::fanObjs[2]->simulate(*state, _, _, _, _); // triggers sizing call locFanSizeVdot = HVACFan::fanObjs[2]->designAirVolFlowRate; // get function - Real64 locDesignHeatGain3 = HVACFan::fanObjs[2]->getFanDesignHeatGain(state, locFanSizeVdot); + Real64 locDesignHeatGain3 = HVACFan::fanObjs[2]->getFanDesignHeatGain(*state, locFanSizeVdot); EXPECT_NEAR(locDesignHeatGain3, 400.0, 0.1); - GetFanInput(state); - Real64 locDesignHeatGain4 = FanDesHeatGain(state, 1, locFanSizeVdot); + GetFanInput(*state); + Real64 locDesignHeatGain4 = FanDesHeatGain(*state, 1, locFanSizeVdot); EXPECT_NEAR(locDesignHeatGain4, 50.0, 0.1); std::string CompName; // component name @@ -450,11 +451,11 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystemWithFans) FinalSysSizing(CurSysNum).DesCoolVolFlow = 1.00; FinalSysSizing(CurSysNum).DesOutAirVolFlow = 0.2; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).supFanModelTypeEnum = DataAirSystems::fanModelTypeNotYetSet; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).supFanModelTypeEnum = DataAirSystems::fanModelTypeNotYetSet; SysSizingRunDone = true; SysSizInput.allocate(1); @@ -483,15 +484,15 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystemWithFans) bool errorsFound = false; CoolingCapacitySizer sizerCoolingCapacity; sizerCoolingCapacity.overrideSizingString(SizingString); - sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintWarning, CallingRoutine); - SizingResult = sizerCoolingCapacity.size(this->state, SizingResult, errorsFound); + sizerCoolingCapacity.initializeWithinEP(*state, CompType, CompName, PrintWarning, CallingRoutine); + SizingResult = sizerCoolingCapacity.size(*this->state, SizingResult, errorsFound); EXPECT_NEAR(18882.0, SizingResult, 0.1); Real64 dxCoilSizeNoFan = SizingResult; // With Test Fan 4 fan heat - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 1; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).supFanModelTypeEnum = DataAirSystems::structArrayLegacyFanModels; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 1; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).supFanModelTypeEnum = DataAirSystems::structArrayLegacyFanModels; CompType = "COIL:COOLING:DX:SINGLESPEED"; CompName = "Single Speed DX Cooling Coil"; SizingType = DataHVACGlobals::CoolingCapacitySizing; @@ -504,15 +505,15 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystemWithFans) Real64 expectedDXCoilSize = dxCoilSizeNoFan + locDesignHeatGain4; // dx cooling coil capacity sizing - sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintWarning, CallingRoutine); - SizingResult = sizerCoolingCapacity.size(this->state, SizingResult, errorsFound); + sizerCoolingCapacity.initializeWithinEP(*state, CompType, CompName, PrintWarning, CallingRoutine); + SizingResult = sizerCoolingCapacity.size(*this->state, SizingResult, errorsFound); EXPECT_NEAR(expectedDXCoilSize, SizingResult, 0.1); // With Test Fan 3 fan heat - this fails before the #6126 fix - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 2; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).supFanVecIndex = 2; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).supFanModelTypeEnum = DataAirSystems::objectVectorOOFanSystemModel; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 2; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).supFanVecIndex = 2; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).supFanModelTypeEnum = DataAirSystems::objectVectorOOFanSystemModel; CompType = "COIL:COOLING:DX:SINGLESPEED"; CompName = "Single Speed DX Cooling Coil"; SizingType = DataHVACGlobals::CoolingCapacitySizing; @@ -525,8 +526,8 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingSystemWithFans) expectedDXCoilSize = dxCoilSizeNoFan + locDesignHeatGain3; // dx cooling coil capacity sizing - sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintWarning, CallingRoutine); - SizingResult = sizerCoolingCapacity.size(this->state, SizingResult, errorsFound); + sizerCoolingCapacity.initializeWithinEP(*state, CompType, CompName, PrintWarning, CallingRoutine); + SizingResult = sizerCoolingCapacity.size(*this->state, SizingResult, errorsFound); EXPECT_NEAR(expectedDXCoilSize, SizingResult, 0.1); } @@ -580,8 +581,8 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingZone) bool errorsFound = false; CoolingCapacitySizer sizerCoolingCapacity; sizerCoolingCapacity.overrideSizingString(SizingString); - sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintWarning, CallingRoutine); - SizingResult = sizerCoolingCapacity.size(this->state, SizingResult, errorsFound); + sizerCoolingCapacity.initializeWithinEP(*state, CompType, CompName, PrintWarning, CallingRoutine); + SizingResult = sizerCoolingCapacity.size(*this->state, SizingResult, errorsFound); EXPECT_NEAR(5664.6, SizingResult, 0.1); CompType = "COIL:COOLING:WATER"; @@ -592,8 +593,8 @@ TEST_F(EnergyPlusFixture, BaseSizer_RequestSizingZone) DataIsDXCoil = false; // chilled water cooling coil capacity sizing - sizerCoolingCapacity.initializeWithinEP(state, CompType, CompName, PrintWarning, CallingRoutine); - SizingResult = sizerCoolingCapacity.size(this->state, SizingResult, errorsFound); + sizerCoolingCapacity.initializeWithinEP(*state, CompType, CompName, PrintWarning, CallingRoutine); + SizingResult = sizerCoolingCapacity.size(*this->state, SizingResult, errorsFound); EXPECT_NEAR(5770.4, SizingResult, 0.1); } @@ -615,7 +616,7 @@ TEST_F(SQLiteFixture, BaseSizer_SQLiteRecordReportSizerOutputTest) UsrDesc = "User-Specified Nominal Capacity [W]"; UsrValue = 26352.97405; // boiler hot water autosizing and userspecified nominal capacity reporting to SQLite output - BaseSizer::reportSizerOutput(state, CompType, CompName, VarDesc, VarValue, UsrDesc, UsrValue); + BaseSizer::reportSizerOutput(*state, CompType, CompName, VarDesc, VarValue, UsrDesc, UsrValue); // get the sqlite output // query the sqLite auto result = queryResult("SELECT * FROM ComponentSizes;", "ComponentSizes"); @@ -871,11 +872,11 @@ TEST_F(EnergyPlusFixture, BaseSizer_FanPeak) { // This is needed to compute time of Peak as a string - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 15; // Setup the predefined tables, because that's where the info is written. - EnergyPlus::OutputReportPredefined::SetPredefinedTables(state); + EnergyPlus::OutputReportPredefined::SetPredefinedTables(*state); // If you wanted to check SQL, you also need this: // We enable the report we care about, making sure it's the right one @@ -910,11 +911,11 @@ TEST_F(EnergyPlusFixture, BaseSizer_FanPeak) DataSizing::FinalZoneSizing(CurZoneEqNum).TimeStepNumAtCoolMax = 72; // Fake a design day - state.dataWeatherManager->DesDayInput.allocate(1); + state->dataWeatherManager->DesDayInput.allocate(1); std::string DDTitle = "CHICAGO ANN CLG 1% CONDNS DB=>MWB"; - state.dataWeatherManager->DesDayInput(FinalZoneSizing(CurZoneEqNum).CoolDDNum).Title = DDTitle; - state.dataWeatherManager->DesDayInput(FinalZoneSizing(CurZoneEqNum).CoolDDNum).Month = 7; - state.dataWeatherManager->DesDayInput(FinalZoneSizing(CurZoneEqNum).CoolDDNum).DayOfMonth = 15; + state->dataWeatherManager->DesDayInput(FinalZoneSizing(CurZoneEqNum).CoolDDNum).Title = DDTitle; + state->dataWeatherManager->DesDayInput(FinalZoneSizing(CurZoneEqNum).CoolDDNum).Month = 7; + state->dataWeatherManager->DesDayInput(FinalZoneSizing(CurZoneEqNum).CoolDDNum).DayOfMonth = 15; // Also need to set this, it's used to check if DDNum <= TotDesDays DataEnvironment::TotDesDays = 1; @@ -932,8 +933,8 @@ TEST_F(EnergyPlusFixture, BaseSizer_FanPeak) // Now, we're ready to call the function bool errorsFound = false; SystemAirFlowSizer sizerSystemAirFlow; - sizerSystemAirFlow.initializeWithinEP(state, CompType, CompName, PrintWarning, CallingRoutine); - SizingResult = sizerSystemAirFlow.size(state, SizingResult, errorsFound); + sizerSystemAirFlow.initializeWithinEP(*state, CompType, CompName, PrintWarning, CallingRoutine); + SizingResult = sizerSystemAirFlow.size(*state, SizingResult, errorsFound); // Check that the Design Day/Time is filled EXPECT_EQ(DDTitle, OutputReportPredefined::RetrievePreDefTableEntry(OutputReportPredefined::pdchFanDesDay, CompName)); @@ -1422,7 +1423,7 @@ TEST_F(EnergyPlusFixture, BaseSizer_SupplyAirTempLessThanZoneTStatTest) ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::ManageSimulation(state); + SimulationManager::ManageSimulation(*state); int CtrlZoneNum(1); // design peak load conditons and design supply air temperature diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingAirFlowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingAirFlowSizing.unit.cc index 07e559db9a1..461a168baf0 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingAirFlowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingAirFlowSizing.unit.cc @@ -71,7 +71,7 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -82,10 +82,10 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) DataSizing::CurTermUnitSizingNum = 1; DataSizing::TermUnitSingDuct = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); // hard-sized value @@ -95,8 +95,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); // hard-sized value @@ -123,16 +123,16 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) EnergyPlus::DataSizing::FinalZoneSizing(1).HeatDDNum = 2; EnergyPlus::DataSizing::FinalZoneSizing(1).TimeStepNumAtCoolMax = 12; EnergyPlus::DataSizing::FinalZoneSizing(1).TimeStepNumAtHeatMax = 6; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataEnvironment::TotDesDays = 2; - state.dataWeatherManager->DesDayInput.allocate(2); - state.dataWeatherManager->DesDayInput(1).Month = 7; - state.dataWeatherManager->DesDayInput(1).DayOfMonth = 7; - state.dataWeatherManager->DesDayInput(2).Month = 1; - state.dataWeatherManager->DesDayInput(2).DayOfMonth = 1; - state.dataWeatherManager->DesDayInput(1).Title = "CoolingDD"; - state.dataWeatherManager->DesDayInput(2).Title = "HeatingDD"; + state->dataWeatherManager->DesDayInput.allocate(2); + state->dataWeatherManager->DesDayInput(1).Month = 7; + state->dataWeatherManager->DesDayInput(1).DayOfMonth = 7; + state->dataWeatherManager->DesDayInput(2).Month = 1; + state->dataWeatherManager->DesDayInput(2).DayOfMonth = 1; + state->dataWeatherManager->DesDayInput(1).Title = "CoolingDD"; + state->dataWeatherManager->DesDayInput(2).Title = "HeatingDD"; // Test 2 - Zone Equipment, sizes to greater of zone cooling and heating flow // start with an auto-sized value as the user input @@ -140,8 +140,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing DataSizing::ZoneSizingInput.allocate(1); DataSizing::ZoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.6, sizedValue, 0.0001); @@ -156,8 +156,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); @@ -169,8 +169,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.6, sizedValue, 0.0001); @@ -181,8 +181,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.6, sizedValue, 0.0001); // data fraction has no affect on cooling air flow rate @@ -196,8 +196,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.8, sizedValue, 0.0001); // max of zone cooling/heating/ZoneEqSizing @@ -209,8 +209,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.6, sizedValue, 0.0001); // zone cooling flow @@ -222,8 +222,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // zone heating flow @@ -236,8 +236,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2.2, sizedValue, 0.0001); // ZoneEqSizing cooling flow @@ -250,8 +250,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.2, sizedValue, 0.0001); // ZoneEqSizing heating flow @@ -262,8 +262,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.2, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -279,8 +279,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -293,8 +293,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.48, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -305,8 +305,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of FinalZoneSizing cooling/heating flow * fraction @@ -317,8 +317,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.88, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -330,8 +330,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -342,8 +342,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of FinalZoneSizing cooling/heating flow * fraction @@ -357,8 +357,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -370,8 +370,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.48, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -383,8 +383,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.88, sizedValue, 0.0001); // max of ZoneEqSizing cooling flow * fraction @@ -396,8 +396,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of ZoneEqSizing heating flow * fraction @@ -408,8 +408,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -421,8 +421,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of FinalZoneSizing cooling/heating flow * fraction @@ -439,8 +439,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // flow per cooling capacity @@ -452,8 +452,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // flow per heating capacity @@ -465,8 +465,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // max of ZoneEqSizing cooling capacity * fraction @@ -478,8 +478,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // ZoneEqSizing heating capacity * fraction @@ -490,8 +490,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -503,8 +503,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of autosized cooling/heating capacity * fraction @@ -517,8 +517,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // flow per cooling capacity @@ -530,8 +530,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // flow per heating capacity @@ -543,8 +543,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // max of autosized cooling capacity * fraction @@ -556,8 +556,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // autosized heating capacity * fraction @@ -568,8 +568,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of autosized cooling/heating capacity * fraction @@ -581,8 +581,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of autosized cooling/heating capacity * fraction @@ -593,8 +593,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) DataSizing::ZoneEqSizing(1).AirVolFlow = 1.75; inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.75, sizedValue, 0.0001); // parent passed size @@ -604,8 +604,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // Test 37 - Zone Equipment, hard size with zone sizing run inputValue = 1.44; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1.44, sizedValue, 0.0001); // hard sized result @@ -615,8 +615,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) inputValue = 1.44; DataSizing::ZoneSizingRunDone = false; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1.44, sizedValue, 0.0001); // hard sized result @@ -628,8 +628,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) inputValue = 1.44; DataSizing::ZoneSizingRunDone = false; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1.33, sizedValue, 0.0001); // override result @@ -657,8 +657,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); // hard-sized value @@ -667,7 +667,7 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // Test 41 - Airloop Equipment - ems override is on DataSizing::SysSizingRunDone = true; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataEnvironment::TotDesDays = 2; DataSizing::SysSizPeakDDNum.allocate(2); DataSizing::SysSizPeakDDNum(1).CoolFlowPeakDD = 1; @@ -686,8 +686,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.33, sizedValue, 0.0001); @@ -711,8 +711,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); @@ -730,8 +730,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.0001); // set by UnitarySysEqSizing(1).CoolingAirVolFlow @@ -746,8 +746,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(7.2, sizedValue, 0.0001); @@ -758,15 +758,15 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) EnergyPlus::DataSizing::FinalSysSizing(1).DesHeatVolFlow = 0.0; EnergyPlus::DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 3.0; EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.0, sizedValue, 0.0001); @@ -779,8 +779,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.7, sizedValue, 0.0001); @@ -794,8 +794,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.6, sizedValue, 0.0001); @@ -803,15 +803,15 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // Test 48 - Outdoor Air System EnergyPlus::DataSizing::OASysEqSizing(1).CoolingAirFlow = false; - state.dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 4.8; + state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 4.8; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4.0, sizedValue, 0.0001); // 4.8 / 1.2 = 4 @@ -828,8 +828,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.4, sizedValue, 0.01); // uses main flow rate @@ -841,8 +841,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.3, sizedValue, 0.01); // uses cooling flow rate @@ -855,8 +855,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.2, sizedValue, 0.01); // uses heating flow rate @@ -869,8 +869,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.4, sizedValue, 0.01); // uses a main flow rate @@ -882,8 +882,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.4, sizedValue, 0.01); // uses main flow rate @@ -896,8 +896,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.8, sizedValue, 0.01); // uses cooling flow rate @@ -913,8 +913,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2.0, sizedValue, 0.01); // hard-sized value @@ -937,8 +937,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2.2, sizedValue, 0.01); // hard-sized value @@ -961,8 +961,8 @@ TEST_F(AutoSizingFixture, CoolingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2.9, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc index 5d6b8982621..575a1c9478d 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingCapacitySizing.unit.cc @@ -51,6 +51,7 @@ #include #include #include +#include #include #include @@ -82,10 +83,10 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) ASSERT_TRUE(process_idf(idf_objects)); DataEnvironment::StdRhoAir = 1.2; // call simulate to trigger sizing call - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, "MyFan")); + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, "MyFan")); DataLoopNode::Node(1).Press = 101325.0; DataLoopNode::Node(1).Temp = 24.0; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _); // this global state is what would be set up by E+ currently static std::string const routineName("CoolingCapacitySizingGauntlet"); @@ -99,7 +100,7 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -111,8 +112,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) DataSizing::TermUnitSingDuct = true; // Test #1 - Zone Equipment, no autosizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5125.3, sizedValue, 0.01); // hard-sized value @@ -128,8 +129,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) DataSizing::ZoneEqSizing(1).DesignSizeFromParent = true; DataSizing::ZoneEqSizing(1).DesCoolingLoad = sizedValue; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5125.3, sizedValue, 0.01); // hard-sized value @@ -168,8 +169,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.zoneSizingInput.allocate(1); sizer.zoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4981.71, sizedValue, 0.01); @@ -184,8 +185,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4000.0, sizedValue, 0.01); @@ -199,8 +200,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilWater_CoolingHXAssisted), "MyHXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilWater_CoolingHXAssisted), "MyHXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4268.66, sizedValue, 0.01); @@ -213,8 +214,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3500.0, sizedValue, 0.01); @@ -228,8 +229,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4862.02, sizedValue, 0.01); @@ -243,8 +244,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3843.78, sizedValue, 0.01); @@ -258,8 +259,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4862.02, sizedValue, 0.01); @@ -274,8 +275,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) inputValue = 5500.0; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5500.0, sizedValue, 0.01); // hard size value @@ -307,8 +308,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2700.8, sizedValue, 0.0001); // hard-sized value @@ -316,7 +317,7 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) EXPECT_TRUE(compare_eio_stream(eiooutput, true)); DataSizing::SysSizingRunDone = true; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataSizing::SysSizInput.allocate(1); DataSizing::SysSizInput(1).AirLoopNum = 1; DataSizing::FinalSysSizing.allocate(1); @@ -334,8 +335,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4981.71, sizedValue, 0.01); @@ -349,15 +350,15 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4981.71, sizedValue, 0.01); // no change in capacity because coil is in air loop sizer.autoSizedValue = 0.0; // reset for next test // Test 13 - Airloop Equipment, with OA and precooling of OA stream - state.dataAirSystemsData->PrimaryAirSystems(1).NumOACoolCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).NumOACoolCoils = 1; DataSizing::FinalSysSizing(1).PrecoolTemp = 12.0; DataSizing::FinalSysSizing(1).PrecoolHumRat = 0.008; // start with an autosized value @@ -365,8 +366,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4582.31, sizedValue, 0.01); // change in capacity because precool conditions mixed with return @@ -379,8 +380,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) Fans::Fan(1).FanEff = 0.6; Fans::Fan(1).MotInAirFrac = 0.5; Fans::Fan(1).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; - state.dataAirSystemsData->PrimaryAirSystems(1).SupFanNum = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).supFanModelTypeEnum = DataAirSystems::structArrayLegacyFanModels; + state->dataAirSystemsData->PrimaryAirSystems(1).SupFanNum = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).supFanModelTypeEnum = DataAirSystems::structArrayLegacyFanModels; DataSizing::DataFanPlacement = DataSizing::zoneFanPlacement::zoneBlowThru; // Test 14 - Airloop Equipment, with OA and precooling of OA stream, add fan heat @@ -389,8 +390,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4740.64, sizedValue, 0.01); // change in capacity because precool conditions mixed with return @@ -403,14 +404,14 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // Test 15 - Airloop Equipment, with OA and precooling of OA stream, add fan heat, add scalable capacity sizing DataSizing::FinalSysSizing(1).CoolingCapMethod = DataSizing::FractionOfAutosizedCoolingCapacity; DataSizing::FinalSysSizing(1).FractionOfAutosizedCoolingCapacity = 0.5; - state.dataAirSystemsData->PrimaryAirSystems(1).supFanLocation = DataAirSystems::fanPlacement::BlowThru; + state->dataAirSystemsData->PrimaryAirSystems(1).supFanLocation = DataAirSystems::fanPlacement::BlowThru; // start with an autosized value inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(unScaledCapacity * 0.5, sizedValue, 0.01); // change in capacity because precool conditions mixed with return @@ -428,8 +429,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4500.0, sizedValue, 0.01); // capacity precalculated and saved in FinalSysSizing(1).CoolingTotalCapacity @@ -443,8 +444,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3500.0, sizedValue, 0.01); // capacity precalculated and saved in FinalSysSizing(1).CoolingTotalCapacity @@ -459,8 +460,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2500.0, sizedValue, 0.01); // capacity precalculated and saved in UnitarySysEqSizing(1).DesCoolingLoad @@ -477,8 +478,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1500.0, sizedValue, 0.01); // capacity precalculated and saved in OASysEqSizing(1).DesCoolingLoad @@ -486,25 +487,25 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // Test 20 - OA Equipment, DOAS Air loop DataSizing::OASysEqSizing(1).CoolingCapacity = false; - state.dataAirLoop->OutsideAirSys.allocate(1); - state.dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 0.2; - state.dataAirLoopHVACDOAS->airloopDOAS[0].SizingCoolOATemp = 32.0; - state.dataAirLoopHVACDOAS->airloopDOAS[0].m_FanIndex = 0; - state.dataAirLoopHVACDOAS->airloopDOAS[0].FanBlowTroughFlag = true; - state.dataAirLoopHVACDOAS->airloopDOAS[0].m_FanTypeNum = SimAirServingZones::Fan_System_Object; - state.dataAirLoopHVACDOAS->airloopDOAS[0].SizingCoolOAHumRat = 0.009; - state.dataAirLoopHVACDOAS->airloopDOAS[0].PrecoolTemp = 12.0; - state.dataAirLoopHVACDOAS->airloopDOAS[0].PrecoolHumRat = 0.006; + state->dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 0.2; + state->dataAirLoopHVACDOAS->airloopDOAS[0].SizingCoolOATemp = 32.0; + state->dataAirLoopHVACDOAS->airloopDOAS[0].m_FanIndex = 0; + state->dataAirLoopHVACDOAS->airloopDOAS[0].FanBlowTroughFlag = true; + state->dataAirLoopHVACDOAS->airloopDOAS[0].m_FanTypeNum = SimAirServingZones::Fan_System_Object; + state->dataAirLoopHVACDOAS->airloopDOAS[0].SizingCoolOAHumRat = 0.009; + state->dataAirLoopHVACDOAS->airloopDOAS[0].PrecoolTemp = 12.0; + state->dataAirLoopHVACDOAS->airloopDOAS[0].PrecoolHumRat = 0.006; // start with an autosized value inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5634.12, sizedValue, 0.01); // capacity includes system fan heat @@ -519,8 +520,8 @@ TEST_F(AutoSizingFixture, CoolingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(4200.0, sizedValue, 0.01); // hard sized capacity diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingSHRSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingSHRSizing.unit.cc index 0aa4c3ffdc3..5898a5973cc 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingSHRSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingSHRSizing.unit.cc @@ -50,6 +50,7 @@ #include #include +#include namespace EnergyPlus { @@ -68,7 +69,7 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -86,8 +87,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) // Test #1 - Zone Equipment, no autosizing, missing input data DataSizing::DataFlowUsedForSizing = 0.5; // DataCapacityUsedForSizing not initialized - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // no sizing error since not autosized EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.85, sizedValue, 0.01); // default value on error @@ -102,8 +103,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) printFlag = true; inputValue = 0.85; DataSizing::DataCapacityUsedForSizing = 10000.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.85, sizedValue, 0.01); // hard-sized value @@ -130,8 +131,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) // do sizing DataSizing::ZoneSizingInput.allocate(1); DataSizing::ZoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.7763, sizedValue, 0.000001); @@ -145,8 +146,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) // Test #4 - Zone Equipment, repeat with autosized and no initialized DataCapacityUsedForSizing inputValue = EnergyPlus::DataSizing::AutoSize; DataSizing::DataCapacityUsedForSizing = 0.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_TRUE(errorsFound); EXPECT_TRUE(sizer.wasAutoSized); @@ -155,8 +156,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) // Test #5 - Zone Equipment, flow to capacity ratio high DataSizing::DataCapacityUsedForSizing = 10000.0; DataSizing::DataFlowUsedForSizing = 1.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // missing Data* globals and Plant data EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.800655, sizedValue, 0.000001); // includes impact of ValidateADP @@ -170,8 +171,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); initialSHR = 0.431 + 6086.0 * DataHVACGlobals::MinRatedVolFlowPerRatedTotCap(DataHVACGlobals::DXCT); // does not include impact of ValidateADP, which increases SHR @@ -189,8 +190,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; DataHVACGlobals::DXCT = DataHVACGlobals::DOASDXCoil; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); RatedVolFlowPerRatedTotCap = DataSizing::DataFlowUsedForSizing / DataSizing::DataCapacityUsedForSizing; @@ -206,8 +207,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) // Test #8 - Zone Equipment, flow to capacity ratio high DataSizing::DataFlowUsedForSizing = 1.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // missing Data* globals and Plant data EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.800798, sizedValue, 0.000001); // includes impact of ValidateADP @@ -221,8 +222,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); initialSHR = 0.431 + 6086.0 * DataHVACGlobals::MinRatedVolFlowPerRatedTotCap(DataHVACGlobals::DXCT); // does not include impact of ValidateADP, which increases SHR @@ -250,8 +251,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.67, sizedValue, 0.001); // hard-sized value @@ -272,8 +273,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.77630, sizedValue, 0.000001); @@ -292,8 +293,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.800160, sizedValue, 0.000001); @@ -307,8 +308,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.675083, sizedValue, 0.000001); @@ -329,8 +330,8 @@ TEST_F(AutoSizingFixture, CoolingSHRSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.52, sizedValue, 0.000001); diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletHumRatSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletHumRatSizing.unit.cc index e2a0a09986c..8c11edaea8c 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletHumRatSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletHumRatSizing.unit.cc @@ -70,7 +70,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -83,8 +83,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) has_eio_output(true); // Test #1 - Zone Equipment, no autosizing, TU type not set - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.009, sizedValue, 0.001); // hard-sized value @@ -96,8 +96,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) // Test #2 - Zone Equipment, no autosizing, TU type not set printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.009, sizedValue, 0.001); // hard-sized value @@ -135,8 +135,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.008, sizedValue, 0.0001); @@ -153,8 +153,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.008, sizedValue, 0.0001); @@ -168,8 +168,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.007, sizedValue, 0.0001); @@ -183,8 +183,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.007, sizedValue, 0.0001); @@ -197,8 +197,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); Real64 mixedHumRat = 0.9 * 0.007 + 0.1 * 0.004; // 90% of ZoneHumRatAtCoolPeak, 10% of OutHumRatAtCoolPeak @@ -214,8 +214,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(mixedHumRat2, sizedValue, 0.00001); @@ -243,8 +243,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.012, sizedValue, 0.0001); // hard-sized value @@ -252,7 +252,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) EXPECT_TRUE(compare_eio_stream(eiooutput, true)); // Test 10 - Airloop Equipment - no OA coils - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataSizing::SysSizingRunDone = true; EnergyPlus::DataSizing::FinalSysSizing.allocate(1); EnergyPlus::DataSizing::SysSizInput.allocate(1); @@ -265,8 +265,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0105, sizedValue, 0.01); @@ -279,7 +279,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) EXPECT_TRUE(compare_eio_stream(eiooutput, true)); // Test 11 - Airloop Equipment - 1 OA coil, use PrecoolHumRat - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).RetHumRatAtCoolPeak = 0.015; EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).PrecoolHumRat = 0.01; @@ -289,8 +289,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.010, sizedValue, 0.00001); @@ -304,8 +304,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0145, sizedValue, 0.00001); @@ -314,7 +314,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) // OUTDOOR AIR SYSTEM EQUIPMENT TESTING // Test 13 - Outdoor Air System Equipment, no DOAS air loop EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).OutHumRatAtCoolPeak = 0.003; // start with an auto-sized value as the user input @@ -322,8 +322,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); Real64 outAirHumRat = EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).OutHumRatAtCoolPeak; @@ -332,17 +332,17 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) // Test 14 - Outdoor Air System Equipment with DOAS system EnergyPlus::DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 0.0; - state.dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].SizingCoolOAHumRat = 0.0036; + state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].SizingCoolOAHumRat = 0.0036; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0036, sizedValue, 0.00001); // DOAS system hum rat @@ -358,8 +358,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(inputValue, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc index 91610145e9d..953128ae50f 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirInletTempSizing.unit.cc @@ -52,6 +52,8 @@ #include #include #include +#include +#include namespace EnergyPlus { @@ -69,7 +71,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -82,8 +84,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) has_eio_output(true); // Test #1 - Zone Equipment, no autosizing, TU type not set - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(23.7, sizedValue, 0.001); // hard-sized value @@ -95,8 +97,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) // Test #2 - Zone Equipment, no autosizing, TU type not set printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(23.7, sizedValue, 0.001); // hard-sized value @@ -135,8 +137,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(22.88, sizedValue, 0.0001); @@ -153,8 +155,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(22.88, sizedValue, 0.0001); @@ -168,8 +170,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(21.77, sizedValue, 0.0001); @@ -192,8 +194,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(22.5464, sizedValue, 0.0001); @@ -208,8 +210,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(21.77, sizedValue, 0.0001); // no fan heat since DataFanInext = -1 @@ -222,8 +224,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); Real64 mixedTemp = 0.9 * 21.77 + 0.1 * 29.0; // 90% of ZoneTempAtCoolPeak, 10% of OutTempAtCoolPeak @@ -239,8 +241,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(mixedTemp2, sizedValue, 0.00001); @@ -261,7 +263,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) DataSizing::CurSysNum = 1; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataSizing::NumSysSizInput = 1; DataSizing::SysSizingRunDone = false; // start with a hard-sized value as the user input, no system sizing arrays @@ -269,8 +271,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(18.0, sizedValue, 0.0001); // hard-sized value @@ -291,17 +293,17 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; DataSizing::DataDesInletAirTemp = 19.155; sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(19.155, sizedValue, 0.001); sizer.autoSizedValue = 0.0; // reset for next test DataSizing::DataDesInletAirTemp = 0.0; - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 0; DataSizing::DataDesInletAirTemp = 0.0; // Test 13 - Airloop Equipment - no OA coils @@ -310,8 +312,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(20.15, sizedValue, 0.01); @@ -324,7 +326,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) EXPECT_TRUE(compare_eio_stream(eiooutput, true)); // Test 14 - Airloop Equipment - 1 OA coil, use PrecoolHumRat - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).PrecoolTemp = 12.21; // start with an auto-sized value as the user input @@ -333,8 +335,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(12.21, sizedValue, 0.00001); @@ -348,8 +350,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(22.92, sizedValue, 0.00001); @@ -358,15 +360,15 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) // OUTDOOR AIR SYSTEM EQUIPMENT TESTING // Test 16 - Outdoor Air System Equipment, no DOAS air loop EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); Real64 outAirTemp = EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).OutTempAtCoolPeak; @@ -375,17 +377,17 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) // Test 17 - Outdoor Air System Equipment with DOAS system EnergyPlus::DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 0.0; - state.dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].SizingCoolOATemp = 27.44; + state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].SizingCoolOATemp = 27.44; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(27.44, sizedValue, 0.00001); // DOAS system hum rat @@ -401,8 +403,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(inputValue, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletHumRatSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletHumRatSizing.unit.cc index 44a7da943be..5ebbc6ccbc2 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletHumRatSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletHumRatSizing.unit.cc @@ -70,7 +70,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -83,8 +83,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) has_eio_output(true); // Test #1 - Zone Equipment, no autosizing, TU type not set - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.006, sizedValue, 0.001); // hard-sized value @@ -96,8 +96,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // Test #2 - Zone Equipment, no autosizing, TU type not set printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.006, sizedValue, 0.001); // hard-sized value @@ -130,8 +130,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.008, sizedValue, 0.0001); @@ -148,8 +148,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.008, sizedValue, 0.0001); @@ -163,8 +163,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.008, sizedValue, 0.0001); @@ -178,8 +178,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); // humidity ratio at 12 C and 90% RH @@ -208,8 +208,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.012, sizedValue, 0.0001); // hard-sized value @@ -219,7 +219,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // Test 10 - Airloop Equipment - no OA coils DataSizing::CurSysNum = 1; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataSizing::NumSysSizInput = 1; DataSizing::SysSizingRunDone = true; EnergyPlus::DataSizing::FinalSysSizing.allocate(1); @@ -233,8 +233,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); // outlet air hum rat > inlet air hum rat and capped at inlet air hum rat @@ -249,7 +249,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) EXPECT_TRUE(compare_eio_stream(eiooutput, true)); // Test 11 - Airloop Equipment - 1 OA coil, use PrecoolHumRat - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; EnergyPlus::DataSizing::FinalSysSizing(1).CoolSupHumRat = 0.0075; // start with an auto-sized value as the user input @@ -258,8 +258,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0075, sizedValue, 0.00001); @@ -272,8 +272,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0077, sizedValue, 0.00001); @@ -282,7 +282,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // OUTDOOR AIR SYSTEM EQUIPMENT TESTING // Test 13 - Outdoor Air System Equipment, no DOAS air loop EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).OutHumRatAtCoolPeak = 0.005; EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).PrecoolHumRat = 0.004; @@ -291,8 +291,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); Real64 precoolHumRat = EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).PrecoolHumRat; @@ -301,17 +301,17 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // Test 14 - Outdoor Air System Equipment with DOAS system EnergyPlus::DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 0.0; - state.dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].PrecoolHumRat = 0.0036; + state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].PrecoolHumRat = 0.0036; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0036, sizedValue, 0.00001); // DOAS system hum rat @@ -326,8 +326,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(inputValue, sizedValue, 0.01); // hard-sized value @@ -352,8 +352,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(DataSizing::DataDesInletAirHumRat, sizedValue, 0.0001); // hard-sized value @@ -376,8 +376,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(DataSizing::DataDesInletAirHumRat, sizedValue, 0.0001); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc index 217ef0b3eb8..988a75393f6 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesAirOutletTempSizing.unit.cc @@ -52,6 +52,8 @@ #include #include #include +#include +#include namespace EnergyPlus { @@ -69,7 +71,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -82,8 +84,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) has_eio_output(true); // Test #1 - Zone Equipment, no autosizing, TU type not set - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(13.7, sizedValue, 0.001); // hard-sized value @@ -95,8 +97,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) // Test #2 - Zone Equipment, no autosizing, TU type not set printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(13.7, sizedValue, 0.001); // hard-sized value @@ -132,8 +134,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(12.88, sizedValue, 0.0001); @@ -156,8 +158,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(12.88, sizedValue, 0.0001); @@ -172,8 +174,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(14.408, sizedValue, 0.001); @@ -196,8 +198,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.729, sizedValue, 0.001); @@ -212,8 +214,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(12.88, sizedValue, 0.0001); // no fan heat since DataFanInext = -1 @@ -225,8 +227,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(DataSizing::DataDesInletWaterTemp + 0.5, sizedValue, 0.0001); // 0.5 C above inlet water temp @@ -246,7 +248,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) DataSizing::CurSysNum = 1; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataSizing::NumSysSizInput = 1; DataSizing::SysSizingRunDone = false; // start with a hard-sized value as the user input, no system sizing arrays @@ -254,8 +256,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(14.0, sizedValue, 0.0001); // hard-sized value @@ -277,8 +279,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(12.15, sizedValue, 0.01); @@ -291,7 +293,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) EXPECT_TRUE(compare_eio_stream(eiooutput, true)); // Test 11 - Airloop Equipment - no OA coils, with fan heat - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).supFanLocation = DataAirSystems::fanPlacement::DrawThru; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).supFanLocation = DataAirSystems::fanPlacement::DrawThru; DataSizing::DataFanIndex = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; @@ -299,15 +301,15 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(12.026, sizedValue, 0.001); sizer.autoSizedValue = 0.0; // reset for next test // Test 12 - Airloop Equipment - 1 OA coil, use PrecoolHumRat - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).PrecoolTemp = 12.21; // start with an auto-sized value as the user input @@ -316,8 +318,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(12.026, sizedValue, 0.0001); @@ -331,8 +333,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(10.476, sizedValue, 0.001); // includes impact of fan heat @@ -342,15 +344,15 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) // OUTDOOR AIR SYSTEM EQUIPMENT TESTING // Test 14 - Outdoor Air System Equipment, no DOAS air loop EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); Real64 outAirTemp = EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).PrecoolTemp; @@ -359,17 +361,17 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) // Test 15 - Outdoor Air System Equipment with DOAS system EnergyPlus::DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 0.0; - state.dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].PrecoolTemp = 11.44; + state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].PrecoolTemp = 11.44; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(11.44, sizedValue, 0.00001); // DOAS system hum rat @@ -385,8 +387,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(inputValue, sizedValue, 0.01); // hard-sized value @@ -408,8 +410,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesAirOutletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(DataSizing::DataDesInletWaterTemp + 0.5, sizedValue, 0.01); // 0.5 C above water temp diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesWaterInletTempSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesWaterInletTempSizing.unit.cc index df054d32691..428181abf9a 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesWaterInletTempSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterDesWaterInletTempSizing.unit.cc @@ -50,6 +50,8 @@ #include #include +#include +#include namespace EnergyPlus { @@ -65,7 +67,7 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -74,10 +76,10 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) // ZONE EQUIPMENT TESTING DataSizing::DataPltSizCoolNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -87,8 +89,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -108,8 +110,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -122,8 +124,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -136,8 +138,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -150,8 +152,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -163,8 +165,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -175,8 +177,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -187,8 +189,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); // uses a mass flow rate for sizing @@ -216,8 +218,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -240,8 +242,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -260,8 +262,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -273,8 +275,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -287,8 +289,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -300,8 +302,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -314,8 +316,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -324,31 +326,31 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) // OUTDOOR AIR SYSTEM EQUIPMENT TESTING // Test 16 - Outdoor Air System Equipment, no DOAS air loop EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); sizer.autoSizedValue = 0.0; // reset for next test // Test 17 - Outdoor Air System Equipment with DOAS system - state.dataAirLoop->OutsideAirSys(DataSizing::CurOASysNum).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].HeatOutTemp = 12.0; + state->dataAirLoop->OutsideAirSys(DataSizing::CurOASysNum).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].HeatOutTemp = 12.0; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); // uses a mass flow rate for sizing @@ -363,8 +365,8 @@ TEST_F(AutoSizingFixture, CoolingWaterDesWaterInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(12.0, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterNumofTubesPerRowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterNumofTubesPerRowSizing.unit.cc index 758f86de1ab..1484a3782e8 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterNumofTubesPerRowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterNumofTubesPerRowSizing.unit.cc @@ -50,6 +50,7 @@ #include #include +#include namespace EnergyPlus { @@ -65,7 +66,7 @@ TEST_F(AutoSizingFixture, CoolingWaterNumofTubesPerRowSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -74,10 +75,10 @@ TEST_F(AutoSizingFixture, CoolingWaterNumofTubesPerRowSizingGauntlet) // ZONE EQUIPMENT TESTING DataSizing::DataPltSizCoolNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -87,8 +88,8 @@ TEST_F(AutoSizingFixture, CoolingWaterNumofTubesPerRowSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -108,8 +109,8 @@ TEST_F(AutoSizingFixture, CoolingWaterNumofTubesPerRowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.0, sizedValue, 0.01); @@ -123,8 +124,8 @@ TEST_F(AutoSizingFixture, CoolingWaterNumofTubesPerRowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4.0, sizedValue, 0.01); @@ -152,8 +153,8 @@ TEST_F(AutoSizingFixture, CoolingWaterNumofTubesPerRowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -174,8 +175,8 @@ TEST_F(AutoSizingFixture, CoolingWaterNumofTubesPerRowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4.0, sizedValue, 0.01); @@ -189,30 +190,30 @@ TEST_F(AutoSizingFixture, CoolingWaterNumofTubesPerRowSizingGauntlet) // OUTDOOR AIR SYSTEM EQUIPMENT TESTING // Test 6 - Outdoor Air System Equipment, no DOAS air loop EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4.0, sizedValue, 0.01); sizer.autoSizedValue = 0.0; // reset for next test // Test 7 - Outdoor Air System Equipment with DOAS system - state.dataAirLoop->OutsideAirSys(DataSizing::CurOASysNum).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoop->OutsideAirSys(DataSizing::CurOASysNum).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4.0, sizedValue, 0.01); // uses a mass flow rate for sizing @@ -227,8 +228,8 @@ TEST_F(AutoSizingFixture, CoolingWaterNumofTubesPerRowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc index 38a1aabb248..f5f2181da46 100644 --- a/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/CoolingWaterflowSizing.unit.cc @@ -52,6 +52,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -69,7 +70,7 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -84,8 +85,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) DataSizing::TermUnitSizing(1).MaxCWVolFlow = 0.005; // Test #1 - Zone Equipment, no autosizing, missing input data - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -95,8 +96,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) DataSizing::DataWaterLoopNum = 1; DataPlant::PlantLoop.allocate(1); DataSizing::DataWaterCoilSizCoolDeltaT = 10.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -106,8 +107,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -140,8 +141,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) // do sizing DataSizing::ZoneSizingInput.allocate(1); DataSizing::ZoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.000149, sizedValue, 0.000001); @@ -163,8 +164,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) Fans::Fan(1).FanType_Num = DataHVACGlobals::FanType_SimpleConstVolume; DataSizing::DataFanIndex = 1; DataSizing::DataFanEnumType = DataAirSystems::structArrayLegacyFanModels; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // missing Data* globals and Plant data EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.000154, sizedValue, 0.000001); @@ -186,8 +187,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.000154, sizedValue, 0.01); @@ -200,8 +201,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.005, sizedValue, 0.0001); @@ -215,8 +216,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.3, sizedValue, 0.0001); @@ -230,8 +231,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.3, sizedValue, 0.0001); @@ -244,8 +245,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.000309, sizedValue, 0.000001); @@ -266,7 +267,7 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) DataSizing::CurSysNum = 1; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataSizing::NumSysSizInput = 1; DataSizing::SysSizingRunDone = false; DataSizing::DataCapacityUsedForSizing = 5000.0; @@ -275,8 +276,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -296,8 +297,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.000238, sizedValue, 0.000001); @@ -323,8 +324,8 @@ TEST_F(AutoSizingFixture, CoolingWaterflowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.0002, sizedValue, 0.000001); diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingAirFlowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingAirFlowSizing.unit.cc index d68e564f7fb..b957c38950a 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingAirFlowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingAirFlowSizing.unit.cc @@ -71,7 +71,7 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -82,10 +82,10 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) DataSizing::CurTermUnitSizingNum = 1; DataSizing::TermUnitSingDuct = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); // hard-sized value @@ -95,8 +95,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); // hard-sized value @@ -123,16 +123,16 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) EnergyPlus::DataSizing::FinalZoneSizing(1).HeatDDNum = 2; EnergyPlus::DataSizing::FinalZoneSizing(1).TimeStepNumAtCoolMax = 12; EnergyPlus::DataSizing::FinalZoneSizing(1).TimeStepNumAtHeatMax = 6; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataEnvironment::TotDesDays = 2; - state.dataWeatherManager->DesDayInput.allocate(2); - state.dataWeatherManager->DesDayInput(1).Month = 7; - state.dataWeatherManager->DesDayInput(1).DayOfMonth = 7; - state.dataWeatherManager->DesDayInput(2).Month = 1; - state.dataWeatherManager->DesDayInput(2).DayOfMonth = 1; - state.dataWeatherManager->DesDayInput(1).Title = "CoolingDD"; - state.dataWeatherManager->DesDayInput(2).Title = "HeatingDD"; + state->dataWeatherManager->DesDayInput.allocate(2); + state->dataWeatherManager->DesDayInput(1).Month = 7; + state->dataWeatherManager->DesDayInput(1).DayOfMonth = 7; + state->dataWeatherManager->DesDayInput(2).Month = 1; + state->dataWeatherManager->DesDayInput(2).DayOfMonth = 1; + state->dataWeatherManager->DesDayInput(1).Title = "CoolingDD"; + state->dataWeatherManager->DesDayInput(2).Title = "HeatingDD"; // Test 2 - Zone Equipment, sizes to greater of zone cooling and heating flow // start with an auto-sized value as the user input @@ -140,8 +140,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing DataSizing::ZoneSizingInput.allocate(1); DataSizing::ZoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.6, sizedValue, 0.0001); @@ -156,8 +156,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); @@ -169,8 +169,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.6, sizedValue, 0.0001); @@ -181,8 +181,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.6, sizedValue, 0.0001); // data fraction has no affect on cooling air flow rate @@ -196,8 +196,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.8, sizedValue, 0.0001); // max of zone cooling/heating/ZoneEqSizing @@ -209,8 +209,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.6, sizedValue, 0.0001); // zone cooling flow @@ -222,8 +222,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // zone heating flow @@ -236,8 +236,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2.2, sizedValue, 0.0001); // ZoneEqSizing cooling flow @@ -250,8 +250,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.2, sizedValue, 0.0001); // ZoneEqSizing heating flow @@ -262,8 +262,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.2, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -279,8 +279,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -293,8 +293,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.48, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -305,8 +305,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of FinalZoneSizing cooling/heating flow * fraction @@ -317,8 +317,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.88, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -330,8 +330,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -342,8 +342,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of FinalZoneSizing cooling/heating flow * fraction @@ -357,8 +357,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -370,8 +370,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.48, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -383,8 +383,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.88, sizedValue, 0.0001); // max of ZoneEqSizing cooling flow * fraction @@ -396,8 +396,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of ZoneEqSizing heating flow * fraction @@ -408,8 +408,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -421,8 +421,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of FinalZoneSizing cooling/heating flow * fraction @@ -439,8 +439,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // flow per cooling capacity @@ -452,8 +452,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // flow per heating capacity @@ -465,8 +465,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // max of ZoneEqSizing cooling capacity * fraction @@ -478,8 +478,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // ZoneEqSizing heating capacity * fraction @@ -490,8 +490,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -503,8 +503,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of autosized cooling/heating capacity * fraction @@ -517,8 +517,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // flow per cooling capacity @@ -530,8 +530,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // flow per heating capacity @@ -543,8 +543,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // max of autosized cooling capacity * fraction @@ -556,8 +556,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // autosized heating capacity * fraction @@ -568,8 +568,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of autosized cooling/heating capacity * fraction @@ -581,8 +581,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of autosized cooling/heating capacity * fraction @@ -593,8 +593,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) DataSizing::ZoneEqSizing(1).AirVolFlow = 1.75; inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.75, sizedValue, 0.0001); // parent passed size @@ -604,8 +604,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // Test 37 - Zone Equipment, hard size with zone sizing run inputValue = 1.44; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1.44, sizedValue, 0.0001); // hard sized result @@ -615,8 +615,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) inputValue = 1.44; DataSizing::ZoneSizingRunDone = false; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1.44, sizedValue, 0.0001); // hard sized result @@ -628,8 +628,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) inputValue = 1.44; DataSizing::ZoneSizingRunDone = false; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1.33, sizedValue, 0.0001); // override result @@ -657,8 +657,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); // hard-sized value @@ -667,7 +667,7 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // Test 41 - Airloop Equipment - ems override is on DataSizing::SysSizingRunDone = true; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataEnvironment::TotDesDays = 2; DataSizing::SysSizPeakDDNum.allocate(2); DataSizing::SysSizPeakDDNum(1).CoolFlowPeakDD = 1; @@ -686,8 +686,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.33, sizedValue, 0.0001); @@ -711,8 +711,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); @@ -730,8 +730,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(7.0, sizedValue, 0.0001); // set by UnitarySysEqSizing(1).HeatingAirVolFlow @@ -747,8 +747,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(7.2, sizedValue, 0.0001); // uses FinalSysSizing(1).DesHeatVolFlow @@ -759,15 +759,15 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) EnergyPlus::DataSizing::FinalSysSizing(1).DesHeatVolFlow = 0.0; EnergyPlus::DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 3.0; EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.0, sizedValue, 0.0001); @@ -780,8 +780,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.7, sizedValue, 0.0001); @@ -795,8 +795,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.0, sizedValue, 0.0001); // uses FinalSysSizing(this->curSysNum).DesOutAirVolFlow @@ -804,15 +804,15 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // Test 48 - Outdoor Air System EnergyPlus::DataSizing::OASysEqSizing(1).CoolingAirFlow = false; - state.dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 4.8; + state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 4.8; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4.0, sizedValue, 0.0001); // 4.8 / 1.2 = 4 @@ -829,8 +829,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.4, sizedValue, 0.01); // uses main flow rate @@ -842,8 +842,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.3, sizedValue, 0.01); // uses cooling flow rate @@ -856,8 +856,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.2, sizedValue, 0.01); // uses heating flow rate @@ -870,8 +870,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.4, sizedValue, 0.01); // uses a main flow rate @@ -883,8 +883,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.4, sizedValue, 0.01); // uses main flow rate @@ -897,8 +897,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.4, sizedValue, 0.01); // uses main flow rate, does not use DataAirFlowUsedForSizing @@ -914,8 +914,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2.0, sizedValue, 0.01); // hard-sized value @@ -938,8 +938,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2.2, sizedValue, 0.01); // hard-sized value @@ -962,8 +962,8 @@ TEST_F(AutoSizingFixture, HeatingAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2.9, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingAirflowUASizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingAirflowUASizing.unit.cc index 3452f8a9dcc..ead94b98372 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingAirflowUASizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingAirflowUASizing.unit.cc @@ -63,19 +63,19 @@ TEST_F(AutoSizingFixture, HeatingAirflowUA_APIExampleUnitTest) bool errorsFound = false; HeatingAirflowUASizer sizer; // initializeForSingleDuctZoneTerminal(Real64 const elevation, Real64 mainFlowRate) - sizer.initializeForSingleDuctZoneTerminal(state, 1650.0, 0.3); // Denver + sizer.initializeForSingleDuctZoneTerminal(*state, 1650.0, 0.3); // Denver EXPECT_TRUE(sizer.zoneSizingRunDone); EXPECT_EQ(sizer.curZoneEqNum, 1); EXPECT_TRUE(sizer.termUnitSingDuct); EXPECT_EQ(sizer.curTermUnitSizingNum, 1); EXPECT_GT(int(sizer.termUnitSizing.size()), 0); EXPECT_EQ(sizer.termUnitSizing(1).AirVolFlow, 0.3); - Real64 sizedValue = sizer.size(state, DataSizing::AutoSize, errorsFound); + Real64 sizedValue = sizer.size(*state, DataSizing::AutoSize, errorsFound); EXPECT_NEAR(sizedValue, 0.29599, 0.00001); // converts volume input to mass flow rate at elevation EXPECT_FALSE(errorsFound); - sizer.initializeForSingleDuctZoneTerminal(state, 0.0, 0.3); - sizedValue = sizer.size(state, DataSizing::AutoSize, errorsFound); + sizer.initializeForSingleDuctZoneTerminal(*state, 0.0, 0.3); + sizedValue = sizer.size(*state, DataSizing::AutoSize, errorsFound); EXPECT_NEAR(sizedValue, 0.36129, 0.00001); // converts volume input to mass flow rate at elevation } @@ -93,7 +93,7 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -104,10 +104,10 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) DataSizing::CurTermUnitSizingNum = 1; DataSizing::TermUnitSingDuct = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -117,8 +117,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -148,8 +148,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) // do sizing DataSizing::ZoneSizingInput.allocate(1); DataSizing::ZoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.01); @@ -165,8 +165,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.01); @@ -180,8 +180,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.01); @@ -194,8 +194,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.01); @@ -210,8 +210,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.01); @@ -227,8 +227,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.01); @@ -243,8 +243,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.01); @@ -258,8 +258,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // uses a mass flow rate for sizing @@ -287,8 +287,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -311,8 +311,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.01); @@ -333,8 +333,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.01); @@ -347,8 +347,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.0, sizedValue, 0.01); @@ -364,8 +364,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.01); @@ -378,8 +378,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.0, sizedValue, 0.01); @@ -395,8 +395,8 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.01); @@ -407,15 +407,15 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) EnergyPlus::DataSizing::FinalSysSizing(1).DesHeatVolFlow = 0.0; EnergyPlus::DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 5.0; EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.01); @@ -423,16 +423,16 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) // Test 18 - Outdoor Air System Equipment with DOAS system EnergyPlus::DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 0.0; - state.dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 5.0; + state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 5.0; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // uses a mass flow rate for sizing @@ -444,13 +444,13 @@ TEST_F(AutoSizingFixture, HeatingAirflowUASizingGauntlet) // Test 19 - Outdoor Air System Equipment with DOAS system, hard-sized air flow rate // start with an auto-sized value as the user input inputValue = 5.0; - state.dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 3.0; + state->dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 3.0; // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingCapacitySizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingCapacitySizing.unit.cc index ad639af1cba..112e955222a 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingCapacitySizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingCapacitySizing.unit.cc @@ -82,10 +82,10 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) ASSERT_TRUE(process_idf(idf_objects)); DataEnvironment::StdRhoAir = 1.2; // call simulate to trigger sizing call - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, "MyFan")); + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, "MyFan")); DataLoopNode::Node(1).Press = 101325.0; DataLoopNode::Node(1).Temp = 24.0; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _); // this global state is what would be set up by E+ currently static std::string const routineName("HeatingCapacitySizingGauntlet"); @@ -98,7 +98,7 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -110,8 +110,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) DataSizing::TermUnitSingDuct = true; // Test #1 - Zone Equipment, no autosizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5125.3, sizedValue, 0.01); // hard-sized value @@ -127,8 +127,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) DataSizing::ZoneEqSizing(1).DesignSizeFromParent = true; DataSizing::ZoneEqSizing(1).DesHeatingLoad = sizedValue; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5125.3, sizedValue, 0.01); // hard-sized value @@ -175,8 +175,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.zoneSizingInput.allocate(1); sizer.zoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3664.27, sizedValue, 0.01); @@ -190,8 +190,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2024.55, sizedValue, 0.01); @@ -205,8 +205,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_HeatingEmpirical), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_HeatingEmpirical), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2024.55, sizedValue, 0.01); @@ -218,8 +218,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2442.84, sizedValue, 0.01); @@ -233,8 +233,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2935.6, sizedValue, 0.01); @@ -248,8 +248,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1360.5, sizedValue, 0.01); @@ -263,8 +263,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2935.6, sizedValue, 0.01); @@ -278,8 +278,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2809.27, sizedValue, 0.01); @@ -292,8 +292,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6229.26, sizedValue, 0.01); @@ -307,8 +307,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4250.0, sizedValue, 0.01); @@ -322,8 +322,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5125.3, sizedValue, 0.01); @@ -338,8 +338,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2800.0, sizedValue, 0.01); @@ -355,8 +355,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; sizer.initializeWithinEP( - this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + *this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_CoolingSingleSpeed), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1500.0, sizedValue, 0.01); @@ -372,8 +372,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = 5500.0; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5500.0, sizedValue, 0.01); // hard size value @@ -404,8 +404,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2700.8, sizedValue, 0.0001); // hard-sized value @@ -413,8 +413,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) EXPECT_TRUE(compare_eio_stream(eiooutput, true)); DataSizing::SysSizingRunDone = true; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); DataSizing::UnitarySysEqSizing.allocate(1); DataSizing::SysSizInput.allocate(1); DataSizing::SysSizInput(1).AirLoopNum = 1; @@ -435,8 +435,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5024.3, sizedValue, 0.01); @@ -450,8 +450,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(unAdjustedSize * 0.5, sizedValue, 0.01); @@ -462,13 +462,13 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // Test 19 - Airloop Equipment, with min OA DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 0.02; DataSizing::FinalSysSizing(1).HeatOAOption = DataSizing::MinOA; - state.dataAirSystemsData->PrimaryAirSystems(1).NumOAHeatCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).NumOAHeatCoils = 1; // start with an autosized value inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2250.88, sizedValue, 0.01); @@ -481,8 +481,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4500.0, sizedValue, 0.01); @@ -497,8 +497,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5426.24, sizedValue, 0.01); @@ -513,8 +513,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2049.91, sizedValue, 0.01); @@ -528,8 +528,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1688.16, sizedValue, 0.01); @@ -542,8 +542,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3858.66, sizedValue, 0.01); @@ -555,8 +555,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1326.41, sizedValue, 0.01); @@ -569,8 +569,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3135.16, sizedValue, 0.01); @@ -582,8 +582,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1109.36, sizedValue, 0.01); @@ -596,8 +596,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3496.91, sizedValue, 0.01); @@ -609,8 +609,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3858.66, sizedValue, 0.01); @@ -622,8 +622,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3858.66, sizedValue, 0.01); @@ -631,28 +631,28 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // Test 31 - Airloop Equipment, CurDuctType = Main, Unitary system does not set size for HW coils // even when AirLoopControlInfo(1).UnitarySysSimulating = true - state.dataAirLoop->AirLoopControlInfo(1).UnitarySys = true; + state->dataAirLoop->AirLoopControlInfo(1).UnitarySys = true; DataSizing::UnitaryHeatCap = 4790.0; DataSizing::CurDuctType = DataHVACGlobals::Main; // start with an autosized value inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3858.66, sizedValue, 0.01); sizer.autoSizedValue = 0.0; // reset for next test // Test 32 - Airloop Equipment, CurDuctType = Main, Unitary system does set size for non-water heating coils - state.dataAirLoop->AirLoopControlInfo(1).UnitarySysSimulating = true; + state->dataAirLoop->AirLoopControlInfo(1).UnitarySysSimulating = true; // start with an autosized value inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_HeatingEmpirical), "MyDXCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilDX_HeatingEmpirical), "MyDXCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4790.0, sizedValue, 0.01); @@ -665,8 +665,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5325.0, sizedValue, 0.01); @@ -680,15 +680,15 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4325.0, sizedValue, 0.01); sizer.autoSizedValue = 0.0; // reset for next test DataSizing::DataCoolCoilCap = 0.0; - state.dataAirLoop->AirLoopControlInfo(1).UnitarySys = false; + state->dataAirLoop->AirLoopControlInfo(1).UnitarySys = false; // Test 35 - Airloop Equipment, CurDuctType = Main, air loop uses scaled sizing DataSizing::FinalSysSizing(1).HeatingCapMethod = DataSizing::CapacityPerFloorArea; @@ -697,8 +697,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3325.0, sizedValue, 0.01); @@ -711,8 +711,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2325.0, sizedValue, 0.01); @@ -722,14 +722,14 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // Test 37 - OA Equipment, OA Sys capacity sizing DataSizing::CurOASysNum = 1; - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::OASysEqSizing.allocate(1); // start with an autosized value inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(120.58, sizedValue, 0.01); @@ -742,8 +742,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(9043.73, sizedValue, 0.01); @@ -757,8 +757,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(7234.98, sizedValue, 0.01); @@ -772,8 +772,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4400.0, sizedValue, 0.01); @@ -789,8 +789,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(795.85, sizedValue, 0.01); @@ -799,22 +799,22 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // Test 42 - OA Equipment, DOAS Air loop DataSizing::OASysEqSizing(1).HeatingAirFlow = false; - state.dataAirLoop->OutsideAirSys.allocate(1); - state.dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 1.1; - state.dataAirLoopHVACDOAS->airloopDOAS[0].HeatOutTemp = 5.0; - state.dataAirLoopHVACDOAS->airloopDOAS[0].PreheatTemp = 11.0; - state.dataAirLoopHVACDOAS->airloopDOAS[0].m_FanIndex = 0; - state.dataAirLoopHVACDOAS->airloopDOAS[0].FanBlowTroughFlag = true; - state.dataAirLoopHVACDOAS->airloopDOAS[0].m_FanTypeNum = SimAirServingZones::Fan_System_Object; + state->dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].SizingMassFlow = 1.1; + state->dataAirLoopHVACDOAS->airloopDOAS[0].HeatOutTemp = 5.0; + state->dataAirLoopHVACDOAS->airloopDOAS[0].PreheatTemp = 11.0; + state->dataAirLoopHVACDOAS->airloopDOAS[0].m_FanIndex = 0; + state->dataAirLoopHVACDOAS->airloopDOAS[0].FanBlowTroughFlag = true; + state->dataAirLoopHVACDOAS->airloopDOAS[0].m_FanTypeNum = SimAirServingZones::Fan_System_Object; // start with an autosized value inputValue = DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6448.73, sizedValue, 0.01); // capacity includes system fan heat @@ -829,8 +829,8 @@ TEST_F(AutoSizingFixture, HeatingCapacitySizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(4200.0, sizedValue, 0.01); // hard sized capacity diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletHumRatSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletHumRatSizing.unit.cc index 3a6d7b40e53..8e7b5f4f8d0 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletHumRatSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletHumRatSizing.unit.cc @@ -70,7 +70,7 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -83,8 +83,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) has_eio_output(true); // Test #1 - Zone Equipment, no autosizing, TU type not set - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.009, sizedValue, 0.001); // hard-sized value @@ -96,8 +96,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) // Test #2 - Zone Equipment, no autosizing, TU type not set printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.009, sizedValue, 0.001); // hard-sized value @@ -145,8 +145,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.008, sizedValue, 0.0001); @@ -164,8 +164,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.007, sizedValue, 0.0001); @@ -177,8 +177,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); Real64 expectedValue = 0.7 * 0.007 + 0.3 * 0.008; // 70% zone + 30% DesHeatCoilInHumRatTU @@ -194,8 +194,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.006, sizedValue, 0.0001); @@ -209,8 +209,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0059, sizedValue, 0.0001); @@ -222,8 +222,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.00657, sizedValue, 0.00001); @@ -237,8 +237,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.00592, sizedValue, 0.00001); @@ -253,8 +253,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); expectedValue = 0.9 * 0.007 + 0.1 * 0.004; // 90% zone + 10% OA @@ -271,8 +271,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(mixedHumRat2, sizedValue, 0.00001); @@ -286,8 +286,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.007, sizedValue, 0.00001); @@ -315,8 +315,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.012, sizedValue, 0.0001); // hard-sized value @@ -326,7 +326,7 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) // Test 14 - Airloop Equipment - no OA coils DataSizing::CurSysNum = 1; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataSizing::NumSysSizInput = 1; DataSizing::SysSizingRunDone = true; EnergyPlus::DataSizing::FinalSysSizing.allocate(1); @@ -341,8 +341,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.006, sizedValue, 0.01); @@ -355,7 +355,7 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) EXPECT_TRUE(compare_eio_stream(eiooutput, true)); // Test 15 - Airloop Equipment - 1 OA coil - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 1; EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).RetHumRatAtCoolPeak = 0.015; EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).PrecoolHumRat = 0.01; @@ -365,8 +365,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.006, sizedValue, 0.00001); @@ -381,8 +381,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0114, sizedValue, 0.00001); @@ -391,15 +391,15 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) // OUTDOOR AIR SYSTEM EQUIPMENT TESTING // Test 17 - Outdoor Air System Equipment, no DOAS air loop EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); Real64 outAirHumRat = EnergyPlus::DataSizing::FinalSysSizing(DataSizing::CurSysNum).HeatOutHumRat; @@ -408,17 +408,17 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) // Test 18 - Outdoor Air System Equipment with DOAS system EnergyPlus::DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 0.0; - state.dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].HeatOutHumRat = 0.0036; + state->dataAirLoop->OutsideAirSys(1).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].HeatOutHumRat = 0.0036; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0036, sizedValue, 0.00001); // DOAS system hum rat @@ -434,8 +434,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletHumRatSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(inputValue, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletTempSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletTempSizing.unit.cc index f5957f09cfe..801e400e9ca 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletTempSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesAirInletTempSizing.unit.cc @@ -71,7 +71,7 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -82,10 +82,10 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) DataSizing::CurTermUnitSizingNum = 1; DataSizing::TermUnitSingDuct = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -95,8 +95,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -126,8 +126,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.zoneSizingInput.allocate(1); sizer.zoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(15.0, sizedValue, 0.01); @@ -141,8 +141,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(20.0, sizedValue, 0.01); @@ -155,8 +155,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(20.0, sizedValue, 0.01); @@ -169,8 +169,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(20.0, sizedValue, 0.01); @@ -182,8 +182,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(20.0, sizedValue, 0.01); @@ -194,8 +194,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(20.0, sizedValue, 0.01); @@ -206,8 +206,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(20.0, sizedValue, 0.01); // uses a mass flow rate for sizing @@ -235,8 +235,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -253,7 +253,7 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) EnergyPlus::DataSizing::FinalSysSizing(1).HeatRetTemp = 12.0; EnergyPlus::DataSizing::SysSizInput.allocate(1); EnergyPlus::DataSizing::SysSizInput(1).AirLoopNum = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; @@ -261,8 +261,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(10.0, sizedValue, 0.01); @@ -281,8 +281,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(10.0, sizedValue, 0.01); @@ -294,8 +294,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(10.0, sizedValue, 0.01); @@ -308,8 +308,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(10.0, sizedValue, 0.01); @@ -321,8 +321,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(10.0, sizedValue, 0.01); @@ -335,8 +335,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(10.0, sizedValue, 0.01); @@ -345,31 +345,31 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) // OUTDOOR AIR SYSTEM EQUIPMENT TESTING // Test 16 - Outdoor Air System Equipment, no DOAS air loop EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(10.0, sizedValue, 0.01); sizer.autoSizedValue = 0.0; // reset for next test // Test 17 - Outdoor Air System Equipment with DOAS system - state.dataAirLoop->OutsideAirSys(DataSizing::CurOASysNum).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].HeatOutTemp = 12.0; + state->dataAirLoop->OutsideAirSys(DataSizing::CurOASysNum).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].HeatOutTemp = 12.0; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(12.0, sizedValue, 0.01); // uses a mass flow rate for sizing @@ -384,8 +384,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesAirInletTempSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc index ef48efae3d1..1d051f39374 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilLoadUsedForUASizing.unit.cc @@ -50,6 +50,7 @@ #include #include +#include #include namespace EnergyPlus { @@ -69,7 +70,7 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -80,10 +81,10 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) DataSizing::CurTermUnitSizingNum = 1; DataSizing::TermUnitSingDuct = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing (this sizer is not typically hard-sized) - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5125.3, sizedValue, 0.01); // hard-sized value @@ -93,8 +94,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5125.3, sizedValue, 0.01); // hard-sized value @@ -143,8 +144,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) // do sizing sizer.zoneSizingInput.allocate(1); sizer.zoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4114.69, sizedValue, 0.01); @@ -158,8 +159,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4114.69, sizedValue, 0.01); @@ -172,8 +173,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4114.69, sizedValue, 0.01); @@ -186,8 +187,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2935.6, sizedValue, 0.01); @@ -199,8 +200,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1068.96, sizedValue, 0.01); @@ -215,8 +216,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3644.19, sizedValue, 0.01); @@ -231,8 +232,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4858.92, sizedValue, 0.01); @@ -245,8 +246,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2024.55, sizedValue, 0.01); @@ -260,8 +261,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) inputValue = 1500.0; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1500.0, sizedValue, 0.01); @@ -295,8 +296,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5000.0, sizedValue, 0.01); // hard-sized value @@ -314,7 +315,7 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) EnergyPlus::DataSizing::FinalSysSizing(1).HeatSupTemp = 30.0; EnergyPlus::DataSizing::SysSizInput.allocate(1); EnergyPlus::DataSizing::SysSizInput(1).AirLoopNum = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataSizing::DataAirFlowUsedForSizing = 0.6; // start with an auto-sized value as the user input @@ -323,8 +324,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(14469.96, sizedValue, 0.01); @@ -345,8 +346,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(9405.48, sizedValue, 0.01); @@ -361,23 +362,23 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(7234.98, sizedValue, 0.01); sizer.autoSizedValue = 0.0; // reset for next test // Test 16 - Air Loop Equipment, DOAS air loop w/ heating coil - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOAHeatCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOAHeatCoils = 1; DataSizing::DataDesicRegCoil = false; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6149.73, sizedValue, 0.01); @@ -386,32 +387,32 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) // OUTDOOR AIR SYSTEM EQUIPMENT TESTING // Test 17 - Outdoor Air System Equipment, DOAS air loop EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6511.48, sizedValue, 0.01); sizer.autoSizedValue = 0.0; // reset for next test // Test 18 - Outdoor Air System Equipment with DOAS system - state.dataAirLoop->OutsideAirSys(DataSizing::CurOASysNum).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); - state.dataAirLoopHVACDOAS->airloopDOAS[0].HeatOutTemp = 8.0; - state.dataAirLoopHVACDOAS->airloopDOAS[0].PreheatTemp = 15.0; + state->dataAirLoop->OutsideAirSys(DataSizing::CurOASysNum).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoopHVACDOAS->airloopDOAS[0].HeatOutTemp = 8.0; + state->dataAirLoopHVACDOAS->airloopDOAS[0].PreheatTemp = 15.0; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5064.49, sizedValue, 0.01); // uses a mass flow rate for sizing @@ -426,8 +427,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilLoadUsedForUASizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(7000.0, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.unit.cc index 9f04948a775..5cadeea8a2f 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterDesCoilWaterVolFlowUsedForUASizing.unit.cc @@ -50,6 +50,7 @@ #include #include +#include namespace EnergyPlus { @@ -64,7 +65,7 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilWaterVolFlowUsedForUASizingGauntlet bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -74,10 +75,10 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilWaterVolFlowUsedForUASizingGauntlet DataSizing::DataPltSizHeatNum = 1; DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.0005, sizedValue, 0.0001); // hard-sized value @@ -87,8 +88,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilWaterVolFlowUsedForUASizingGauntlet has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.0005, sizedValue, 0.0001); // hard-sized value @@ -111,8 +112,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilWaterVolFlowUsedForUASizingGauntlet // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0001, sizedValue, 0.0001); @@ -129,8 +130,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilWaterVolFlowUsedForUASizingGauntlet inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.000125, sizedValue, 0.0001); @@ -146,8 +147,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilWaterVolFlowUsedForUASizingGauntlet inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.000125, sizedValue, 0.0001); @@ -174,8 +175,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilWaterVolFlowUsedForUASizingGauntlet // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.0003, sizedValue, 0.0001); // hard-sized value @@ -195,8 +196,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilWaterVolFlowUsedForUASizingGauntlet // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0004, sizedValue, 0.0001); @@ -211,30 +212,30 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilWaterVolFlowUsedForUASizingGauntlet // OUTDOOR AIR SYSTEM EQUIPMENT TESTING // Test 7 - Outdoor Air System Equipment, no DOAS air loop EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0004, sizedValue, 0.0001); sizer.autoSizedValue = 0.0; // reset for next test // Test 8 - Outdoor Air System Equipment with DOAS system - state.dataAirLoop->OutsideAirSys(DataSizing::CurOASysNum).AirLoopDOASNum = 0; - state.dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); + state->dataAirLoop->OutsideAirSys(DataSizing::CurOASysNum).AirLoopDOASNum = 0; + state->dataAirLoopHVACDOAS->airloopDOAS.emplace_back(); // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.0004, sizedValue, 0.0001); // uses a mass flow rate for sizing @@ -249,8 +250,8 @@ TEST_F(AutoSizingFixture, HeatingWaterDesCoilWaterVolFlowUsedForUASizingGauntlet // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.0005, sizedValue, 0.0001); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc index a20cccb883b..a000271f828 100644 --- a/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/HeatingWaterflowSizing.unit.cc @@ -69,7 +69,7 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -78,8 +78,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) // test auto calculate DataSizing::DataFractionUsedForSizing = 0.0; DataSizing::DataConstantUsedForSizing = 1.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); // developer errror, DataFractionUsedForSizing = 0 and Constant > 0 EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); @@ -89,8 +89,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) DataSizing::DataFractionUsedForSizing = 1.0; DataSizing::DataConstantUsedForSizing = 0.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.0, sizedValue, 0.01); // auto calculates to 0 @@ -99,8 +99,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) DataSizing::DataFractionUsedForSizing = 1.0; DataSizing::DataConstantUsedForSizing = 1.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1.0, sizedValue, 0.01); // auto calculates to 1 @@ -110,8 +110,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) inputValue = DataSizing::AutoSize; DataSizing::DataFractionUsedForSizing = 1.0; DataSizing::DataConstantUsedForSizing = 2.0; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); // autosized input + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); // autosized input EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2.0, sizedValue, 0.01); // autosizes to 1.0 @@ -130,8 +130,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) DataSizing::TermUnitSizing(1).MaxHWVolFlow = 0.005; // Test #1 - Zone Equipment, no autosizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -141,8 +141,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -177,8 +177,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) // do sizing DataSizing::ZoneSizingInput.allocate(1); DataSizing::ZoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.005, sizedValue, 0.01); @@ -193,8 +193,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.005, sizedValue, 0.01); @@ -207,8 +207,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.005, sizedValue, 0.01); @@ -221,8 +221,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.005, sizedValue, 0.01); @@ -235,8 +235,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.005, sizedValue, 0.01); @@ -250,8 +250,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.005, sizedValue, 0.01); @@ -267,8 +267,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.000066, sizedValue, 0.000001); @@ -282,8 +282,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.000133, sizedValue, 0.000001); // uses a mass flow rate for sizing @@ -298,8 +298,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.000066, sizedValue, 0.000001); // uses a mass flow rate for sizing @@ -329,8 +329,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -354,8 +354,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) DataSizing::DataCapacityUsedForSizing = 5000.0; sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.000121, sizedValue, 0.000001); @@ -381,8 +381,8 @@ TEST_F(AutoSizingFixture, HeatingWaterflowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(0.0002, sizedValue, 0.000001); diff --git a/tst/EnergyPlus/unit/Autosizing/SystemAirFlowSizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/SystemAirFlowSizing.unit.cc index 6738b0cee47..d22e33cdd27 100644 --- a/tst/EnergyPlus/unit/Autosizing/SystemAirFlowSizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/SystemAirFlowSizing.unit.cc @@ -70,7 +70,7 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(this->state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.0001); // unitialized sizing types always return 0 @@ -79,10 +79,10 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // ZONE EQUIPMENT TESTING DataSizing::CurZoneEqNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); // hard-sized value @@ -92,8 +92,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); // hard-sized value @@ -120,16 +120,16 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) EnergyPlus::DataSizing::FinalZoneSizing(1).HeatDDNum = 2; EnergyPlus::DataSizing::FinalZoneSizing(1).TimeStepNumAtCoolMax = 12; EnergyPlus::DataSizing::FinalZoneSizing(1).TimeStepNumAtHeatMax = 6; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataEnvironment::TotDesDays = 2; - state.dataWeatherManager->DesDayInput.allocate(2); - state.dataWeatherManager->DesDayInput(1).Month = 7; - state.dataWeatherManager->DesDayInput(1).DayOfMonth = 7; - state.dataWeatherManager->DesDayInput(2).Month = 1; - state.dataWeatherManager->DesDayInput(2).DayOfMonth = 1; - state.dataWeatherManager->DesDayInput(1).Title = "CoolingDD"; - state.dataWeatherManager->DesDayInput(2).Title = "HeatingDD"; + state->dataWeatherManager->DesDayInput.allocate(2); + state->dataWeatherManager->DesDayInput(1).Month = 7; + state->dataWeatherManager->DesDayInput(1).DayOfMonth = 7; + state->dataWeatherManager->DesDayInput(2).Month = 1; + state->dataWeatherManager->DesDayInput(2).DayOfMonth = 1; + state->dataWeatherManager->DesDayInput(1).Title = "CoolingDD"; + state->dataWeatherManager->DesDayInput(2).Title = "HeatingDD"; // Test 2 - Zone Equipment, sizes to greater of zone cooling and heating flow // start with an auto-sized value as the user input @@ -137,8 +137,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing DataSizing::ZoneSizingInput.allocate(1); DataSizing::ZoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.6, sizedValue, 0.0001); @@ -153,8 +153,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); @@ -166,8 +166,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.6, sizedValue, 0.0001); @@ -178,8 +178,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.8, sizedValue, 0.0001); // 1/2 of zone cooling air flow rate @@ -193,8 +193,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.8, sizedValue, 0.0001); // max of zone cooling/heating/ZoneEqSizing @@ -206,8 +206,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.6, sizedValue, 0.0001); // zone cooling flow @@ -219,8 +219,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // zone heating flow @@ -233,8 +233,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2.2, sizedValue, 0.0001); // ZoneEqSizing cooling flow @@ -247,8 +247,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.2, sizedValue, 0.0001); // ZoneEqSizing heating flow @@ -259,8 +259,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.2, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -276,8 +276,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -290,8 +290,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.48, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -302,8 +302,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of FinalZoneSizing cooling/heating flow * fraction @@ -314,8 +314,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.88, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -327,8 +327,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -339,8 +339,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of FinalZoneSizing cooling/heating flow * fraction @@ -354,8 +354,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -367,8 +367,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.48, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow @@ -380,8 +380,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.88, sizedValue, 0.0001); // max of ZoneEqSizing cooling flow * fraction @@ -393,8 +393,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of ZoneEqSizing heating flow * fraction @@ -405,8 +405,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.28, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -418,8 +418,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.64, sizedValue, 0.0001); // max of FinalZoneSizing cooling/heating flow * fraction @@ -436,8 +436,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // flow per cooling capacity @@ -449,8 +449,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // flow per heating capacity @@ -462,8 +462,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // max of ZoneEqSizing cooling capacity * fraction @@ -475,8 +475,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // ZoneEqSizing heating capacity * fraction @@ -487,8 +487,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of ZoneEqSizing cooling/heating flow * fraction @@ -500,8 +500,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of autosized cooling/heating capacity * fraction @@ -514,8 +514,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // flow per cooling capacity @@ -527,8 +527,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // flow per heating capacity @@ -540,8 +540,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(0.5, sizedValue, 0.0001); // max of autosized cooling capacity * fraction @@ -553,8 +553,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // autosized heating capacity * fraction @@ -565,8 +565,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of autosized cooling/heating capacity * fraction @@ -578,8 +578,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.2, sizedValue, 0.0001); // max of autosized cooling/heating capacity * fraction @@ -590,8 +590,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) DataSizing::ZoneEqSizing(1).AirVolFlow = 1.75; inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.75, sizedValue, 0.0001); // parent passed size @@ -601,8 +601,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // Test 37 - Zone Equipment, hard size with zone sizing run inputValue = 1.44; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1.44, sizedValue, 0.0001); // hard sized result @@ -612,8 +612,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) inputValue = 1.44; DataSizing::ZoneSizingRunDone = false; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1.44, sizedValue, 0.0001); // hard sized result @@ -625,8 +625,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) inputValue = 1.44; DataSizing::ZoneSizingRunDone = false; // do sizing - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1.33, sizedValue, 0.0001); // override result @@ -654,8 +654,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); // hard-sized value @@ -664,7 +664,7 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // Test 41 - Airloop Equipment - ems override is on DataSizing::SysSizingRunDone = true; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataEnvironment::TotDesDays = 2; DataSizing::SysSizPeakDDNum.allocate(2); DataSizing::SysSizPeakDDNum(1).CoolFlowPeakDD = 1; @@ -683,8 +683,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1.33, sizedValue, 0.0001); @@ -707,8 +707,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.0001); @@ -726,8 +726,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(7.0, sizedValue, 0.0001); @@ -740,8 +740,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(7.0, sizedValue, 0.0001); @@ -755,8 +755,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(6.0, sizedValue, 0.0001); @@ -768,15 +768,15 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) EnergyPlus::DataSizing::FinalSysSizing(1).DesHeatVolFlow = 0.0; EnergyPlus::DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 3.0; EnergyPlus::DataSizing::OASysEqSizing.allocate(1); - state.dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys.allocate(1); DataSizing::CurOASysNum = 1; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.0, sizedValue, 0.0001); @@ -789,8 +789,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // uses main flow rate @@ -803,8 +803,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // uses cooling flow rate @@ -818,8 +818,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(8.0, sizedValue, 0.01); // uses heating flow rate @@ -832,8 +832,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // uses a main flow rate @@ -848,8 +848,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // uses main flow rate @@ -862,8 +862,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // uses cooling flow rate @@ -877,8 +877,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(8.0, sizedValue, 0.01); // uses heating flow rate @@ -891,8 +891,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // uses a main flow rate @@ -905,8 +905,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // uses a main flow rate @@ -922,8 +922,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2.0, sizedValue, 0.01); // hard-sized value @@ -945,8 +945,8 @@ TEST_F(AutoSizingFixture, SystemAirFlowSizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(this->state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*this->state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(2.2, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc index b858a34675c..072eab10fd0 100644 --- a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCapacitySizing.unit.cc @@ -50,6 +50,7 @@ #include #include +#include #include namespace EnergyPlus { @@ -69,7 +70,7 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -80,10 +81,10 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) DataSizing::CurTermUnitSizingNum = 1; DataSizing::TermUnitSingDuct = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(state, inputValue, errorsFound); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5125.3, sizedValue, 0.01); // hard-sized value @@ -93,8 +94,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5125.3, sizedValue, 0.01); // hard-sized value @@ -142,8 +143,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) // do sizing sizer.zoneSizingInput.allocate(1); sizer.zoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(10286.73, sizedValue, 0.01); @@ -157,8 +158,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4114.69, sizedValue, 0.01); @@ -171,8 +172,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2935.6, sizedValue, 0.01); @@ -184,8 +185,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1068.96, sizedValue, 0.01); @@ -200,8 +201,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3644.19, sizedValue, 0.01); @@ -216,8 +217,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(4858.92, sizedValue, 0.01); @@ -230,8 +231,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(2024.55, sizedValue, 0.01); @@ -243,8 +244,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(1012.27, sizedValue, 0.01); @@ -258,8 +259,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCapacitySizingGauntlet) inputValue = 1500.0; // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(1500.0, sizedValue, 0.01); diff --git a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc index af581337b08..b1b158886ed 100644 --- a/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc +++ b/tst/EnergyPlus/unit/Autosizing/WaterHeatingCoilUASizing.unit.cc @@ -71,7 +71,7 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) bool printFlag = false; // uninitialized sizing type - Real64 sizedValue = sizer.size(state, inputValue, errorsFound); + Real64 sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType2, sizer.errorType); EXPECT_NEAR(0.0, sizedValue, 0.01); // unitialized sizing types always return 0 @@ -82,10 +82,10 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) DataSizing::CurTermUnitSizingNum = 1; DataSizing::TermUnitSingDuct = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); // Test #1 - Zone Equipment, no autosizing - sizedValue = sizer.size(state, inputValue, errorsFound); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(35.0, sizedValue, 0.01); // hard-sized value @@ -95,8 +95,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) has_eio_output(true); printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(35.0, sizedValue, 0.01); // hard-sized value @@ -111,17 +111,17 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) // reset eio stream has_eio_output(true); - state.dataWaterCoils->WaterCoil.allocate(1); - state.dataWaterCoils->WaterCoil(1).InletAirTemp = 21.0; - state.dataWaterCoils->WaterCoil(1).InletAirHumRat = 0.006; - state.dataWaterCoils->WaterCoil(1).Control = state.dataWaterCoils->DesignCalc; - state.dataWaterCoils->WaterCoil(1).InletWaterTemp = 60.0; - state.dataWaterCoils->WaterCoil(1).InletAirMassFlowRate = 0.2; - state.dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = 0.8; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(1).SchedPtr = -1; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->WaterCoil.allocate(1); + state->dataWaterCoils->WaterCoil(1).InletAirTemp = 21.0; + state->dataWaterCoils->WaterCoil(1).InletAirHumRat = 0.006; + state->dataWaterCoils->WaterCoil(1).Control = state->dataWaterCoils->DesignCalc; + state->dataWaterCoils->WaterCoil(1).InletWaterTemp = 60.0; + state->dataWaterCoils->WaterCoil(1).InletAirMassFlowRate = 0.2; + state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = 0.8; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(1).SchedPtr = -1; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MySizeFlag.allocate(1); ScheduleManager::Schedule.allocate(1); // now allocate sizing arrays for testing autosized field @@ -154,8 +154,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) // do sizing DataSizing::ZoneSizingInput.allocate(1); DataSizing::ZoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(98.35, sizedValue, 0.01); @@ -165,21 +165,21 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) EXPECT_TRUE(compare_eio_stream(eiooutput, true)); // Test 2 - Zone Equipment, UA sizing fails - state.dataWaterCoils->WaterCoil(1).InletAirTemp = 61.0; + state->dataWaterCoils->WaterCoil(1).InletAirTemp = 61.0; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing DataSizing::ZoneSizingInput.allocate(1); DataSizing::ZoneSizingInput(1).ZoneNum = 1; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_TRUE(DataSizing::DataErrorsFound); EXPECT_TRUE(sizer.dataErrorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(3.0, sizedValue, 0.01); // 0.1% of 3000 W capacity - state.dataWaterCoils->WaterCoil(1).InletAirTemp = 21.0; + state->dataWaterCoils->WaterCoil(1).InletAirTemp = 21.0; DataSizing::DataErrorsFound = false; sizer.dataErrorsFound = false; errorsFound = false; @@ -206,8 +206,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value @@ -229,8 +229,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(98.35, sizedValue, 0.01); @@ -248,30 +248,30 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(98.35, sizedValue, 0.01); sizer.autoSizedValue = 0.0; // reset for next test // Test 5 - Airloop Equipment, failed UA sizing - state.dataWaterCoils->WaterCoil(1).InletAirTemp = 61.0; + state->dataWaterCoils->WaterCoil(1).InletAirTemp = 61.0; // start with an auto-sized value as the user input inputValue = EnergyPlus::DataSizing::AutoSize; // do sizing sizer.wasAutoSized = false; printFlag = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::ErrorType1, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_TRUE(errorsFound); EXPECT_TRUE(DataSizing::DataErrorsFound); EXPECT_TRUE(sizer.dataErrorsFound); EXPECT_NEAR(3.0, sizedValue, 0.01); // 0.1% of 3000 W capacity - state.dataWaterCoils->WaterCoil(1).InletAirTemp = 21.0; + state->dataWaterCoils->WaterCoil(1).InletAirTemp = 21.0; DataSizing::DataErrorsFound = false; sizer.dataErrorsFound = false; errorsFound = false; @@ -286,8 +286,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) // do sizing sizer.wasAutoSized = false; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); EXPECT_TRUE(sizer.wasAutoSized); EXPECT_NEAR(98.35, sizedValue, 0.01); @@ -303,8 +303,8 @@ TEST_F(AutoSizingFixture, WaterHeatingCoilUASizingGauntlet) // do sizing sizer.wasAutoSized = false; printFlag = true; - sizer.initializeWithinEP(this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); - sizedValue = sizer.size(state, inputValue, errorsFound); + sizer.initializeWithinEP(*this->state, DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater), "MyWaterCoil", printFlag, routineName); + sizedValue = sizer.size(*state, inputValue, errorsFound); EXPECT_EQ(AutoSizingResultType::NoError, sizer.errorType); // cumulative of previous calls EXPECT_FALSE(sizer.wasAutoSized); EXPECT_NEAR(5.0, sizedValue, 0.01); // hard-sized value diff --git a/tst/EnergyPlus/unit/BaseboardRadiator.unit.cc b/tst/EnergyPlus/unit/BaseboardRadiator.unit.cc index 1f87627abf3..f811761b342 100644 --- a/tst/EnergyPlus/unit/BaseboardRadiator.unit.cc +++ b/tst/EnergyPlus/unit/BaseboardRadiator.unit.cc @@ -52,6 +52,7 @@ // EnergyPlus Headers #include "Fixtures/EnergyPlusFixture.hh" +#include #include #include #include @@ -325,38 +326,38 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) ASSERT_TRUE(process_idf(idf_objects)); - 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 + 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 bool errorsFound(false); - HeatBalanceManager::GetProjectControlData(state, errorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetMaterialData(state, errorsFound); // read material data + HeatBalanceManager::GetMaterialData(*state, errorsFound); // read material data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetConstructData(state, errorsFound); // read construction data + HeatBalanceManager::GetConstructData(*state, errorsFound); // read construction data EXPECT_FALSE(errorsFound); // expect no errors - HeatBalanceManager::GetZoneData(state, errorsFound); + HeatBalanceManager::GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(3); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(3); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(3); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(3); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, errorsFound); + SurfaceGeometry::GetSurfaceData(*state, errorsFound); ASSERT_FALSE(errorsFound); ZoneSizingInput.allocate(3); @@ -385,9 +386,9 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) loopsidebranch.Comp.allocate(1); } - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); // get electric baseboard inputs - BaseboardRadiator::GetBaseboardInput(state); + BaseboardRadiator::GetBaseboardInput(*state); DataSizing::FinalZoneSizing.allocate(3); DataSizing::ZoneEqSizing.allocate(3); @@ -401,26 +402,26 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) FirstHVACIteration = true; DataSizing::ZoneEqSizing(CntrlZoneNum).SizingMethod.allocate(DataHVACGlobals::NumOfSizingTypes); DataSizing::ZoneEqSizing(CntrlZoneNum).SizingMethod(DataHVACGlobals::HeatingCapacitySizing) = - state.dataBaseboardRadiator->Baseboard(BaseboardNum).HeatingCapMethod; + state->dataBaseboardRadiator->Baseboard(BaseboardNum).HeatingCapMethod; DataSizing::FinalZoneSizing(CntrlZoneNum).NonAirSysDesHeatLoad = 2000.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(CntrlZoneNum).RemainingOutputReqToHeatSP = 2000.0; DataZoneEnergyDemands::CurDeadBandOrSetback(CntrlZoneNum) = false; FinalZoneSizing(CntrlZoneNum).ZoneTempAtHeatPeak = 20.0; FinalZoneSizing(CntrlZoneNum).ZoneHumRatAtHeatPeak = 0.005; // do baseboard sizing - state.dataBaseboardRadiator->Baseboard(BaseboardNum).LoopNum = 1; - state.dataBaseboardRadiator->Baseboard(BaseboardNum).ZonePtr = 1; - BaseboardRadiator::SizeBaseboard(state, BaseboardNum); + state->dataBaseboardRadiator->Baseboard(BaseboardNum).LoopNum = 1; + state->dataBaseboardRadiator->Baseboard(BaseboardNum).ZonePtr = 1; + BaseboardRadiator::SizeBaseboard(*state, BaseboardNum); // check UA value - EXPECT_EQ(state.dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity, 1000.0); - EXPECT_EQ(state.dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 1000.0); + EXPECT_EQ(state->dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity, 1000.0); + EXPECT_EQ(state->dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 1000.0); // check UA value with autosized scaled capacity - state.dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity = DataSizing::AutoSize; - state.dataBaseboardRadiator->Baseboard(BaseboardNum).WaterVolFlowRateMax = DataSizing::AutoSize; - state.dataBaseboardRadiator->Baseboard(BaseboardNum).UA = DataSizing::AutoSize; // reset to autosize to test new calculation - BaseboardRadiator::SizeBaseboard(state, BaseboardNum); + state->dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity = DataSizing::AutoSize; + state->dataBaseboardRadiator->Baseboard(BaseboardNum).WaterVolFlowRateMax = DataSizing::AutoSize; + state->dataBaseboardRadiator->Baseboard(BaseboardNum).UA = DataSizing::AutoSize; // reset to autosize to test new calculation + BaseboardRadiator::SizeBaseboard(*state, BaseboardNum); EXPECT_EQ(DataZoneEnergyDemands::ZoneSysEnergyDemand(CntrlZoneNum).RemainingOutputReqToHeatSP, 2000.0); // design load = 2000 - EXPECT_EQ(state.dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 2000.0); // UA = design load + EXPECT_EQ(state->dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 2000.0); // UA = design load BaseboardNum = 2; CntrlZoneNum = 2; @@ -428,26 +429,26 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) FirstHVACIteration = true; DataSizing::ZoneEqSizing(CntrlZoneNum).SizingMethod.allocate(DataHVACGlobals::NumOfSizingTypes); DataSizing::ZoneEqSizing(CntrlZoneNum).SizingMethod(DataHVACGlobals::HeatingCapacitySizing) = - state.dataBaseboardRadiator->Baseboard(BaseboardNum).HeatingCapMethod; + state->dataBaseboardRadiator->Baseboard(BaseboardNum).HeatingCapMethod; DataSizing::FinalZoneSizing(CntrlZoneNum).NonAirSysDesHeatLoad = 2000.0; DataZoneEnergyDemands::CurDeadBandOrSetback(CntrlZoneNum) = false; FinalZoneSizing(CntrlZoneNum).ZoneTempAtHeatPeak = 20.0; FinalZoneSizing(CntrlZoneNum).ZoneHumRatAtHeatPeak = 0.005; DataHeatBalance::Zone(CntrlZoneNum).FloorArea = 100.0; // do baseboard sizing - state.dataBaseboardRadiator->Baseboard(BaseboardNum).LoopNum = 1; - state.dataBaseboardRadiator->Baseboard(BaseboardNum).ZonePtr = 2; - BaseboardRadiator::SizeBaseboard(state, BaseboardNum); + state->dataBaseboardRadiator->Baseboard(BaseboardNum).LoopNum = 1; + state->dataBaseboardRadiator->Baseboard(BaseboardNum).ZonePtr = 2; + BaseboardRadiator::SizeBaseboard(*state, BaseboardNum); // check UA value - EXPECT_EQ(state.dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity, 40.0); - EXPECT_EQ(state.dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 4000.0); - state.dataBaseboardRadiator->Baseboard(BaseboardNum).UA = DataSizing::AutoSize; // reset to autosize to test new calculation - state.dataBaseboardRadiator->Baseboard(BaseboardNum).WaterVolFlowRateMax = DataSizing::AutoSize; + EXPECT_EQ(state->dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity, 40.0); + EXPECT_EQ(state->dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 4000.0); + state->dataBaseboardRadiator->Baseboard(BaseboardNum).UA = DataSizing::AutoSize; // reset to autosize to test new calculation + state->dataBaseboardRadiator->Baseboard(BaseboardNum).WaterVolFlowRateMax = DataSizing::AutoSize; // check UA value with autosized UA - state.dataBaseboardRadiator->Baseboard(BaseboardNum).HeatingCapMethod = DataSizing::HeatingDesignCapacity; - state.dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity = DataSizing::AutoSize; - BaseboardRadiator::SizeBaseboard(state, BaseboardNum); - EXPECT_EQ(state.dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 2000.0); + state->dataBaseboardRadiator->Baseboard(BaseboardNum).HeatingCapMethod = DataSizing::HeatingDesignCapacity; + state->dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity = DataSizing::AutoSize; + BaseboardRadiator::SizeBaseboard(*state, BaseboardNum); + EXPECT_EQ(state->dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 2000.0); BaseboardNum = 3; CntrlZoneNum = 3; @@ -455,26 +456,26 @@ TEST_F(EnergyPlusFixture, BaseboardConvWater_SizingTest) FirstHVACIteration = true; DataSizing::ZoneEqSizing(CntrlZoneNum).SizingMethod.allocate(DataHVACGlobals::NumOfSizingTypes); DataSizing::ZoneEqSizing(CntrlZoneNum).SizingMethod(DataHVACGlobals::HeatingCapacitySizing) = - state.dataBaseboardRadiator->Baseboard(BaseboardNum).HeatingCapMethod; + state->dataBaseboardRadiator->Baseboard(BaseboardNum).HeatingCapMethod; DataSizing::FinalZoneSizing(CntrlZoneNum).NonAirSysDesHeatLoad = 3000.0; DataZoneEnergyDemands::CurDeadBandOrSetback(CntrlZoneNum) = false; FinalZoneSizing(CntrlZoneNum).ZoneTempAtHeatPeak = 20.0; FinalZoneSizing(CntrlZoneNum).ZoneHumRatAtHeatPeak = 0.005; DataHeatBalance::Zone(CntrlZoneNum).FloorArea = 100.0; // do baseboard sizing - state.dataBaseboardRadiator->Baseboard(BaseboardNum).LoopNum = 1; - state.dataBaseboardRadiator->Baseboard(BaseboardNum).ZonePtr = 3; - BaseboardRadiator::SizeBaseboard(state, BaseboardNum); + state->dataBaseboardRadiator->Baseboard(BaseboardNum).LoopNum = 1; + state->dataBaseboardRadiator->Baseboard(BaseboardNum).ZonePtr = 3; + BaseboardRadiator::SizeBaseboard(*state, BaseboardNum); // check UA value - EXPECT_EQ(state.dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity, 0.50); - EXPECT_EQ(state.dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 1500.0); - state.dataBaseboardRadiator->Baseboard(BaseboardNum).UA = DataSizing::AutoSize; // reset to autosize to test new calculation - state.dataBaseboardRadiator->Baseboard(BaseboardNum).WaterVolFlowRateMax = DataSizing::AutoSize; + EXPECT_EQ(state->dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity, 0.50); + EXPECT_EQ(state->dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 1500.0); + state->dataBaseboardRadiator->Baseboard(BaseboardNum).UA = DataSizing::AutoSize; // reset to autosize to test new calculation + state->dataBaseboardRadiator->Baseboard(BaseboardNum).WaterVolFlowRateMax = DataSizing::AutoSize; // check UA value with autosized scaled capacity - state.dataBaseboardRadiator->Baseboard(BaseboardNum).HeatingCapMethod = DataSizing::HeatingDesignCapacity; - state.dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity = DataSizing::AutoSize; - BaseboardRadiator::SizeBaseboard(state, BaseboardNum); - EXPECT_EQ(state.dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 3000.0); + state->dataBaseboardRadiator->Baseboard(BaseboardNum).HeatingCapMethod = DataSizing::HeatingDesignCapacity; + state->dataBaseboardRadiator->Baseboard(BaseboardNum).ScaledHeatingCapacity = DataSizing::AutoSize; + BaseboardRadiator::SizeBaseboard(*state, BaseboardNum); + EXPECT_EQ(state->dataBaseboardRadiator->Baseboard(BaseboardNum).UA, 3000.0); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/BoilerHotWater.unit.cc b/tst/EnergyPlus/unit/BoilerHotWater.unit.cc index fa2705617ae..b653838472a 100644 --- a/tst/EnergyPlus/unit/BoilerHotWater.unit.cc +++ b/tst/EnergyPlus/unit/BoilerHotWater.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -71,14 +72,14 @@ using namespace EnergyPlus::Psychrometrics; TEST_F(EnergyPlusFixture, Boiler_HotWaterSizingTest) { // unit test for autosizing boiler nominal capacity in Boiler:HotWater - state.dataBoilers->Boiler.allocate(1); + state->dataBoilers->Boiler.allocate(1); // Hardsized Hot Water Boiler - state.dataBoilers->Boiler(1).LoopNum = 1; - state.dataBoilers->Boiler(1).SizFac = 1.2; - state.dataBoilers->Boiler(1).NomCap = 40000.0; - state.dataBoilers->Boiler(1).NomCapWasAutoSized = false; - state.dataBoilers->Boiler(1).VolFlowRate = 1.0; - state.dataBoilers->Boiler(1).VolFlowRateWasAutoSized = false; + state->dataBoilers->Boiler(1).LoopNum = 1; + state->dataBoilers->Boiler(1).SizFac = 1.2; + state->dataBoilers->Boiler(1).NomCap = 40000.0; + state->dataBoilers->Boiler(1).NomCapWasAutoSized = false; + state->dataBoilers->Boiler(1).VolFlowRate = 1.0; + state->dataBoilers->Boiler(1).VolFlowRateWasAutoSized = false; DataPlant::PlantLoop.allocate(1); DataSizing::PlantSizData.allocate(1); @@ -90,25 +91,25 @@ TEST_F(EnergyPlusFixture, Boiler_HotWaterSizingTest) DataSizing::PlantSizData(1).DeltaT = 10.0; DataPlant::PlantFirstSizesOkayToFinalize = true; // now call sizing routine - state.dataBoilers->Boiler(1).SizeBoiler(state); + state->dataBoilers->Boiler(1).SizeBoiler(*state); // see if boiler volume flow rate returned is hard-sized value - EXPECT_DOUBLE_EQ(state.dataBoilers->Boiler(1).VolFlowRate, 1.0); + EXPECT_DOUBLE_EQ(state->dataBoilers->Boiler(1).VolFlowRate, 1.0); // see if boiler nominal capacity returned is hard-sized value - EXPECT_DOUBLE_EQ(state.dataBoilers->Boiler(1).NomCap, 40000.0); + EXPECT_DOUBLE_EQ(state->dataBoilers->Boiler(1).NomCap, 40000.0); // Autosized Hot Water Boiler - state.dataBoilers->Boiler(1).NomCapWasAutoSized = true; - state.dataBoilers->Boiler(1).VolFlowRateWasAutoSized = true; - state.dataBoilers->Boiler(1).NomCap = DataSizing::AutoSize; - state.dataBoilers->Boiler(1).VolFlowRate = DataSizing::AutoSize; + state->dataBoilers->Boiler(1).NomCapWasAutoSized = true; + state->dataBoilers->Boiler(1).VolFlowRateWasAutoSized = true; + state->dataBoilers->Boiler(1).NomCap = DataSizing::AutoSize; + state->dataBoilers->Boiler(1).VolFlowRate = DataSizing::AutoSize; // now call sizing routine - state.dataBoilers->Boiler(1).SizeBoiler(state); + state->dataBoilers->Boiler(1).SizeBoiler(*state); // see if boiler volume flow rate returned is autosized value - EXPECT_NEAR(state.dataBoilers->Boiler(1).VolFlowRate, 1.2, 0.000001); + EXPECT_NEAR(state->dataBoilers->Boiler(1).VolFlowRate, 1.2, 0.000001); // see if boiler nominal capacity returned is autosized value - EXPECT_NEAR(state.dataBoilers->Boiler(1).NomCap, 49376304.0, 1.0); + EXPECT_NEAR(state->dataBoilers->Boiler(1).NomCap, 49376304.0, 1.0); // clear - state.dataBoilers->Boiler.deallocate(); + state->dataBoilers->Boiler.deallocate(); DataSizing::PlantSizData.deallocate(); DataPlant::PlantLoop.deallocate(); } @@ -116,14 +117,14 @@ TEST_F(EnergyPlusFixture, Boiler_HotWaterAutoSizeTempTest) { // unit test for checking hot water temperature for autosizing // boiler nominal capacity in Boiler:HotWater - state.dataBoilers->Boiler.allocate(1); + state->dataBoilers->Boiler.allocate(1); // Autosized Hot Water Boiler - state.dataBoilers->Boiler(1).LoopNum = 1; - state.dataBoilers->Boiler(1).SizFac = 1.2; - state.dataBoilers->Boiler(1).NomCap = DataSizing::AutoSize; - state.dataBoilers->Boiler(1).NomCapWasAutoSized = true; - state.dataBoilers->Boiler(1).VolFlowRate = DataSizing::AutoSize; - state.dataBoilers->Boiler(1).VolFlowRateWasAutoSized = true; + state->dataBoilers->Boiler(1).LoopNum = 1; + state->dataBoilers->Boiler(1).SizFac = 1.2; + state->dataBoilers->Boiler(1).NomCap = DataSizing::AutoSize; + state->dataBoilers->Boiler(1).NomCapWasAutoSized = true; + state->dataBoilers->Boiler(1).VolFlowRate = DataSizing::AutoSize; + state->dataBoilers->Boiler(1).VolFlowRateWasAutoSized = true; DataPlant::PlantLoop.allocate(1); DataSizing::PlantSizData.allocate(1); @@ -136,25 +137,25 @@ TEST_F(EnergyPlusFixture, Boiler_HotWaterAutoSizeTempTest) DataPlant::PlantFirstSizesOkayToFinalize = true; // calculate nominal capacity at 60.0 C hot water temperature - Real64 rho = FluidProperties::GetDensityGlycol(state, - DataPlant::PlantLoop(state.dataBoilers->Boiler(1).LoopNum).FluidName, + Real64 rho = FluidProperties::GetDensityGlycol(*state, + DataPlant::PlantLoop(state->dataBoilers->Boiler(1).LoopNum).FluidName, 60.0, - DataPlant::PlantLoop(state.dataBoilers->Boiler(1).LoopNum).FluidIndex, + DataPlant::PlantLoop(state->dataBoilers->Boiler(1).LoopNum).FluidIndex, "Boiler_HotWaterAutoSizeTempTest"); - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, - DataPlant::PlantLoop(state.dataBoilers->Boiler(1).LoopNum).FluidName, + Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, + DataPlant::PlantLoop(state->dataBoilers->Boiler(1).LoopNum).FluidName, 60.0, - DataPlant::PlantLoop(state.dataBoilers->Boiler(1).LoopNum).FluidIndex, + DataPlant::PlantLoop(state->dataBoilers->Boiler(1).LoopNum).FluidIndex, "Boiler_HotWaterAutoSizeTempTest"); - Real64 NomCapBoilerExpected = rho * PlantSizData(1).DesVolFlowRate * Cp * PlantSizData(1).DeltaT * state.dataBoilers->Boiler(1).SizFac; + Real64 NomCapBoilerExpected = rho * PlantSizData(1).DesVolFlowRate * Cp * PlantSizData(1).DeltaT * state->dataBoilers->Boiler(1).SizFac; // now call sizing routine - state.dataBoilers->Boiler(1).SizeBoiler(state); + state->dataBoilers->Boiler(1).SizeBoiler(*state); // see if boiler volume flow rate returned is autosized value - EXPECT_DOUBLE_EQ(state.dataBoilers->Boiler(1).VolFlowRate, 1.2); + EXPECT_DOUBLE_EQ(state->dataBoilers->Boiler(1).VolFlowRate, 1.2); // see if boiler nominal capacity returned is autosized value - EXPECT_DOUBLE_EQ(state.dataBoilers->Boiler(1).NomCap, NomCapBoilerExpected); + EXPECT_DOUBLE_EQ(state->dataBoilers->Boiler(1).NomCap, NomCapBoilerExpected); } // Cf: https://github.com/NREL/EnergyPlus/issues/6164 @@ -182,13 +183,13 @@ TEST_F(EnergyPlusFixture, Boiler_HotWater_BlankDesignWaterFlowRate) }); ASSERT_TRUE(process_idf(idf_objects)); - GetBoilerInput(state); + GetBoilerInput(*state); - EXPECT_EQ(1, state.dataBoilers->numBoilers); - EXPECT_EQ(AutoSize, state.dataBoilers->Boiler(1).VolFlowRate); + EXPECT_EQ(1, state->dataBoilers->numBoilers); + EXPECT_EQ(AutoSize, state->dataBoilers->Boiler(1).VolFlowRate); // Additional tests for fuel type input - EXPECT_EQ(state.dataBoilers->Boiler(1).BoilerFuelTypeForOutputVariable, "NaturalGas"); + EXPECT_EQ(state->dataBoilers->Boiler(1).BoilerFuelTypeForOutputVariable, "NaturalGas"); } TEST_F(EnergyPlusFixture, Boiler_HotWater_BoilerEfficiency) @@ -200,9 +201,9 @@ TEST_F(EnergyPlusFixture, Boiler_HotWater_BoilerEfficiency) DataPlant::TotNumLoops = 2; DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; Psychrometrics::InitializePsychRoutines(); @@ -248,8 +249,8 @@ TEST_F(EnergyPlusFixture, Boiler_HotWater_BoilerEfficiency) loopsidebranch.Comp.allocate(1); } - GetBoilerInput(state); - auto &thisBoiler = state.dataBoilers->Boiler(1); + GetBoilerInput(*state); + auto &thisBoiler = state->dataBoilers->Boiler(1); DataPlant::PlantLoop(1).Name = "HotWaterLoop"; DataPlant::PlantLoop(1).FluidName = "HotWater"; @@ -269,13 +270,13 @@ TEST_F(EnergyPlusFixture, Boiler_HotWater_BoilerEfficiency) DataPlant::PlantFirstSizesOkayToReport = true; DataPlant::PlantFinalSizesOkayToReport = true; - thisBoiler.InitBoiler(state); - thisBoiler.SizeBoiler(state); + thisBoiler.InitBoiler(*state); + thisBoiler.SizeBoiler(*state); // run through init again after sizing is complete to set mass flow rate and run calc function - state.dataGlobal->BeginEnvrnFlag = true; - thisBoiler.InitBoiler(state); - thisBoiler.CalcBoilerModel(state, MyLoad, RunFlag, DataBranchAirLoopPlant::ControlType_SeriesActive); + state->dataGlobal->BeginEnvrnFlag = true; + thisBoiler.InitBoiler(*state); + thisBoiler.CalcBoilerModel(*state, MyLoad, RunFlag, DataBranchAirLoopPlant::ControlType_SeriesActive); // check boiler part load ratio and the resultant boiler efficiency EXPECT_NEAR(thisBoiler.BoilerPLR, 0.24, 0.01); diff --git a/tst/EnergyPlus/unit/BoilerSteam.unit.cc b/tst/EnergyPlus/unit/BoilerSteam.unit.cc index f0b804e9c3e..f6de361a2c2 100644 --- a/tst/EnergyPlus/unit/BoilerSteam.unit.cc +++ b/tst/EnergyPlus/unit/BoilerSteam.unit.cc @@ -55,8 +55,10 @@ #include #include #include +#include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -90,8 +92,8 @@ TEST_F(EnergyPlusFixture, BoilerSteam_GetInput) }); ASSERT_TRUE(process_idf(idf_objects, false)); - GetBoilerInput(state); - auto &thisBoiler = state.dataBoilerSteam->Boiler(state.dataBoilerSteam->numBoilers); + GetBoilerInput(*state); + auto &thisBoiler = state->dataBoilerSteam->Boiler(state->dataBoilerSteam->numBoilers); EXPECT_EQ(thisBoiler.Name, "STEAM BOILER PLANT BOILER"); EXPECT_EQ(thisBoiler.FuelType, AssignResourceTypeNum("NATURALGAS")); EXPECT_EQ(thisBoiler.BoilerMaxOperPress, 160000); @@ -120,9 +122,9 @@ TEST_F(EnergyPlusFixture, BoilerSteam_BoilerEfficiency) DataPlant::TotNumLoops = 2; DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; Psychrometrics::InitializePsychRoutines(); @@ -158,8 +160,8 @@ TEST_F(EnergyPlusFixture, BoilerSteam_BoilerEfficiency) loopsidebranch.Comp.allocate(1); } - GetBoilerInput(state); - auto &thisBoiler = state.dataBoilerSteam->Boiler(state.dataBoilerSteam->numBoilers); + GetBoilerInput(*state); + auto &thisBoiler = state->dataBoilerSteam->Boiler(state->dataBoilerSteam->numBoilers); DataPlant::PlantLoop(1).Name = "SteamLoop"; DataPlant::PlantLoop(1).FluidName = "Steam"; @@ -179,9 +181,9 @@ TEST_F(EnergyPlusFixture, BoilerSteam_BoilerEfficiency) DataPlant::PlantFirstSizesOkayToReport = true; DataPlant::PlantFinalSizesOkayToReport = true; - state.dataGlobal->BeginEnvrnFlag = true; - thisBoiler.initialize(state); - thisBoiler.calculate(state, MyLoad, RunFlag, DataBranchAirLoopPlant::ControlType_SeriesActive); + state->dataGlobal->BeginEnvrnFlag = true; + thisBoiler.initialize(*state); + thisBoiler.calculate(*state, MyLoad, RunFlag, DataBranchAirLoopPlant::ControlType_SeriesActive); // check boiler fuel used and the resultant boiler efficiency EXPECT_EQ(thisBoiler.BoilerLoad, 1000000); diff --git a/tst/EnergyPlus/unit/BranchInputManager.unit.cc b/tst/EnergyPlus/unit/BranchInputManager.unit.cc index a58c2fcd878..c540f7de876 100644 --- a/tst/EnergyPlus/unit/BranchInputManager.unit.cc +++ b/tst/EnergyPlus/unit/BranchInputManager.unit.cc @@ -54,6 +54,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace BranchInputManager; @@ -86,7 +87,7 @@ TEST_F(EnergyPlusFixture, GetBranchInput_One_SingleComponentBranch) static std::string const RoutineName("GetBranchInput: "); std::string CurrentModuleObject = "Branch"; - int NumOfBranches = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumOfBranches = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); int NumParams; int NumAlphas; // Used to retrieve names from IDF int NumNumbers; // Used to retrieve numbers from IDF @@ -102,12 +103,12 @@ TEST_F(EnergyPlusFixture, GetBranchInput_One_SingleComponentBranch) int IOStat; // Could be used in the Get Routines, not currently checked if (NumOfBranches > 0) { - state.dataBranchInputManager->Branch.allocate(NumOfBranches); - for (auto &e : state.dataBranchInputManager->Branch) + state->dataBranchInputManager->Branch.allocate(NumOfBranches); + for (auto &e : state->dataBranchInputManager->Branch) e.AssignedLoopName.clear(); - inputProcessor->getObjectDefMaxArgs(state, "NodeList", NumParams, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, "NodeList", NumParams, NumAlphas, NumNumbers); NodeNums.dimension(NumParams, 0); - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, NumParams, NumAlphas, NumNumbers); Alphas.allocate(NumAlphas); Numbers.dimension(NumNumbers, 0.0); cAlphaFields.allocate(NumAlphas); @@ -117,11 +118,11 @@ TEST_F(EnergyPlusFixture, GetBranchInput_One_SingleComponentBranch) int BCount = 0; for (int Count = 1; Count <= NumOfBranches; ++Count) { - inputProcessor->getObjectItem(state, CurrentModuleObject, Count, Alphas, NumAlphas, Numbers, NumNumbers, IOStat, lNumericBlanks, lAlphaBlanks, + inputProcessor->getObjectItem(*state, CurrentModuleObject, Count, Alphas, NumAlphas, Numbers, NumNumbers, IOStat, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields); IsNotOK = false; IsBlank = false; - UtilityRoutines::VerifyName(state, Alphas(1), state.dataBranchInputManager->Branch, BCount, IsNotOK, IsBlank, CurrentModuleObject + " Name"); + UtilityRoutines::VerifyName(*state, Alphas(1), state->dataBranchInputManager->Branch, BCount, IsNotOK, IsBlank, CurrentModuleObject + " Name"); if (IsNotOK) { if (IsBlank) { continue; @@ -131,7 +132,7 @@ TEST_F(EnergyPlusFixture, GetBranchInput_One_SingleComponentBranch) } ++BCount; - GetSingleBranchInput(state, RoutineName, BCount, Alphas, cAlphaFields, NumAlphas, NodeNums, lAlphaBlanks); + GetSingleBranchInput(*state, RoutineName, BCount, Alphas, cAlphaFields, NumAlphas, NodeNums, lAlphaBlanks); } EXPECT_EQ(NumOfBranches, 1); @@ -242,7 +243,7 @@ TEST_F(EnergyPlusFixture, GetBranchInput_One_FourComponentBranch) static std::string const RoutineName("GetBranchInput: "); std::string CurrentModuleObject = "Branch"; - int NumOfBranches = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumOfBranches = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); int NumParams; int NumAlphas; // Used to retrieve names from IDF int NumNumbers; // Used to retrieve numbers from IDF @@ -258,12 +259,12 @@ TEST_F(EnergyPlusFixture, GetBranchInput_One_FourComponentBranch) int IOStat; // Could be used in the Get Routines, not currently checked if (NumOfBranches > 0) { - state.dataBranchInputManager->Branch.allocate(NumOfBranches); - for (auto &e : state.dataBranchInputManager->Branch) + state->dataBranchInputManager->Branch.allocate(NumOfBranches); + for (auto &e : state->dataBranchInputManager->Branch) e.AssignedLoopName.clear(); - inputProcessor->getObjectDefMaxArgs(state, "NodeList", NumParams, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, "NodeList", NumParams, NumAlphas, NumNumbers); NodeNums.dimension(NumParams, 0); - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, NumParams, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, NumParams, NumAlphas, NumNumbers); Alphas.allocate(NumAlphas); Numbers.dimension(NumNumbers, 0.0); cAlphaFields.allocate(NumAlphas); @@ -273,11 +274,11 @@ TEST_F(EnergyPlusFixture, GetBranchInput_One_FourComponentBranch) int BCount = 0; for (int Count = 1; Count <= NumOfBranches; ++Count) { - inputProcessor->getObjectItem(state, CurrentModuleObject, Count, Alphas, NumAlphas, Numbers, NumNumbers, IOStat, lNumericBlanks, lAlphaBlanks, + inputProcessor->getObjectItem(*state, CurrentModuleObject, Count, Alphas, NumAlphas, Numbers, NumNumbers, IOStat, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields); IsNotOK = false; IsBlank = false; - UtilityRoutines::VerifyName(state, Alphas(1), state.dataBranchInputManager->Branch, BCount, IsNotOK, IsBlank, CurrentModuleObject + " Name"); + UtilityRoutines::VerifyName(*state, Alphas(1), state->dataBranchInputManager->Branch, BCount, IsNotOK, IsBlank, CurrentModuleObject + " Name"); if (IsNotOK) { if (IsBlank) { continue; @@ -287,7 +288,7 @@ TEST_F(EnergyPlusFixture, GetBranchInput_One_FourComponentBranch) } ++BCount; - GetSingleBranchInput(state, RoutineName, BCount, Alphas, cAlphaFields, NumAlphas, NodeNums, lAlphaBlanks); + GetSingleBranchInput(*state, RoutineName, BCount, Alphas, cAlphaFields, NumAlphas, NodeNums, lAlphaBlanks); } EXPECT_EQ(NumOfBranches, 1); @@ -374,7 +375,7 @@ TEST_F(EnergyPlusFixture, BranchInputManager_FindAirLoopBranchConnection) FoundLoopVolFlowRate = 0.0; MatchedLoop = false; - FindAirLoopBranchConnection(state, BranchListName, FoundLoopName, FoundLoopNum, LoopType, FoundLoopVolFlowRate, MatchedLoop); + FindAirLoopBranchConnection(*state, BranchListName, FoundLoopName, FoundLoopNum, LoopType, FoundLoopVolFlowRate, MatchedLoop); EXPECT_EQ("AIR LOOP 1", FoundLoopName); EXPECT_EQ(2, FoundLoopNum); @@ -390,7 +391,7 @@ TEST_F(EnergyPlusFixture, BranchInputManager_FindAirLoopBranchConnection) FoundLoopVolFlowRate = 0.0; MatchedLoop = false; - FindAirLoopBranchConnection(state, BranchListName, FoundLoopName, FoundLoopNum, LoopType, FoundLoopVolFlowRate, MatchedLoop); + FindAirLoopBranchConnection(*state, BranchListName, FoundLoopName, FoundLoopNum, LoopType, FoundLoopVolFlowRate, MatchedLoop); EXPECT_EQ("DOAS", FoundLoopName); EXPECT_EQ(1, FoundLoopNum); @@ -406,7 +407,7 @@ TEST_F(EnergyPlusFixture, BranchInputManager_FindAirLoopBranchConnection) FoundLoopVolFlowRate = 0.0; MatchedLoop = false; - FindAirLoopBranchConnection(state, BranchListName, FoundLoopName, FoundLoopNum, LoopType, FoundLoopVolFlowRate, MatchedLoop); + FindAirLoopBranchConnection(*state, BranchListName, FoundLoopName, FoundLoopNum, LoopType, FoundLoopVolFlowRate, MatchedLoop); EXPECT_EQ("None", FoundLoopName); EXPECT_EQ(0, FoundLoopNum); @@ -460,7 +461,7 @@ TEST_F(EnergyPlusFixture, BranchInputManager_GetAirBranchIndex) CompType = "AIRLOOPHVAC:OUTDOORAIRSYSTEM"; CompName = "DOAS OA SYSTEM"; - BranchIndex = GetAirBranchIndex(state, CompType, CompName); + BranchIndex = GetAirBranchIndex(*state, CompType, CompName); EXPECT_EQ(1, BranchIndex); @@ -468,7 +469,7 @@ TEST_F(EnergyPlusFixture, BranchInputManager_GetAirBranchIndex) CompType = "PIPE:ADIABATIC"; CompName = "TOWERWATERSYS DEMAND BYPASS PIPE"; - BranchIndex = GetAirBranchIndex(state, CompType, CompName); + BranchIndex = GetAirBranchIndex(*state, CompType, CompName); EXPECT_EQ(2, BranchIndex); @@ -476,7 +477,7 @@ TEST_F(EnergyPlusFixture, BranchInputManager_GetAirBranchIndex) CompType = "PIPE:ADIABATIC"; CompName = "TOWERWATERSYS DEMAND BYPASS PIPE NOT THERE"; - BranchIndex = GetAirBranchIndex(state, CompType, CompName); + BranchIndex = GetAirBranchIndex(*state, CompType, CompName); EXPECT_EQ(0, BranchIndex); } diff --git a/tst/EnergyPlus/unit/BranchNodeConnections.unit.cc b/tst/EnergyPlus/unit/BranchNodeConnections.unit.cc index 9dc74ab17e2..0c7662cd60f 100644 --- a/tst/EnergyPlus/unit/BranchNodeConnections.unit.cc +++ b/tst/EnergyPlus/unit/BranchNodeConnections.unit.cc @@ -74,6 +74,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::BranchNodeConnections; @@ -93,10 +94,10 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, BranchNodeErrorCheck_SingleNode) { bool errFlag = false; - RegisterNodeConnection(state, 1, "BadNode", "Type1", "Object1", "ZoneNode", 1, false, errFlag); + RegisterNodeConnection(*state, 1, "BadNode", "Type1", "Object1", "ZoneNode", 1, false, errFlag); bool ErrorsFound = false; - CheckNodeConnections(state, ErrorsFound); + CheckNodeConnections(*state, ErrorsFound); EXPECT_FALSE(errFlag); // Node should register without error EXPECT_FALSE(ErrorsFound); // Node check should not fail on Check 10 -- zone node name must be unique @@ -105,13 +106,13 @@ TEST_F(EnergyPlusFixture, BranchNodeErrorCheck_SingleNode) TEST_F(EnergyPlusFixture, BranchNodeErrorCheck11Test) { bool errFlag = false; - RegisterNodeConnection(state, 1, "BadNode", "Type1", "Object1", "ZoneNode", 1, false, errFlag); - RegisterNodeConnection(state, 2, "GoodNode", "Type2", "Object2", "Sensor", 1, false, errFlag); - RegisterNodeConnection(state, 1, "BadNode", "Type3", "Object3", "ZoneNode", 1, false, errFlag); - RegisterNodeConnection(state, 2, "GoodNode", "Type4", "Object4", "Outlet", 1, false, errFlag); + RegisterNodeConnection(*state, 1, "BadNode", "Type1", "Object1", "ZoneNode", 1, false, errFlag); + RegisterNodeConnection(*state, 2, "GoodNode", "Type2", "Object2", "Sensor", 1, false, errFlag); + RegisterNodeConnection(*state, 1, "BadNode", "Type3", "Object3", "ZoneNode", 1, false, errFlag); + RegisterNodeConnection(*state, 2, "GoodNode", "Type4", "Object4", "Outlet", 1, false, errFlag); bool ErrorsFound = false; - CheckNodeConnections(state, ErrorsFound); + CheckNodeConnections(*state, ErrorsFound); std::string const error_string = delimited_string( {" ** Severe ** Node Connection Error, Node Name=\"BadNode\", The same zone node appears more than once.", " ** ~~~ ** Reference Object=TYPE1, Object Name=Object1", " ** ~~~ ** Reference Object=TYPE3, Object Name=Object3"}); @@ -1111,20 +1112,20 @@ TEST_F(EnergyPlusFixture, BranchNodeConnections_ReturnPlenumNodeCheckFailure) ASSERT_TRUE(process_idf(idf_objects)); compare_err_stream(""); // OutputProcessor::TimeValue.allocate(2); - state.dataGlobal->DDOnlySimulation = true; + state->dataGlobal->DDOnlySimulation = true; - GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); - SetPreConstructionInputParameters(state); // establish array bounds for constructions early + GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); + SetPreConstructionInputParameters(*state); // establish array bounds for constructions early createFacilityElectricPowerServiceObject(); - BranchInputManager::ManageBranchInput(state); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->ZoneSizingCalc = true; - SizingManager::ManageSizing(state); + BranchInputManager::ManageBranchInput(*state); + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->ZoneSizingCalc = true; + SizingManager::ManageSizing(*state); bool ErrorsFound(false); - BranchNodeConnections::CheckNodeConnections(state, ErrorsFound); + BranchNodeConnections::CheckNodeConnections(*state, ErrorsFound); EXPECT_TRUE(ErrorsFound); // Node check will fail on Check 11 -- AirLoopHVAC:ReturnPlenum zone node name must be unique } @@ -2119,20 +2120,20 @@ TEST_F(EnergyPlusFixture, BranchNodeConnections_ReturnPlenumNodeCheck) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - state.dataGlobal->DDOnlySimulation = true; + state->dataGlobal->DDOnlySimulation = true; - GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); - SetPreConstructionInputParameters(state); // establish array bounds for constructions early + GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); + SetPreConstructionInputParameters(*state); // establish array bounds for constructions early createFacilityElectricPowerServiceObject(); - BranchInputManager::ManageBranchInput(state); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->ZoneSizingCalc = true; - SizingManager::ManageSizing(state); + BranchInputManager::ManageBranchInput(*state); + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->ZoneSizingCalc = true; + SizingManager::ManageSizing(*state); bool ErrorsFound(false); - BranchNodeConnections::CheckNodeConnections(state, ErrorsFound); + BranchNodeConnections::CheckNodeConnections(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/CTElectricGenerator.unit.cc b/tst/EnergyPlus/unit/CTElectricGenerator.unit.cc index 611dba3b7e0..848f64af3cf 100644 --- a/tst/EnergyPlus/unit/CTElectricGenerator.unit.cc +++ b/tst/EnergyPlus/unit/CTElectricGenerator.unit.cc @@ -52,6 +52,7 @@ // EnergyPlus Headers #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -139,9 +140,9 @@ TEST_F(EnergyPlusFixture, CTElectricGenerator_Fueltype) ASSERT_TRUE(process_idf(idf_objects)); - GetCTGeneratorInput(state); + GetCTGeneratorInput(*state); - EXPECT_EQ(state.dataCTElectricGenerator->CTGenerator(1).FuelType, "NaturalGas"); + EXPECT_EQ(state->dataCTElectricGenerator->CTGenerator(1).FuelType, "NaturalGas"); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/ChilledCeilingPanelSimple.unit.cc b/tst/EnergyPlus/unit/ChilledCeilingPanelSimple.unit.cc index 52b23aa65b5..badf9744584 100644 --- a/tst/EnergyPlus/unit/ChilledCeilingPanelSimple.unit.cc +++ b/tst/EnergyPlus/unit/ChilledCeilingPanelSimple.unit.cc @@ -56,6 +56,7 @@ #include #include #include +#include using namespace EnergyPlus::CoolingPanelSimple; @@ -72,7 +73,7 @@ TEST_F(EnergyPlusFixture, SetCoolingPanelControlTemp) CoolingPanelNum = 1; ZoneNum = 1; - state.dataChilledCeilingPanelSimple->CoolingPanel.allocate(1); + state->dataChilledCeilingPanelSimple->CoolingPanel.allocate(1); DataHeatBalFanSys::MAT.allocate(1); DataHeatBalFanSys::MAT(1) = 22.0; DataHeatBalance::MRT.allocate(1); @@ -81,24 +82,24 @@ TEST_F(EnergyPlusFixture, SetCoolingPanelControlTemp) DataHeatBalance::Zone(1).OutDryBulbTemp = 10.0; DataHeatBalance::Zone(1).OutWetBulbTemp = 5.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ControlType = CoolingPanelSimple::Control::MAT; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SetCoolingPanelControlTemp(state, ControlTemp, ZoneNum); + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ControlType = CoolingPanelSimple::Control::MAT; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SetCoolingPanelControlTemp(*state, ControlTemp, ZoneNum); EXPECT_EQ(ControlTemp, 22.0); - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ControlType = CoolingPanelSimple::Control::MRT; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SetCoolingPanelControlTemp(state, ControlTemp, ZoneNum); + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ControlType = CoolingPanelSimple::Control::MRT; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SetCoolingPanelControlTemp(*state, ControlTemp, ZoneNum); EXPECT_EQ(ControlTemp, 20.0); - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ControlType = CoolingPanelSimple::Control::Operative; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SetCoolingPanelControlTemp(state, ControlTemp, ZoneNum); + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ControlType = CoolingPanelSimple::Control::Operative; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SetCoolingPanelControlTemp(*state, ControlTemp, ZoneNum); EXPECT_EQ(ControlTemp, 21.0); - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ControlType = CoolingPanelSimple::Control::ODB; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SetCoolingPanelControlTemp(state, ControlTemp, ZoneNum); + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ControlType = CoolingPanelSimple::Control::ODB; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SetCoolingPanelControlTemp(*state, ControlTemp, ZoneNum); EXPECT_EQ(ControlTemp, 10.0); - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ControlType = CoolingPanelSimple::Control::OWB; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SetCoolingPanelControlTemp(state, ControlTemp, ZoneNum); + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ControlType = CoolingPanelSimple::Control::OWB; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SetCoolingPanelControlTemp(*state, ControlTemp, ZoneNum); EXPECT_EQ(ControlTemp, 5.0); } @@ -111,49 +112,49 @@ TEST_F(EnergyPlusFixture, SizeCoolingPanelUA) CoolingPanelNum = 1; SizeCoolingPanelUASuccess = true; - state.dataChilledCeilingPanelSimple->CoolingPanel.allocate(CoolingPanelNum); + state->dataChilledCeilingPanelSimple->CoolingPanel.allocate(CoolingPanelNum); // Valid input combination - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterFlowRate = 1.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ScaledCoolingCapacity = 4000.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterTemp = 20.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedZoneAirTemp = 21.0; - SizeCoolingPanelUASuccess = state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SizeCoolingPanelUA(state); + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterFlowRate = 1.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ScaledCoolingCapacity = 4000.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterTemp = 20.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedZoneAirTemp = 21.0; + SizeCoolingPanelUASuccess = state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SizeCoolingPanelUA(*state); EXPECT_EQ(SizeCoolingPanelUASuccess, true); - EXPECT_NEAR(state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).UA, 14569.0, 1.0); + EXPECT_NEAR(state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).UA, 14569.0, 1.0); // Capacity slightly high case--code fixes this and moves on - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterFlowRate = 1.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ScaledCoolingCapacity = 4200.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterTemp = 20.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedZoneAirTemp = 21.0; - SizeCoolingPanelUASuccess = state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SizeCoolingPanelUA(state); + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterFlowRate = 1.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ScaledCoolingCapacity = 4200.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterTemp = 20.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedZoneAirTemp = 21.0; + SizeCoolingPanelUASuccess = state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SizeCoolingPanelUA(*state); EXPECT_EQ(SizeCoolingPanelUASuccess, true); - EXPECT_NEAR(state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).UA, 37947.0, 1.0); + EXPECT_NEAR(state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).UA, 37947.0, 1.0); // Temperatures too close--code fixes this and moves on - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterFlowRate = 1.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ScaledCoolingCapacity = 2000.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterTemp = 20.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedZoneAirTemp = 20.4; - SizeCoolingPanelUASuccess = state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SizeCoolingPanelUA(state); + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterFlowRate = 1.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ScaledCoolingCapacity = 2000.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterTemp = 20.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedZoneAirTemp = 20.4; + SizeCoolingPanelUASuccess = state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SizeCoolingPanelUA(*state); EXPECT_EQ(SizeCoolingPanelUASuccess, true); - EXPECT_NEAR(state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).UA, 14569.0, 1.0); + EXPECT_NEAR(state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).UA, 14569.0, 1.0); // Capacity too high case - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterFlowRate = 1.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ScaledCoolingCapacity = 5000.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterTemp = 20.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedZoneAirTemp = 21.0; - SizeCoolingPanelUASuccess = state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SizeCoolingPanelUA(state); + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterFlowRate = 1.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ScaledCoolingCapacity = 5000.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterTemp = 20.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedZoneAirTemp = 21.0; + SizeCoolingPanelUASuccess = state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SizeCoolingPanelUA(*state); EXPECT_EQ(SizeCoolingPanelUASuccess, false); // Water temperature higher than zone temperature (not cooling) case - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterFlowRate = 1.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ScaledCoolingCapacity = 4000.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterTemp = 21.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedZoneAirTemp = 20.0; - SizeCoolingPanelUASuccess = state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SizeCoolingPanelUA(state); + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterFlowRate = 1.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ScaledCoolingCapacity = 4000.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedWaterTemp = 21.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RatedZoneAirTemp = 20.0; + SizeCoolingPanelUASuccess = state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).SizeCoolingPanelUA(*state); EXPECT_EQ(SizeCoolingPanelUASuccess, false); } @@ -163,18 +164,18 @@ TEST_F(EnergyPlusFixture, ReportCoolingPanel) CoolingPanelNum = 1; - state.dataChilledCeilingPanelSimple->CoolingPanel.allocate(CoolingPanelNum); + state->dataChilledCeilingPanelSimple->CoolingPanel.allocate(CoolingPanelNum); // Test the new output for running the values through the Report subroutine - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).TotPower = -10.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).Power = -9.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ConvPower = -4.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RadPower = -5.0; - state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ReportCoolingPanel(); - EXPECT_NEAR(state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).TotPower, 10.0, 1.0); - EXPECT_NEAR(state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).Power, 9.0, 1.0); - EXPECT_NEAR(state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ConvPower, 4.0, 1.0); - EXPECT_NEAR(state.dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RadPower, 5.0, 1.0); + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).TotPower = -10.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).Power = -9.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ConvPower = -4.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RadPower = -5.0; + state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ReportCoolingPanel(); + EXPECT_NEAR(state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).TotPower, 10.0, 1.0); + EXPECT_NEAR(state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).Power, 9.0, 1.0); + EXPECT_NEAR(state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).ConvPower, 4.0, 1.0); + EXPECT_NEAR(state->dataChilledCeilingPanelSimple->CoolingPanel(CoolingPanelNum).RadPower, 5.0, 1.0); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/ChillerAbsorption.unit.cc b/tst/EnergyPlus/unit/ChillerAbsorption.unit.cc index 25ad2209d32..dfd062350b9 100644 --- a/tst/EnergyPlus/unit/ChillerAbsorption.unit.cc +++ b/tst/EnergyPlus/unit/ChillerAbsorption.unit.cc @@ -58,6 +58,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -1773,7 +1774,7 @@ TEST_F(EnergyPlusFixture, ChillerAbsorption_Calc) ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::ManageSimulation(state); // run the design day + SimulationManager::ManageSimulation(*state); // run the design day // set conditions for test int AbsChillNum = 1; @@ -1781,7 +1782,7 @@ TEST_F(EnergyPlusFixture, ChillerAbsorption_Calc) Real64 AbsChillEvapLoad; bool AbsChillRunFlag = true; // check chiller inputs - auto &thisChiller = state.dataChillerAbsorber->absorptionChillers(AbsChillNum); + auto &thisChiller = state->dataChillerAbsorber->absorptionChillers(AbsChillNum); EXPECT_EQ(thisChiller.NomCap, 100000.0); EXPECT_EQ(thisChiller.FlowMode, DataPlant::FlowMode::LEAVINGSETPOINTMODULATED); // define local var @@ -1817,7 +1818,7 @@ TEST_F(EnergyPlusFixture, ChillerAbsorption_Calc) PlantLoop(GenLoopNum).LoopSide(GenLoopSideNum).FlowLock = 0; // run CalcBLASTAbsorberModel thisChiller.EquipFlowCtrl = EquipFlowCtrl; - thisChiller.calculate(state, AbsChillEvapLoad, AbsChillRunFlag); + thisChiller.calculate(*state, AbsChillEvapLoad, AbsChillRunFlag); // check generator hot water mass flow rate is proportional to the chilled water flow rate EXPECT_EQ(DataLoopNode::Node(GeneratorInletNode).MassFlowRate, GenMassFlowRateTestResult); EXPECT_EQ(DataLoopNode::Node(GeneratorOutletNode).MassFlowRate, GenMassFlowRateTestResult); diff --git a/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc b/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc index 25c9662d795..9b98f28b1e9 100644 --- a/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc +++ b/tst/EnergyPlus/unit/ChillerConstantCOP.unit.cc @@ -59,6 +59,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::DataLoopNode; @@ -71,9 +72,9 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_WaterCooled_Autosize) DataPlant::TotNumLoops = 4; DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; std::string const idf_objects = delimited_string({ " Chiller:ConstantCOP,", @@ -108,9 +109,9 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_WaterCooled_Autosize) loopsidebranch.Comp.allocate(1); } - ConstCOPChillerSpecs::getInput(state); + ConstCOPChillerSpecs::getInput(*state); - auto &thisChiller = state.dataPlantChillers->ConstCOPChiller(1); + auto &thisChiller = state->dataPlantChillers->ConstCOPChiller(1); DataPlant::PlantLoop(1).Name = "ChilledWaterLoop"; DataPlant::PlantLoop(1).FluidName = "ChilledWater"; @@ -147,12 +148,12 @@ TEST_F(EnergyPlusFixture, ChillerConstantCOP_WaterCooled_Autosize) Real64 MyLoad(-20000.0); Psychrometrics::InitializePsychRoutines(); - thisChiller.initialize(state, RunFlag, MyLoad); - thisChiller.size(state); + thisChiller.initialize(*state, RunFlag, MyLoad); + thisChiller.size(*state); // run init again after sizing is complete to set mass flow rate - state.dataGlobal->BeginEnvrnFlag = true; - thisChiller.initialize(state, RunFlag, MyLoad); + state->dataGlobal->BeginEnvrnFlag = true; + thisChiller.initialize(*state, RunFlag, MyLoad); // check autocalculate chiller nominal capacity EXPECT_NEAR(thisChiller.NomCap, 20987.5090557, 0.000001); diff --git a/tst/EnergyPlus/unit/ChillerElectric.unit.cc b/tst/EnergyPlus/unit/ChillerElectric.unit.cc index 3f5bbba7924..b57b7f3a9fb 100644 --- a/tst/EnergyPlus/unit/ChillerElectric.unit.cc +++ b/tst/EnergyPlus/unit/ChillerElectric.unit.cc @@ -59,6 +59,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::DataLoopNode; @@ -70,9 +71,9 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Autosize) DataPlant::TotNumLoops = 4; DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; std::string const idf_objects = delimited_string({ " Chiller:Electric,", @@ -120,27 +121,27 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Autosize) loopsidebranch.Comp.allocate(1); } - ElectricChillerSpecs::getInput(state); + ElectricChillerSpecs::getInput(*state); DataPlant::PlantLoop(1).Name = "ChilledWaterLoop"; DataPlant::PlantLoop(1).FluidName = "ChilledWater"; DataPlant::PlantLoop(1).FluidIndex = 1; DataPlant::PlantLoop(1).PlantSizNum = 1; DataPlant::PlantLoop(1).FluidName = "WATER"; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataPlantChillers->ElectricChiller(1).Name; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataPlantChillers->ElectricChiller(1).Name; DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_Chiller_Electric; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataPlantChillers->ElectricChiller(1).EvapInletNodeNum; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataPlantChillers->ElectricChiller(1).EvapOutletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataPlantChillers->ElectricChiller(1).EvapInletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataPlantChillers->ElectricChiller(1).EvapOutletNodeNum; DataPlant::PlantLoop(2).Name = "CondenserWaterLoop"; DataPlant::PlantLoop(2).FluidName = "CondenserWater"; DataPlant::PlantLoop(2).FluidIndex = 1; DataPlant::PlantLoop(2).PlantSizNum = 2; DataPlant::PlantLoop(2).FluidName = "WATER"; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataPlantChillers->ElectricChiller(1).Name; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataPlantChillers->ElectricChiller(1).Name; DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_Chiller_Electric; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataPlantChillers->ElectricChiller(1).CondInletNodeNum; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataPlantChillers->ElectricChiller(1).CondOutletNodeNum; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataPlantChillers->ElectricChiller(1).CondInletNodeNum; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataPlantChillers->ElectricChiller(1).CondOutletNodeNum; DataSizing::PlantSizData.allocate(2); DataSizing::PlantSizData(1).DesVolFlowRate = 0.001; @@ -157,37 +158,37 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Autosize) Real64 MyLoad(-20000.0); Psychrometrics::InitializePsychRoutines(); - auto &thisChiller = state.dataPlantChillers->ElectricChiller(1); - thisChiller.initialize(state, RunFlag, MyLoad); - thisChiller.size(state); + auto &thisChiller = state->dataPlantChillers->ElectricChiller(1); + thisChiller.initialize(*state, RunFlag, MyLoad); + thisChiller.size(*state); // run init again after sizing is complete to set mass flow rate - state.dataGlobal->BeginEnvrnFlag = true; - thisChiller.initialize(state, RunFlag, MyLoad); + state->dataGlobal->BeginEnvrnFlag = true; + thisChiller.initialize(*state, RunFlag, MyLoad); // check hardsized chiller nominal capacity - EXPECT_DOUBLE_EQ(state.dataPlantChillers->ElectricChiller(1).NomCap, 100000.00); + EXPECT_DOUBLE_EQ(state->dataPlantChillers->ElectricChiller(1).NomCap, 100000.00); // check hardsized chiller evap water vol flow rate - EXPECT_DOUBLE_EQ(state.dataPlantChillers->ElectricChiller(1).EvapVolFlowRate, 0.0011); + EXPECT_DOUBLE_EQ(state->dataPlantChillers->ElectricChiller(1).EvapVolFlowRate, 0.0011); // check hardsized chiller cond water vol flow rate - EXPECT_DOUBLE_EQ(state.dataPlantChillers->ElectricChiller(1).CondVolFlowRate, 0.0011); + EXPECT_DOUBLE_EQ(state->dataPlantChillers->ElectricChiller(1).CondVolFlowRate, 0.0011); // Reset nom cap, Evap Vol Flow Rate and Cond Vol FLow Rate to autosize - state.dataPlantChillers->ElectricChiller(1).NomCap = DataSizing::AutoSize; - state.dataPlantChillers->ElectricChiller(1).EvapVolFlowRate = DataSizing::AutoSize; - state.dataPlantChillers->ElectricChiller(1).CondVolFlowRate = DataSizing::AutoSize; + state->dataPlantChillers->ElectricChiller(1).NomCap = DataSizing::AutoSize; + state->dataPlantChillers->ElectricChiller(1).EvapVolFlowRate = DataSizing::AutoSize; + state->dataPlantChillers->ElectricChiller(1).CondVolFlowRate = DataSizing::AutoSize; // Reset outosize flags - state.dataPlantChillers->ElectricChiller(1).NomCapWasAutoSized = true; - state.dataPlantChillers->ElectricChiller(1).EvapVolFlowRateWasAutoSized = true; - state.dataPlantChillers->ElectricChiller(1).CondVolFlowRateWasAutoSized = true; + state->dataPlantChillers->ElectricChiller(1).NomCapWasAutoSized = true; + state->dataPlantChillers->ElectricChiller(1).EvapVolFlowRateWasAutoSized = true; + state->dataPlantChillers->ElectricChiller(1).CondVolFlowRateWasAutoSized = true; // do autosizing calc - thisChiller.initialize(state, RunFlag, MyLoad); - thisChiller.size(state); + thisChiller.initialize(*state, RunFlag, MyLoad); + thisChiller.size(*state); // check autocalculate chiller nominal capacity - EXPECT_DOUBLE_EQ(state.dataPlantChillers->ElectricChiller(1).NomCap, 20987.509055700004); + EXPECT_DOUBLE_EQ(state->dataPlantChillers->ElectricChiller(1).NomCap, 20987.509055700004); // check autocalculate chiller evap water vol flow rate - EXPECT_DOUBLE_EQ(state.dataPlantChillers->ElectricChiller(1).EvapVolFlowRate, 0.0010000000000000000); + EXPECT_DOUBLE_EQ(state->dataPlantChillers->ElectricChiller(1).EvapVolFlowRate, 0.0010000000000000000); // check autocalculate chiller cond water vol flow rate - EXPECT_DOUBLE_EQ(state.dataPlantChillers->ElectricChiller(1).CondVolFlowRate, 0.0012208075356136608); + EXPECT_DOUBLE_EQ(state->dataPlantChillers->ElectricChiller(1).CondVolFlowRate, 0.0012208075356136608); } TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Simulate) @@ -196,9 +197,9 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Simulate) DataPlant::TotNumLoops = 4; DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataHVACGlobals::TimeStepSys = 60; std::string const idf_objects = delimited_string({ @@ -247,27 +248,27 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Simulate) loopsidebranch.Comp.allocate(1); } - ElectricChillerSpecs::getInput(state); + ElectricChillerSpecs::getInput(*state); DataPlant::PlantLoop(1).Name = "ChilledWaterLoop"; DataPlant::PlantLoop(1).FluidName = "ChilledWater"; DataPlant::PlantLoop(1).FluidIndex = 1; DataPlant::PlantLoop(1).PlantSizNum = 1; DataPlant::PlantLoop(1).FluidName = "WATER"; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataPlantChillers->ElectricChiller(1).Name; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataPlantChillers->ElectricChiller(1).Name; DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_Chiller_Electric; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataPlantChillers->ElectricChiller(1).EvapInletNodeNum; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataPlantChillers->ElectricChiller(1).EvapOutletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataPlantChillers->ElectricChiller(1).EvapInletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataPlantChillers->ElectricChiller(1).EvapOutletNodeNum; DataPlant::PlantLoop(2).Name = "CondenserWaterLoop"; DataPlant::PlantLoop(2).FluidName = "CondenserWater"; DataPlant::PlantLoop(2).FluidIndex = 1; DataPlant::PlantLoop(2).PlantSizNum = 2; DataPlant::PlantLoop(2).FluidName = "WATER"; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataPlantChillers->ElectricChiller(1).Name; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataPlantChillers->ElectricChiller(1).Name; DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_Chiller_Electric; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataPlantChillers->ElectricChiller(1).CondInletNodeNum; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataPlantChillers->ElectricChiller(1).CondOutletNodeNum; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataPlantChillers->ElectricChiller(1).CondInletNodeNum; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataPlantChillers->ElectricChiller(1).CondOutletNodeNum; DataSizing::PlantSizData.allocate(2); DataSizing::PlantSizData(1).DesVolFlowRate = 0.001; @@ -284,31 +285,31 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Simulate) Real64 MyLoad(-20000.0); Psychrometrics::InitializePsychRoutines(); - auto &thisChiller = state.dataPlantChillers->ElectricChiller(1); - thisChiller.initialize(state, RunFlag, MyLoad); - thisChiller.size(state); + auto &thisChiller = state->dataPlantChillers->ElectricChiller(1); + thisChiller.initialize(*state, RunFlag, MyLoad); + thisChiller.size(*state); // run init again after sizing is complete to set mass flow rate - state.dataGlobal->BeginEnvrnFlag = true; - thisChiller.initialize(state, RunFlag, MyLoad); + state->dataGlobal->BeginEnvrnFlag = true; + thisChiller.initialize(*state, RunFlag, MyLoad); // check hardsized chiller nominal capacity - EXPECT_DOUBLE_EQ(state.dataPlantChillers->ElectricChiller(1).NomCap, 100000.00); + EXPECT_DOUBLE_EQ(state->dataPlantChillers->ElectricChiller(1).NomCap, 100000.00); // check hardsized chiller evap water vol flow rate - EXPECT_DOUBLE_EQ(state.dataPlantChillers->ElectricChiller(1).EvapVolFlowRate, 0.0011); + EXPECT_DOUBLE_EQ(state->dataPlantChillers->ElectricChiller(1).EvapVolFlowRate, 0.0011); // check hardsized chiller cond water vol flow rate - EXPECT_DOUBLE_EQ(state.dataPlantChillers->ElectricChiller(1).CondVolFlowRate, 0.0011); + EXPECT_DOUBLE_EQ(state->dataPlantChillers->ElectricChiller(1).CondVolFlowRate, 0.0011); // Reset nom cap, Evap Vol Flow Rate and Cond Vol FLow Rate to autosize - state.dataPlantChillers->ElectricChiller(1).NomCap = DataSizing::AutoSize; - state.dataPlantChillers->ElectricChiller(1).EvapVolFlowRate = DataSizing::AutoSize; - state.dataPlantChillers->ElectricChiller(1).CondVolFlowRate = DataSizing::AutoSize; + state->dataPlantChillers->ElectricChiller(1).NomCap = DataSizing::AutoSize; + state->dataPlantChillers->ElectricChiller(1).EvapVolFlowRate = DataSizing::AutoSize; + state->dataPlantChillers->ElectricChiller(1).CondVolFlowRate = DataSizing::AutoSize; // Reset autosize flags - state.dataPlantChillers->ElectricChiller(1).NomCapWasAutoSized = true; - state.dataPlantChillers->ElectricChiller(1).EvapVolFlowRateWasAutoSized = true; - state.dataPlantChillers->ElectricChiller(1).CondVolFlowRateWasAutoSized = true; + state->dataPlantChillers->ElectricChiller(1).NomCapWasAutoSized = true; + state->dataPlantChillers->ElectricChiller(1).EvapVolFlowRateWasAutoSized = true; + state->dataPlantChillers->ElectricChiller(1).CondVolFlowRateWasAutoSized = true; // Do autosizing calcs - thisChiller.initialize(state, RunFlag, MyLoad); - thisChiller.size(state); + thisChiller.initialize(*state, RunFlag, MyLoad); + thisChiller.size(*state); // simulate PlantLocation loc(1, 1, 1, 1); @@ -316,7 +317,7 @@ TEST_F(EnergyPlusFixture, ChillerElectric_WaterCooled_Simulate) Real64 curLoad = -10000.0; bool runFlag = true; - thisChiller.simulate(state, loc, firstHVAC, curLoad, runFlag); + thisChiller.simulate(*state, loc, firstHVAC, curLoad, runFlag); Real64 TestCOP = thisChiller.QEvaporator / thisChiller.Power; EXPECT_NEAR(TestCOP, thisChiller.ActualCOP, 1E-3); diff --git a/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc b/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc index c7d69e96ec5..fb95c28cb43 100644 --- a/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc +++ b/tst/EnergyPlus/unit/ChillerElectricEIR.unit.cc @@ -57,6 +57,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -66,8 +67,8 @@ using namespace EnergyPlus::DataLoopNode; TEST_F(EnergyPlusFixture, ChillerElectricEIR_TestOutletNodeConditions) { - state.dataChillerElectricEIR->ElectricEIRChiller.allocate(1); - auto &thisEIR = state.dataChillerElectricEIR->ElectricEIRChiller(1); + state->dataChillerElectricEIR->ElectricEIRChiller.allocate(1); + auto &thisEIR = state->dataChillerElectricEIR->ElectricEIRChiller(1); thisEIR.EvapInletNodeNum = 1; thisEIR.EvapOutletNodeNum = 2; @@ -91,8 +92,8 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_TestOutletNodeConditions) TEST_F(EnergyPlusFixture, ElectricEIRChiller_HeatRecoveryAutosizeTest) { // unit test for autosizing heat recovery in Chiller:Electric:EIR - state.dataChillerElectricEIR->ElectricEIRChiller.allocate(1); - auto &thisEIR = state.dataChillerElectricEIR->ElectricEIRChiller(1); + state->dataChillerElectricEIR->ElectricEIRChiller.allocate(1); + auto &thisEIR = state->dataChillerElectricEIR->ElectricEIRChiller(1); thisEIR.SizFac = 1.0; thisEIR.DesignHeatRecVolFlowRateWasAutoSized = true; @@ -124,7 +125,7 @@ TEST_F(EnergyPlusFixture, ElectricEIRChiller_HeatRecoveryAutosizeTest) DataPlant::PlantFirstSizesOkayToFinalize = true; // now call sizing routine - thisEIR.size(state); + thisEIR.size(*state); // see if heat recovery flow rate is as expected EXPECT_NEAR(thisEIR.DesignHeatRecVolFlowRate, 0.5, 0.00001); @@ -141,9 +142,9 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller) DataPlant::TotNumLoops = 2; DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; Psychrometrics::InitializePsychRoutines(); @@ -204,8 +205,8 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller) loopsidebranch.Comp.allocate(1); } - GetElectricEIRChillerInput(state); - auto &thisEIR = state.dataChillerElectricEIR->ElectricEIRChiller(1); + GetElectricEIRChillerInput(*state); + auto &thisEIR = state->dataChillerElectricEIR->ElectricEIRChiller(1); DataPlant::PlantLoop(1).Name = "ChilledWaterLoop"; DataPlant::PlantLoop(1).FluidName = "ChilledWater"; @@ -225,12 +226,12 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_AirCooledChiller) DataPlant::PlantFirstSizesOkayToReport = true; DataPlant::PlantFinalSizesOkayToReport = true; - thisEIR.initialize(state, RunFlag, MyLoad); - thisEIR.size(state); + thisEIR.initialize(*state, RunFlag, MyLoad); + thisEIR.size(*state); // run through init again after sizing is complete to set mass flow rate - state.dataGlobal->BeginEnvrnFlag = true; - thisEIR.initialize(state, RunFlag, MyLoad); + state->dataGlobal->BeginEnvrnFlag = true; + thisEIR.initialize(*state, RunFlag, MyLoad); // check chiller water side evap flow rate is non-zero EXPECT_NEAR(thisEIR.EvapMassFlowRateMax, 0.999898, 0.0000001); @@ -292,9 +293,9 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_EvaporativelyCooled_Calculate) DataPlant::TotNumLoops = 2; DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; Psychrometrics::InitializePsychRoutines(); @@ -311,8 +312,8 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_EvaporativelyCooled_Calculate) loopsidebranch.Comp.allocate(1); } - GetElectricEIRChillerInput(state); - auto &thisEIRChiller = state.dataChillerElectricEIR->ElectricEIRChiller(1); + GetElectricEIRChillerInput(*state); + auto &thisEIRChiller = state->dataChillerElectricEIR->ElectricEIRChiller(1); DataPlant::PlantLoop(1).Name = "ChilledWaterLoop"; DataPlant::PlantLoop(1).FluidName = "ChilledWater"; @@ -335,7 +336,7 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_EvaporativelyCooled_Calculate) DataEnvironment::OutDryBulbTemp = 29.4; DataEnvironment::OutWetBulbTemp = 23.0; DataEnvironment::OutHumRat = - Psychrometrics::PsyWFnTdbTwbPb(state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutWetBulbTemp, DataEnvironment::OutBaroPress); + Psychrometrics::PsyWFnTdbTwbPb(*state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutWetBulbTemp, DataEnvironment::OutBaroPress); DataLoopNode::Node(thisEIRChiller.CondInletNodeNum).Temp = DataEnvironment::OutDryBulbTemp; DataLoopNode::Node(thisEIRChiller.CondInletNodeNum).OutAirWetBulb = DataEnvironment::OutWetBulbTemp; DataLoopNode::Node(thisEIRChiller.CondInletNodeNum).HumRat = DataEnvironment::OutHumRat; @@ -343,17 +344,17 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_EvaporativelyCooled_Calculate) // set load and run flag bool RunFlag(true); Real64 MyLoad(-18000.0); - openOutputFiles(state); + openOutputFiles(*state); DataPlant::PlantLoop(1).LoopDemandCalcScheme = DataPlant::SingleSetPoint; DataLoopNode::Node(thisEIRChiller.EvapOutletNodeNum).TempSetPoint = 6.67; DataLoopNode::Node(thisEIRChiller.EvapInletNodeNum).Temp = 16.0; // init and size - thisEIRChiller.initialize(state, RunFlag, MyLoad); - thisEIRChiller.size(state); + thisEIRChiller.initialize(*state, RunFlag, MyLoad); + thisEIRChiller.size(*state); // init again after sizing is complete to set mass flow rate - state.dataGlobal->BeginEnvrnFlag = true; - thisEIRChiller.initialize(state, RunFlag, MyLoad); + state->dataGlobal->BeginEnvrnFlag = true; + thisEIRChiller.initialize(*state, RunFlag, MyLoad); // check chiller water side evap flow rate is non-zero EXPECT_NEAR(thisEIRChiller.EvapMassFlowRateMax, 0.999898, 0.0000001); // check autocalculate for evaporatively-cooled chiller condenser side fluid flow rate @@ -362,7 +363,7 @@ TEST_F(EnergyPlusFixture, ChillerElectricEIR_EvaporativelyCooled_Calculate) EXPECT_NEAR(thisEIRChiller.CondVolFlowRate, 2.3925760323498, 0.0000001); EXPECT_NEAR(thisEIRChiller.CondMassFlowRateMax, 2.7918772761695, 0.0000001); // run chiller - thisEIRChiller.calculate(state, MyLoad, RunFlag); + thisEIRChiller.calculate(*state, MyLoad, RunFlag); // calc evap-cooler water consumption rate Real64 EvapCondWaterVolFlowRate = thisEIRChiller.CondMassFlowRate * (thisEIRChiller.CondOutletHumRat - DataEnvironment::OutHumRat) / Psychrometrics::RhoH2O(DataGlobalConstants::InitConvTemp()); diff --git a/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc b/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc index 1a4b3e614c5..b2fd770e004 100644 --- a/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc +++ b/tst/EnergyPlus/unit/ChillerExhaustAbsorption.unit.cc @@ -54,6 +54,7 @@ // EnergyPlus Headers #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -297,30 +298,30 @@ TEST_F(EnergyPlusFixture, ExhAbsorption_GetInput_Test) ASSERT_TRUE(process_idf(idf_objects)); compare_err_stream(""); - GetExhaustAbsorberInput(state); + GetExhaustAbsorberInput(*state); compare_err_stream(""); - EXPECT_EQ(1u, state.dataChillerExhaustAbsorption->ExhaustAbsorber.size()); - EXPECT_EQ("EXH CHILLER", state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).Name); + EXPECT_EQ(1u, state->dataChillerExhaustAbsorption->ExhaustAbsorber.size()); + EXPECT_EQ("EXH CHILLER", state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).Name); - EXPECT_EQ(100000., state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).NomCoolingCap); - EXPECT_EQ(0.8, state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).NomHeatCoolRatio); - EXPECT_EQ(0.97, state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).ThermalEnergyCoolRatio); - EXPECT_EQ(1.25, state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).ThermalEnergyHeatRatio); - EXPECT_EQ(0.01, state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).ElecCoolRatio); - EXPECT_EQ(0.005, state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).ElecHeatRatio); + EXPECT_EQ(100000., state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).NomCoolingCap); + EXPECT_EQ(0.8, state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).NomHeatCoolRatio); + EXPECT_EQ(0.97, state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).ThermalEnergyCoolRatio); + EXPECT_EQ(1.25, state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).ThermalEnergyHeatRatio); + EXPECT_EQ(0.01, state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).ElecCoolRatio); + EXPECT_EQ(0.005, state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).ElecHeatRatio); - EXPECT_EQ(0.000001, state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).MinPartLoadRat); - EXPECT_EQ(1.0, state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).MaxPartLoadRat); - EXPECT_EQ(0.6, state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).OptPartLoadRat); + EXPECT_EQ(0.000001, state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).MinPartLoadRat); + EXPECT_EQ(1.0, state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).MaxPartLoadRat); + EXPECT_EQ(0.6, state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).OptPartLoadRat); - EXPECT_EQ(29., state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).TempDesCondReturn); - EXPECT_EQ(7., state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).TempDesCHWSupply); - EXPECT_EQ(0.0011, state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).EvapVolFlowRate); - EXPECT_EQ(0.0043, state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).HeatVolFlowRate); + EXPECT_EQ(29., state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).TempDesCondReturn); + EXPECT_EQ(7., state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).TempDesCHWSupply); + EXPECT_EQ(0.0011, state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).EvapVolFlowRate); + EXPECT_EQ(0.0043, state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).HeatVolFlowRate); - EXPECT_TRUE(state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).isEnterCondensTemp); - EXPECT_FALSE(state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).isWaterCooled); - EXPECT_EQ(2., state.dataChillerExhaustAbsorption->ExhaustAbsorber(1).CHWLowLimitTemp); + EXPECT_TRUE(state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).isEnterCondensTemp); + EXPECT_FALSE(state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).isWaterCooled); + EXPECT_EQ(2., state->dataChillerExhaustAbsorption->ExhaustAbsorber(1).CHWLowLimitTemp); } diff --git a/tst/EnergyPlus/unit/ChillerGasAbsorption.unit.cc b/tst/EnergyPlus/unit/ChillerGasAbsorption.unit.cc index 5467a9495c7..2ff382b6eb0 100644 --- a/tst/EnergyPlus/unit/ChillerGasAbsorption.unit.cc +++ b/tst/EnergyPlus/unit/ChillerGasAbsorption.unit.cc @@ -54,6 +54,7 @@ // EnergyPlus Headers #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -140,33 +141,33 @@ TEST_F(EnergyPlusFixture, GasAbsorption_GetInput_Test) ASSERT_TRUE(process_idf(idf_objects)); - GetGasAbsorberInput(state); + GetGasAbsorberInput(*state); - EXPECT_EQ(1u, state.dataChillerGasAbsorption->GasAbsorber.size()); - EXPECT_EQ("BIG CHILLER", state.dataChillerGasAbsorption->GasAbsorber(1).Name); - EXPECT_EQ(100000., state.dataChillerGasAbsorption->GasAbsorber(1).NomCoolingCap); - EXPECT_EQ(0.8, state.dataChillerGasAbsorption->GasAbsorber(1).NomHeatCoolRatio); + EXPECT_EQ(1u, state->dataChillerGasAbsorption->GasAbsorber.size()); + EXPECT_EQ("BIG CHILLER", state->dataChillerGasAbsorption->GasAbsorber(1).Name); + EXPECT_EQ(100000., state->dataChillerGasAbsorption->GasAbsorber(1).NomCoolingCap); + EXPECT_EQ(0.8, state->dataChillerGasAbsorption->GasAbsorber(1).NomHeatCoolRatio); - EXPECT_EQ(0.97, state.dataChillerGasAbsorption->GasAbsorber(1).FuelCoolRatio); - EXPECT_EQ(1.25, state.dataChillerGasAbsorption->GasAbsorber(1).FuelHeatRatio); - EXPECT_EQ(0.01, state.dataChillerGasAbsorption->GasAbsorber(1).ElecCoolRatio); - EXPECT_EQ(0.005, state.dataChillerGasAbsorption->GasAbsorber(1).ElecHeatRatio); + EXPECT_EQ(0.97, state->dataChillerGasAbsorption->GasAbsorber(1).FuelCoolRatio); + EXPECT_EQ(1.25, state->dataChillerGasAbsorption->GasAbsorber(1).FuelHeatRatio); + EXPECT_EQ(0.01, state->dataChillerGasAbsorption->GasAbsorber(1).ElecCoolRatio); + EXPECT_EQ(0.005, state->dataChillerGasAbsorption->GasAbsorber(1).ElecHeatRatio); - EXPECT_EQ(0.000001, state.dataChillerGasAbsorption->GasAbsorber(1).MinPartLoadRat); - EXPECT_EQ(1.0, state.dataChillerGasAbsorption->GasAbsorber(1).MaxPartLoadRat); - EXPECT_EQ(0.6, state.dataChillerGasAbsorption->GasAbsorber(1).OptPartLoadRat); + EXPECT_EQ(0.000001, state->dataChillerGasAbsorption->GasAbsorber(1).MinPartLoadRat); + EXPECT_EQ(1.0, state->dataChillerGasAbsorption->GasAbsorber(1).MaxPartLoadRat); + EXPECT_EQ(0.6, state->dataChillerGasAbsorption->GasAbsorber(1).OptPartLoadRat); - EXPECT_EQ(29., state.dataChillerGasAbsorption->GasAbsorber(1).TempDesCondReturn); - EXPECT_EQ(7., state.dataChillerGasAbsorption->GasAbsorber(1).TempDesCHWSupply); - EXPECT_EQ(0.0011, state.dataChillerGasAbsorption->GasAbsorber(1).EvapVolFlowRate); - EXPECT_EQ(0.0043, state.dataChillerGasAbsorption->GasAbsorber(1).HeatVolFlowRate); + EXPECT_EQ(29., state->dataChillerGasAbsorption->GasAbsorber(1).TempDesCondReturn); + EXPECT_EQ(7., state->dataChillerGasAbsorption->GasAbsorber(1).TempDesCHWSupply); + EXPECT_EQ(0.0011, state->dataChillerGasAbsorption->GasAbsorber(1).EvapVolFlowRate); + EXPECT_EQ(0.0043, state->dataChillerGasAbsorption->GasAbsorber(1).HeatVolFlowRate); - EXPECT_TRUE(state.dataChillerGasAbsorption->GasAbsorber(1).isEnterCondensTemp); - EXPECT_FALSE(state.dataChillerGasAbsorption->GasAbsorber(1).isWaterCooled); + EXPECT_TRUE(state->dataChillerGasAbsorption->GasAbsorber(1).isEnterCondensTemp); + EXPECT_FALSE(state->dataChillerGasAbsorption->GasAbsorber(1).isWaterCooled); - EXPECT_EQ(2., state.dataChillerGasAbsorption->GasAbsorber(1).CHWLowLimitTemp); - EXPECT_EQ("NaturalGas", state.dataChillerGasAbsorption->GasAbsorber(1).FuelType); + EXPECT_EQ(2., state->dataChillerGasAbsorption->GasAbsorber(1).CHWLowLimitTemp); + EXPECT_EQ("NaturalGas", state->dataChillerGasAbsorption->GasAbsorber(1).FuelType); // Additional tests for fuel type input - EXPECT_EQ(state.dataChillerGasAbsorption->GasAbsorber(1).FuelType, "NaturalGas"); + EXPECT_EQ(state->dataChillerGasAbsorption->GasAbsorber(1).FuelType, "NaturalGas"); } diff --git a/tst/EnergyPlus/unit/ChillerIndirectAbsorption.unit.cc b/tst/EnergyPlus/unit/ChillerIndirectAbsorption.unit.cc index 1a6e9e3f3c1..5b8bbc6ccb3 100644 --- a/tst/EnergyPlus/unit/ChillerIndirectAbsorption.unit.cc +++ b/tst/EnergyPlus/unit/ChillerIndirectAbsorption.unit.cc @@ -55,6 +55,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -100,16 +101,16 @@ TEST_F(EnergyPlusFixture, ChillerIndirectAbsorption_GetInput) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->DoWeathSim = true; + state->dataGlobal->DoWeathSim = true; - GetIndirectAbsorberInput(state); + GetIndirectAbsorberInput(*state); - EXPECT_EQ(state.dataChillerIndirectAbsorption->IndirectAbsorber.size(), 1u); - EXPECT_EQ(state.dataChillerIndirectAbsorption->IndirectAbsorber(1).Name, "BIG CHILLER"); - EXPECT_EQ(state.dataChillerIndirectAbsorption->IndirectAbsorber(1).NomCap, 10000.); - EXPECT_EQ(state.dataChillerIndirectAbsorption->IndirectAbsorber(1).NomPumpPower, 150.); - EXPECT_EQ(state.dataChillerIndirectAbsorption->IndirectAbsorber(1).MinPartLoadRat, 0.15); - EXPECT_EQ(state.dataChillerIndirectAbsorption->IndirectAbsorber(1).MaxPartLoadRat, 1.00); - EXPECT_EQ(state.dataChillerIndirectAbsorption->IndirectAbsorber(1).OptPartLoadRat, 0.65); - EXPECT_EQ(state.dataChillerIndirectAbsorption->IndirectAbsorber(1).LoopSubcool, 12.0); + EXPECT_EQ(state->dataChillerIndirectAbsorption->IndirectAbsorber.size(), 1u); + EXPECT_EQ(state->dataChillerIndirectAbsorption->IndirectAbsorber(1).Name, "BIG CHILLER"); + EXPECT_EQ(state->dataChillerIndirectAbsorption->IndirectAbsorber(1).NomCap, 10000.); + EXPECT_EQ(state->dataChillerIndirectAbsorption->IndirectAbsorber(1).NomPumpPower, 150.); + EXPECT_EQ(state->dataChillerIndirectAbsorption->IndirectAbsorber(1).MinPartLoadRat, 0.15); + EXPECT_EQ(state->dataChillerIndirectAbsorption->IndirectAbsorber(1).MaxPartLoadRat, 1.00); + EXPECT_EQ(state->dataChillerIndirectAbsorption->IndirectAbsorber(1).OptPartLoadRat, 0.65); + EXPECT_EQ(state->dataChillerIndirectAbsorption->IndirectAbsorber(1).LoopSubcool, 12.0); } diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc b/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc index d0a235db102..d900a2cce9a 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDX.unit.cc @@ -50,7 +50,7 @@ // EnergyPlus Headers #include - +#include #include "../Coils/CoilCoolingDXFixture.hh" using namespace EnergyPlus; @@ -59,7 +59,7 @@ TEST_F( CoilCoolingDXTest, CoilCoolingDXInput ) { std::string idf_objects = this->getCoilObjectString("coolingCoil", false, 2); EXPECT_TRUE(process_idf( idf_objects, false )); - int coilIndex = CoilCoolingDX::factory(state, "coolingCoil"); + int coilIndex = CoilCoolingDX::factory(*state, "coolingCoil"); auto const &thisCoil(coilCoolingDXs[coilIndex]); EXPECT_EQ("COOLINGCOIL", thisCoil.name); EXPECT_EQ("PERFORMANCEOBJECTNAME", thisCoil.performance.name); diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc index 97acf7bdc44..1c9593b957e 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitOperatingMode.unit.cc @@ -62,7 +62,7 @@ TEST_F( CoilCoolingDXTest, CoilCoolingDXCurveFitModeInput ) { std::string idf_objects = this->getModeObjectString("mode1", 2); EXPECT_TRUE(process_idf( idf_objects, false )); - CoilCoolingDXCurveFitOperatingMode thisMode(state, "mode1"); + CoilCoolingDXCurveFitOperatingMode thisMode(*state, "mode1"); EXPECT_EQ("MODE1", thisMode.name); EXPECT_EQ("MODE1SPEED1", thisMode.speeds[0].name); } @@ -114,7 +114,7 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXCurveFitOperatingMode_Sizing) { }); idf_objects += this->getSpeedObjectString("Coil Cooling DX Curve Fit Speed 1"); EXPECT_TRUE(process_idf( idf_objects, false )); - CoilCoolingDXCurveFitOperatingMode thisMode(state, "Coil Cooling DX Curve Fit Operating Mode 1"); + CoilCoolingDXCurveFitOperatingMode thisMode(*state, "Coil Cooling DX Curve Fit Operating Mode 1"); EXPECT_EQ(CoilCoolingDXCurveFitOperatingMode::CondenserType::EVAPCOOLED, thisMode.condenserType); EXPECT_EQ(DataSizing::AutoSize, thisMode.ratedEvapAirFlowRate); EXPECT_EQ(DataSizing::AutoSize, thisMode.ratedGrossTotalCap); @@ -146,7 +146,7 @@ TEST_F(CoilCoolingDXTest, CoilCoolingDXCurveFitOperatingMode_Sizing) { DataSizing::FinalZoneSizing(DataSizing::CurZoneEqNum).CoolDesTemp = 15.0; DataSizing::FinalZoneSizing(DataSizing::CurZoneEqNum).CoolDesHumRat = 0.0006; - thisMode.size(state); + thisMode.size(*state); // We need to commit, so that the ComponentSizes is actually written EnergyPlus::sqlite->sqliteCommit(); diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitPerformance.unit.cc b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitPerformance.unit.cc index cc7561d0819..c4887477e22 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitPerformance.unit.cc +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitPerformance.unit.cc @@ -59,7 +59,7 @@ TEST_F( CoilCoolingDXTest, CoilCoolingDXCurveFitPerformanceInput ) { std::string idf_objects = this->getPerformanceObjectString("coilPerformance", false, 2); EXPECT_TRUE(process_idf( idf_objects, false )); - CoilCoolingDXCurveFitPerformance thisPerf(state, "coilPerformance"); + CoilCoolingDXCurveFitPerformance thisPerf(*state, "coilPerformance"); EXPECT_EQ("COILPERFORMANCE", thisPerf.name); EXPECT_EQ("BASEOPERATINGMODE", thisPerf.normalMode.name); EXPECT_EQ(thisPerf.hasAlternateMode, DataHVACGlobals::coilNormalMode); @@ -69,7 +69,7 @@ TEST_F( CoilCoolingDXTest, CoilCoolingDXCurveFitPerformanceInputAlternateMode ) { std::string idf_objects = this->getPerformanceObjectString("coilPerformance", true, 2); EXPECT_TRUE(process_idf( idf_objects, false )); - CoilCoolingDXCurveFitPerformance thisPerf(state, "coilPerformance"); + CoilCoolingDXCurveFitPerformance thisPerf(*state, "coilPerformance"); EXPECT_EQ("COILPERFORMANCE", thisPerf.name); EXPECT_EQ("BASEOPERATINGMODE", thisPerf.normalMode.name); EXPECT_EQ(thisPerf.hasAlternateMode, DataHVACGlobals::coilEnhancedMode); diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitSpeed.unit.cc b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitSpeed.unit.cc index ea3d159b8f9..275ba12fee7 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitSpeed.unit.cc +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDXCurveFitSpeed.unit.cc @@ -62,7 +62,7 @@ TEST_F( CoilCoolingDXTest, CoilCoolingDXCurveFitSpeedInput ) { std::string idf_objects = this->getSpeedObjectString("speed1"); EXPECT_TRUE(process_idf( idf_objects, false )); - CoilCoolingDXCurveFitSpeed thisSpeed(state, "speed1"); + CoilCoolingDXCurveFitSpeed thisSpeed(*state, "speed1"); EXPECT_EQ("SPEED1", thisSpeed.name); } @@ -70,7 +70,7 @@ TEST_F( CoilCoolingDXTest, CoilCoolingDXCurveFitSpeedTest ) { std::string idf_objects = this->getSpeedObjectString("speed1"); EXPECT_TRUE(process_idf( idf_objects, false )); - CoilCoolingDXCurveFitSpeed thisSpeed(state, "speed1"); + CoilCoolingDXCurveFitSpeed thisSpeed(*state, "speed1"); EXPECT_EQ("SPEED1", thisSpeed.name); CoilCoolingDXCurveFitOperatingMode thisMode; @@ -96,7 +96,7 @@ TEST_F( CoilCoolingDXTest, CoilCoolingDXCurveFitSpeedTest ) thisSpeed.AirMassFlow = 1.0; int fanOpMode = 0; Real64 condInletTemp = 24; - thisSpeed.CalcSpeedOutput(state, inletNode, outletNode, thisSpeed.PLR, fanOpMode, condInletTemp); + thisSpeed.CalcSpeedOutput(*state, inletNode, outletNode, thisSpeed.PLR, fanOpMode, condInletTemp); EXPECT_NEAR( outletNode.Temp, 17.791, 0.001 ); EXPECT_NEAR( outletNode.HumRat, 0.00754, 0.0001 ); diff --git a/tst/EnergyPlus/unit/Coils/CoilCoolingDXFixture.hh b/tst/EnergyPlus/unit/Coils/CoilCoolingDXFixture.hh index 85dc27e9495..cbe88e4dd9e 100644 --- a/tst/EnergyPlus/unit/Coils/CoilCoolingDXFixture.hh +++ b/tst/EnergyPlus/unit/Coils/CoilCoolingDXFixture.hh @@ -50,6 +50,9 @@ // EnergyPlus Headers #include "../Fixtures/SQLiteFixture.hh" +#include +#include + class CoilCoolingDXTest : public EnergyPlus::SQLiteFixture { public: protected: diff --git a/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc b/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc index b87a2304b2f..aff90b7e6e8 100644 --- a/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc +++ b/tst/EnergyPlus/unit/CondenserLoopTowers.unit.cc @@ -66,6 +66,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -486,36 +487,36 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_MerkelNoCooling) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); createFacilityElectricPowerServiceObject(); - OutputProcessor::GetReportVariableInput(state); - PlantManager::CheckIfAnyPlant(state); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. + OutputProcessor::GetReportVariableInput(*state); + PlantManager::CheckIfAnyPlant(*state); + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); - SimulationManager::SetupSimulation(state, ErrorsFound); - CondenserLoopTowers::GetTowerInput(state); + WeatherManager::ResetEnvironmentCounter(*state); + SimulationManager::SetupSimulation(*state, ErrorsFound); + CondenserLoopTowers::GetTowerInput(*state); - state.dataCondenserLoopTowers->towers(1).initialize(state); - state.dataCondenserLoopTowers->towers(1).SizeVSMerkelTower(state); - state.dataCondenserLoopTowers->towers(1).initialize(state); + state->dataCondenserLoopTowers->towers(1).initialize(*state); + state->dataCondenserLoopTowers->towers(1).SizeVSMerkelTower(*state); + state->dataCondenserLoopTowers->towers(1).initialize(*state); Real64 MyLoad = 0.0; - state.dataCondenserLoopTowers->towers(1).calculateMerkelVariableSpeedTower(state, MyLoad); - state.dataCondenserLoopTowers->towers(1).update(state); - state.dataCondenserLoopTowers->towers(1).report(true); + state->dataCondenserLoopTowers->towers(1).calculateMerkelVariableSpeedTower(*state, MyLoad); + state->dataCondenserLoopTowers->towers(1).update(*state); + state->dataCondenserLoopTowers->towers(1).report(true); // test that tower is really not cooling with no load so temp in and out is the same issue #4927 EXPECT_DOUBLE_EQ(DataLoopNode::Node(9).Temp, DataLoopNode::Node(10).Temp); @@ -878,35 +879,35 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedSizing) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); createFacilityElectricPowerServiceObject(); - OutputProcessor::GetReportVariableInput(state); - PlantManager::CheckIfAnyPlant(state); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. + OutputProcessor::GetReportVariableInput(*state); + PlantManager::CheckIfAnyPlant(*state); + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); - SimulationManager::SetupSimulation(state, ErrorsFound); - CondenserLoopTowers::GetTowerInput(state); + WeatherManager::ResetEnvironmentCounter(*state); + SimulationManager::SetupSimulation(*state, ErrorsFound); + CondenserLoopTowers::GetTowerInput(*state); - state.dataCondenserLoopTowers->towers(1).initialize(state); - state.dataCondenserLoopTowers->towers(1).SizeTower(state); - state.dataCondenserLoopTowers->towers(1).initialize(state); - state.dataCondenserLoopTowers->towers(1).calculateSingleSpeedTower(state); - state.dataCondenserLoopTowers->towers(1).update(state); - state.dataCondenserLoopTowers->towers(1).report(true); + state->dataCondenserLoopTowers->towers(1).initialize(*state); + state->dataCondenserLoopTowers->towers(1).SizeTower(*state); + state->dataCondenserLoopTowers->towers(1).initialize(*state); + state->dataCondenserLoopTowers->towers(1).calculateSingleSpeedTower(*state); + state->dataCondenserLoopTowers->towers(1).update(*state); + state->dataCondenserLoopTowers->towers(1).report(true); // test that tower outlet temperature = set point temperature int inletNodeIndex = 0; @@ -926,31 +927,31 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedSizing) // EXPECT_DOUBLE_EQ( 30.0, DataLoopNode::Node( outletNodeIndex ).Temp ); // outlet node temperature // input not needed for sizing (WasAutoSized = false) using NominalCapacity method but this variable should still size - EXPECT_FALSE(state.dataCondenserLoopTowers->towers(1).HighSpeedTowerUAWasAutoSized); - EXPECT_GT(state.dataCondenserLoopTowers->towers(1).HighSpeedTowerUA, + EXPECT_FALSE(state->dataCondenserLoopTowers->towers(1).HighSpeedTowerUAWasAutoSized); + EXPECT_GT(state->dataCondenserLoopTowers->towers(1).HighSpeedTowerUA, 10000000.0); // nominal capacity input was huge at 1E+25 so all sized variables referencing capacity are very large // input not needed for sizing (WasAutoSized = false) using NominalCapacity method but this variable should still size - EXPECT_FALSE(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRateWasAutoSized); - EXPECT_GT(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 10000000.0); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 5.382e-8 * state.dataCondenserLoopTowers->towers(1).TowerNominalCapacity); + EXPECT_FALSE(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRateWasAutoSized); + EXPECT_GT(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 10000000.0); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 5.382e-8 * state->dataCondenserLoopTowers->towers(1).TowerNominalCapacity); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRateWasAutoSized); - EXPECT_GT(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, 10000000.0); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, - state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower * 0.5 * (101325.0 / DataEnvironment::StdBaroPress) / 190.0); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRateWasAutoSized); + EXPECT_GT(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, 10000000.0); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, + state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower * 0.5 * (101325.0 / DataEnvironment::StdBaroPress) / 190.0); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPowerWasAutoSized); - EXPECT_GT(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 10000000.0); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 0.0105 * state.dataCondenserLoopTowers->towers(1).TowerNominalCapacity); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPowerWasAutoSized); + EXPECT_GT(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 10000000.0); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 0.0105 * state->dataCondenserLoopTowers->towers(1).TowerNominalCapacity); // autocalculate input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateWasAutoSized); - EXPECT_GT(state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, 10000000.0); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, - state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateSizingFactor * state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateWasAutoSized); + EXPECT_GT(state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, 10000000.0); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, + state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateSizingFactor * state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate); } TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUserInputTowerSizing) @@ -1309,57 +1310,57 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUserInputTowerSizing) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); createFacilityElectricPowerServiceObject(); - OutputProcessor::GetReportVariableInput(state); - PlantManager::CheckIfAnyPlant(state); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. + OutputProcessor::GetReportVariableInput(*state); + PlantManager::CheckIfAnyPlant(*state); + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); - SimulationManager::SetupSimulation(state, ErrorsFound); - CondenserLoopTowers::GetTowerInput(state); + WeatherManager::ResetEnvironmentCounter(*state); + SimulationManager::SetupSimulation(*state, ErrorsFound); + CondenserLoopTowers::GetTowerInput(*state); // sized using user inputs in cooling tower instead of plant sizing object - state.dataCondenserLoopTowers->towers(1).SizeTower(state); + state->dataCondenserLoopTowers->towers(1).SizeTower(*state); // input not needed for sizing - EXPECT_FALSE(state.dataCondenserLoopTowers->towers(1).HighSpeedTowerUAWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).HighSpeedTowerUA, 9595.0, 1.0); // nominal capacity input was 100 kW, approach, 3.9K, range 5.5K + EXPECT_FALSE(state->dataCondenserLoopTowers->towers(1).HighSpeedTowerUAWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).HighSpeedTowerUA, 9595.0, 1.0); // nominal capacity input was 100 kW, approach, 3.9K, range 5.5K // input not needed for sizing - EXPECT_FALSE(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRateWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 0.005382, 0.00001); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 5.382e-8 * state.dataCondenserLoopTowers->towers(1).TowerNominalCapacity); + EXPECT_FALSE(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRateWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 0.005382, 0.00001); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 5.382e-8 * state->dataCondenserLoopTowers->towers(1).TowerNominalCapacity); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRateWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, 2.8262, 0.0001); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, - state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower * 0.5 * (101325.0 / DataEnvironment::StdBaroPress) / 190.0); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRateWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, 2.8262, 0.0001); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, + state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower * 0.5 * (101325.0 / DataEnvironment::StdBaroPress) / 190.0); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPowerWasAutoSized); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 1050); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 0.0105 * state.dataCondenserLoopTowers->towers(1).TowerNominalCapacity); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPowerWasAutoSized); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 1050); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 0.0105 * state->dataCondenserLoopTowers->towers(1).TowerNominalCapacity); // autocalculate input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, 0.28262, 0.00001); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, - state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateSizingFactor * state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, 0.28262, 0.00001); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, + state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateSizingFactor * state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate); } TEST_F(EnergyPlusFixture, CondenserLoopTowers_TwoSpeedUserInputTowerSizing) @@ -1724,71 +1725,71 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_TwoSpeedUserInputTowerSizing) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); createFacilityElectricPowerServiceObject(); - OutputProcessor::GetReportVariableInput(state); - PlantManager::CheckIfAnyPlant(state); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. + OutputProcessor::GetReportVariableInput(*state); + PlantManager::CheckIfAnyPlant(*state); + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); - SimulationManager::SetupSimulation(state, ErrorsFound); - CondenserLoopTowers::GetTowerInput(state); + WeatherManager::ResetEnvironmentCounter(*state); + SimulationManager::SetupSimulation(*state, ErrorsFound); + CondenserLoopTowers::GetTowerInput(*state); // sized using user inputs in cooling tower instead of plant sizing object - state.dataCondenserLoopTowers->towers(1).SizeTower(state); + state->dataCondenserLoopTowers->towers(1).SizeTower(*state); // input not needed for sizing (NOT WasAutoSized) - EXPECT_FALSE(state.dataCondenserLoopTowers->towers(1).HighSpeedTowerUAWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).HighSpeedTowerUA, 9595.55, 1.0); // nominal capacity input was 100 kW, approach, 3.9K, range 5.5K + EXPECT_FALSE(state->dataCondenserLoopTowers->towers(1).HighSpeedTowerUAWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).HighSpeedTowerUA, 9595.55, 1.0); // nominal capacity input was 100 kW, approach, 3.9K, range 5.5K // input not needed for sizing (NOT WasAutoSized) - EXPECT_FALSE(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRateWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 0.005382, 0.00001); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 5.382e-8 * state.dataCondenserLoopTowers->towers(1).TowerNominalCapacity); + EXPECT_FALSE(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRateWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 0.005382, 0.00001); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 5.382e-8 * state->dataCondenserLoopTowers->towers(1).TowerNominalCapacity); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRateWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, 2.8262, 0.0001); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, - state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower * 0.5 * (101325.0 / DataEnvironment::StdBaroPress) / 190.0); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRateWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, 2.8262, 0.0001); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, + state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower * 0.5 * (101325.0 / DataEnvironment::StdBaroPress) / 190.0); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPowerWasAutoSized); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 1050); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 0.0105 * state.dataCondenserLoopTowers->towers(1).TowerNominalCapacity); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPowerWasAutoSized); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 1050); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 0.0105 * state->dataCondenserLoopTowers->towers(1).TowerNominalCapacity); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).LowSpeedAirFlowRateWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).LowSpeedAirFlowRate, 1.4131, 0.0001); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).LowSpeedAirFlowRate, - state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate * state.dataCondenserLoopTowers->towers(1).LowSpeedAirFlowRateSizingFactor); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).LowSpeedAirFlowRateWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).LowSpeedAirFlowRate, 1.4131, 0.0001); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).LowSpeedAirFlowRate, + state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate * state->dataCondenserLoopTowers->towers(1).LowSpeedAirFlowRateSizingFactor); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).LowSpeedTowerUAWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).LowSpeedTowerUA, 346.0, 1.0); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).LowSpeedTowerUAWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).LowSpeedTowerUA, 346.0, 1.0); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).LowSpeedFanPowerWasAutoSized); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).LowSpeedFanPower, 168); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).LowSpeedFanPower, - state.dataCondenserLoopTowers->towers(1).LowSpeedFanPowerSizingFactor * state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).LowSpeedFanPowerWasAutoSized); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).LowSpeedFanPower, 168); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).LowSpeedFanPower, + state->dataCondenserLoopTowers->towers(1).LowSpeedFanPowerSizingFactor * state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).FreeConvTowerUAWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).FreeConvTowerUA, 168.0, 1.0); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).FreeConvTowerUAWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).FreeConvTowerUA, 168.0, 1.0); } TEST_F(EnergyPlusFixture, CondenserLoopTowers_MerkelUserInputTowerSizing) @@ -2208,61 +2209,61 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_MerkelUserInputTowerSizing) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); createFacilityElectricPowerServiceObject(); - OutputProcessor::GetReportVariableInput(state); - PlantManager::CheckIfAnyPlant(state); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. + OutputProcessor::GetReportVariableInput(*state); + PlantManager::CheckIfAnyPlant(*state); + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); - SimulationManager::SetupSimulation(state, ErrorsFound); - CondenserLoopTowers::GetTowerInput(state); + WeatherManager::ResetEnvironmentCounter(*state); + SimulationManager::SetupSimulation(*state, ErrorsFound); + CondenserLoopTowers::GetTowerInput(*state); // sized using user inputs in cooling tower instead of plant sizing object - state.dataCondenserLoopTowers->towers(1).SizeVSMerkelTower(state); + state->dataCondenserLoopTowers->towers(1).SizeVSMerkelTower(*state); // input not needed for sizing (NOT WasAutoSized) - EXPECT_FALSE(state.dataCondenserLoopTowers->towers(1).HighSpeedTowerUAWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).HighSpeedTowerUA, 9770.0, 1.0); // nominal capacity input was 100 kW, approach, 3.9K, range 5.5K + EXPECT_FALSE(state->dataCondenserLoopTowers->towers(1).HighSpeedTowerUAWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).HighSpeedTowerUA, 9770.0, 1.0); // nominal capacity input was 100 kW, approach, 3.9K, range 5.5K // input not needed for sizing (NOT WasAutoSized) - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRateWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 0.005382, 0.00001); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 5.382e-8 * state.dataCondenserLoopTowers->towers(1).TowerNominalCapacity); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRateWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 0.005382, 0.00001); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRate, 5.382e-8 * state->dataCondenserLoopTowers->towers(1).TowerNominalCapacity); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRateWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, 2.7632, 0.0001); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, - state.dataCondenserLoopTowers->towers(1).TowerNominalCapacity * state.dataCondenserLoopTowers->towers(1).DesignAirFlowPerUnitNomCap); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRateWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, 2.7632, 0.0001); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate, + state->dataCondenserLoopTowers->towers(1).TowerNominalCapacity * state->dataCondenserLoopTowers->towers(1).DesignAirFlowPerUnitNomCap); // autosized input - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPowerWasAutoSized); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 1050); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 0.0105 * state.dataCondenserLoopTowers->towers(1).TowerNominalCapacity); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPowerWasAutoSized); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 1050); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).HighSpeedFanPower, 0.0105 * state->dataCondenserLoopTowers->towers(1).TowerNominalCapacity); // input not needed for sizing (NOT WasAutoSized) - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, 0.27632, 0.00001); - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, - state.dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateSizingFactor * state.dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, 0.27632, 0.00001); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRate, + state->dataCondenserLoopTowers->towers(1).FreeConvAirFlowRateSizingFactor * state->dataCondenserLoopTowers->towers(1).HighSpeedAirFlowRate); // autosized input - EXPECT_FALSE(state.dataCondenserLoopTowers->towers(1).FreeConvTowerUAWasAutoSized); - EXPECT_NEAR(state.dataCondenserLoopTowers->towers(1).FreeConvTowerUA, 590.0, 1.0); + EXPECT_FALSE(state->dataCondenserLoopTowers->towers(1).FreeConvTowerUAWasAutoSized); + EXPECT_NEAR(state->dataCondenserLoopTowers->towers(1).FreeConvTowerUA, 590.0, 1.0); } TEST_F(EnergyPlusFixture, CondenserLoopTowers_TwoSpeedTowerLowSpeedNomCapSizing) @@ -2635,42 +2636,42 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_TwoSpeedTowerLowSpeedNomCapSizing) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); createFacilityElectricPowerServiceObject(); - OutputProcessor::GetReportVariableInput(state); - PlantManager::CheckIfAnyPlant(state); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. + OutputProcessor::GetReportVariableInput(*state); + PlantManager::CheckIfAnyPlant(*state); + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); - SimulationManager::SetupSimulation(state, ErrorsFound); + WeatherManager::ResetEnvironmentCounter(*state); + SimulationManager::SetupSimulation(*state, ErrorsFound); // get inputs of cooling tower object - CondenserLoopTowers::GetTowerInput(state); + CondenserLoopTowers::GetTowerInput(*state); // check the low speed nominal capacity field is autosized - EXPECT_TRUE(state.dataCondenserLoopTowers->towers(1).TowerLowSpeedNomCapWasAutoSized); + EXPECT_TRUE(state->dataCondenserLoopTowers->towers(1).TowerLowSpeedNomCapWasAutoSized); // check user input value for high speed nominal capacity - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).TowerNominalCapacity, 100000.0); + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).TowerNominalCapacity, 100000.0); // autosized other input fields of cooling tower - state.dataCondenserLoopTowers->towers(1).SizeTower(state); + state->dataCondenserLoopTowers->towers(1).SizeTower(*state); // size low speed nominal capacity - LowSpeedCoolTowerNomCap = state.dataCondenserLoopTowers->towers(1).TowerNominalCapacity * state.dataCondenserLoopTowers->towers(1).TowerLowSpeedNomCapSizingFactor; - EXPECT_DOUBLE_EQ(state.dataCondenserLoopTowers->towers(1).TowerLowSpeedNomCap, LowSpeedCoolTowerNomCap); + LowSpeedCoolTowerNomCap = state->dataCondenserLoopTowers->towers(1).TowerNominalCapacity * state->dataCondenserLoopTowers->towers(1).TowerLowSpeedNomCapSizingFactor; + EXPECT_DOUBLE_EQ(state->dataCondenserLoopTowers->towers(1).TowerLowSpeedNomCap, LowSpeedCoolTowerNomCap); // check the low speed nominal capacity is higher than that of free convection nominal capacity - EXPECT_GT(state.dataCondenserLoopTowers->towers(1).TowerLowSpeedNomCap, state.dataCondenserLoopTowers->towers(1).TowerFreeConvNomCap); + EXPECT_GT(state->dataCondenserLoopTowers->towers(1).TowerLowSpeedNomCap, state->dataCondenserLoopTowers->towers(1).TowerFreeConvNomCap); } TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUser_SizingError_SizingPlant) @@ -3024,36 +3025,36 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUser_SizingError_Sizing }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); createFacilityElectricPowerServiceObject(); - OutputProcessor::GetReportVariableInput(state); - PlantManager::CheckIfAnyPlant(state); + OutputProcessor::GetReportVariableInput(*state); + PlantManager::CheckIfAnyPlant(*state); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. // Get plant loop data - PlantManager::GetPlantLoopData(state); - PlantManager::GetPlantInput(state); - SizingManager::GetPlantSizingInput(state); + PlantManager::GetPlantLoopData(*state); + PlantManager::GetPlantInput(*state); + SizingManager::GetPlantSizingInput(*state); PlantManager::InitOneTimePlantSizingInfo(1); - PlantManager::SizePlantLoop(state, 1, true); + PlantManager::SizePlantLoop(*state, 1, true); PlantManager::InitLoopEquip = true; // Fake having more than small load DataSizing::PlantSizData(1).DesVolFlowRate = 1000.0; - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; // autosized other input fields of cooling tower. Tt throws, so we catch that so we can compare the error - ASSERT_THROW(state.dataCondenserLoopTowers->towers(1).SizeTower(state), std::runtime_error); + ASSERT_THROW(state->dataCondenserLoopTowers->towers(1).SizeTower(*state), std::runtime_error); std::string const error_string = delimited_string({ @@ -3416,26 +3417,26 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUser_SizingError_UserSp }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); createFacilityElectricPowerServiceObject(); - OutputProcessor::GetReportVariableInput(state); - PlantManager::CheckIfAnyPlant(state); + OutputProcessor::GetReportVariableInput(*state); + PlantManager::CheckIfAnyPlant(*state); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. // Get plant loop data - PlantManager::GetPlantLoopData(state); - PlantManager::GetPlantInput(state); - SizingManager::GetPlantSizingInput(state); + PlantManager::GetPlantLoopData(*state); + PlantManager::GetPlantInput(*state); + SizingManager::GetPlantSizingInput(*state); PlantManager::InitOneTimePlantSizingInfo(1); - PlantManager::SizePlantLoop(state, 1, true); + PlantManager::SizePlantLoop(*state, 1, true); PlantManager::InitLoopEquip = true; // Fake having more than small load @@ -3443,19 +3444,19 @@ TEST_F(EnergyPlusFixture, CondenserLoopTowers_SingleSpeedUser_SizingError_UserSp // SizingManager::ManageSizing(); - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; // get inputs of cooling tower object - CondenserLoopTowers::GetTowerInput(state); + CondenserLoopTowers::GetTowerInput(*state); - state.dataCondenserLoopTowers->towers(1).initialize(state); + state->dataCondenserLoopTowers->towers(1).initialize(*state); // Fake a flow - state.dataCondenserLoopTowers->towers(1).DesignWaterFlowRate = 1000.0; + state->dataCondenserLoopTowers->towers(1).DesignWaterFlowRate = 1000.0; // autosized other input fields of cooling tower. Tt throws, so we catch that so we can compare the error - ASSERT_THROW(state.dataCondenserLoopTowers->towers(1).SizeTower(state), std::runtime_error); + ASSERT_THROW(state->dataCondenserLoopTowers->towers(1).SizeTower(*state), std::runtime_error); std::string const error_string = delimited_string({ @@ -3891,48 +3892,48 @@ TEST_F(EnergyPlusFixture, VSCoolingTowers_WaterOutletTempTest) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); createFacilityElectricPowerServiceObject(); - OutputProcessor::GetReportVariableInput(state); - PlantManager::CheckIfAnyPlant(state); - BranchInputManager::ManageBranchInput(state); + OutputProcessor::GetReportVariableInput(*state); + PlantManager::CheckIfAnyPlant(*state); + BranchInputManager::ManageBranchInput(*state); // Get plant loop data - PlantManager::GetPlantLoopData(state); - PlantManager::GetPlantInput(state); - SizingManager::GetPlantSizingInput(state); + PlantManager::GetPlantLoopData(*state); + PlantManager::GetPlantInput(*state); + SizingManager::GetPlantSizingInput(*state); PlantManager::InitOneTimePlantSizingInfo(1); - PlantManager::SizePlantLoop(state, 1, true); + PlantManager::SizePlantLoop(*state, 1, true); PlantManager::InitLoopEquip = true; - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - CondenserLoopTowers::GetTowerInput(state); - auto &VSTower = state.dataCondenserLoopTowers->towers(1); + CondenserLoopTowers::GetTowerInput(*state); + auto &VSTower = state->dataCondenserLoopTowers->towers(1); DataPlant::PlantFirstSizesOkayToFinalize = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; // test case 1: DataEnvironment::OutDryBulbTemp = 35.0; DataEnvironment::OutWetBulbTemp = 26.0; DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::OutHumRat = - Psychrometrics::PsyWFnTdbTwbPb(state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutWetBulbTemp, DataEnvironment::OutBaroPress); + Psychrometrics::PsyWFnTdbTwbPb(*state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutWetBulbTemp, DataEnvironment::OutBaroPress); DataLoopNode::Node(VSTower.WaterInletNodeNum).Temp = 35.0; - VSTower.initialize(state); - state.dataGlobal->BeginEnvrnFlag = false; - VSTower.SizeTower(state); - VSTower.initialize(state); + VSTower.initialize(*state); + state->dataGlobal->BeginEnvrnFlag = false; + VSTower.SizeTower(*state); + VSTower.initialize(*state); VSTower.InletWaterTemp = 35.0; Real64 WaterFlowRateRatio = 0.75; @@ -3942,17 +3943,17 @@ TEST_F(EnergyPlusFixture, VSCoolingTowers_WaterOutletTempTest) DataPlant::PlantLoop(VSTower.LoopNum).LoopSide(VSTower.LoopSideNum).TempSetPoint = 30.0; VSTower.WaterMassFlowRate = VSTower.DesWaterMassFlowRate * WaterFlowRateRatio; - VSTower.calculateVariableSpeedTower(state); + VSTower.calculateVariableSpeedTower(*state); EXPECT_DOUBLE_EQ(30.0, VSTower.OutletWaterTemp); EXPECT_DOUBLE_EQ(1.0, VSTower.FanCyclingRatio); - Real64 TowerOutletWaterTemp = VSTower.calculateVariableTowerOutletTemp(state, WaterFlowRateRatio, VSTower.airFlowRateRatio, AirWetBulbTemp); + Real64 TowerOutletWaterTemp = VSTower.calculateVariableTowerOutletTemp(*state, WaterFlowRateRatio, VSTower.airFlowRateRatio, AirWetBulbTemp); EXPECT_NEAR(30.0, TowerOutletWaterTemp, 0.0001); // test case 2: DataEnvironment::OutDryBulbTemp = 15.0; DataEnvironment::OutWetBulbTemp = 10.0; DataEnvironment::OutHumRat = - Psychrometrics::PsyWFnTdbTwbPb(state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutWetBulbTemp, DataEnvironment::OutBaroPress); + Psychrometrics::PsyWFnTdbTwbPb(*state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutWetBulbTemp, DataEnvironment::OutBaroPress); AirWetBulbTemp = DataEnvironment::OutWetBulbTemp; VSTower.WaterMassFlowRate = VSTower.DesWaterMassFlowRate * WaterFlowRateRatio; @@ -3960,11 +3961,11 @@ TEST_F(EnergyPlusFixture, VSCoolingTowers_WaterOutletTempTest) VSTower.AirWetBulb = DataEnvironment::OutWetBulbTemp; VSTower.AirHumRat = DataEnvironment::OutHumRat; - VSTower.calculateVariableSpeedTower(state); + VSTower.calculateVariableSpeedTower(*state); EXPECT_DOUBLE_EQ(30.0, VSTower.OutletWaterTemp); EXPECT_NEAR(0.5213, VSTower.FanCyclingRatio, 0.0001); // outside air condition is favorable that fan only needs to cycle at min flow to meet the setpoint - TowerOutletWaterTemp = VSTower.calculateVariableTowerOutletTemp(state, WaterFlowRateRatio, VSTower.MinimumVSAirFlowFrac, AirWetBulbTemp); + TowerOutletWaterTemp = VSTower.calculateVariableTowerOutletTemp(*state, WaterFlowRateRatio, VSTower.MinimumVSAirFlowFrac, AirWetBulbTemp); // this is tower outlet temperature at continuous minimum fan flow EXPECT_NEAR(26.9537, TowerOutletWaterTemp, 0.0001); } diff --git a/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc b/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc index b4576e45eeb..2d3e335cb91 100644 --- a/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc +++ b/tst/EnergyPlus/unit/ConstructionInternalSource.unit.cc @@ -54,6 +54,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -83,7 +84,7 @@ TEST_F(EnergyPlusFixture, ConstructionInternalSource) bool errorsFound(false); - GetConstructData(state, errorsFound); + GetConstructData(*state, errorsFound); - EXPECT_NEAR(0.1524, state.dataConstruction->Construct(1).ThicknessPerpend, 0.0001); + EXPECT_NEAR(0.1524, state->dataConstruction->Construct(1).ThicknessPerpend, 0.0001); } diff --git a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc index 247d0e1c4cb..cf9419e4fa5 100644 --- a/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc +++ b/tst/EnergyPlus/unit/ConvectionCoefficients.unit.cc @@ -70,6 +70,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -435,30 +436,30 @@ TEST_F(ConvectionCoefficientsFixture, DynamicIntConvSurfaceClassification) ASSERT_TRUE(process_idf(idf_objects)); bool errorsFound(false); - HeatBalanceManager::GetProjectControlData(state, errorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetMaterialData(state, errorsFound); // read material data + HeatBalanceManager::GetMaterialData(*state, errorsFound); // read material data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetConstructData(state, errorsFound); // read construction data + HeatBalanceManager::GetConstructData(*state, errorsFound); // read construction data EXPECT_FALSE(errorsFound); // expect no errors - HeatBalanceManager::GetZoneData(state, errorsFound); + HeatBalanceManager::GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); - SurfaceGeometry::SetupZoneGeometry(state, errorsFound); + SurfaceGeometry::SetupZoneGeometry(*state, errorsFound); ASSERT_FALSE(errorsFound); - HeatBalanceManager::AllocateHeatBalArrays(state); - HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(state); + HeatBalanceManager::AllocateHeatBalArrays(*state); + HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(*state); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); - BaseboardElectric::GetBaseboardInput(state); + BaseboardElectric::GetBaseboardInput(*state); - state.dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->ZoneSizingCalc = true; // Surface 1 is a vertical wall // Surface 2 is a wall tilted down (interior faces up) @@ -487,99 +488,99 @@ TEST_F(ConvectionCoefficientsFixture, DynamicIntConvSurfaceClassification) // Case 1 - Zone air warmer than surfaces DataHeatBalFanSys::MAT(1) = 30.0; - DynamicIntConvSurfaceClassification(state, 1); + DynamicIntConvSurfaceClassification(*state, 1); EXPECT_EQ(DataSurfaces::Surface(1).IntConvClassification, DataSurfaces::InConvClass_A3_VertWalls); - DynamicIntConvSurfaceClassification(state, 2); + DynamicIntConvSurfaceClassification(*state, 2); EXPECT_EQ(DataSurfaces::Surface(2).IntConvClassification, DataSurfaces::InConvClass_A3_StableTilted); - DynamicIntConvSurfaceClassification(state, 3); + DynamicIntConvSurfaceClassification(*state, 3); EXPECT_EQ(DataSurfaces::Surface(3).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableTilted); - DynamicIntConvSurfaceClassification(state, 4); + DynamicIntConvSurfaceClassification(*state, 4); EXPECT_EQ(DataSurfaces::Surface(4).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableTilted); - DynamicIntConvSurfaceClassification(state, 5); + DynamicIntConvSurfaceClassification(*state, 5); EXPECT_EQ(DataSurfaces::Surface(5).IntConvClassification, DataSurfaces::InConvClass_A3_StableTilted); // vertical floor is currently not a valid case, so returns zero with a severe error - DynamicIntConvSurfaceClassification(state, 6); + DynamicIntConvSurfaceClassification(*state, 6); EXPECT_EQ(DataSurfaces::Surface(6).IntConvClassification, 0); - DynamicIntConvSurfaceClassification(state, 7); + DynamicIntConvSurfaceClassification(*state, 7); EXPECT_EQ(DataSurfaces::Surface(7).IntConvClassification, DataSurfaces::InConvClass_A3_StableTilted); - DynamicIntConvSurfaceClassification(state, 8); + DynamicIntConvSurfaceClassification(*state, 8); EXPECT_EQ(DataSurfaces::Surface(8).IntConvClassification, DataSurfaces::InConvClass_A3_StableTilted); - DynamicIntConvSurfaceClassification(state, 9); + DynamicIntConvSurfaceClassification(*state, 9); EXPECT_EQ(DataSurfaces::Surface(9).IntConvClassification, DataSurfaces::InConvClass_A3_StableHoriz); - DynamicIntConvSurfaceClassification(state, 10); + DynamicIntConvSurfaceClassification(*state, 10); EXPECT_EQ(DataSurfaces::Surface(10).IntConvClassification, DataSurfaces::InConvClass_A3_StableHoriz); - DynamicIntConvSurfaceClassification(state, 11); + DynamicIntConvSurfaceClassification(*state, 11); EXPECT_EQ(DataSurfaces::Surface(11).IntConvClassification, DataSurfaces::InConvClass_A3_VertWalls); - DynamicIntConvSurfaceClassification(state, 12); + DynamicIntConvSurfaceClassification(*state, 12); EXPECT_EQ(DataSurfaces::Surface(12).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableTilted); - DynamicIntConvSurfaceClassification(state, 13); + DynamicIntConvSurfaceClassification(*state, 13); EXPECT_EQ(DataSurfaces::Surface(13).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableTilted); - DynamicIntConvSurfaceClassification(state, 14); + DynamicIntConvSurfaceClassification(*state, 14); EXPECT_EQ(DataSurfaces::Surface(14).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableHoriz); - DynamicIntConvSurfaceClassification(state, 15); + DynamicIntConvSurfaceClassification(*state, 15); EXPECT_EQ(DataSurfaces::Surface(15).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableHoriz); // Case 2 - Zone air colder than surfaces DataHeatBalFanSys::MAT(1) = 10.0; - DynamicIntConvSurfaceClassification(state, 1); + DynamicIntConvSurfaceClassification(*state, 1); EXPECT_EQ(DataSurfaces::Surface(1).IntConvClassification, DataSurfaces::InConvClass_A3_VertWalls); - DynamicIntConvSurfaceClassification(state, 2); + DynamicIntConvSurfaceClassification(*state, 2); EXPECT_EQ(DataSurfaces::Surface(2).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableTilted); - DynamicIntConvSurfaceClassification(state, 3); + DynamicIntConvSurfaceClassification(*state, 3); EXPECT_EQ(DataSurfaces::Surface(3).IntConvClassification, DataSurfaces::InConvClass_A3_StableTilted); - DynamicIntConvSurfaceClassification(state, 4); + DynamicIntConvSurfaceClassification(*state, 4); EXPECT_EQ(DataSurfaces::Surface(4).IntConvClassification, DataSurfaces::InConvClass_A3_StableTilted); - DynamicIntConvSurfaceClassification(state, 5); + DynamicIntConvSurfaceClassification(*state, 5); EXPECT_EQ(DataSurfaces::Surface(5).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableTilted); // vertical floor is currently not a valid case, so returns zero with a severe error - DynamicIntConvSurfaceClassification(state, 6); + DynamicIntConvSurfaceClassification(*state, 6); EXPECT_EQ(DataSurfaces::Surface(6).IntConvClassification, 0); - DynamicIntConvSurfaceClassification(state, 7); + DynamicIntConvSurfaceClassification(*state, 7); EXPECT_EQ(DataSurfaces::Surface(7).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableTilted); - DynamicIntConvSurfaceClassification(state, 8); + DynamicIntConvSurfaceClassification(*state, 8); EXPECT_EQ(DataSurfaces::Surface(8).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableTilted); - DynamicIntConvSurfaceClassification(state, 9); + DynamicIntConvSurfaceClassification(*state, 9); EXPECT_EQ(DataSurfaces::Surface(9).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableHoriz); - DynamicIntConvSurfaceClassification(state, 10); + DynamicIntConvSurfaceClassification(*state, 10); EXPECT_EQ(DataSurfaces::Surface(10).IntConvClassification, DataSurfaces::InConvClass_A3_UnstableHoriz); - DynamicIntConvSurfaceClassification(state, 11); + DynamicIntConvSurfaceClassification(*state, 11); EXPECT_EQ(DataSurfaces::Surface(11).IntConvClassification, DataSurfaces::InConvClass_A3_VertWalls); - DynamicIntConvSurfaceClassification(state, 12); + DynamicIntConvSurfaceClassification(*state, 12); EXPECT_EQ(DataSurfaces::Surface(12).IntConvClassification, DataSurfaces::InConvClass_A3_StableTilted); - DynamicIntConvSurfaceClassification(state, 13); + DynamicIntConvSurfaceClassification(*state, 13); EXPECT_EQ(DataSurfaces::Surface(13).IntConvClassification, DataSurfaces::InConvClass_A3_StableTilted); - DynamicIntConvSurfaceClassification(state, 14); + DynamicIntConvSurfaceClassification(*state, 14); EXPECT_EQ(DataSurfaces::Surface(14).IntConvClassification, DataSurfaces::InConvClass_A3_StableHoriz); - DynamicIntConvSurfaceClassification(state, 15); + DynamicIntConvSurfaceClassification(*state, 15); EXPECT_EQ(DataSurfaces::Surface(15).IntConvClassification, DataSurfaces::InConvClass_A3_StableHoriz); } @@ -594,23 +595,23 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateIntHcModelsFisherPedersen) SurfNum = 1; DataSurfaces::TotSurfaces = 1; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataSurfaces::Surface.allocate( 1 ); - state.dataConstruction->Construct.allocate( 1 ); + state->dataConstruction->Construct.allocate( 1 ); DataHeatBalance::Zone.allocate( 1 ); DataLoopNode::Node.allocate( 1 ); DataSurfaces::Surface( SurfNum ).Zone = 1; DataSurfaces::Surface( SurfNum ).Construction = 1; DataSurfaces::Surface(SurfNum).TAirRef = 0; - state.dataConstruction->Construct( 1 ).TypeIsWindow = false; + state->dataConstruction->Construct( 1 ).TypeIsWindow = false; DataHeatBalance::Zone( 1 ).SystemZoneNodeNumber = 1; DataHeatBalance::Zone( 1 ).Multiplier = 1.0; DataHeatBalance::Zone( 1 ).ListMultiplier = 1.0; DataEnvironment::OutBaroPress = 101325.0; DataLoopNode::Node( 1 ).Temp = 20.0; - HeatBalanceManager::AllocateHeatBalArrays(state); - HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(state); + HeatBalanceManager::AllocateHeatBalArrays(*state); + HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(*state); for (int surf = 1; surf <= DataSurfaces::TotSurfaces; ++surf) { DataHeatBalSurface::TH(2, 1, surf) = 20.0; @@ -633,7 +634,7 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateIntHcModelsFisherPedersen) HcExpectedValue = CalcASHRAETARPNatural(DataHeatBalSurface::TH(2, 1, 1), DataHeatBalFanSys::MAT(1), -DataSurfaces::Surface( SurfNum ).CosTilt); - EvaluateIntHcModels(state, SurfNum, ConvModelEquationNum, Hc ); + EvaluateIntHcModels(*state, SurfNum, ConvModelEquationNum, Hc ); EXPECT_EQ( DataSurfaces::Surface(SurfNum).TAirRef, DataSurfaces::ZoneMeanAirTemp ); EXPECT_NEAR( Hc, HcExpectedValue, 0.1 ); @@ -644,7 +645,7 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateIntHcModelsFisherPedersen) HcExpectedValue = CalcASHRAETARPNatural(DataHeatBalSurface::TH(2, 1, 1), DataHeatBalFanSys::MAT(1), -DataSurfaces::Surface( SurfNum ).CosTilt); - EvaluateIntHcModels(state, SurfNum, ConvModelEquationNum, Hc ); + EvaluateIntHcModels(*state, SurfNum, ConvModelEquationNum, Hc ); EXPECT_EQ( DataSurfaces::Surface(SurfNum).TAirRef, DataSurfaces::ZoneMeanAirTemp ); EXPECT_NEAR( Hc, HcExpectedValue, 0.1 ); @@ -655,7 +656,7 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateIntHcModelsFisherPedersen) HcExpectedValue = CalcASHRAETARPNatural(DataHeatBalSurface::TH(2, 1, 1), DataHeatBalFanSys::MAT(1), -DataSurfaces::Surface( SurfNum ).CosTilt); - EvaluateIntHcModels(state, SurfNum, ConvModelEquationNum, Hc ); + EvaluateIntHcModels(*state, SurfNum, ConvModelEquationNum, Hc ); EXPECT_EQ( DataSurfaces::Surface(SurfNum).TAirRef, DataSurfaces::ZoneMeanAirTemp ); EXPECT_NEAR( Hc, HcExpectedValue, 0.1 ); @@ -672,7 +673,7 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateIntHcModelsFisherPedersen) HcExpectedValue = 4.122; - EvaluateIntHcModels(state, SurfNum, ConvModelEquationNum, Hc ); + EvaluateIntHcModels(*state, SurfNum, ConvModelEquationNum, Hc ); EXPECT_EQ( DataSurfaces::Surface(SurfNum).TAirRef, DataSurfaces::ZoneMeanAirTemp ); EXPECT_NEAR( Hc, HcExpectedValue, 0.1 ); @@ -683,7 +684,7 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateIntHcModelsFisherPedersen) HcExpectedValue = 9.476; - EvaluateIntHcModels(state, SurfNum, ConvModelEquationNum, Hc ); + EvaluateIntHcModels(*state, SurfNum, ConvModelEquationNum, Hc ); EXPECT_EQ( DataSurfaces::Surface(SurfNum).TAirRef, DataSurfaces::ZoneMeanAirTemp ); EXPECT_NEAR( Hc, HcExpectedValue, 0.1 ); @@ -694,7 +695,7 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateIntHcModelsFisherPedersen) HcExpectedValue = 3.212; - EvaluateIntHcModels(state, SurfNum, ConvModelEquationNum, Hc ); + EvaluateIntHcModels(*state, SurfNum, ConvModelEquationNum, Hc ); EXPECT_EQ( DataSurfaces::Surface(SurfNum).TAirRef, DataSurfaces::ZoneMeanAirTemp ); EXPECT_NEAR( Hc, HcExpectedValue, 0.1 ); } @@ -735,7 +736,7 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateHnModels) DataSurfaces::Surface(SurfNum).CosTilt = 1.0; SurfTemp(1) = 0.0; HcIn(1) = 0.0; - CalcDetailedHcInForDVModel(state, SurfNum, SurfTemp, HcIn); + CalcDetailedHcInForDVModel(*state, SurfNum, SurfTemp, HcIn); Hn = HcIn(1); EXPECT_NEAR(Hn, 1.520, 0.001); @@ -747,7 +748,7 @@ TEST_F(ConvectionCoefficientsFixture, EvaluateHnModels) SurfTemp(1) = 0.0; HcIn(1) = 0.0; Vhc(1) = 1.0; - CalcDetailedHcInForDVModel(state, SurfNum, SurfTemp, HcIn, Vhc); + CalcDetailedHcInForDVModel(*state, SurfNum, SurfTemp, HcIn, Vhc); Hn = HcIn(1); EXPECT_NEAR(Hn, 4.347, 0.001); @@ -764,7 +765,7 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcZoneSystemACH) if (!allocated(DataHeatBalance::Zone)) DataHeatBalance::Zone.allocate(TotalNumberofZones); DataHeatBalance::Zone(ZoneNum).Volume = 100.0; DataHeatBalance::Zone(ZoneNum).SystemZoneNodeNumber = 1; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; DataHeatBalance::Zone(ZoneNum).Multiplier = 1.0; DataHeatBalance::Zone(ZoneNum).ListMultiplier = 1.0; EnergyPlus::DataEnvironment::OutBaroPress = 101400.0; @@ -773,7 +774,7 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcZoneSystemACH) // Test 1: Node not allocated, returns a zero ACH if (allocated(EnergyPlus::DataLoopNode::Node)) EnergyPlus::DataLoopNode::Node.deallocate(); ACHExpected = 0.0; - ACHAnswer = CalcZoneSystemACH(state, ZoneNum); + ACHAnswer = CalcZoneSystemACH(*state, ZoneNum); EXPECT_NEAR(ACHExpected, ACHAnswer, 0.0001); // Test 2: Node now allocated, needs to return a proper ACH @@ -781,7 +782,7 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcZoneSystemACH) EnergyPlus::DataLoopNode::Node(ZoneNode).Temp = 20.0; EnergyPlus::DataLoopNode::Node(ZoneNode).MassFlowRate = 0.2; ACHExpected = 6.11506; - ACHAnswer = CalcZoneSystemACH(state, ZoneNum); + ACHAnswer = CalcZoneSystemACH(*state, ZoneNum); EXPECT_NEAR(ACHExpected, ACHAnswer, 0.0001); } @@ -812,7 +813,7 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcFisherPedersenCeilDiffuserNatConv) height = 1.0; isWindow = false; ExpectedHconv = 1.2994; - CalculatedHconv = CalcFisherPedersenCeilDiffuserNatConv(state, Hforced,ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserNatConv(*state, Hforced,ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); // Test 2: Window, all natural @@ -825,7 +826,7 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcFisherPedersenCeilDiffuserNatConv) height = 1.0; isWindow = true; ExpectedHconv = 0.8067; - CalculatedHconv = CalcFisherPedersenCeilDiffuserNatConv(state, Hforced,ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserNatConv(*state, Hforced,ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); // Test 3: Non-window, all natural @@ -838,7 +839,7 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcFisherPedersenCeilDiffuserNatConv) height = 1.0; isWindow = false; ExpectedHconv = 1.2994; - CalculatedHconv = CalcFisherPedersenCeilDiffuserNatConv(state, Hforced,ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserNatConv(*state, Hforced,ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); // Test 4: Non-window, transition @@ -851,7 +852,7 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcFisherPedersenCeilDiffuserNatConv) height = 1.0; isWindow = false; ExpectedHconv = 2.16942; - CalculatedHconv = CalcFisherPedersenCeilDiffuserNatConv(state, Hforced,ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserNatConv(*state, Hforced,ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); // Test 5: Non-window, all ceiling diffuser correlation @@ -864,7 +865,7 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcFisherPedersenCeilDiffuserNatConv) height = 1.0; isWindow = false; ExpectedHconv = 10.0; - CalculatedHconv = CalcFisherPedersenCeilDiffuserNatConv(state, Hforced,ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserNatConv(*state, Hforced,ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); } @@ -893,13 +894,13 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcFisherPedersenCeilDiffuserCorrelat height = 1.0; isWindow = false; ExpectedHconv = 4.13721502661183; - CalculatedHconv = CalcFisherPedersenCeilDiffuserFloor(state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserFloor(*state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); ExpectedHconv = 9.70692167003631; - CalculatedHconv = CalcFisherPedersenCeilDiffuserCeiling(state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserCeiling(*state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); ExpectedHconv = 3.28943537910741; - CalculatedHconv = CalcFisherPedersenCeilDiffuserWalls(state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserWalls(*state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); // Test 2: Natural Convection All Correlations (Floor, Ceiling, Wall)--note, all should give same answer because of how variables are set @@ -911,11 +912,11 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcFisherPedersenCeilDiffuserCorrelat height = 1.0; isWindow = false; ExpectedHconv = 1.2994; - CalculatedHconv = CalcFisherPedersenCeilDiffuserFloor(state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserFloor(*state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); - CalculatedHconv = CalcFisherPedersenCeilDiffuserCeiling(state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserCeiling(*state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); - CalculatedHconv = CalcFisherPedersenCeilDiffuserWalls(state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserWalls(*state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); // Test 3: Mixed Covection All Correlations (Floor, Ceiling, Wall) @@ -927,13 +928,13 @@ TEST_F(ConvectionCoefficientsFixture, TestCalcFisherPedersenCeilDiffuserCorrelat height = 1.0; isWindow = false; ExpectedHconv = 2.70653; - CalculatedHconv = CalcFisherPedersenCeilDiffuserFloor(state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserFloor(*state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); ExpectedHconv = 5.32826; - CalculatedHconv = CalcFisherPedersenCeilDiffuserCeiling(state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserCeiling(*state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); ExpectedHconv = 2.23620; - CalculatedHconv = CalcFisherPedersenCeilDiffuserWalls(state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); + CalculatedHconv = CalcFisherPedersenCeilDiffuserWalls(*state, ACH,Tsurf,Tair,cosTilt,humRat,height,isWindow); EXPECT_NEAR(ExpectedHconv, CalculatedHconv, 0.0001); } @@ -979,30 +980,30 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedAssistedWall) DataEnvironment::OutBaroPress = 101325.0; bool errorsFound(false); - HeatBalanceManager::GetProjectControlData(state, errorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetMaterialData(state, errorsFound); // read material data + HeatBalanceManager::GetMaterialData(*state, errorsFound); // read material data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetConstructData(state, errorsFound); // read construction data + HeatBalanceManager::GetConstructData(*state, errorsFound); // read construction data EXPECT_FALSE(errorsFound); // expect no errors - HeatBalanceManager::GetZoneData(state, errorsFound); + HeatBalanceManager::GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); - SurfaceGeometry::SetupZoneGeometry(state, errorsFound); + SurfaceGeometry::SetupZoneGeometry(*state, errorsFound); ASSERT_FALSE(errorsFound); - HeatBalanceManager::AllocateHeatBalArrays(state); - HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(state); + HeatBalanceManager::AllocateHeatBalArrays(*state); + HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(*state); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); - BaseboardElectric::GetBaseboardInput(state); + BaseboardElectric::GetBaseboardInput(*state); - state.dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->ZoneSizingCalc = true; Real64 tolerance = 1E-3; @@ -1011,18 +1012,18 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedAssistedWall) Real64 height = 1.0; Real64 surfTemp = 20.0; int zoneNum = 1; - Real64 convCoeff = CalcBeausoleilMorrisonMixedAssistedWall(state, deltaTemp, height, surfTemp, zoneNum); + Real64 convCoeff = CalcBeausoleilMorrisonMixedAssistedWall(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 2.667, tolerance); // DeltaT = 0 Error Path deltaTemp = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedAssistedWall(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedAssistedWall(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); // Height = 0 Error Path deltaTemp = 10.0; height = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedAssistedWall(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedAssistedWall(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); } @@ -1036,30 +1037,30 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedOpposingWall) DataEnvironment::OutBaroPress = 101325.0; bool errorsFound(false); - HeatBalanceManager::GetProjectControlData(state, errorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetMaterialData(state, errorsFound); // read material data + HeatBalanceManager::GetMaterialData(*state, errorsFound); // read material data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetConstructData(state, errorsFound); // read construction data + HeatBalanceManager::GetConstructData(*state, errorsFound); // read construction data EXPECT_FALSE(errorsFound); // expect no errors - HeatBalanceManager::GetZoneData(state, errorsFound); + HeatBalanceManager::GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); - SurfaceGeometry::SetupZoneGeometry(state, errorsFound); + SurfaceGeometry::SetupZoneGeometry(*state, errorsFound); ASSERT_FALSE(errorsFound); - HeatBalanceManager::AllocateHeatBalArrays(state); - HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(state); + HeatBalanceManager::AllocateHeatBalArrays(*state); + HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(*state); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); - BaseboardElectric::GetBaseboardInput(state); + BaseboardElectric::GetBaseboardInput(*state); - state.dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->ZoneSizingCalc = true; Real64 tolerance = 1E-3; @@ -1068,18 +1069,18 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedOpposingWall) Real64 height = 1.0; Real64 surfTemp = 20.0; int zoneNum = 1; - Real64 convCoeff = CalcBeausoleilMorrisonMixedOpposingWall(state, deltaTemp, height, surfTemp, zoneNum); + Real64 convCoeff = CalcBeausoleilMorrisonMixedOpposingWall(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 2.673, tolerance); // DeltaT = 0 Error Path deltaTemp = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedOpposingWall(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedOpposingWall(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); // Height = 0 Error Path deltaTemp = 10.0; height = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedOpposingWall(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedOpposingWall(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); } @@ -1093,30 +1094,30 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedStableFloor) DataEnvironment::OutBaroPress = 101325.0; bool errorsFound(false); - HeatBalanceManager::GetProjectControlData(state, errorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetMaterialData(state, errorsFound); // read material data + HeatBalanceManager::GetMaterialData(*state, errorsFound); // read material data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetConstructData(state, errorsFound); // read construction data + HeatBalanceManager::GetConstructData(*state, errorsFound); // read construction data EXPECT_FALSE(errorsFound); // expect no errors - HeatBalanceManager::GetZoneData(state, errorsFound); + HeatBalanceManager::GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); - SurfaceGeometry::SetupZoneGeometry(state, errorsFound); + SurfaceGeometry::SetupZoneGeometry(*state, errorsFound); ASSERT_FALSE(errorsFound); - HeatBalanceManager::AllocateHeatBalArrays(state); - HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(state); + HeatBalanceManager::AllocateHeatBalArrays(*state); + HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(*state); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); - BaseboardElectric::GetBaseboardInput(state); + BaseboardElectric::GetBaseboardInput(*state); - state.dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->ZoneSizingCalc = true; Real64 tolerance = 1E-3; @@ -1125,18 +1126,18 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedStableFloor) Real64 height = 1.0; Real64 surfTemp = 20.0; int zoneNum = 1; - Real64 convCoeff = CalcBeausoleilMorrisonMixedStableFloor(state, deltaTemp, height, surfTemp, zoneNum); + Real64 convCoeff = CalcBeausoleilMorrisonMixedStableFloor(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 0.962, tolerance); // DeltaT = 0 Error Path deltaTemp = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedStableFloor(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedStableFloor(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); // Height = 0 Error Path deltaTemp = 10.0; height = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedStableFloor(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedStableFloor(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); } @@ -1150,30 +1151,30 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedUnstableFloor) DataEnvironment::OutBaroPress = 101325.0; bool errorsFound(false); - HeatBalanceManager::GetProjectControlData(state, errorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetMaterialData(state, errorsFound); // read material data + HeatBalanceManager::GetMaterialData(*state, errorsFound); // read material data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetConstructData(state, errorsFound); // read construction data + HeatBalanceManager::GetConstructData(*state, errorsFound); // read construction data EXPECT_FALSE(errorsFound); // expect no errors - HeatBalanceManager::GetZoneData(state, errorsFound); + HeatBalanceManager::GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); - SurfaceGeometry::SetupZoneGeometry(state, errorsFound); + SurfaceGeometry::SetupZoneGeometry(*state, errorsFound); ASSERT_FALSE(errorsFound); - HeatBalanceManager::AllocateHeatBalArrays(state); - HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(state); + HeatBalanceManager::AllocateHeatBalArrays(*state); + HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(*state); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); - BaseboardElectric::GetBaseboardInput(state); + BaseboardElectric::GetBaseboardInput(*state); - state.dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->ZoneSizingCalc = true; Real64 tolerance = 1E-3; @@ -1182,18 +1183,18 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedUnstableFloor) Real64 height = 1.0; Real64 surfTemp = 20.0; int zoneNum = 1; - Real64 convCoeff = CalcBeausoleilMorrisonMixedUnstableFloor(state, deltaTemp, height, surfTemp, zoneNum); + Real64 convCoeff = CalcBeausoleilMorrisonMixedUnstableFloor(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 3.583, tolerance); // DeltaT = 0 Error Path deltaTemp = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedUnstableFloor(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedUnstableFloor(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); // Height = 0 Error Path deltaTemp = 10.0; height = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedUnstableFloor(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedUnstableFloor(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); } @@ -1207,30 +1208,30 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedStableCeiling) DataEnvironment::OutBaroPress = 101325.0; bool errorsFound(false); - HeatBalanceManager::GetProjectControlData(state, errorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetMaterialData(state, errorsFound); // read material data + HeatBalanceManager::GetMaterialData(*state, errorsFound); // read material data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetConstructData(state, errorsFound); // read construction data + HeatBalanceManager::GetConstructData(*state, errorsFound); // read construction data EXPECT_FALSE(errorsFound); // expect no errors - HeatBalanceManager::GetZoneData(state, errorsFound); + HeatBalanceManager::GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); - SurfaceGeometry::SetupZoneGeometry(state, errorsFound); + SurfaceGeometry::SetupZoneGeometry(*state, errorsFound); ASSERT_FALSE(errorsFound); - HeatBalanceManager::AllocateHeatBalArrays(state); - HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(state); + HeatBalanceManager::AllocateHeatBalArrays(*state); + HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(*state); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); - BaseboardElectric::GetBaseboardInput(state); + BaseboardElectric::GetBaseboardInput(*state); - state.dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->ZoneSizingCalc = true; Real64 tolerance = 1E-3; @@ -1239,18 +1240,18 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedStableCeiling) Real64 height = 1.0; Real64 surfTemp = 20.0; int zoneNum = 1; - Real64 convCoeff = CalcBeausoleilMorrisonMixedStableCeiling(state, deltaTemp, height, surfTemp, zoneNum); + Real64 convCoeff = CalcBeausoleilMorrisonMixedStableCeiling(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 0.937, tolerance); // DeltaT = 0 Error Path deltaTemp = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedStableCeiling(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedStableCeiling(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); // Height = 0 Error Path deltaTemp = 10.0; height = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedStableCeiling(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedStableCeiling(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); } @@ -1264,30 +1265,30 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedUnstableCeiling DataEnvironment::OutBaroPress = 101325.0; bool errorsFound(false); - HeatBalanceManager::GetProjectControlData(state, errorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetMaterialData(state, errorsFound); // read material data + HeatBalanceManager::GetMaterialData(*state, errorsFound); // read material data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetConstructData(state, errorsFound); // read construction data + HeatBalanceManager::GetConstructData(*state, errorsFound); // read construction data EXPECT_FALSE(errorsFound); // expect no errors - HeatBalanceManager::GetZoneData(state, errorsFound); + HeatBalanceManager::GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); - SurfaceGeometry::SetupZoneGeometry(state, errorsFound); + SurfaceGeometry::SetupZoneGeometry(*state, errorsFound); ASSERT_FALSE(errorsFound); - HeatBalanceManager::AllocateHeatBalArrays(state); - HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(state); + HeatBalanceManager::AllocateHeatBalArrays(*state); + HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(*state); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); - BaseboardElectric::GetBaseboardInput(state); + BaseboardElectric::GetBaseboardInput(*state); - state.dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->ZoneSizingCalc = true; Real64 tolerance = 1E-3; @@ -1296,18 +1297,18 @@ TEST_F(ConvectionCoefficientsFixture, CalcBeausoleilMorrisonMixedUnstableCeiling Real64 height = 1.0; Real64 surfTemp = 20.0; int zoneNum = 1; - Real64 convCoeff = CalcBeausoleilMorrisonMixedUnstableCeiling(state, deltaTemp, height, surfTemp, zoneNum); + Real64 convCoeff = CalcBeausoleilMorrisonMixedUnstableCeiling(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 3.581, tolerance); // DeltaT = 0 Error Path deltaTemp = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedUnstableCeiling(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedUnstableCeiling(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); // Height = 0 Error Path deltaTemp = 10.0; height = 0.0; - convCoeff = CalcBeausoleilMorrisonMixedUnstableCeiling(state, deltaTemp, height, surfTemp, zoneNum); + convCoeff = CalcBeausoleilMorrisonMixedUnstableCeiling(*state, deltaTemp, height, surfTemp, zoneNum); EXPECT_NEAR(convCoeff, 9.999, tolerance); } @@ -1440,7 +1441,7 @@ TEST_F(ConvectionCoefficientsFixture, ConvectionCoefficientsTest_HConvInDependen DataHeatBalance::HConvIn.allocate(1); - CalcASHRAESimpleIntConvCoeff(state, 1, 20.0, 30.0); + CalcASHRAESimpleIntConvCoeff(*state, 1, 20.0, 30.0); ConvectionCoefficient = DataHeatBalance::HConvIn(1); @@ -1467,108 +1468,108 @@ TEST_F(EnergyPlusFixture, AdaptiveModelSelections_ProperConstruction) int algorithm_identifier; - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_FohannoPolidoriVerticalWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondUnstableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq3WallAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq4CeilingAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolHeatedFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolHeatedFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AwbiHattonHeatedFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolChilledCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolChilledCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KaradagChilledCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq6NonHeatedWalls); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatHeatedWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatHeatedWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AwbiHattonHeatedWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq7Ceiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_FohannoPolidoriVerticalWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallNearHeaterEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallNearHeaterEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq5WallNearHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq7Ceiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserWalls); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_FisherPedersenCeilDiffuserCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserWindow); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq3WallAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq4CeilingAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyAssistingFlowWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyAssistingFlowWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedAssistingWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyOppossingFlowWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyOppossingFlowWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedOppossingWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedStableFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedUnstableFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedStableCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedUnstableCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserWindow); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallWindwardEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallWindwardEqNum; ASSERT_EQ(algorithm_identifier, HcExt_SparrowWindward); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallLeewardEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallLeewardEqNum; ASSERT_EQ(algorithm_identifier, HcExt_SparrowLeeward); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindHorizRoofEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindHorizRoofEqNum; ASSERT_EQ(algorithm_identifier, HcExt_ClearRoof); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcExt_NaturalASHRAEVerticalWall); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcExt_NaturalWaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcExt_NaturalWaltonUnstableHorizontalOrTilt); } @@ -1600,112 +1601,112 @@ TEST_F(EnergyPlusFixture, AdaptiveModelSelections_Implicit) DataHeatBalSurface::TempSurfInTmp(4) = 25.0; DataHeatBalSurface::TempSurfInTmp(5) = 25.0; DataHeatBalSurface::TempSurfInTmp(6) = 25.0; - ConvectionCoefficients::InitInteriorConvectionCoeffs(state, DataHeatBalSurface::TempSurfInTmp); + ConvectionCoefficients::InitInteriorConvectionCoeffs(*state, DataHeatBalSurface::TempSurfInTmp); int algorithm_identifier; - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_FohannoPolidoriVerticalWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondUnstableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq3WallAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq4CeilingAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolHeatedFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolHeatedFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AwbiHattonHeatedFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolChilledCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolChilledCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KaradagChilledCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq6NonHeatedWalls); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatHeatedWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatHeatedWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AwbiHattonHeatedWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq7Ceiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_FohannoPolidoriVerticalWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallNearHeaterEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallNearHeaterEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq5WallNearHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq7Ceiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserWalls); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_FisherPedersenCeilDiffuserCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserWindow); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq3WallAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq4CeilingAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyAssistingFlowWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyAssistingFlowWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedAssistingWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyOppossingFlowWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyOppossingFlowWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedOppossingWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedStableFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedUnstableFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedStableCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedUnstableCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserWindow); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallWindwardEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallWindwardEqNum; ASSERT_EQ(algorithm_identifier, HcExt_SparrowWindward); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallLeewardEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallLeewardEqNum; ASSERT_EQ(algorithm_identifier, HcExt_SparrowLeeward); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindHorizRoofEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindHorizRoofEqNum; ASSERT_EQ(algorithm_identifier, HcExt_ClearRoof); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcExt_NaturalASHRAEVerticalWall); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcExt_NaturalWaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcExt_NaturalWaltonUnstableHorizontalOrTilt); DataHeatBalSurface::TempSurfInTmp.deallocate(); @@ -1840,113 +1841,113 @@ TEST_F(EnergyPlusFixture, AdaptiveModelSelections_ExplicitSelection) DataHeatBalSurface::TempSurfInTmp(4) = 25.0; DataHeatBalSurface::TempSurfInTmp(5) = 25.0; DataHeatBalSurface::TempSurfInTmp(6) = 25.0; - ConvectionCoefficients::InitInteriorConvectionCoeffs(state, DataHeatBalSurface::TempSurfInTmp); - ConvectionCoefficients::GetUserConvectionCoefficients(state); + ConvectionCoefficients::InitInteriorConvectionCoeffs(*state, DataHeatBalSurface::TempSurfInTmp); + ConvectionCoefficients::GetUserConvectionCoefficients(*state); int algorithm_identifier; - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondUnstableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.SimpleBouyWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq3WallAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq4CeilingAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolHeatedFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolHeatedFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AwbiHattonHeatedFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolChilledCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolChilledCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KaradagChilledCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.FloorHeatCeilingCoolWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq6NonHeatedWalls); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatHeatedWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatHeatedWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AwbiHattonHeatedWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq7Ceiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.WallPanelHeatWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_FohannoPolidoriVerticalWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallNearHeaterEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatVertWallNearHeaterEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq5WallNearHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq7Ceiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ConvectiveHeatWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserWalls); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_FisherPedersenCeilDiffuserCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.CentralAirWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserWindow); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq3WallAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_AlamdariHammondStableHorizontal); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcInt_KhalifaEq4CeilingAwayFromHeat); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircStableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableTiltedEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircUnstableTiltedEqNum; ASSERT_EQ(algorithm_identifier, HcInt_WaltonUnstableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.ZoneFanCircWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_ISO15099Windows); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyAssistingFlowWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyAssistingFlowWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedAssistingWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyOppossingFlowWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedBouyOppossingFlowWallEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedOppossingWall); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedStableFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableFloorEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableFloorEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedUnstableFloor); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedStableCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedStableCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableCeilingEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedUnstableCeilingEqNum; ASSERT_EQ(algorithm_identifier, HcInt_BeausoleilMorrisonMixedUnstableCeiling); - algorithm_identifier = state.dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedWindowsEqNum; + algorithm_identifier = state->dataConvectionCoefficient->InsideFaceAdaptiveConvectionAlgo.MixedWindowsEqNum; ASSERT_EQ(algorithm_identifier, HcInt_GoldsteinNovoselacCeilingDiffuserWindow); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallWindwardEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallWindwardEqNum; ASSERT_EQ(algorithm_identifier, HcExt_SparrowWindward); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallLeewardEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindWallLeewardEqNum; ASSERT_EQ(algorithm_identifier, HcExt_SparrowLeeward); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindHorizRoofEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HWindHorizRoofEqNum; ASSERT_EQ(algorithm_identifier, HcExt_ClearRoof); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatVertWallEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatVertWallEqNum; ASSERT_EQ(algorithm_identifier, HcExt_NaturalASHRAEVerticalWall); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatStableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatStableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcExt_NaturalWaltonStableHorizontalOrTilt); - algorithm_identifier = state.dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatUnstableHorizEqNum; + algorithm_identifier = state->dataConvectionCoefficient->OutsideFaceAdaptiveConvectionAlgo.HNatUnstableHorizEqNum; ASSERT_EQ(algorithm_identifier, HcExt_NaturalWaltonUnstableHorizontalOrTilt); DataHeatBalSurface::TempSurfInTmp.deallocate(); diff --git a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc index ea7513956c0..6070840a83f 100644 --- a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc +++ b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc @@ -65,6 +65,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::CrossVentMgr; @@ -74,12 +75,12 @@ TEST_F(EnergyPlusFixture, CrossVentMgr_EvolveParaUCSDCV_Test) { // set up all conditions entering the EvolveParaUCSDCV when using the Issue #5520 test file on hitcount 9925 (where it used to crash) - state.dataGlobal->NumOfZones = 2; + state->dataGlobal->NumOfZones = 2; int MaxSurf = 2; - RecInflowRatio.allocate(state.dataGlobal->NumOfZones); + RecInflowRatio.allocate(state->dataGlobal->NumOfZones); - AirflowNetworkSurfaceUCSDCV.allocate({0, MaxSurf}, state.dataGlobal->NumOfZones); + AirflowNetworkSurfaceUCSDCV.allocate({0, MaxSurf}, state->dataGlobal->NumOfZones); AirflowNetworkSurfaceUCSDCV(1, 1) = 1; AirflowNetworkSurfaceUCSDCV(0, 1) = 1; AirflowNetworkSurfaceUCSDCV(0, 2) = 2; @@ -120,7 +121,7 @@ TEST_F(EnergyPlusFixture, CrossVentMgr_EvolveParaUCSDCV_Test) EnergyPlus::DataEnvironment::WindDir = 271.66666666666669; - EnergyPlus::DataRoomAirModel::AirModel.allocate(state.dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::AirModel.allocate(state->dataGlobal->NumOfZones); EnergyPlus::AirflowNetwork::AirflowNetworkLinkageData.allocate(2); EnergyPlus::AirflowNetwork::AirflowNetworkLinkageData(1).CompNum = 1; @@ -152,24 +153,24 @@ TEST_F(EnergyPlusFixture, CrossVentMgr_EvolveParaUCSDCV_Test) EnergyPlus::DataUCSDSharedData::APos_Wall(3) = 8; EnergyPlus::DataUCSDSharedData::APos_Wall(4) = 10; - EnergyPlus::DataRoomAirModel::Droom.allocate(state.dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::Droom.allocate(state->dataGlobal->NumOfZones); EnergyPlus::DataRoomAirModel::Droom(1) = 13.631070390838719; - EnergyPlus::DataRoomAirModel::Dstar.allocate(state.dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::Dstar.allocate(state->dataGlobal->NumOfZones); - EnergyPlus::DataRoomAirModel::Ain.allocate(state.dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::Ain.allocate(state->dataGlobal->NumOfZones); - EnergyPlus::DataRoomAirModel::ZoneUCSDCV.allocate(state.dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::ZoneUCSDCV.allocate(state->dataGlobal->NumOfZones); EnergyPlus::DataRoomAirModel::ZoneUCSDCV(1).ZonePtr = 1; - EnergyPlus::DataRoomAirModel::JetRecAreaRatio.allocate(state.dataGlobal->NumOfZones); - EnergyPlus::DataRoomAirModel::Ujet.allocate(state.dataGlobal->NumOfZones); - EnergyPlus::DataRoomAirModel::Urec.allocate(state.dataGlobal->NumOfZones); - EnergyPlus::DataRoomAirModel::Qrec.allocate(state.dataGlobal->NumOfZones); - EnergyPlus::DataRoomAirModel::Qtot.allocate(state.dataGlobal->NumOfZones); - EnergyPlus::DataRoomAirModel::Tin.allocate(state.dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::JetRecAreaRatio.allocate(state->dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::Ujet.allocate(state->dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::Urec.allocate(state->dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::Qrec.allocate(state->dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::Qtot.allocate(state->dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::Tin.allocate(state->dataGlobal->NumOfZones); - EvolveParaUCSDCV(state, 1); + EvolveParaUCSDCV(*state, 1); EXPECT_NEAR(27.14, CVJetRecFlows(1, 1).Fin, 0.01); EXPECT_NEAR(0.871, CVJetRecFlows(1, 1).Uin, 0.001); diff --git a/tst/EnergyPlus/unit/CurveManager.unit.cc b/tst/EnergyPlus/unit/CurveManager.unit.cc index 0bed8510960..84fa1e38d8b 100644 --- a/tst/EnergyPlus/unit/CurveManager.unit.cc +++ b/tst/EnergyPlus/unit/CurveManager.unit.cc @@ -53,6 +53,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -74,16 +75,16 @@ TEST_F(EnergyPlusFixture, CurveExponentialSkewNormal_MaximumCurveOutputTest) }); ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_EQ(0, state.dataCurveManager->NumCurves); - CurveManager::GetCurveInput(state); - state.dataCurveManager->GetCurvesInputFlag = false; - ASSERT_EQ(1, state.dataCurveManager->NumCurves); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + ASSERT_EQ(1, state->dataCurveManager->NumCurves); - EXPECT_EQ(1.0, state.dataCurveManager->PerfCurve(1).CurveMax); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMaxPresent); + EXPECT_EQ(1.0, state->dataCurveManager->PerfCurve(1).CurveMax); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMaxPresent); - EXPECT_EQ(0.1, state.dataCurveManager->PerfCurve(1).CurveMin); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMinPresent); + EXPECT_EQ(0.1, state->dataCurveManager->PerfCurve(1).CurveMin); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMinPresent); } TEST_F(EnergyPlusFixture, QuadraticCurve) @@ -109,16 +110,16 @@ TEST_F(EnergyPlusFixture, QuadraticCurve) }); ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_EQ(0, state.dataCurveManager->NumCurves); - CurveManager::GetCurveInput(state); - state.dataCurveManager->GetCurvesInputFlag = false; - ASSERT_EQ(1, state.dataCurveManager->NumCurves); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + ASSERT_EQ(1, state->dataCurveManager->NumCurves); - EXPECT_EQ(38.0, state.dataCurveManager->PerfCurve(1).CurveMax); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMaxPresent); + EXPECT_EQ(38.0, state->dataCurveManager->PerfCurve(1).CurveMax); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMaxPresent); - EXPECT_EQ(0., state.dataCurveManager->PerfCurve(1).CurveMin); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMinPresent); + EXPECT_EQ(0., state->dataCurveManager->PerfCurve(1).CurveMin); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMinPresent); } TEST_F(EnergyPlusFixture, TableLookup) @@ -213,20 +214,20 @@ TEST_F(EnergyPlusFixture, TableLookup) }); ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_EQ(0, state.dataCurveManager->NumCurves); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); - CurveManager::GetCurveInput(state); - state.dataCurveManager->GetCurvesInputFlag = false; - ASSERT_EQ(3, state.dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + ASSERT_EQ(3, state->dataCurveManager->NumCurves); - EXPECT_EQ("Table:Lookup", state.dataCurveManager->PerfCurve(1).ObjectType); - EXPECT_EQ("CAPMODFUNCOFWATERFLOW", state.dataCurveManager->PerfCurve(1).Name); + EXPECT_EQ("Table:Lookup", state->dataCurveManager->PerfCurve(1).ObjectType); + EXPECT_EQ("CAPMODFUNCOFWATERFLOW", state->dataCurveManager->PerfCurve(1).Name); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMinPresent); - EXPECT_EQ(0.0, state.dataCurveManager->PerfCurve(1).CurveMin); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMinPresent); + EXPECT_EQ(0.0, state->dataCurveManager->PerfCurve(1).CurveMin); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMaxPresent); - EXPECT_EQ(1.04, state.dataCurveManager->PerfCurve(1).CurveMax); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMaxPresent); + EXPECT_EQ(1.04, state->dataCurveManager->PerfCurve(1).CurveMax); } TEST_F(EnergyPlusFixture, DivisorNormalizationNone) @@ -312,20 +313,20 @@ TEST_F(EnergyPlusFixture, DivisorNormalizationNone) }); ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_EQ(0, state.dataCurveManager->NumCurves); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); - CurveManager::GetCurveInput(state); - state.dataCurveManager->GetCurvesInputFlag = false; - ASSERT_EQ(1, state.dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + ASSERT_EQ(1, state->dataCurveManager->NumCurves); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMinPresent); - EXPECT_EQ(expected_curve_min, state.dataCurveManager->PerfCurve(1).CurveMin); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMinPresent); + EXPECT_EQ(expected_curve_min, state->dataCurveManager->PerfCurve(1).CurveMin); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMaxPresent); - EXPECT_EQ(expected_curve_max, state.dataCurveManager->PerfCurve(1).CurveMax); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMaxPresent); + EXPECT_EQ(expected_curve_max, state->dataCurveManager->PerfCurve(1).CurveMax); for (auto data_point : table_data ){ - EXPECT_DOUBLE_EQ(data_point.first*data_point.second, CurveManager::CurveValue(state, 1, data_point.first, data_point.second)); + EXPECT_DOUBLE_EQ(data_point.first*data_point.second, CurveManager::CurveValue(*state, 1, data_point.first, data_point.second)); } } @@ -413,20 +414,20 @@ TEST_F(EnergyPlusFixture, DivisorNormalizationDivisorOnly) }); ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_EQ(0, state.dataCurveManager->NumCurves); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); - CurveManager::GetCurveInput(state); - state.dataCurveManager->GetCurvesInputFlag = false; - ASSERT_EQ(1, state.dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + ASSERT_EQ(1, state->dataCurveManager->NumCurves); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMinPresent); - EXPECT_EQ(expected_curve_min, state.dataCurveManager->PerfCurve(1).CurveMin); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMinPresent); + EXPECT_EQ(expected_curve_min, state->dataCurveManager->PerfCurve(1).CurveMin); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMaxPresent); - EXPECT_EQ(expected_curve_max, state.dataCurveManager->PerfCurve(1).CurveMax); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMaxPresent); + EXPECT_EQ(expected_curve_max, state->dataCurveManager->PerfCurve(1).CurveMax); for (auto data_point : table_data ){ - EXPECT_DOUBLE_EQ(data_point.first*data_point.second/expected_divisor, CurveManager::CurveValue(state, 1, data_point.first, data_point.second)); + EXPECT_DOUBLE_EQ(data_point.first*data_point.second/expected_divisor, CurveManager::CurveValue(*state, 1, data_point.first, data_point.second)); } } @@ -515,20 +516,20 @@ TEST_F(EnergyPlusFixture, DivisorNormalizationAutomaticWithDivisor) }); ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_EQ(0, state.dataCurveManager->NumCurves); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); - CurveManager::GetCurveInput(state); - state.dataCurveManager->GetCurvesInputFlag = false; - ASSERT_EQ(1, state.dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + ASSERT_EQ(1, state->dataCurveManager->NumCurves); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMinPresent); - EXPECT_EQ(expected_curve_min, state.dataCurveManager->PerfCurve(1).CurveMin); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMinPresent); + EXPECT_EQ(expected_curve_min, state->dataCurveManager->PerfCurve(1).CurveMin); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMaxPresent); - EXPECT_EQ(expected_curve_max, state.dataCurveManager->PerfCurve(1).CurveMax); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMaxPresent); + EXPECT_EQ(expected_curve_max, state->dataCurveManager->PerfCurve(1).CurveMax); for (auto data_point : table_data ){ - EXPECT_DOUBLE_EQ(data_point.first*data_point.second/expected_auto_divisor, CurveManager::CurveValue(state, 1, data_point.first, data_point.second)); + EXPECT_DOUBLE_EQ(data_point.first*data_point.second/expected_auto_divisor, CurveManager::CurveValue(*state, 1, data_point.first, data_point.second)); } } @@ -618,21 +619,21 @@ TEST_F(EnergyPlusFixture, NormalizationAutomaticWithDivisorAndSpecifiedDivisor) }); ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_EQ(0, state.dataCurveManager->NumCurves); + EXPECT_EQ(0, state->dataCurveManager->NumCurves); - CurveManager::GetCurveInput(state); - state.dataCurveManager->GetCurvesInputFlag = false; - ASSERT_EQ(1, state.dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + ASSERT_EQ(1, state->dataCurveManager->NumCurves); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMinPresent); - EXPECT_EQ(expected_curve_min, state.dataCurveManager->PerfCurve(1).CurveMin); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMinPresent); + EXPECT_EQ(expected_curve_min, state->dataCurveManager->PerfCurve(1).CurveMin); - EXPECT_TRUE(state.dataCurveManager->PerfCurve(1).CurveMaxPresent); - EXPECT_EQ(expected_curve_max, state.dataCurveManager->PerfCurve(1).CurveMax); + EXPECT_TRUE(state->dataCurveManager->PerfCurve(1).CurveMaxPresent); + EXPECT_EQ(expected_curve_max, state->dataCurveManager->PerfCurve(1).CurveMax); for (auto data_point : table_data) { EXPECT_DOUBLE_EQ(data_point.first * data_point.second / expected_auto_divisor / normalization_divisor, - CurveManager::CurveValue(state, 1, data_point.first, data_point.second)); + CurveManager::CurveValue(*state, 1, data_point.first, data_point.second)); } } @@ -641,12 +642,12 @@ TEST_F(EnergyPlusFixture, CSV_CarriageReturns_Handling) CurveManager::TableFile testTableFile = CurveManager::TableFile(); std::string testCSV = configured_source_directory() + "/tst/EnergyPlus/unit/Resources/TestCarriageReturn.csv"; testTableFile.filePath = testCSV; - testTableFile.load(state, testCSV); + testTableFile.load(*state, testCSV); std::vector TestArray; std::size_t col = 2; std::size_t row = 1; std::size_t expected_length = 168; - TestArray = testTableFile.getArray(state, std::make_pair(col,row)); + TestArray = testTableFile.getArray(*state, std::make_pair(col,row)); EXPECT_EQ(TestArray.size(), expected_length ); for (std::size_t i=0; i #include #include +#include // EnergyPlus Headers #include "Fixtures/EnergyPlusFixture.hh" @@ -302,51 +303,51 @@ TEST_F(EnergyPlusFixture, DElightManagerF_GetInputDElightComplexFenestration_Tes bool foundErrors = false; - HeatBalanceManager::GetProjectControlData(state, foundErrors); // read project control data + HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetMaterialData(state, foundErrors); // read material data + HeatBalanceManager::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetConstructData(state, foundErrors); // read construction data + HeatBalanceManager::GetConstructData(*state, foundErrors); // read construction data compare_err_stream(""); EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetZoneData(state, foundErrors); // read zone data + HeatBalanceManager::GetZoneData(*state, foundErrors); // read zone data EXPECT_FALSE(foundErrors); // expect no errors - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, foundErrors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, foundErrors); // setup zone geometry and get zone data EXPECT_FALSE(foundErrors); // expect no errors - SurfaceGeometry::SetupZoneGeometry(state, foundErrors); // this calls GetSurfaceData() + SurfaceGeometry::SetupZoneGeometry(*state, foundErrors); // this calls GetSurfaceData() EXPECT_FALSE(foundErrors); // expect no errors - 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); + 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); ScheduleManager::ScheduleInputProcessed = true; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); - InternalHeatGains::GetInternalHeatGainsInput(state); + ScheduleManager::UpdateScheduleValues(*state); + InternalHeatGains::GetInternalHeatGainsInput(*state); InternalHeatGains::GetInternalHeatGainsInputFlag = false; - GetInputDElightComplexFenestration(state, foundErrors); + GetInputDElightComplexFenestration(*state, foundErrors); compare_err_stream(""); EXPECT_FALSE(foundErrors); // expect no errors diff --git a/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc b/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc index db058faadb9..a92258c9cf6 100644 --- a/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc +++ b/tst/EnergyPlus/unit/DOASEffectOnZoneSizing.unit.cc @@ -67,6 +67,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace ZoneEquipmentManager; @@ -97,17 +98,17 @@ TEST_F(EnergyPlusFixture, DOASEffectOnZoneSizing_CalcDOASSupCondsForSizing) DOASHighTemp = 23.9; OutDB = 10.0; OutHR = 0.005; - CalcDOASSupCondsForSizing(state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.016, 0.0143, DOASSupTemp, DOASSupHR); + CalcDOASSupCondsForSizing(*state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.016, 0.0143, DOASSupTemp, DOASSupHR); EXPECT_DOUBLE_EQ(21.1, DOASSupTemp); EXPECT_DOUBLE_EQ(0.005, DOASSupHR); OutDB = 35.6; OutHR = 0.0185; - CalcDOASSupCondsForSizing(state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.016, 0.0143, DOASSupTemp, DOASSupHR); + CalcDOASSupCondsForSizing(*state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.016, 0.0143, DOASSupTemp, DOASSupHR); EXPECT_DOUBLE_EQ(23.9, DOASSupTemp); EXPECT_DOUBLE_EQ(0.016, DOASSupHR); OutDB = 22.3; OutHR = 0.0085; - CalcDOASSupCondsForSizing(state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.016, 0.0143, DOASSupTemp, DOASSupHR); + CalcDOASSupCondsForSizing(*state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.016, 0.0143, DOASSupTemp, DOASSupHR); EXPECT_DOUBLE_EQ(22.3, DOASSupTemp); EXPECT_DOUBLE_EQ(0.0085, DOASSupHR); // neutral dehumidified supply air @@ -116,12 +117,12 @@ TEST_F(EnergyPlusFixture, DOASEffectOnZoneSizing_CalcDOASSupCondsForSizing) DOASHighTemp = 22.2; OutDB = 11; OutHR = 0.004; - CalcDOASSupCondsForSizing(state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.0153, 0.0092, DOASSupTemp, DOASSupHR); + CalcDOASSupCondsForSizing(*state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.0153, 0.0092, DOASSupTemp, DOASSupHR); EXPECT_DOUBLE_EQ(22.2, DOASSupTemp); EXPECT_DOUBLE_EQ(0.004, DOASSupHR); OutDB = 35.6; OutHR = 0.0185; - CalcDOASSupCondsForSizing(state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.0153, 0.0092, DOASSupTemp, DOASSupHR); + CalcDOASSupCondsForSizing(*state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.0153, 0.0092, DOASSupTemp, DOASSupHR); EXPECT_DOUBLE_EQ(22.2, DOASSupTemp); EXPECT_DOUBLE_EQ(0.0092, DOASSupHR); // cold supply air @@ -130,12 +131,12 @@ TEST_F(EnergyPlusFixture, DOASEffectOnZoneSizing_CalcDOASSupCondsForSizing) DOASHighTemp = 14.4; OutDB = 11; OutHR = 0.005; - CalcDOASSupCondsForSizing(state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.0092, 0.008, DOASSupTemp, DOASSupHR); + CalcDOASSupCondsForSizing(*state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.0092, 0.008, DOASSupTemp, DOASSupHR); EXPECT_DOUBLE_EQ(14.4, DOASSupTemp); EXPECT_DOUBLE_EQ(0.005, DOASSupHR); OutDB = 35.6; OutHR = 0.0185; - CalcDOASSupCondsForSizing(state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.0092, 0.008, DOASSupTemp, DOASSupHR); + CalcDOASSupCondsForSizing(*state, OutDB, OutHR, DOASControl, DOASLowTemp, DOASHighTemp, 0.0092, 0.008, DOASSupTemp, DOASSupHR); EXPECT_DOUBLE_EQ(12.2, DOASSupTemp); EXPECT_DOUBLE_EQ(0.008, DOASSupHR); } @@ -164,9 +165,9 @@ TEST_F(EnergyPlusFixture, DOASEffectOnZoneSizing_SizeZoneEquipment) ZoneEquipConfig(1).ExhaustNode.allocate(1); ZoneEquipConfig(2).ExhaustNode.allocate(1); ZoneMassBalanceFlag.allocate(2); - state.dataGlobal->NumOfZones = 2; - MassConservation.allocate(state.dataGlobal->NumOfZones); - HeatBalanceManager::AllocateHeatBalArrays(state); + state->dataGlobal->NumOfZones = 2; + MassConservation.allocate(state->dataGlobal->NumOfZones); + HeatBalanceManager::AllocateHeatBalArrays(*state); AirflowNetwork::AirflowNetworkNumOfExhFan = 0; TempControlType(1) = 4; TempControlType(2) = 4; @@ -289,8 +290,8 @@ TEST_F(EnergyPlusFixture, DOASEffectOnZoneSizing_SizeZoneEquipment) Zone(1).ListMultiplier = 1; Zone(2).ListMultiplier = 1; - state.dataZoneEquipmentManager->SizeZoneEquipmentOneTimeFlag = false; - SizeZoneEquipment(state); + state->dataZoneEquipmentManager->SizeZoneEquipmentOneTimeFlag = false; + SizeZoneEquipment(*state); EXPECT_DOUBLE_EQ(12.2, CalcZoneSizing(1, 1).DOASSupTemp); EXPECT_NEAR(.00795195, CalcZoneSizing(1, 1).DOASSupHumRat, .00000001); @@ -350,66 +351,66 @@ TEST_F(EnergyPlusFixture, TestAutoCalcDOASControlStrategy) ZoneSizingInput(2).DOASControlStrategy = DOANeutralSup; ZoneSizingInput(2).DOASLowSetpoint = AutoSize; ZoneSizingInput(2).DOASHighSetpoint = AutoSize; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_DOUBLE_EQ(21.1, ZoneSizingInput(2).DOASLowSetpoint); EXPECT_DOUBLE_EQ(23.9, ZoneSizingInput(2).DOASHighSetpoint); ZoneSizingInput(2).DOASLowSetpoint = AutoSize; ZoneSizingInput(2).DOASHighSetpoint = 23.7; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_NEAR(20.9, ZoneSizingInput(2).DOASLowSetpoint, .000001); EXPECT_DOUBLE_EQ(23.7, ZoneSizingInput(2).DOASHighSetpoint); ZoneSizingInput(2).DOASLowSetpoint = 21.2; ZoneSizingInput(2).DOASHighSetpoint = AutoSize; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_NEAR(24.0, ZoneSizingInput(2).DOASHighSetpoint, .000001); EXPECT_DOUBLE_EQ(21.2, ZoneSizingInput(2).DOASLowSetpoint); ZoneSizingInput(2).DOASLowSetpoint = 21.5; ZoneSizingInput(2).DOASHighSetpoint = 22.6; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_DOUBLE_EQ(22.6, ZoneSizingInput(2).DOASHighSetpoint); EXPECT_DOUBLE_EQ(21.5, ZoneSizingInput(2).DOASLowSetpoint); ZoneSizingInput(2).DOASControlStrategy = DOANeutralDehumSup; ZoneSizingInput(2).DOASLowSetpoint = AutoSize; ZoneSizingInput(2).DOASHighSetpoint = AutoSize; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_DOUBLE_EQ(14.4, ZoneSizingInput(2).DOASLowSetpoint); EXPECT_DOUBLE_EQ(22.2, ZoneSizingInput(2).DOASHighSetpoint); ZoneSizingInput(2).DOASLowSetpoint = AutoSize; ZoneSizingInput(2).DOASHighSetpoint = 22.4; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_DOUBLE_EQ(14.4, ZoneSizingInput(2).DOASLowSetpoint); EXPECT_DOUBLE_EQ(22.4, ZoneSizingInput(2).DOASHighSetpoint); ZoneSizingInput(2).DOASLowSetpoint = 13.8; ZoneSizingInput(2).DOASHighSetpoint = AutoSize; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_DOUBLE_EQ(22.2, ZoneSizingInput(2).DOASHighSetpoint); EXPECT_DOUBLE_EQ(13.8, ZoneSizingInput(2).DOASLowSetpoint); ZoneSizingInput(2).DOASLowSetpoint = 13.9; ZoneSizingInput(2).DOASHighSetpoint = 22.6; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_DOUBLE_EQ(22.6, ZoneSizingInput(2).DOASHighSetpoint); EXPECT_DOUBLE_EQ(13.9, ZoneSizingInput(2).DOASLowSetpoint); ZoneSizingInput(2).DOASControlStrategy = DOACoolSup; ZoneSizingInput(2).DOASLowSetpoint = AutoSize; ZoneSizingInput(2).DOASHighSetpoint = AutoSize; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_DOUBLE_EQ(12.2, ZoneSizingInput(2).DOASLowSetpoint); EXPECT_DOUBLE_EQ(14.4, ZoneSizingInput(2).DOASHighSetpoint); ZoneSizingInput(2).DOASLowSetpoint = AutoSize; ZoneSizingInput(2).DOASHighSetpoint = 14.6; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_NEAR(12.4, ZoneSizingInput(2).DOASLowSetpoint, .000001); EXPECT_DOUBLE_EQ(14.6, ZoneSizingInput(2).DOASHighSetpoint); ZoneSizingInput(2).DOASLowSetpoint = 12.3; ZoneSizingInput(2).DOASHighSetpoint = AutoSize; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_NEAR(14.5, ZoneSizingInput(2).DOASHighSetpoint, .000001); EXPECT_DOUBLE_EQ(12.3, ZoneSizingInput(2).DOASLowSetpoint); ZoneSizingInput(2).DOASLowSetpoint = 12.6; ZoneSizingInput(2).DOASHighSetpoint = 13.8; - AutoCalcDOASControlStrategy(state); + AutoCalcDOASControlStrategy(*state); EXPECT_DOUBLE_EQ(13.8, ZoneSizingInput(2).DOASHighSetpoint); EXPECT_DOUBLE_EQ(12.6, ZoneSizingInput(2).DOASLowSetpoint); diff --git a/tst/EnergyPlus/unit/DXCoils.unit.cc b/tst/EnergyPlus/unit/DXCoils.unit.cc index 1ce3780d025..6f2c5f20a20 100644 --- a/tst/EnergyPlus/unit/DXCoils.unit.cc +++ b/tst/EnergyPlus/unit/DXCoils.unit.cc @@ -68,6 +68,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace DXCoils; @@ -159,56 +160,56 @@ TEST_F(EnergyPlusFixture, DXCoils_Test1) DXCoil(DXCoilNum).RegionNum = 4; DXCoil(DXCoilNum).MinOATCompressor = -17.78; - state.dataCurveManager->NumCurves = 3; - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->NumCurves = 3; + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); CurveNum = 1; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 2.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 2.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0; CurveNum = 2; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 1.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.7; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 1.0; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 1.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.7; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 1.0; CurveNum = 3; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = -100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = -100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 100.0; - - SetPredefinedTables(state); - SizeDXCoil(state, 2); + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = -100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = -100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 100.0; + + SetPredefinedTables(*state); + SizeDXCoil(*state, 2); EXPECT_DOUBLE_EQ(5000.0, DXCoil(2).DefrostCapacity); EXPECT_TRUE(has_eio_output()); @@ -258,11 +259,11 @@ TEST_F(EnergyPlusFixture, DXCoils_Test1) int FanOpMode = 1; int CompOp = 1; int SingleMode = 0; - CalcMultiSpeedDXCoilCooling(state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, SingleMode); + CalcMultiSpeedDXCoilCooling(*state, CoilIndex, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, SingleMode); Real64 TdbAtOutlet = PsyTdbFnHW(DXCoil(CoilIndex).OutletAirEnthalpy, DXCoil(CoilIndex).OutletAirHumRat); - Real64 tSatAtOutlet = PsyTsatFnHPb(state, DXCoil(CoilIndex).OutletAirEnthalpy, OutBaroPress); - Real64 rhAtOutlet = PsyRhFnTdbWPb(state, DXCoil(CoilIndex).OutletAirTemp, DXCoil(CoilIndex).OutletAirHumRat, OutBaroPress); + Real64 tSatAtOutlet = PsyTsatFnHPb(*state, DXCoil(CoilIndex).OutletAirEnthalpy, OutBaroPress); + Real64 rhAtOutlet = PsyRhFnTdbWPb(*state, DXCoil(CoilIndex).OutletAirTemp, DXCoil(CoilIndex).OutletAirHumRat, OutBaroPress); // air outlet condition is right next to the saturation curve EXPECT_DOUBLE_EQ(TdbAtOutlet, tSatAtOutlet); // Tdb higher than TSat by 1.8E-15 C @@ -279,11 +280,11 @@ TEST_F(EnergyPlusFixture, DXCoils_Test2) int DXCoilNum; int CurveNum; - state.dataGlobal->DisplayExtraWarnings = true; + state->dataGlobal->DisplayExtraWarnings = true; SysSizingRunDone = true; FinalSysSizing.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); CurSysNum = 1; NumDXCoils = 2; DXCoilNum = 2; @@ -311,56 +312,56 @@ TEST_F(EnergyPlusFixture, DXCoils_Test2) DXCoil(DXCoilNum).EIRFFlow(1) = 1; DXCoil(DXCoilNum).EIRFTemp(1) = 1; DXCoil(DXCoilNum).PLFFPLR(1) = 1; - state.dataCurveManager->NumCurves = 3; - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->NumCurves = 3; + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); CurveNum = 1; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 2.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 2.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 2.0; CurveNum = 2; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 1.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.7; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 1.0; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 1.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 0.7; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 1.0; CurveNum = 3; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = -100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = -100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 100.0; - - SetPredefinedTables(state); - SizeDXCoil(state, 2); + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = -100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = -100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 100.0; + + SetPredefinedTables(*state); + SizeDXCoil(*state, 2); EXPECT_DOUBLE_EQ(0.0, DXCoil(2).RatedTotCap(1)); EXPECT_TRUE(has_eio_output()); @@ -382,8 +383,8 @@ TEST_F(EnergyPlusFixture, DXCoils_Test2) // Clean up UnitarySysEqSizing.deallocate(); FinalSysSizing.deallocate(); - state.dataAirSystemsData->PrimaryAirSystems.deallocate(); - state.dataAirLoop->AirLoopControlInfo.deallocate(); + state->dataAirSystemsData->PrimaryAirSystems.deallocate(); + state->dataAirLoop->AirLoopControlInfo.deallocate(); } TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) @@ -470,16 +471,16 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) for (int mode = 1; mode <= Coil.NumOfSpeeds; ++mode) { Coil.MSRatedAirMassFlowRate(mode) = - Coil.MSRatedAirVolFlowRate(mode) * PsyRhoAirFnPbTdbW(state, EnergyPlus::DataEnvironment::StdBaroPress, 21.11, 0.00881, "InitDXCoil"); + Coil.MSRatedAirVolFlowRate(mode) * PsyRhoAirFnPbTdbW(*state, EnergyPlus::DataEnvironment::StdBaroPress, 21.11, 0.00881, "InitDXCoil"); } - state.dataCurveManager->NumCurves = 11; - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->NumCurves = 11; + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); PerformanceCurveData *pCurve; int const nCapfT1 = 1; - pCurve = &state.dataCurveManager->PerfCurve(nCapfT1); + pCurve = &state->dataCurveManager->PerfCurve(nCapfT1); pCurve->CurveType = CurveTypeEnum::BiQuadratic; pCurve->Name = "HP_Heat-Cap-fT1"; pCurve->Coeff1 = 0.95624428; @@ -496,7 +497,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.MSCCapFTemp(1) = nCapfT1; int const nCapfFF1 = 2; - pCurve = &state.dataCurveManager->PerfCurve(nCapfFF1); + pCurve = &state->dataCurveManager->PerfCurve(nCapfFF1); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->Name = "HP_Heat-Cap-fFF1"; pCurve->Coeff1 = 1; @@ -510,7 +511,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.MSCCapFFlow(1) = nCapfFF1; int const nEIRfT1 = 3; - pCurve = &state.dataCurveManager->PerfCurve(nEIRfT1); + pCurve = &state->dataCurveManager->PerfCurve(nEIRfT1); pCurve->CurveType = CurveTypeEnum::BiQuadratic; pCurve->Name = "HP_Heat-EIR-fT1"; pCurve->Coeff1 = 1.065476178; @@ -527,7 +528,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.MSEIRFTemp(1) = nEIRfT1; int const nEIRfFF1 = 4; - pCurve = &state.dataCurveManager->PerfCurve(nEIRfFF1); + pCurve = &state->dataCurveManager->PerfCurve(nEIRfFF1); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->Name = "HP_Heat-EIR-fFF1"; pCurve->Coeff1 = 1; @@ -541,7 +542,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.MSEIRFFlow(1) = nEIRfFF1; int const nPLFfPLR1 = 5; - pCurve = &state.dataCurveManager->PerfCurve(nPLFfPLR1); + pCurve = &state->dataCurveManager->PerfCurve(nPLFfPLR1); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->Name = "HP_Heat-PLF-fPLR1"; pCurve->Coeff1 = 1; @@ -555,7 +556,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.MSPLFFPLR(1) = nPLFfPLR1; int const nConstantBiquadratic = 6; - pCurve = &state.dataCurveManager->PerfCurve(nConstantBiquadratic); + pCurve = &state->dataCurveManager->PerfCurve(nConstantBiquadratic); pCurve->CurveType = CurveTypeEnum::BiQuadratic; pCurve->Name = "ConstantBiquadratic"; pCurve->Coeff1 = 1; @@ -573,7 +574,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.MSWasteHeat(2) = nConstantBiquadratic; int const nCapfT2 = 7; - pCurve = &state.dataCurveManager->PerfCurve(nCapfT2); + pCurve = &state->dataCurveManager->PerfCurve(nCapfT2); pCurve->CurveType = CurveTypeEnum::BiQuadratic; pCurve->Name = "HP_Heat-Cap-fT2"; pCurve->Coeff1 = 0.95624428; @@ -590,7 +591,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.MSCCapFTemp(2) = nCapfT2; int const nCapfFF2 = 8; - pCurve = &state.dataCurveManager->PerfCurve(nCapfFF2); + pCurve = &state->dataCurveManager->PerfCurve(nCapfFF2); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->Name = "HP_Heat-Cap-fFF2"; pCurve->Coeff1 = 1; @@ -604,7 +605,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.MSCCapFFlow(2) = nCapfFF2; int const nEIRfT2 = 9; - pCurve = &state.dataCurveManager->PerfCurve(nEIRfT2); + pCurve = &state->dataCurveManager->PerfCurve(nEIRfT2); pCurve->CurveType = CurveTypeEnum::BiQuadratic; pCurve->Name = "HP_Heat-EIR-fT2"; pCurve->Coeff1 = 1.065476178; @@ -621,7 +622,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.MSEIRFTemp(2) = nEIRfT2; int const nEIRfFF2 = 10; - pCurve = &state.dataCurveManager->PerfCurve(nEIRfFF2); + pCurve = &state->dataCurveManager->PerfCurve(nEIRfFF2); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->Name = "HP_Heat-EIR-fFF2"; pCurve->Coeff1 = 1; @@ -635,7 +636,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.MSEIRFFlow(2) = nEIRfFF2; int const nPLFfPLR2 = 11; - pCurve = &state.dataCurveManager->PerfCurve(nPLFfPLR2); + pCurve = &state->dataCurveManager->PerfCurve(nPLFfPLR2); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->Name = "HP_Heat-PLF-fPLR2"; pCurve->Coeff1 = 1; @@ -648,8 +649,8 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) Coil.MSPLFFPLR(2) = nPLFfPLR2; - for (int CurveNum = 1; CurveNum <= state.dataCurveManager->NumCurves; ++CurveNum) { - PerformanceCurveData &rCurve = state.dataCurveManager->PerfCurve(CurveNum); + for (int CurveNum = 1; CurveNum <= state->dataCurveManager->NumCurves; ++CurveNum) { + PerformanceCurveData &rCurve = state->dataCurveManager->PerfCurve(CurveNum); if (rCurve.CurveType == CurveTypeEnum::BiQuadratic) { rCurve.ObjectType = "Curve:Biquadratic"; rCurve.InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; @@ -677,15 +678,15 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) // Defroster on OutDryBulbTemp = -5.0; // cold - CalcMultiSpeedDXCoilHeating(state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); - Real64 COPwoDefrost = Coil.MSRatedCOP(SpeedNum) / (CurveValue(state, nEIRfT2, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(state, nEIRfFF2, 1)); + CalcMultiSpeedDXCoilHeating(*state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); + Real64 COPwoDefrost = Coil.MSRatedCOP(SpeedNum) / (CurveValue(*state, nEIRfT2, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(*state, nEIRfFF2, 1)); Real64 COPwDefrost = Coil.TotalHeatingEnergyRate / Coil.ElecHeatingPower; EXPECT_LT(COPwDefrost, COPwoDefrost); // Defroster off OutDryBulbTemp = 5.0; // not cold enough for defroster - CalcMultiSpeedDXCoilHeating(state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); - COPwoDefrost = Coil.MSRatedCOP(SpeedNum) / (CurveValue(state, nEIRfT2, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(state, nEIRfFF2, 1)); + CalcMultiSpeedDXCoilHeating(*state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); + COPwoDefrost = Coil.MSRatedCOP(SpeedNum) / (CurveValue(*state, nEIRfT2, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(*state, nEIRfFF2, 1)); COPwDefrost = Coil.TotalHeatingEnergyRate / Coil.ElecHeatingPower; EXPECT_DOUBLE_EQ(COPwoDefrost, COPwDefrost); @@ -694,15 +695,15 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) // Defroster on OutDryBulbTemp = -5.0; // cold - CalcMultiSpeedDXCoilHeating(state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); - COPwoDefrost = Coil.MSRatedCOP(SpeedNum) / (CurveValue(state, nEIRfT1, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(state, nEIRfFF1, 1)); + CalcMultiSpeedDXCoilHeating(*state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); + COPwoDefrost = Coil.MSRatedCOP(SpeedNum) / (CurveValue(*state, nEIRfT1, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(*state, nEIRfFF1, 1)); COPwDefrost = Coil.TotalHeatingEnergyRate / Coil.ElecHeatingPower; EXPECT_LT(COPwDefrost, COPwoDefrost); // Defroster off OutDryBulbTemp = 5.0; // not cold enough for defroster - CalcMultiSpeedDXCoilHeating(state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); - COPwoDefrost = Coil.MSRatedCOP(SpeedNum) / (CurveValue(state, nEIRfT1, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(state, nEIRfFF1, 1)); + CalcMultiSpeedDXCoilHeating(*state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); + COPwoDefrost = Coil.MSRatedCOP(SpeedNum) / (CurveValue(*state, nEIRfT1, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(*state, nEIRfFF1, 1)); COPwDefrost = Coil.TotalHeatingEnergyRate / Coil.ElecHeatingPower; EXPECT_DOUBLE_EQ(COPwoDefrost, COPwDefrost); @@ -716,7 +717,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) CycRatio = 1.0; SpeedNum = 2; - CalcMultiSpeedDXCoilHeating(state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); + CalcMultiSpeedDXCoilHeating(*state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); Real64 DXCoilOutletNodeTemp2 = Coil.OutletAirTemp; Real64 DXCoilOutletNodeHumRat2 = Coil.OutletAirHumRat; @@ -735,7 +736,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) CycRatio = 1.0; SpeedNum = 1; - CalcMultiSpeedDXCoilHeating(state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); + CalcMultiSpeedDXCoilHeating(*state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); DXCoilOutletNodeTemp = Coil.OutletAirTemp; DXCoilOutletNodeHumRat = Coil.OutletAirHumRat; @@ -746,7 +747,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedDefrostCOP) CycRatio = 1.0; SpeedNum = 2; - CalcMultiSpeedDXCoilHeating(state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); + CalcMultiSpeedDXCoilHeating(*state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, 0); DXCoilOutletNodeTemp2 = Coil.OutletAirTemp; DXCoilOutletNodeHumRat2 = Coil.OutletAirHumRat; @@ -799,7 +800,7 @@ TEST_F(EnergyPlusFixture, TestSingleSpeedDefrostCOP) Coil.RatedEIR(1) = 1 / Coil.RatedCOP(1); Coil.RatedAirVolFlowRate(1) = 0.43873066751851; Coil.RatedAirMassFlowRate(1) = - Coil.RatedAirVolFlowRate(1) * PsyRhoAirFnPbTdbW(state, EnergyPlus::DataEnvironment::StdBaroPress, 21.11, 0.00881, "InitDXCoil"); + Coil.RatedAirVolFlowRate(1) * PsyRhoAirFnPbTdbW(*state, EnergyPlus::DataEnvironment::StdBaroPress, 21.11, 0.00881, "InitDXCoil"); Coil.FanPowerPerEvapAirFlowRate(1) = 773.3; Coil.MinOATCompressor = -73.27777777777779; Coil.CrankcaseHeaterCapacity = 0.0; @@ -813,13 +814,13 @@ TEST_F(EnergyPlusFixture, TestSingleSpeedDefrostCOP) Coil.FuelTypeNum = DataGlobalConstants::ResourceType::Electricity; Coil.RegionNum = 4; - state.dataCurveManager->NumCurves = 5; - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->NumCurves = 5; + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); PerformanceCurveData *pCurve; int const nCapfT2 = 1; - pCurve = &state.dataCurveManager->PerfCurve(nCapfT2); + pCurve = &state->dataCurveManager->PerfCurve(nCapfT2); pCurve->CurveType = CurveTypeEnum::BiQuadratic; pCurve->Name = "HP_Heat-Cap-fT2"; pCurve->Coeff1 = 0.95624428; @@ -836,7 +837,7 @@ TEST_F(EnergyPlusFixture, TestSingleSpeedDefrostCOP) Coil.CCapFTemp(1) = nCapfT2; int const nCapfFF2 = 2; - pCurve = &state.dataCurveManager->PerfCurve(nCapfFF2); + pCurve = &state->dataCurveManager->PerfCurve(nCapfFF2); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->Name = "HP_Heat-Cap-fFF2"; pCurve->Coeff1 = 1; @@ -850,7 +851,7 @@ TEST_F(EnergyPlusFixture, TestSingleSpeedDefrostCOP) Coil.CCapFFlow(1) = nCapfFF2; int const nEIRfT2 = 3; - pCurve = &state.dataCurveManager->PerfCurve(nEIRfT2); + pCurve = &state->dataCurveManager->PerfCurve(nEIRfT2); pCurve->CurveType = CurveTypeEnum::BiQuadratic; pCurve->Name = "HP_Heat-EIR-fT2"; pCurve->Coeff1 = 1.065476178; @@ -867,7 +868,7 @@ TEST_F(EnergyPlusFixture, TestSingleSpeedDefrostCOP) Coil.EIRFTemp(1) = nEIRfT2; int const nEIRfFF2 = 4; - pCurve = &state.dataCurveManager->PerfCurve(nEIRfFF2); + pCurve = &state->dataCurveManager->PerfCurve(nEIRfFF2); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->Name = "HP_Heat-EIR-fFF2"; pCurve->Coeff1 = 1; @@ -881,7 +882,7 @@ TEST_F(EnergyPlusFixture, TestSingleSpeedDefrostCOP) Coil.EIRFFlow(1) = nEIRfFF2; int const nPLFfPLR2 = 5; - pCurve = &state.dataCurveManager->PerfCurve(nPLFfPLR2); + pCurve = &state->dataCurveManager->PerfCurve(nPLFfPLR2); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->Name = "HP_Heat-PLF-fPLR2"; pCurve->Coeff1 = 1; @@ -894,8 +895,8 @@ TEST_F(EnergyPlusFixture, TestSingleSpeedDefrostCOP) Coil.PLFFPLR(1) = nPLFfPLR2; - for (int CurveNum = 1; CurveNum <= state.dataCurveManager->NumCurves; ++CurveNum) { - PerformanceCurveData &rCurve = state.dataCurveManager->PerfCurve(CurveNum); + for (int CurveNum = 1; CurveNum <= state->dataCurveManager->NumCurves; ++CurveNum) { + PerformanceCurveData &rCurve = state->dataCurveManager->PerfCurve(CurveNum); if (rCurve.CurveType == CurveTypeEnum::BiQuadratic) { rCurve.ObjectType = "Curve:Biquadratic"; rCurve.InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; @@ -918,15 +919,15 @@ TEST_F(EnergyPlusFixture, TestSingleSpeedDefrostCOP) // Defrost Off OutDryBulbTemp = -5.0; // cold - CalcDXHeatingCoil(state, DXCoilNum, PLR, FanOpMode); - Real64 COPwoDefrost = Coil.RatedCOP(1) / (CurveValue(state, nEIRfT2, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(state, nEIRfFF2, 1)); + CalcDXHeatingCoil(*state, DXCoilNum, PLR, FanOpMode); + Real64 COPwoDefrost = Coil.RatedCOP(1) / (CurveValue(*state, nEIRfT2, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(*state, nEIRfFF2, 1)); Real64 COPwDefrost = Coil.TotalHeatingEnergyRate / Coil.ElecHeatingPower; EXPECT_LT(COPwDefrost, COPwoDefrost); // Defrost On OutDryBulbTemp = 5.0; // not as cold - CalcDXHeatingCoil(state, DXCoilNum, PLR, FanOpMode); - COPwoDefrost = Coil.RatedCOP(1) / (CurveValue(state, nEIRfT2, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(state, nEIRfFF2, 1)); + CalcDXHeatingCoil(*state, DXCoilNum, PLR, FanOpMode); + COPwoDefrost = Coil.RatedCOP(1) / (CurveValue(*state, nEIRfT2, Coil.InletAirTemp, OutDryBulbTemp) * CurveValue(*state, nEIRfFF2, 1)); COPwDefrost = Coil.TotalHeatingEnergyRate / Coil.ElecHeatingPower; EXPECT_DOUBLE_EQ(COPwoDefrost, COPwDefrost); } @@ -947,21 +948,21 @@ TEST_F(EnergyPlusFixture, TestCalcCBF) Real64 CBF_calculated; AirPressure = StdPressureSeaLevel; - InletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, InletDBTemp, InletWBTemp, AirPressure); - CBF_calculated = CalcCBF(state, CoilType, CoilName, InletDBTemp, InletAirHumRat, TotalCap, AirVolFlowRate, SHR, true); + InletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb(*state, InletDBTemp, InletWBTemp, AirPressure); + CBF_calculated = CalcCBF(*state, CoilType, CoilName, InletDBTemp, InletAirHumRat, TotalCap, AirVolFlowRate, SHR, true); CBF_expected = 0.17268167698750708; EXPECT_DOUBLE_EQ(CBF_calculated, CBF_expected); // push inlet condition towards saturation curve to test CBF calculation robustness InletWBTemp = 19.7; // 19.72 DB / 19.7 WB - InletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, InletDBTemp, InletWBTemp, AirPressure); - CBF_calculated = CalcCBF(state, CoilType, CoilName, InletDBTemp, InletAirHumRat, TotalCap, AirVolFlowRate, SHR, true); + InletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb(*state, InletDBTemp, InletWBTemp, AirPressure); + CBF_calculated = CalcCBF(*state, CoilType, CoilName, InletDBTemp, InletAirHumRat, TotalCap, AirVolFlowRate, SHR, true); EXPECT_NEAR(CBF_calculated, 0.00020826, 0.0000001); InletDBTemp = 13.1; // colder and much less likely inlet air temperature InletWBTemp = 13.08; // 13.1 DB / 13.08 WB - hard to find ADP (needed mod to CalcCBF function) - InletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, InletDBTemp, InletWBTemp, AirPressure); - CBF_calculated = CalcCBF(state, CoilType, CoilName, InletDBTemp, InletAirHumRat, TotalCap, AirVolFlowRate, SHR, true); + InletAirHumRat = Psychrometrics::PsyWFnTdbTwbPb(*state, InletDBTemp, InletWBTemp, AirPressure); + CBF_calculated = CalcCBF(*state, CoilType, CoilName, InletDBTemp, InletAirHumRat, TotalCap, AirVolFlowRate, SHR, true); EXPECT_NEAR(CBF_calculated, 0.0001572, 0.0000001); } @@ -1063,16 +1064,16 @@ TEST_F(EnergyPlusFixture, DXCoilEvapCondPumpSizingTest) ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); - GetCurveInput(state); - GetDXCoils(state); + ProcessScheduleInput(*state); + GetCurveInput(*state); + GetDXCoils(*state); ASSERT_EQ(1, NumDXCoils); EXPECT_EQ(DataSizing::AutoSize, DXCoil(1).EvapCondPumpElecNomPower(1)); - SetPredefinedTables(state); + SetPredefinedTables(*state); - SizeDXCoil(state, 1); + SizeDXCoil(*state, 1); EXPECT_EQ(25000.0, DXCoil(1).RatedTotCap(1)); EXPECT_EQ(DXCoil(1).RatedTotCap(1) * 0.004266, DXCoil(1).EvapCondPumpElecNomPower(1)); // Minimum Outdoor Temperature for Compressor Operation defaults to -25.0 C @@ -1112,14 +1113,14 @@ TEST_F(EnergyPlusFixture, TestDXCoilIndoorOrOutdoor) // Run DXCoilNum = 1; DXCoil(DXCoilNum).AirInNode = 1; // "Outside Air Inlet Node 1" - DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(state, DXCoil(DXCoilNum).AirInNode); + DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(*state, DXCoil(DXCoilNum).AirInNode); DXCoilNum = 2; DXCoil(DXCoilNum).AirInNode = 2; // "Outside Air Inlet Node 2" - DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(state, DXCoil(DXCoilNum).AirInNode); + DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(*state, DXCoil(DXCoilNum).AirInNode); DXCoilNum = 3; // "Inside Air Inlet Node" - DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(state, DXCoil(DXCoilNum).AirInNode); + DXCoil(DXCoilNum).IsDXCoilInZone = !CheckOutAirNodeNumber(*state, DXCoil(DXCoilNum).AirInNode); // Check EXPECT_FALSE(DXCoil(1).IsDXCoilInZone); @@ -1301,7 +1302,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedWasteHeat) ASSERT_TRUE(process_idf(idf_objects)); // Case 1 test - GetDXCoils(state); + GetDXCoils(*state); EXPECT_EQ("Electricity", DXCoil(1).FuelType); // it also covers a test for fuel type input EXPECT_EQ(DataGlobalConstants::ResourceType::Electricity, DXCoil(1).FuelTypeNum); @@ -1317,7 +1318,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedWasteHeat) OutDryBulbTemp = 35; OutHumRat = 0.0128; OutBaroPress = 101325; - OutWetBulbTemp = PsyTwbFnTdbWPb(state, OutDryBulbTemp, OutHumRat, OutBaroPress); + OutWetBulbTemp = PsyTwbFnTdbWPb(*state, OutDryBulbTemp, OutHumRat, OutBaroPress); DXCoil(1).MSRatedAirMassFlowRate(1) = DXCoil(1).MSRatedAirVolFlowRate(1) * 1.2; DXCoil(1).MSRatedAirMassFlowRate(2) = DXCoil(1).MSRatedAirVolFlowRate(2) * 1.2; @@ -1334,7 +1335,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedWasteHeat) DXCoil(1).MSRatedCBF(1) = 0.1262; DXCoil(1).MSRatedCBF(2) = 0.0408; - CalcMultiSpeedDXCoilCooling(state, 1, 1, 1, 2, 1, 1, 0); + CalcMultiSpeedDXCoilCooling(*state, 1, 1, 1, 2, 1, 1, 0); EXPECT_EQ(0, MSHPWasteHeat); // Case 3 heat recovery is true and no waste heat function cuvre @@ -1342,7 +1343,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedWasteHeat) DXCoil(1).MSWasteHeat(2) = 0; DXCoil(1).MSHPHeatRecActive = true; - CalcMultiSpeedDXCoilCooling(state, 1, 1, 1, 2, 1, 1, 0); + CalcMultiSpeedDXCoilCooling(*state, 1, 1, 1, 2, 1, 1, 0); EXPECT_NEAR(1302.748, MSHPWasteHeat, 0.001); } @@ -1447,10 +1448,10 @@ TEST_F(EnergyPlusFixture, DXCoil_ValidateADPFunction) ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); - GetCurveInput(state); - GetDXCoils(state); - SetPredefinedTables(state); + ProcessScheduleInput(*state); + GetCurveInput(*state); + GetDXCoils(*state); + SetPredefinedTables(*state); CurZoneEqNum = 1; // Need this to prevent crash in Sizers @@ -1470,13 +1471,13 @@ TEST_F(EnergyPlusFixture, DXCoil_ValidateADPFunction) ZoneSizingRunDone = true; StdBaroPress = 101325.0; - SizeDXCoil(state, 1); // normal sizing + SizeDXCoil(*state, 1); // normal sizing Real64 const RatedInletAirTemp(26.6667); // 26.6667C or 80F Real64 const RatedInletAirHumRat(0.01125); // Humidity ratio corresponding to 80F dry bulb/67F wet bulb std::string const CallingRoutine("DXCoil_ValidateADPFunction"); - Real64 CBF_calculated = CalcCBF(state, DXCoil(1).DXCoilType, + Real64 CBF_calculated = CalcCBF(*state, DXCoil(1).DXCoilType, DXCoil(1).Name, RatedInletAirTemp, RatedInletAirHumRat, @@ -1491,8 +1492,8 @@ TEST_F(EnergyPlusFixture, DXCoil_ValidateADPFunction) DXCoil(1).RatedTotCap(1) = 35000.0; // simulate outlet condition right at the saturation curve DXCoil(1).RatedSHR(1) = AutoSize; - SizeDXCoil(state, 1); - CBF_calculated = CalcCBF(state, DXCoil(1).DXCoilType, + SizeDXCoil(*state, 1); + CBF_calculated = CalcCBF(*state, DXCoil(1).DXCoilType, DXCoil(1).Name, RatedInletAirTemp, RatedInletAirHumRat, @@ -1507,8 +1508,8 @@ TEST_F(EnergyPlusFixture, DXCoil_ValidateADPFunction) DXCoil(1).RatedTotCap(1) = 40000.0; // reverse perturb SHR (i.e., decrease SHR), CalcCBF would have failed with RH >= 1.0 DXCoil(1).RatedSHR(1) = AutoSize; - SizeDXCoil(state, 1); - CBF_calculated = CalcCBF(state, DXCoil(1).DXCoilType, + SizeDXCoil(*state, 1); + CBF_calculated = CalcCBF(*state, DXCoil(1).DXCoilType, DXCoil(1).Name, RatedInletAirTemp, RatedInletAirHumRat, @@ -1692,21 +1693,21 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCrankcaseOutput) ASSERT_TRUE(process_idf(idf_objects)); // Case 1 test - GetDXCoils(state); + GetDXCoils(*state); - state.dataAirLoop->AirLoopInputsFilled = true; + state->dataAirLoop->AirLoopInputsFilled = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; - InitDXCoil(state, 1); + InitDXCoil(*state, 1); EXPECT_FALSE(DXCoil(1).ReportCoolingCoilCrankcasePower); // These two output variables are listed in rdd for Coil:Cooling:DX:MultiSpeed used for AC only EXPECT_EQ("Cooling Coil Crankcase Heater Electricity Rate", OutputProcessor::DDVariableTypes(10).VarNameOnly); EXPECT_EQ("Cooling Coil Crankcase Heater Electricity Energy", OutputProcessor::DDVariableTypes(11).VarNameOnly); - state.dataGlobal->SysSizingCalc = false; - state.dataAirLoop->AirLoopInputsFilled = false; + state->dataGlobal->SysSizingCalc = false; + state->dataAirLoop->AirLoopInputsFilled = false; } TEST_F(EnergyPlusFixture, BlankDefrostEIRCurveInput) @@ -1777,9 +1778,9 @@ TEST_F(EnergyPlusFixture, BlankDefrostEIRCurveInput) ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); - GetCurveInput(state); - GetDXCoils(state); + ProcessScheduleInput(*state); + GetCurveInput(*state); + GetDXCoils(*state); ASSERT_EQ(1, NumDXCoils); ASSERT_EQ(DXCoil(1).DefrostStrategy, ReverseCycle); @@ -1844,14 +1845,14 @@ TEST_F(EnergyPlusFixture, CurveOutputLimitWarning) ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); - GetCurveInput(state); - GetDXCoils(state); + ProcessScheduleInput(*state); + GetCurveInput(*state); + GetDXCoils(*state); // TODO: FIXME: Should this still have cerr output? // EXPECT_TRUE( has_cerr_output() ); // capacity as a function of temperature inputs will give output above 1.0 +- 10% and trip warning message - Real64 CurveVal = CurveValue(state, DXCoil(1).CCapFTemp(1), RatedInletWetBulbTemp, RatedOutdoorAirTemp); + Real64 CurveVal = CurveValue(*state, DXCoil(1).CCapFTemp(1), RatedInletWetBulbTemp, RatedOutdoorAirTemp); ASSERT_EQ(CurveVal, 1.1001); // anything over 1.1 will trip warning message for capacity as a function of temperature } @@ -1949,8 +1950,8 @@ TEST_F(EnergyPlusFixture, CoilHeatingDXSingleSpeed_MinOADBTempCompOperLimit) ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); - GetDXCoils(state); + ProcessScheduleInput(*state); + GetDXCoils(*state); ASSERT_EQ("HEATING COIL SINGLESPEED", DXCoil(1).Name); // Heating Coil Single Speed ASSERT_EQ(-30.0, DXCoil(1).MinOATCompressor); // removed the minimum limit of -20.0C @@ -2058,8 +2059,8 @@ TEST_F(EnergyPlusFixture, CoilCoolingDXTwoSpeed_MinOADBTempCompOperLimit) ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); - GetDXCoils(state); + ProcessScheduleInput(*state); + GetDXCoils(*state); ASSERT_EQ("MAIN COOLING COIL 1", DXCoil(1).Name); // Cooling Coil Two Speed ASSERT_EQ(-25.0, DXCoil(1).MinOATCompressor); // use default value at -25C @@ -2179,8 +2180,8 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_TwoSpeed) ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(state); - DXCoils::GetDXCoils(state); + ScheduleManager::ProcessScheduleInput(*state); + DXCoils::GetDXCoils(*state); EXPECT_EQ(1, DXCoils::NumDXCoils); DataSizing::CurZoneEqNum = 0; @@ -2194,10 +2195,10 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_TwoSpeed) DataSizing::FinalSysSizing(CurSysNum).DesCoolVolFlow = 1.00; DataSizing::FinalSysSizing(CurSysNum).DesOutAirVolFlow = 0.2; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; DataSizing::SysSizingRunDone = true; DataSizing::SysSizInput.allocate(1); @@ -2220,10 +2221,10 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_TwoSpeed) // OutputReportTabular::displayEioSummary = true; // Setting predefined tables is needed though - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // SizeDXCoil is the one doing the sizing AND the reporting - DXCoils::SizeDXCoil(state, 1); + DXCoils::SizeDXCoil(*state, 1); // Ensure we have a RatedTotCap size to begin with Real64 ratedTotCap = DXCoils::DXCoil(1).RatedTotCap(1); EXPECT_GT(ratedTotCap, 0.0); @@ -2404,8 +2405,8 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_SingleSpeed) ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(state); - DXCoils::GetDXCoils(state); + ScheduleManager::ProcessScheduleInput(*state); + DXCoils::GetDXCoils(*state); EXPECT_EQ(1, DXCoils::NumDXCoils); // All of this is to basically manage to get RatedTotCap to be autosized @@ -2420,10 +2421,10 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_SingleSpeed) DataSizing::FinalSysSizing(CurSysNum).DesCoolVolFlow = 1.00; DataSizing::FinalSysSizing(CurSysNum).DesOutAirVolFlow = 0.2; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; DataSizing::SysSizingRunDone = true; DataSizing::SysSizInput.allocate(1); @@ -2445,10 +2446,10 @@ TEST_F(SQLiteFixture, DXCoils_TestComponentSizingOutput_SingleSpeed) // OutputReportTabular::displayEioSummary = true; // Setting predefined tables is needed though - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // SizeDXCoil is the one doing the sizing AND the reporting - DXCoils::SizeDXCoil(state, 1); + DXCoils::SizeDXCoil(*state, 1); // Ensure we have a RatedTotCap size to begin with Real64 ratedTotCap = DXCoils::DXCoil(1).RatedTotCap(1); EXPECT_GT(ratedTotCap, 0.0); @@ -2889,12 +2890,12 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedHeatingCoilSizingOutput) ASSERT_TRUE(process_idf(idf_objects)); // get input - GetDXCoils(state); - SetPredefinedTables(state); + GetDXCoils(*state); + SetPredefinedTables(*state); // check multi-speed DX cooling coil EXPECT_EQ("ASHP CLG COIL", DXCoil(1).Name); EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", DXCoil(1).DXCoilType); - SizeDXCoil(state, 1); + SizeDXCoil(*state, 1); EXPECT_EQ(14067.4113682534, DXCoil(1).MSRatedTotCap(2)); EXPECT_EQ(10128.5361851424, DXCoil(1).MSRatedTotCap(1)); EXPECT_EQ(0.649588460819866, DXCoil(1).MSRatedAirVolFlowRate(2)); @@ -2903,7 +2904,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedHeatingCoilSizingOutput) // check multi-speed DX heating coil EXPECT_EQ("ASHP HTG COIL", DXCoil(2).Name); EXPECT_EQ("Coil:Heating:DX:MultiSpeed", DXCoil(2).DXCoilType); - SizeDXCoil(state, 2); + SizeDXCoil(*state, 2); EXPECT_EQ(14067.4113682534, DXCoil(2).MSRatedTotCap(2)); EXPECT_EQ(10128.5361851424, DXCoil(2).MSRatedTotCap(1)); EXPECT_EQ(0.664879557979531, DXCoil(2).MSRatedAirVolFlowRate(2)); @@ -3104,9 +3105,9 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilTabularReporting) ASSERT_TRUE(process_idf(idf_objects)); // get input - GetDXCoils(state); + GetDXCoils(*state); // Setup the predefined tables - EnergyPlus::OutputReportPredefined::SetPredefinedTables(state); + EnergyPlus::OutputReportPredefined::SetPredefinedTables(*state); // check multi-speed DX cooling coil EXPECT_EQ("ASHP CLG COIL", DXCoil(1).Name); EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", DXCoil(1).DXCoilType); @@ -3116,7 +3117,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilTabularReporting) UnitarySysEqSizing(CurSysNum).CoolingCapacity = false; UnitarySysEqSizing(CurSysNum).HeatingCapacity = false; // coil sizing - SizeDXCoil(state, 1); + SizeDXCoil(*state, 1); EXPECT_EQ(14067.4113682534, DXCoil(1).MSRatedTotCap(2)); EXPECT_EQ(10128.5361851424, DXCoil(1).MSRatedTotCap(1)); EXPECT_EQ(0.649588460819866, DXCoil(1).MSRatedAirVolFlowRate(2)); @@ -3508,8 +3509,8 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput) ASSERT_TRUE(process_idf(idf_objects)); // get input - GetDXCoils(state); - SetPredefinedTables(state); + GetDXCoils(*state); + SetPredefinedTables(*state); // check multi-speed DX cooling coil EXPECT_EQ("ASHP CLG COIL", DXCoil(1).Name); EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", DXCoil(1).DXCoilType); @@ -3531,10 +3532,10 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput) DataSizing::FinalSysSizing(CurSysNum).MixHumRatAtCoolPeak = 0.0095218208835786931; DataSizing::FinalSysSizing(CurSysNum).OutTempAtCoolPeak = 28.244709704058657; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; DataSizing::SysSizInput.allocate(1); DataSizing::SysSizInput(1).AirLoopNum = CurSysNum; @@ -3542,7 +3543,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput) // Need this to prevent crash in Sizers DataSizing::UnitarySysEqSizing.allocate(1); - SizeDXCoil(state, 1); + SizeDXCoil(*state, 1); // Design flow rate at speed 2 and speed 1 EXPECT_EQ(1.75, DXCoil(1).MSRatedAirVolFlowRate(2)); EXPECT_EQ(0.875, DXCoil(1).MSRatedAirVolFlowRate(2) * 0.5); @@ -3556,7 +3557,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoilsAutoSizingOutput) EXPECT_EQ("Coil:Heating:DX:MultiSpeed", DXCoil(2).DXCoilType); // set companion dx cooling coil DXCoil(2).CompanionUpstreamDXCoil = 1; - SizeDXCoil(state, 2); + SizeDXCoil(*state, 2); EXPECT_EQ(1.75, DXCoil(2).MSRatedAirVolFlowRate(2)); EXPECT_EQ(0.875, DXCoil(2).MSRatedAirVolFlowRate(2) * 0.5); EXPECT_EQ(0.875, DXCoil(2).MSRatedAirVolFlowRate(1)); @@ -3760,8 +3761,8 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilPartialAutoSizeOutput) ASSERT_TRUE(process_idf(idf_objects)); // get input - GetDXCoils(state); - SetPredefinedTables(state); + GetDXCoils(*state); + SetPredefinedTables(*state); // check multi-speed DX cooling coil EXPECT_EQ("ASHP CLG COIL", DXCoil(1).Name); EXPECT_EQ("Coil:Cooling:DX:MultiSpeed", DXCoil(1).DXCoilType); @@ -3783,10 +3784,10 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilPartialAutoSizeOutput) DataSizing::FinalSysSizing(CurSysNum).MixHumRatAtCoolPeak = 0.0095218208835786931; DataSizing::FinalSysSizing(CurSysNum).OutTempAtCoolPeak = 28.244709704058657; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).SupFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).RetFanNum = 0; DataSizing::SysSizInput.allocate(1); DataSizing::SysSizInput(1).AirLoopNum = CurSysNum; @@ -3795,7 +3796,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilPartialAutoSizeOutput) DataSizing::UnitarySysEqSizing.allocate(1); // test SHR design size when all autosized - SizeDXCoil(state, 1); + SizeDXCoil(*state, 1); // Design flow rate at speed 2 and speed 1 EXPECT_EQ(1.75, DXCoil(1).MSRatedAirVolFlowRate(2)); EXPECT_EQ(0.875, DXCoil(1).MSRatedAirVolFlowRate(2) * 0.5); @@ -3812,7 +3813,7 @@ TEST_F(EnergyPlusFixture, TestMultiSpeedCoolingCoilPartialAutoSizeOutput) DXCoil(1).MSRatedTotCap(1) = 17500.0; // DataSizing::AutoSize; DXCoil(1).MSRatedTotCap(2) = 35000.0; // DataSizing::AutoSize; - SizeDXCoil(state, 1); + SizeDXCoil(*state, 1); // Design size SHR at speed 2 and speed 1 EXPECT_NEAR(0.80099, DXCoil(1).MSRatedSHR(2), 0.00001); EXPECT_NEAR(0.80099, DXCoil(1).MSRatedSHR(1), 0.00001); @@ -3843,72 +3844,72 @@ TEST_F(EnergyPlusFixture, DXCoils_GetDXCoilCapFTCurveIndexTest) DXCoil(DXCoilNum).MSCCapFTemp.allocate(DXCoil(DXCoilNum).NumOfSpeeds); } - state.dataCurveManager->NumCurves = 4; - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->NumCurves = 4; + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); CurveNum = 1; - state.dataCurveManager->PerfCurve(CurveNum).Name = "HP_Cool-Cap-fT-SP1"; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1.658788451; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = -0.0834530076; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.00342409032; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0024332436; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = -4.5036e-005; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = -0.00053367984; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 13.88; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 23.88; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 18.33; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 51.66; + state->dataCurveManager->PerfCurve(CurveNum).Name = "HP_Cool-Cap-fT-SP1"; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1.658788451; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = -0.0834530076; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.00342409032; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0024332436; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = -4.5036e-005; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = -0.00053367984; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 13.88; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 23.88; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 18.33; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 51.66; CurveNum = 2; - state.dataCurveManager->PerfCurve(CurveNum).Name = "HP_Cool-Cap-fT-SP2"; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1.472738138; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = -0.0672218352; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0029199042; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 5.16005999999982e-005; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = -2.97756e-005; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = -0.00035908596; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 13.88; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 23.88; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 18.33; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 51.66; + state->dataCurveManager->PerfCurve(CurveNum).Name = "HP_Cool-Cap-fT-SP2"; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1.472738138; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = -0.0672218352; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0029199042; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 5.16005999999982e-005; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = -2.97756e-005; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = -0.00035908596; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 13.88; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 23.88; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 18.33; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 51.66; CurveNum = 3; - state.dataCurveManager->PerfCurve(CurveNum).Name = "HP_Heat-Cap-fT-SP1"; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.84077409; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = -0.0014336586; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = -0.000150336; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.029628603; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.000161676; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = -2.349e-005; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = -100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = -100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 100.0; + state->dataCurveManager->PerfCurve(CurveNum).Name = "HP_Heat-Cap-fT-SP1"; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.84077409; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = -0.0014336586; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = -0.000150336; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.029628603; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.000161676; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = -2.349e-005; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = -100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = -100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 100.0; CurveNum = 4; - state.dataCurveManager->PerfCurve(CurveNum).Name = "HP_Heat-Cap-fT-SP2"; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.831506971; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0018392166; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = -0.000187596; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0266002056; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.000191484; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = -6.5772e-005; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = -100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = -100.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 100.0; + state->dataCurveManager->PerfCurve(CurveNum).Name = "HP_Heat-Cap-fT-SP2"; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.831506971; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.0018392166; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = -0.000187596; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0266002056; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.000191484; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = -6.5772e-005; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = -100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = -100.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 100.0; DXCoil(1).MSCCapFTemp(1) = 1; DXCoil(1).MSCCapFTemp(2) = 2; @@ -3925,11 +3926,11 @@ TEST_F(EnergyPlusFixture, DXCoils_GetDXCoilCapFTCurveIndexTest) // dx cooling coil int CoilIndex = 1; EXPECT_EQ(DXCoil(CoilIndex).DXCoilType, "Coil:Cooling:DX:MultiSpeed"); - DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(state, CoilIndex, ErrorsFound); + DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(*state, CoilIndex, ErrorsFound); EXPECT_EQ(2, DataTotCapCurveIndex); // evaluate dx cooling coil curves to show impacts of incorrect curve index - Real64 TotCapTempModFac_lowestSpeed = CurveValue(state, 1, 19.4, 30.0); - Real64 TotCapTempModFac_designSpeed = CurveValue(state, DataTotCapCurveIndex, 19.4, 30.0); + Real64 TotCapTempModFac_lowestSpeed = CurveValue(*state, 1, 19.4, 30.0); + Real64 TotCapTempModFac_designSpeed = CurveValue(*state, DataTotCapCurveIndex, 19.4, 30.0); EXPECT_DOUBLE_EQ(1.0503539775151995, TotCapTempModFac_lowestSpeed); EXPECT_DOUBLE_EQ(1.0333316291120003, TotCapTempModFac_designSpeed); // apply dx cooling coil capacity curve correction @@ -3942,11 +3943,11 @@ TEST_F(EnergyPlusFixture, DXCoils_GetDXCoilCapFTCurveIndexTest) // dx heating coil CoilIndex = 2; EXPECT_EQ(DXCoil(CoilIndex).DXCoilType, "Coil:Heating:DX:MultiSpeed"); - DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(state, CoilIndex, ErrorsFound); + DataTotCapCurveIndex = DXCoils::GetDXCoilCapFTCurveIndex(*state, CoilIndex, ErrorsFound); EXPECT_EQ(4, DataTotCapCurveIndex); // evaluate dx heating coil curves to show impacts of incorrect curve index - TotCapTempModFac_lowestSpeed = CurveValue(state, 3, 5.0, 10.0); - TotCapTempModFac_designSpeed = CurveValue(state, DataTotCapCurveIndex, 5.0, 10.0); + TotCapTempModFac_lowestSpeed = CurveValue(*state, 3, 5.0, 10.0); + TotCapTempModFac_designSpeed = CurveValue(*state, DataTotCapCurveIndex, 5.0, 10.0); EXPECT_DOUBLE_EQ(1.1411265269999999, TotCapTempModFac_lowestSpeed); EXPECT_DOUBLE_EQ(1.1178750099999999, TotCapTempModFac_designSpeed); // apply dx heating coil capacity curve correction @@ -3961,7 +3962,7 @@ TEST_F(EnergyPlusFixture, DXCoils_RatedInletAirWTest) Real64 Tdb = 26.6667; Real64 Twet = 19.4444; - Real64 RatedW = Psychrometrics::PsyWFnTdbTwbPb(state, Tdb, Twet, 101325.0); + Real64 RatedW = Psychrometrics::PsyWFnTdbTwbPb(*state, Tdb, Twet, 101325.0); EXPECT_NEAR(RatedInletAirHumRat, RatedW, 0.000001); } @@ -3969,7 +3970,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedDXCoolingCoilOutputTest) { int DXCoilNum(1); DXCoils::NumDXCoils = 1; - state.dataCurveManager->NumCurves = 2; + state->dataCurveManager->NumCurves = 2; DXCoil.allocate(DXCoils::NumDXCoils); DataLoopNode::Node.allocate(2); DXCoilNumericFields.allocate(DXCoils::NumDXCoils); @@ -3982,10 +3983,10 @@ TEST_F(EnergyPlusFixture, SingleSpeedDXCoolingCoilOutputTest) DXCoilFullLoadOutAirHumRat.allocate(DXCoils::NumDXCoils); DXCoilPartLoadRatio.allocate(DXCoils::NumDXCoils); DXCoilFanOpMode.allocate(DXCoils::NumDXCoils); - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); auto &Coil = DXCoils::DXCoil(DXCoilNum); - auto &constantcurve1 = state.dataCurveManager->PerfCurve(1); - auto &constantcurve2 = state.dataCurveManager->PerfCurve(2); + auto &constantcurve1 = state->dataCurveManager->PerfCurve(1); + auto &constantcurve2 = state->dataCurveManager->PerfCurve(2); auto &AirInletNode = DataLoopNode::Node(1); auto &AirOutletNode = DataLoopNode::Node(2); // set coil parameters @@ -4056,7 +4057,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedDXCoolingCoilOutputTest) Real64 AirFlowRatio(1.0); int FanOpMode(2); int CompOp(1); - CalcDoe2DXCoil(state, DXCoilNum, CompOp, true, PartLoadRatio, FanOpMode, _, AirFlowRatio); + CalcDoe2DXCoil(*state, DXCoilNum, CompOp, true, PartLoadRatio, FanOpMode, _, AirFlowRatio); EXPECT_NEAR(17580.0, Coil.TotalCoolingEnergyRate, 0.0001); // equals fully capacity EXPECT_NEAR(17580.0, Coil.SensCoolingEnergyRate, 0.0001); // sensible cooling only EXPECT_NEAR(0.0, Coil.LatCoolingEnergyRate, 1.0E-11); // zero latent cooling rate @@ -4083,7 +4084,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedDXCoolingCoilOutputTest) AirInletNode.HumRat = Coil.InletAirHumRat; AirInletNode.Enthalpy = Coil.InletAirEnthalpy; // run coil at full capacity - CalcDoe2DXCoil(state, DXCoilNum, CompOp, true, PartLoadRatio, FanOpMode, _, AirFlowRatio); + CalcDoe2DXCoil(*state, DXCoilNum, CompOp, true, PartLoadRatio, FanOpMode, _, AirFlowRatio); EXPECT_NEAR(17580.0, Coil.TotalCoolingEnergyRate, 0.0001); // equals fully capacity EXPECT_NEAR(13104.577807007219, Coil.SensCoolingEnergyRate, 0.0001); // sensible cooling rate EXPECT_NEAR(4475.4221929927808, Coil.LatCoolingEnergyRate, 0.0001); // latent cooling rate @@ -4106,7 +4107,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedDXCoolingCoilOutputTest) int DXCoilNum(1); DXCoils::NumDXCoils = 1; - state.dataCurveManager->NumCurves = 2; + state->dataCurveManager->NumCurves = 2; DataHVACGlobals::MSHPMassFlowRateLow = 0.6; DataHVACGlobals::MSHPMassFlowRateHigh = 1.0; DXCoil.allocate(DXCoils::NumDXCoils); @@ -4119,11 +4120,11 @@ TEST_F(EnergyPlusFixture, MultiSpeedDXCoolingCoilOutputTest) DXCoilOutletHumRat.allocate(1); DXCoilPartLoadRatio.allocate(1); DXCoilFanOpMode.allocate(1); - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); auto &Coil = DXCoils::DXCoil(1); - auto &constantcurve1 = state.dataCurveManager->PerfCurve(1); - auto &constantcurve2 = state.dataCurveManager->PerfCurve(2); + auto &constantcurve1 = state->dataCurveManager->PerfCurve(1); + auto &constantcurve2 = state->dataCurveManager->PerfCurve(2); auto &AirInletNode = DataLoopNode::Node(1); auto &AirOutletNode = DataLoopNode::Node(2); @@ -4229,7 +4230,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedDXCoolingCoilOutputTest) // run the coil at low speed Real64 SpeedRatio = 0.0; Real64 CycRatio = 1.0; - CalcMultiSpeedDXCoilCooling(state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, SingleMode); + CalcMultiSpeedDXCoilCooling(*state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, SingleMode); EXPECT_NEAR(10710.0, Coil.TotalCoolingEnergyRate, 0.0001); // equals low speed capacity EXPECT_NEAR(10710.0, Coil.SensCoolingEnergyRate, 0.0001); // sensible cooling rate at low speed EXPECT_NEAR(0.0, Coil.LatCoolingEnergyRate, 1.0E-11); // zero latent cooling rate at low speed @@ -4247,7 +4248,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedDXCoolingCoilOutputTest) EXPECT_NEAR(results_latentoutput, Coil.LatCoolingEnergyRate, 1.0E-11); // run the coil at high speed SpeedRatio = 1.0; - CalcMultiSpeedDXCoilCooling(state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, SingleMode); + CalcMultiSpeedDXCoilCooling(*state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, SingleMode); EXPECT_NEAR(17850.0, Coil.TotalCoolingEnergyRate, 0.0001); // total capacity at high speed EXPECT_NEAR(17850.0, Coil.SensCoolingEnergyRate, 0.0001); // sensible cooling rate at high speed EXPECT_NEAR(0.0, Coil.LatCoolingEnergyRate, 1.0E-11); // zero latent cooling rate at high speed @@ -4275,7 +4276,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedDXCoolingCoilOutputTest) // run coil at low speed SpeedRatio = 0.0; CycRatio = 1.0; - CalcMultiSpeedDXCoilCooling(state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, SingleMode); + CalcMultiSpeedDXCoilCooling(*state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, SingleMode); EXPECT_NEAR(10710.0, Coil.TotalCoolingEnergyRate, 0.0001); // equals low speed cooling capacity EXPECT_NEAR(7930.3412059184047, Coil.SensCoolingEnergyRate, 0.0001); // sensible cooling rate at low speed EXPECT_NEAR(2779.6587940815953, Coil.LatCoolingEnergyRate, 0.0001); // latent cooling rate at low speed @@ -4294,7 +4295,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedDXCoolingCoilOutputTest) // run the coil at high speed SpeedRatio = 1.0; - CalcMultiSpeedDXCoilCooling(state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, SingleMode); + CalcMultiSpeedDXCoilCooling(*state, DXCoilNum, SpeedRatio, CycRatio, SpeedNum, FanOpMode, CompOp, SingleMode); EXPECT_NEAR(17850.0, Coil.TotalCoolingEnergyRate, 0.0001); // total capacity at high speed EXPECT_NEAR(13217.235343197342, Coil.SensCoolingEnergyRate, 0.0001); // sensible cooling rate at high speed EXPECT_NEAR(4632.7646568026576, Coil.LatCoolingEnergyRate, 0.0001); // latent cooling rate at high speed diff --git a/tst/EnergyPlus/unit/DataEnvironment.unit.cc b/tst/EnergyPlus/unit/DataEnvironment.unit.cc index 50ce708a0fc..af5d5d7a3c5 100644 --- a/tst/EnergyPlus/unit/DataEnvironment.unit.cc +++ b/tst/EnergyPlus/unit/DataEnvironment.unit.cc @@ -52,6 +52,7 @@ // EnergyPlus Headers #include +#include #include "Fixtures/EnergyPlusFixture.hh" diff --git a/tst/EnergyPlus/unit/DataGlobalConstants.unit.cc b/tst/EnergyPlus/unit/DataGlobalConstants.unit.cc index a29f26c3076..0e8fd6e962e 100644 --- a/tst/EnergyPlus/unit/DataGlobalConstants.unit.cc +++ b/tst/EnergyPlus/unit/DataGlobalConstants.unit.cc @@ -52,6 +52,7 @@ // EnergyPlus Headers #include +#include #include "Fixtures/EnergyPlusFixture.hh" diff --git a/tst/EnergyPlus/unit/DataHeatBalance.unit.cc b/tst/EnergyPlus/unit/DataHeatBalance.unit.cc index dcad889ebe4..a2e5bd5bd2a 100644 --- a/tst/EnergyPlus/unit/DataHeatBalance.unit.cc +++ b/tst/EnergyPlus/unit/DataHeatBalance.unit.cc @@ -65,6 +65,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -800,92 +801,92 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_CheckConstructLayers) // OutputProcessor::TimeValue.allocate(2); - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules ErrorsFound = false; - GetProjectControlData(state, ErrorsFound); // read project control data + GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); // expect no errors ErrorsFound = false; - GetMaterialData(state, ErrorsFound); // read material data + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors ErrorsFound = false; - GetFrameAndDividerData(state, ErrorsFound); + GetFrameAndDividerData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SetPreConstructionInputParameters(state); + SetPreConstructionInputParameters(*state); ErrorsFound = false; - GetConstructData(state, ErrorsFound); // read construction data + GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); // expect no errors ErrorsFound = false; - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors ErrorsFound = false; - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); ErrorsFound = false; - SurfaceGeometry::SetupZoneGeometry(state, - ErrorsFound); // this calls GetSurfaceData() and SetFlagForWindowConstructionWithShadeOrBlindLayer(state) + SurfaceGeometry::SetupZoneGeometry(*state, + ErrorsFound); // this calls GetSurfaceData() and SetFlagForWindowConstructionWithShadeOrBlindLayer(*state) EXPECT_FALSE(ErrorsFound); - EXPECT_EQ(state.dataConstruction->Construct(4).Name, "WIN-CON-DOUBLEPANE"); // glass, air gap, glass - EXPECT_EQ(state.dataConstruction->Construct(4).TotLayers, 3); // outer glass, air gap, inner glass - EXPECT_EQ(state.dataConstruction->Construct(4).TotGlassLayers, 2); // outer glass, inner glass - EXPECT_EQ(state.dataConstruction->Construct(4).TotSolidLayers, 2); // outer glass, inner glass + EXPECT_EQ(state->dataConstruction->Construct(4).Name, "WIN-CON-DOUBLEPANE"); // glass, air gap, glass + EXPECT_EQ(state->dataConstruction->Construct(4).TotLayers, 3); // outer glass, air gap, inner glass + EXPECT_EQ(state->dataConstruction->Construct(4).TotGlassLayers, 2); // outer glass, inner glass + EXPECT_EQ(state->dataConstruction->Construct(4).TotSolidLayers, 2); // outer glass, inner glass EXPECT_EQ(dataMaterial.Material(4).Name, "SINGLEPANE"); // single pane glass EXPECT_EQ(dataMaterial.Material(5).Name, "WINGAS"); // air gap EXPECT_EQ(dataMaterial.Material(6).Name, "BLIND"); // window blind // construction layer material pointers. this construction has no blind - EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(1), 4); // glass, outer layer - EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(2), 5); // air gap - EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(3), 4); // glass, inner layer + EXPECT_EQ(state->dataConstruction->Construct(4).LayerPoint(1), 4); // glass, outer layer + EXPECT_EQ(state->dataConstruction->Construct(4).LayerPoint(2), 5); // air gap + EXPECT_EQ(state->dataConstruction->Construct(4).LayerPoint(3), 4); // glass, inner layer int windowSurfNum = UtilityRoutines::FindItemInList("ZN001:WALL001:WIN001", DataSurfaces::Surface); EXPECT_FALSE(SurfWinHasShadeOrBlindLayer(windowSurfNum)); // the window construction has no blind // check if the construction has a blind material layer - SetFlagForWindowConstructionWithShadeOrBlindLayer(state); + SetFlagForWindowConstructionWithShadeOrBlindLayer(*state); EXPECT_FALSE(SurfWinHasShadeOrBlindLayer(windowSurfNum)); // the window construction has no blind - GetEMSInput(state); + GetEMSInput(*state); // check if EMS actuator is not setup because there is no blind/shade layer - SetupWindowShadingControlActuators(state); + SetupWindowShadingControlActuators(*state); EXPECT_EQ(numEMSActuatorsAvailable, 0); // no EMS actuator because there is shade/blind layer // add a blind layer in between glass - state.dataConstruction->Construct(4).TotLayers = 5; - state.dataConstruction->Construct(4).TotGlassLayers = 2; - state.dataConstruction->Construct(4).TotSolidLayers = 3; - state.dataConstruction->Construct(4).LayerPoint(1) = 4; // glass - state.dataConstruction->Construct(4).LayerPoint(2) = 5; // air gap - state.dataConstruction->Construct(4).LayerPoint(3) = 6; // window blind - state.dataConstruction->Construct(4).LayerPoint(4) = 5; // air gap - state.dataConstruction->Construct(4).LayerPoint(5) = 4; // glass + state->dataConstruction->Construct(4).TotLayers = 5; + state->dataConstruction->Construct(4).TotGlassLayers = 2; + state->dataConstruction->Construct(4).TotSolidLayers = 3; + state->dataConstruction->Construct(4).LayerPoint(1) = 4; // glass + state->dataConstruction->Construct(4).LayerPoint(2) = 5; // air gap + state->dataConstruction->Construct(4).LayerPoint(3) = 6; // window blind + state->dataConstruction->Construct(4).LayerPoint(4) = 5; // air gap + state->dataConstruction->Construct(4).LayerPoint(5) = 4; // glass // updated contruction and material layers data - EXPECT_EQ(state.dataConstruction->Construct(4).TotLayers, 5); // outer glass, air gap, blind, air gap, inner glass - EXPECT_EQ(state.dataConstruction->Construct(4).TotGlassLayers, 2); // outer glass, inner glass - EXPECT_EQ(state.dataConstruction->Construct(4).TotSolidLayers, 3); // glass, blind, glass + EXPECT_EQ(state->dataConstruction->Construct(4).TotLayers, 5); // outer glass, air gap, blind, air gap, inner glass + EXPECT_EQ(state->dataConstruction->Construct(4).TotGlassLayers, 2); // outer glass, inner glass + EXPECT_EQ(state->dataConstruction->Construct(4).TotSolidLayers, 3); // glass, blind, glass // construction layer material pointers. this construction has blind - EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(1), 4); // glass, outer layer - EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(2), 5); // air gap - EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(3), 6); // blind - EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(4), 5); // air gap - EXPECT_EQ(state.dataConstruction->Construct(4).LayerPoint(5), 4); // glass, inner layer + EXPECT_EQ(state->dataConstruction->Construct(4).LayerPoint(1), 4); // glass, outer layer + EXPECT_EQ(state->dataConstruction->Construct(4).LayerPoint(2), 5); // air gap + EXPECT_EQ(state->dataConstruction->Construct(4).LayerPoint(3), 6); // blind + EXPECT_EQ(state->dataConstruction->Construct(4).LayerPoint(4), 5); // air gap + EXPECT_EQ(state->dataConstruction->Construct(4).LayerPoint(5), 4); // glass, inner layer // check if the construction has a blind material layer - SetFlagForWindowConstructionWithShadeOrBlindLayer(state); + SetFlagForWindowConstructionWithShadeOrBlindLayer(*state); EXPECT_TRUE(SurfWinHasShadeOrBlindLayer(windowSurfNum)); // the window construction has blind // set the blind to movable SurfWinMovableSlats(windowSurfNum) = true; // check if EMS actuator is available when blind layer is added - SetupWindowShadingControlActuators(state); + SetupWindowShadingControlActuators(*state); EXPECT_EQ(numEMSActuatorsAvailable, 2); EXPECT_EQ(EMSActuatorAvailable(1).ComponentTypeName, "Window Shading Control"); EXPECT_EQ(EMSActuatorAvailable(1).ControlTypeName, "Control Status"); @@ -902,26 +903,26 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_setUserTemperatureLocationPerpendicula Real64 expectedReturnValue; Real64 actualReturnValue; - state.dataConstruction->Construct.allocate(1); - auto &thisConstruct(state.dataConstruction->Construct(1)); + state->dataConstruction->Construct.allocate(1); + auto &thisConstruct(state->dataConstruction->Construct(1)); thisConstruct.Name = "RadiantSystem1"; // Test 1: User value is less than zero--should be reset to zero userInputValue = -0.25; expectedReturnValue = 0.0; - actualReturnValue = thisConstruct.setUserTemperatureLocationPerpendicular(state, userInputValue); + actualReturnValue = thisConstruct.setUserTemperatureLocationPerpendicular(*state, userInputValue); EXPECT_EQ(actualReturnValue,expectedReturnValue); // Test 2: User value is greater than unity--should be reset to 1.0 userInputValue = 1.23456; expectedReturnValue = 1.0; - actualReturnValue = thisConstruct.setUserTemperatureLocationPerpendicular(state, userInputValue); + actualReturnValue = thisConstruct.setUserTemperatureLocationPerpendicular(*state, userInputValue); EXPECT_EQ(actualReturnValue,expectedReturnValue); // Test 3: User value is valid (between 0 and 1)--returned value should be equal to user input userInputValue = 0.234567; expectedReturnValue = 0.234567; - actualReturnValue = thisConstruct.setUserTemperatureLocationPerpendicular(state, userInputValue); + actualReturnValue = thisConstruct.setUserTemperatureLocationPerpendicular(*state, userInputValue); EXPECT_EQ(actualReturnValue,expectedReturnValue); } @@ -930,8 +931,8 @@ TEST_F(EnergyPlusFixture, DataHeatBalance_setNodeSourceAndUserTemp) { int expectedNodeNumberAtSource; int expectedNodeNumberAtUserSpecifiedLocation; - state.dataConstruction->Construct.allocate(1); - auto &thisConstruct(state.dataConstruction->Construct(1)); + state->dataConstruction->Construct.allocate(1); + auto &thisConstruct(state->dataConstruction->Construct(1)); thisConstruct.NumOfPerpendNodes = 4; // Data common to all tests diff --git a/tst/EnergyPlus/unit/DataPlant.unit.cc b/tst/EnergyPlus/unit/DataPlant.unit.cc index 321227cce64..5c426058b85 100644 --- a/tst/EnergyPlus/unit/DataPlant.unit.cc +++ b/tst/EnergyPlus/unit/DataPlant.unit.cc @@ -54,6 +54,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" diff --git a/tst/EnergyPlus/unit/DataSizing.unit.cc b/tst/EnergyPlus/unit/DataSizing.unit.cc index 8db6504977d..d2cb39668da 100644 --- a/tst/EnergyPlus/unit/DataSizing.unit.cc +++ b/tst/EnergyPlus/unit/DataSizing.unit.cc @@ -52,6 +52,7 @@ // EnergyPlus Headers #include +#include #include "Fixtures/EnergyPlusFixture.hh" diff --git a/tst/EnergyPlus/unit/DataSurfaces.unit.cc b/tst/EnergyPlus/unit/DataSurfaces.unit.cc index ec7ba01b338..d4df75e77a9 100644 --- a/tst/EnergyPlus/unit/DataSurfaces.unit.cc +++ b/tst/EnergyPlus/unit/DataSurfaces.unit.cc @@ -62,6 +62,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -158,31 +159,31 @@ TEST_F(EnergyPlusFixture, DataSurfaces_SetSurfaceOutBulbTempAtTest) ASSERT_TRUE(process_idf(idf_objects)); ErrorsFound = false; - GetProjectControlData(state, ErrorsFound); // read project control data + GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); // expect no errors ErrorsFound = false; - GetMaterialData(state, ErrorsFound); // read material data + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors ErrorsFound = false; - GetConstructData(state, ErrorsFound); // read construction data + GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); // expect no errors ErrorsFound = false; - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; ErrorsFound = false; - GetSurfaceData(state, ErrorsFound); // setup zone geometry and get zone data + GetSurfaceData(*state, ErrorsFound); // setup zone geometry and get zone data EXPECT_FALSE(ErrorsFound); // expect no errors SetSurfaceOutBulbTempAt(); @@ -257,7 +258,7 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightRectangle) s.CosAzim = std::cos(s.Azimuth * DataGlobalConstants::DegToRadians()); s.SinTilt = std::sin(s.Tilt * DataGlobalConstants::DegToRadians()); - EXPECT_DOUBLE_EQ(s.get_average_height(state), 0.0); + EXPECT_DOUBLE_EQ(s.get_average_height(*state), 0.0); s.Vertex = {Vector(0, 0, 0), Vector(1, 1, 0), Vector(1, 1, 1), Vector(0, 0, 1)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); @@ -266,7 +267,7 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightRectangle) s.CosAzim = std::cos(s.Azimuth * DataGlobalConstants::DegToRadians()); s.SinTilt = std::sin(s.Tilt * DataGlobalConstants::DegToRadians()); - EXPECT_DOUBLE_EQ(s.get_average_height(state), 1.0); + EXPECT_DOUBLE_EQ(s.get_average_height(*state), 1.0); s.Vertex = {Vector(0, 0, 0), Vector(1, 0, 0), Vector(1, 1, 1), Vector(0, 1, 1)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); @@ -275,7 +276,7 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightRectangle) s.CosAzim = std::cos(s.Azimuth * DataGlobalConstants::DegToRadians()); s.SinTilt = std::sin(s.Tilt * DataGlobalConstants::DegToRadians()); - EXPECT_DOUBLE_EQ(s.get_average_height(state), 1.0 / s.SinTilt ); + EXPECT_DOUBLE_EQ(s.get_average_height(*state), 1.0 / s.SinTilt ); s.Vertex = { Vector(0, 0, 0), Vector(0, 1, 0), Vector(0, 1, 1), Vector(0, 0, 1) }; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); @@ -284,7 +285,7 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightRectangle) s.CosAzim = std::cos(s.Azimuth * DataGlobalConstants::DegToRadians()); s.SinTilt = std::sin(s.Tilt * DataGlobalConstants::DegToRadians()); - EXPECT_DOUBLE_EQ(s.get_average_height(state), 1.0); + EXPECT_DOUBLE_EQ(s.get_average_height(*state), 1.0); s.Vertex = { Vector(1, -1, 0), Vector(1, -1, -1), Vector(0, 0, -1), Vector(0, 0, 0) }; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); @@ -293,7 +294,7 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightRectangle) s.CosAzim = std::cos(s.Azimuth * DataGlobalConstants::DegToRadians()); s.SinTilt = std::sin(s.Tilt * DataGlobalConstants::DegToRadians()); - EXPECT_DOUBLE_EQ(s.get_average_height(state), 1.0); + EXPECT_DOUBLE_EQ(s.get_average_height(*state), 1.0); } } @@ -312,7 +313,7 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightTriangle) s.CosAzim = std::cos(s.Azimuth * DataGlobalConstants::DegToRadians()); s.SinTilt = std::sin(s.Tilt * DataGlobalConstants::DegToRadians()); - EXPECT_DOUBLE_EQ(s.get_average_height(state), 0.5); + EXPECT_DOUBLE_EQ(s.get_average_height(*state), 0.5); s.Vertex = {Vector(0, 0, 0), Vector(0, 0, 1), Vector(1, 0, 0)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); @@ -321,7 +322,7 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightTriangle) s.CosAzim = std::cos(s.Azimuth * DataGlobalConstants::DegToRadians()); s.SinTilt = std::sin(s.Tilt * DataGlobalConstants::DegToRadians()); - EXPECT_DOUBLE_EQ(s.get_average_height(state), 0.5); + EXPECT_DOUBLE_EQ(s.get_average_height(*state), 0.5); } } @@ -339,7 +340,7 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightL) s.CosAzim = std::cos(s.Azimuth * DataGlobalConstants::DegToRadians()); s.SinTilt = std::sin(s.Tilt * DataGlobalConstants::DegToRadians()); - EXPECT_DOUBLE_EQ(s.get_average_height(state), 0.75); + EXPECT_DOUBLE_EQ(s.get_average_height(*state), 0.75); s.Vertex = {Vector(0, 0, 0), Vector(0, 0, 1), Vector(1, 0, 1), Vector(1, 0, 0.5), Vector(0.5, 0, 0.5), Vector(0.5, 0, 0)}; Vectors::CreateNewellSurfaceNormalVector(s.Vertex, s.Vertex.size(), s.NewellSurfaceNormalVector); @@ -348,6 +349,6 @@ TEST_F(EnergyPlusFixture, SurfaceTest_AverageHeightL) s.CosAzim = std::cos(s.Azimuth * DataGlobalConstants::DegToRadians()); s.SinTilt = std::sin(s.Tilt * DataGlobalConstants::DegToRadians()); - EXPECT_DOUBLE_EQ(s.get_average_height(state), 0.75); + EXPECT_DOUBLE_EQ(s.get_average_height(*state), 0.75); } } diff --git a/tst/EnergyPlus/unit/DataSystemVariables.unit.cc b/tst/EnergyPlus/unit/DataSystemVariables.unit.cc index 002bd8d5953..26c293f44e1 100644 --- a/tst/EnergyPlus/unit/DataSystemVariables.unit.cc +++ b/tst/EnergyPlus/unit/DataSystemVariables.unit.cc @@ -51,6 +51,7 @@ // EnergyPlus Headers #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -64,7 +65,7 @@ TEST_F(EnergyPlusFixture, File_Not_Found_ERR_Output) bool fileFound = false; std::string fullPath; std::string contextString = "Test File_Not_Found_ERR_Output"; - DataSystemVariables::CheckForActualFileName(this->state, filePath, fileFound, fullPath, contextString); + DataSystemVariables::CheckForActualFileName(*this->state, filePath, fileFound, fullPath, contextString); EXPECT_FALSE(fileFound); EXPECT_TRUE(match_err_stream(expectedError)); } diff --git a/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc b/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc index e5e6e9cc974..3a795e70f9f 100644 --- a/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc +++ b/tst/EnergyPlus/unit/DataZoneEquipment.unit.cc @@ -58,6 +58,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -68,8 +69,8 @@ using namespace ObjexxFCL; TEST_F(EnergyPlusFixture, DataZoneEquipment_TestGetSystemNodeNumberForZone) { - state.dataGlobal->NumOfZones = 2; - ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 2; + ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); ZoneEquipConfig(1).ZoneName = "Zone1"; ZoneEquipConfig(1).ActualZoneNum = 1; @@ -81,8 +82,8 @@ TEST_F(EnergyPlusFixture, DataZoneEquipment_TestGetSystemNodeNumberForZone) ZoneEquipInputsFilled = true; - EXPECT_EQ(0, GetSystemNodeNumberForZone(state, "NonExistingZone")); - EXPECT_EQ(1, GetSystemNodeNumberForZone(state, "Zone1")); + EXPECT_EQ(0, GetSystemNodeNumberForZone(*state, "NonExistingZone")); + EXPECT_EQ(1, GetSystemNodeNumberForZone(*state, "Zone1")); ZoneEquipConfig.deallocate(); } @@ -127,23 +128,23 @@ TEST_F(EnergyPlusFixture, DataZoneEquipment_TestCalcDesignSpecificationOutdoorAi Real64 OAVolumeFlowRate; // Test ZOAM_ProportionalControlSchOcc DataContaminantBalance::ZoneAirCO2(1) = 500.0; - OAVolumeFlowRate = CalcDesignSpecificationOutdoorAir(state, 1, 1, false, false); + OAVolumeFlowRate = CalcDesignSpecificationOutdoorAir(*state, 1, 1, false, false); EXPECT_NEAR(0.031, OAVolumeFlowRate, 0.00001); DataContaminantBalance::ZoneAirCO2(1) = 405.0; - OAVolumeFlowRate = CalcDesignSpecificationOutdoorAir(state, 1, 1, false, false); + OAVolumeFlowRate = CalcDesignSpecificationOutdoorAir(*state, 1, 1, false, false); EXPECT_NEAR(0.0308115, OAVolumeFlowRate, 0.00001); // Test ZOAM_ProportionalControlDesOcc DataContaminantBalance::ZoneAirCO2(1) = 500.0; DataSizing::OARequirements(1).OAFlowMethod = DataSizing::ZOAM_ProportionalControlDesOcc; - OAVolumeFlowRate = CalcDesignSpecificationOutdoorAir(state, 1, 1, false, false); + OAVolumeFlowRate = CalcDesignSpecificationOutdoorAir(*state, 1, 1, false, false); EXPECT_NEAR(0.0315879, OAVolumeFlowRate, 0.00001); // Test ZOAM_IAQP DataSizing::OARequirements(1).OAFlowMethod = DataSizing::ZOAM_IAQP; DataContaminantBalance::ZoneSysContDemand(1).OutputRequiredToCO2SP = 0.2 * DataEnvironment::StdRhoAir; - OAVolumeFlowRate = CalcDesignSpecificationOutdoorAir(state, 1, 1, false, false); + OAVolumeFlowRate = CalcDesignSpecificationOutdoorAir(*state, 1, 1, false, false); EXPECT_NEAR(0.2, OAVolumeFlowRate, 0.00001); // Cleanup diff --git a/tst/EnergyPlus/unit/Datasets.unit.cc b/tst/EnergyPlus/unit/Datasets.unit.cc index c770a490bf9..206ead7dac7 100644 --- a/tst/EnergyPlus/unit/Datasets.unit.cc +++ b/tst/EnergyPlus/unit/Datasets.unit.cc @@ -58,6 +58,7 @@ #include #include #include "Fixtures/EnergyPlusFixture.hh" +#include namespace EnergyPlus { @@ -81,7 +82,7 @@ TEST_F(DataSetFixture, California_Title_24_2008) } TEST_F(DataSetFixture, Chillers) { - state.dataGlobal->preserveIDFOrder = false; + state->dataGlobal->preserveIDFOrder = false; ASSERT_TRUE(process_idf(delimited_string(read_lines_in_file(configured_source_directory() + "/datasets/Chillers.idf")))); } TEST_F(DataSetFixture, CompositeWallConstructions) @@ -112,7 +113,7 @@ TEST_F(DataSetFixture, ExhaustFiredChiller) } TEST_F(DataSetFixture, FluidPropertiesRefData) { - state.dataGlobal->preserveIDFOrder = false; + state->dataGlobal->preserveIDFOrder = false; ASSERT_TRUE(process_idf(delimited_string(read_lines_in_file(configured_source_directory() + "/datasets/FluidPropertiesRefData.idf")))); } TEST_F(DataSetFixture, FossilFuelEnvironmentalImpactFactors) @@ -170,16 +171,16 @@ TEST_F(DataSetFixture, PerfCurves) } TEST_F(DataSetFixture, PrecipitationSchedulesUSA) { - state.dataGlobal->preserveIDFOrder = false; + state->dataGlobal->preserveIDFOrder = false; ASSERT_TRUE(process_idf(delimited_string(read_lines_in_file(configured_source_directory() + "/datasets/PrecipitationSchedulesUSA.idf")))); } TEST_F(DataSetFixture, RefrigerationCasesDataSet) { - state.dataGlobal->preserveIDFOrder = false; + state->dataGlobal->preserveIDFOrder = false; ASSERT_TRUE(process_idf(delimited_string(read_lines_in_file(configured_source_directory() + "/datasets/RefrigerationCasesDataSet.idf")))); } // TEST_F( DataSetFixture, RefrigerationCompressorCurves ) { -// state.dataGlobal->preserveIDFOrder = false; +// state->dataGlobal->preserveIDFOrder = false; // ASSERT_TRUE( process_idf( delimited_string( read_lines_in_file( configured_source_directory() + "/datasets/RefrigerationCompressorCurves.idf" //) ) ) ); //} diff --git a/tst/EnergyPlus/unit/DaylightingManager.unit.cc b/tst/EnergyPlus/unit/DaylightingManager.unit.cc index 78967cf466a..12cab335c7e 100644 --- a/tst/EnergyPlus/unit/DaylightingManager.unit.cc +++ b/tst/EnergyPlus/unit/DaylightingManager.unit.cc @@ -72,6 +72,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::Construction; @@ -127,16 +128,16 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDaylightingControls_Test) ASSERT_TRUE(process_idf(idf_objects)); bool foundErrors = false; - GetZoneData(state, foundErrors); + GetZoneData(*state, foundErrors); ASSERT_FALSE(foundErrors); - int numObjs = inputProcessor->getNumObjectsFound(state, "Daylighting:Controls"); - GetInputDayliteRefPt(state, foundErrors); + int numObjs = inputProcessor->getNumObjectsFound(*state, "Daylighting:Controls"); + GetInputDayliteRefPt(*state, foundErrors); compare_err_stream(""); EXPECT_FALSE(foundErrors); EXPECT_EQ(1, TotRefPoints); - GetDaylightingControls(state, numObjs, foundErrors); + GetDaylightingControls(*state, numObjs, foundErrors); compare_err_stream(""); EXPECT_FALSE(foundErrors); EXPECT_EQ(1, numObjs); @@ -229,16 +230,16 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDaylightingControls_3RefPt_ ASSERT_TRUE(process_idf(idf_objects)); bool foundErrors = false; - GetZoneData(state, foundErrors); + GetZoneData(*state, foundErrors); ASSERT_FALSE(foundErrors); - int numObjs = inputProcessor->getNumObjectsFound(state, "Daylighting:Controls"); - GetInputDayliteRefPt(state, foundErrors); + int numObjs = inputProcessor->getNumObjectsFound(*state, "Daylighting:Controls"); + GetInputDayliteRefPt(*state, foundErrors); compare_err_stream(""); EXPECT_FALSE(foundErrors); EXPECT_EQ(3, TotRefPoints); - GetDaylightingControls(state, numObjs, foundErrors); + GetDaylightingControls(*state, numObjs, foundErrors); compare_err_stream(""); EXPECT_FALSE(foundErrors); EXPECT_EQ(1, numObjs); @@ -315,10 +316,10 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDayliteRefPt_Test) ASSERT_TRUE(process_idf(idf_objects)); bool foundErrors = false; - GetZoneData(state, foundErrors); + GetZoneData(*state, foundErrors); ASSERT_FALSE(foundErrors); - GetInputDayliteRefPt(state, foundErrors); + GetInputDayliteRefPt(*state, foundErrors); compare_err_stream(""); EXPECT_FALSE(foundErrors); EXPECT_EQ(3, TotRefPoints); @@ -377,10 +378,10 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputOutputIlluminanceMap_Test) ASSERT_TRUE(process_idf(idf_objects)); bool foundErrors = false; - GetZoneData(state, foundErrors); + GetZoneData(*state, foundErrors); ASSERT_FALSE(foundErrors); - GetInputIlluminanceMap(state, foundErrors); + GetInputIlluminanceMap(*state, foundErrors); // compare_err_stream(""); // expecting errors because zone is not really defined EXPECT_EQ(1, TotIllumMaps); @@ -807,55 +808,55 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetDaylParamInGeoTrans_Test) bool foundErrors = false; - HeatBalanceManager::GetProjectControlData(state, foundErrors); // read project control data + HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetMaterialData(state, foundErrors); // read material data + HeatBalanceManager::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetConstructData(state, foundErrors); // read construction data + HeatBalanceManager::GetConstructData(*state, foundErrors); // read construction data compare_err_stream(""); EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetZoneData(state, foundErrors); // read zone data + HeatBalanceManager::GetZoneData(*state, foundErrors); // read zone data EXPECT_FALSE(foundErrors); // expect no errors - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, foundErrors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, foundErrors); // setup zone geometry and get zone data EXPECT_FALSE(foundErrors); // expect no errors - SurfaceGeometry::SetupZoneGeometry(state, foundErrors); // this calls GetSurfaceData() + SurfaceGeometry::SetupZoneGeometry(*state, foundErrors); // this calls GetSurfaceData() EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceIntRadExchange::InitSolarViewFactors(state); + HeatBalanceIntRadExchange::InitSolarViewFactors(*state); - 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); + 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); ScheduleManager::ScheduleInputProcessed = true; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->PreviousHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->PreviousHour = 1; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); - InternalHeatGains::GetInternalHeatGainsInput(state); + ScheduleManager::UpdateScheduleValues(*state); + InternalHeatGains::GetInternalHeatGainsInput(*state); InternalHeatGains::GetInternalHeatGainsInputFlag = false; - GetDaylightingParametersInput(state); + GetDaylightingParametersInput(*state); compare_err_stream(""); EXPECT_EQ(3, TotRefPoints); @@ -865,7 +866,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetDaylParamInGeoTrans_Test) DataHeatBalance::Zone(1).RelNorth = 45.; - GeometryTransformForDaylighting(state); + GeometryTransformForDaylighting(*state); EXPECT_NEAR(3.603, ZoneDaylight(1).DaylRefPtAbsCoord(1, 1), 0.001); EXPECT_NEAR(0.707, ZoneDaylight(1).DaylRefPtAbsCoord(2, 1), 0.001); @@ -873,23 +874,23 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetDaylParamInGeoTrans_Test) DataHeatBalance::Zone(1).RelNorth = 90.; - GeometryTransformForDaylighting(state); + GeometryTransformForDaylighting(*state); EXPECT_NEAR(3.048, ZoneDaylight(1).DaylRefPtAbsCoord(1, 1), 0.001); EXPECT_NEAR(-2.048, ZoneDaylight(1).DaylRefPtAbsCoord(2, 1), 0.001); EXPECT_NEAR(0.9, ZoneDaylight(1).DaylRefPtAbsCoord(3, 1), 0.001); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->WeightNow = 1.0; - state.dataGlobal->WeightPreviousHour = 0.0; - CalcDayltgCoefficients(state); + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->WeightNow = 1.0; + state->dataGlobal->WeightPreviousHour = 0.0; + CalcDayltgCoefficients(*state); int zoneNum = 1; // test that tmp arrays are allocated to correct dimension // zone 1 has only 1 daylighting reference point - DayltgInteriorIllum(state, zoneNum); + DayltgInteriorIllum(*state, zoneNum); zoneNum += 1; // zone 2 has 2 daylighting reference points and will crash if not dimensioned appropriately. - DayltgInteriorIllum(state, zoneNum); + DayltgInteriorIllum(*state, zoneNum); } TEST_F(EnergyPlusFixture, DaylightingManager_ProfileAngle_Test) @@ -926,8 +927,8 @@ TEST_F(EnergyPlusFixture, DaylightingManager_ProfileAngle_Test) TEST_F(EnergyPlusFixture, AssociateWindowShadingControlWithDaylighting_Test) { - state.dataGlobal->NumOfZones = 4; - ZoneDaylight.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 4; + ZoneDaylight.allocate(state->dataGlobal->NumOfZones); ZoneDaylight(1).Name = "ZD1"; ZoneDaylight(2).Name = "ZD2"; ZoneDaylight(3).Name = "ZD3"; @@ -945,7 +946,7 @@ TEST_F(EnergyPlusFixture, AssociateWindowShadingControlWithDaylighting_Test) WindowShadingControl(3).Name = "WSC3"; WindowShadingControl(3).DaylightingControlName = "ZD-NONE"; - AssociateWindowShadingControlWithDaylighting(state); + AssociateWindowShadingControlWithDaylighting(*state); EXPECT_EQ(WindowShadingControl(1).DaylightControlIndex, 3); EXPECT_EQ(WindowShadingControl(2).DaylightControlIndex, 1); @@ -988,8 +989,8 @@ TEST_F(EnergyPlusFixture, CreateShadeDeploymentOrder_test) WindowShadingControl(3).FenestrationIndex(1) = 8; WindowShadingControl(3).FenestrationIndex(2) = 9; - state.dataGlobal->NumOfZones = zn; - ZoneDaylight.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = zn; + ZoneDaylight.allocate(state->dataGlobal->NumOfZones); CreateShadeDeploymentOrder(zn); @@ -1059,8 +1060,8 @@ TEST_F(EnergyPlusFixture, MapShadeDeploymentOrderToLoopNumber_Test) WindowShadingControl(3).FenestrationIndex(1) = 8; WindowShadingControl(3).FenestrationIndex(2) = 9; - state.dataGlobal->NumOfZones = zn; - ZoneDaylight.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = zn; + ZoneDaylight.allocate(state->dataGlobal->NumOfZones); CreateShadeDeploymentOrder(zn); @@ -1080,7 +1081,7 @@ TEST_F(EnergyPlusFixture, MapShadeDeploymentOrderToLoopNumber_Test) ZoneDaylight(zn).DayltgExtWinSurfNums(8) = 8; ZoneDaylight(zn).DayltgExtWinSurfNums(9) = 9; - MapShadeDeploymentOrderToLoopNumber(state, zn); + MapShadeDeploymentOrderToLoopNumber(*state, zn); EXPECT_EQ(ZoneDaylight(zn).MapShdOrdToLoopNum(1), 8); EXPECT_EQ(ZoneDaylight(zn).MapShdOrdToLoopNum(2), 9); @@ -1307,12 +1308,12 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) }); ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 10; - state.dataGlobal->PreviousHour = 10; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 10; + state->dataGlobal->PreviousHour = 10; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; DataEnvironment::DSTIndicator = 0; @@ -1320,30 +1321,30 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) DataEnvironment::HolidayIndex = 0; bool foundErrors = false; - HeatBalanceManager::GetProjectControlData(state, foundErrors); // read project control data + HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetMaterialData(state, foundErrors); // read material data + HeatBalanceManager::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetConstructData(state, foundErrors); // read construction data + HeatBalanceManager::GetConstructData(*state, foundErrors); // read construction data compare_err_stream(""); EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetZoneData(state, foundErrors); // read zone data + HeatBalanceManager::GetZoneData(*state, foundErrors); // read zone data EXPECT_FALSE(foundErrors); // expect no errors - SurfaceGeometry::SetupZoneGeometry(state, foundErrors); // this calls GetSurfaceData() + SurfaceGeometry::SetupZoneGeometry(*state, foundErrors); // this calls GetSurfaceData() EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceIntRadExchange::InitSolarViewFactors(state); + HeatBalanceIntRadExchange::InitSolarViewFactors(*state); int ZoneNum = UtilityRoutines::FindItemInList("EAST ZONE", DataHeatBalance::Zone); - InternalHeatGains::GetInternalHeatGainsInput(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); InternalHeatGains::GetInternalHeatGainsInputFlag = false; - DaylightingManager::GetInputDayliteRefPt(state, foundErrors); - DaylightingManager::GetDaylightingParametersInput(state); + DaylightingManager::GetInputDayliteRefPt(*state, foundErrors); + DaylightingManager::GetDaylightingParametersInput(*state); DaylightingManager::GILSK = 100.0; - state.dataGlobal->WeightNow = 1.0; + state->dataGlobal->WeightNow = 1.0; DataEnvironment::HISUNF = 100.0; DataEnvironment::HISKF = 100.0; DataEnvironment::SkyClearness = 6.0; @@ -1358,7 +1359,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) ZoneDaylight(ZoneNum).DaylSourceFacSky = 0.0; ZoneDaylight(ZoneNum).DaylSourceFacSun = 0.0; ZoneDaylight(ZoneNum).DaylSourceFacSunDisk = 0.0; - DaylightingManager::DayltgInteriorIllum(state, ZoneNum); + DaylightingManager::DayltgInteriorIllum(*state, ZoneNum); EXPECT_NEAR(DaylightingManager::DaylIllum(1), 0.0, 0.001); int ISky = 1; @@ -1371,21 +1372,21 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) // Set un-shaded surface illuminance factor to 1.0 for RefPt1, 0.1 for RefPt2 // Set shaded surface illuminance factor to 0.5 for RefPt1, 0.05 for RefPt2 int RefPt = 1; - ZoneDaylight(ZoneNum).DaylIllFacSky(state.dataGlobal->HourOfDay, Unshaded, ISky, RefPt, DayltgExtWin) = 1.0; - ZoneDaylight(ZoneNum).DaylIllFacSky(state.dataGlobal->HourOfDay, Shaded, ISky, RefPt, DayltgExtWin) = 0.5; + ZoneDaylight(ZoneNum).DaylIllFacSky(state->dataGlobal->HourOfDay, Unshaded, ISky, RefPt, DayltgExtWin) = 1.0; + ZoneDaylight(ZoneNum).DaylIllFacSky(state->dataGlobal->HourOfDay, Shaded, ISky, RefPt, DayltgExtWin) = 0.5; RefPt = 2; - ZoneDaylight(ZoneNum).DaylIllFacSky(state.dataGlobal->HourOfDay, Unshaded, ISky, RefPt, DayltgExtWin) = 0.1; - ZoneDaylight(ZoneNum).DaylIllFacSky(state.dataGlobal->HourOfDay, Shaded, ISky, RefPt, DayltgExtWin) = 0.05; + ZoneDaylight(ZoneNum).DaylIllFacSky(state->dataGlobal->HourOfDay, Unshaded, ISky, RefPt, DayltgExtWin) = 0.1; + ZoneDaylight(ZoneNum).DaylIllFacSky(state->dataGlobal->HourOfDay, Shaded, ISky, RefPt, DayltgExtWin) = 0.05; // Window5 model - expect 100 for unshaded and 50 for shaded (10 and 5 for RefPt2) SurfWinWindowModelType(IWin) = Window5DetailedModel; SurfWinShadingFlag(IWin) = DataSurfaces::NoShade; - DaylightingManager::DayltgInteriorIllum(state, ZoneNum); + DaylightingManager::DayltgInteriorIllum(*state, ZoneNum); EXPECT_NEAR(DaylightingManager::DaylIllum(1), 100.0, 0.001); EXPECT_NEAR(DaylightingManager::DaylIllum(2), 10.0, 0.001); SurfWinShadingFlag(IWin) = DataSurfaces::ExtBlindOn; - DaylightingManager::DayltgInteriorIllum(state, ZoneNum); + DaylightingManager::DayltgInteriorIllum(*state, ZoneNum); EXPECT_NEAR(DaylightingManager::DaylIllum(1), 50.0, 0.001); EXPECT_NEAR(DaylightingManager::DaylIllum(2), 5.0, 0.001); @@ -1393,12 +1394,12 @@ TEST_F(EnergyPlusFixture, DaylightingManager_DayltgInteriorIllum_Test) // BSDF does shading differently, it's integrated in the base state SurfWinWindowModelType(IWin) = WindowBSDFModel; SurfWinShadingFlag(IWin) = DataSurfaces::NoShade; - DaylightingManager::DayltgInteriorIllum(state, ZoneNum); + DaylightingManager::DayltgInteriorIllum(*state, ZoneNum); EXPECT_NEAR(DaylightingManager::DaylIllum(1), 100.0, 0.001); EXPECT_NEAR(DaylightingManager::DaylIllum(2), 10.0, 0.001); SurfWinShadingFlag(IWin) = DataSurfaces::ExtBlindOn; - DaylightingManager::DayltgInteriorIllum(state, ZoneNum); + DaylightingManager::DayltgInteriorIllum(*state, ZoneNum); EXPECT_NEAR(DaylightingManager::DaylIllum(1), 100.0, 0.001); EXPECT_NEAR(DaylightingManager::DaylIllum(2), 10.0, 0.001); } @@ -1541,18 +1542,18 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDaylightingControls_Roundin ASSERT_TRUE(process_idf(idf_objects)); bool foundErrors = false; - HeatBalanceManager::GetZoneData(state, foundErrors); + HeatBalanceManager::GetZoneData(*state, foundErrors); ASSERT_FALSE(foundErrors); - int numObjs = inputProcessor->getNumObjectsFound(state, "Daylighting:Controls"); + int numObjs = inputProcessor->getNumObjectsFound(*state, "Daylighting:Controls"); EXPECT_EQ(1, numObjs); - DaylightingManager::GetInputDayliteRefPt(state, foundErrors); + DaylightingManager::GetInputDayliteRefPt(*state, foundErrors); compare_err_stream(""); EXPECT_FALSE(foundErrors); EXPECT_EQ(10, DataDaylighting::TotRefPoints); - DaylightingManager::GetDaylightingControls(state, numObjs, foundErrors); + DaylightingManager::GetDaylightingControls(*state, numObjs, foundErrors); // Used to throw // ** Severe ** GetDaylightingControls: Fraction of Zone controlled by the Daylighting reference points is > 1.0. // ** ~~~ ** ..discovered in \"Daylighting:Controls\" for Zone=\"WEST ZONE\", trying to control 1.00 of the zone.\n @@ -1653,18 +1654,18 @@ TEST_F(EnergyPlusFixture, DaylightingManager_GetInputDaylightingControls_NotArou ASSERT_TRUE(process_idf(idf_objects)); bool foundErrors = false; - HeatBalanceManager::GetZoneData(state, foundErrors); + HeatBalanceManager::GetZoneData(*state, foundErrors); ASSERT_FALSE(foundErrors); - int numObjs = inputProcessor->getNumObjectsFound(state, "Daylighting:Controls"); + int numObjs = inputProcessor->getNumObjectsFound(*state, "Daylighting:Controls"); EXPECT_EQ(1, numObjs); - DaylightingManager::GetInputDayliteRefPt(state, foundErrors); + DaylightingManager::GetInputDayliteRefPt(*state, foundErrors); compare_err_stream(""); EXPECT_FALSE(foundErrors); EXPECT_EQ(2, DataDaylighting::TotRefPoints); - DaylightingManager::GetDaylightingControls(state, numObjs, foundErrors); + DaylightingManager::GetDaylightingControls(*state, numObjs, foundErrors); std::string const error_string = delimited_string({ " ** Severe ** GetDaylightingControls: Fraction of Zone controlled by the Daylighting reference points is > 1.0.", @@ -2081,56 +2082,56 @@ TEST_F(EnergyPlusFixture, DaylightingManager_OutputFormats) bool foundErrors = false; - HeatBalanceManager::GetProjectControlData(state, foundErrors); // read project control data + HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetMaterialData(state, foundErrors); // read material data + HeatBalanceManager::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetConstructData(state, foundErrors); // read construction data + HeatBalanceManager::GetConstructData(*state, foundErrors); // read construction data compare_err_stream(""); EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetZoneData(state, foundErrors); // read zone data + HeatBalanceManager::GetZoneData(*state, foundErrors); // read zone data EXPECT_FALSE(foundErrors); // expect no errors - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, foundErrors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, foundErrors); // setup zone geometry and get zone data EXPECT_FALSE(foundErrors); // expect no errors - SurfaceGeometry::SetupZoneGeometry(state, foundErrors); // this calls GetSurfaceData() + SurfaceGeometry::SetupZoneGeometry(*state, foundErrors); // this calls GetSurfaceData() EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceIntRadExchange::InitSolarViewFactors(state); + HeatBalanceIntRadExchange::InitSolarViewFactors(*state); - 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); + 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); ScheduleManager::ScheduleInputProcessed = true; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->PreviousHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->PreviousHour = 1; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::CurMnDy = "01/21"; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); - InternalHeatGains::GetInternalHeatGainsInput(state); + ScheduleManager::UpdateScheduleValues(*state); + InternalHeatGains::GetInternalHeatGainsInput(*state); InternalHeatGains::GetInternalHeatGainsInputFlag = false; - GetDaylightingParametersInput(state); + GetDaylightingParametersInput(*state); compare_err_stream(""); EXPECT_EQ(4, TotRefPoints); @@ -2140,7 +2141,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_OutputFormats) DataHeatBalance::Zone(1).RelNorth = 45.; - GeometryTransformForDaylighting(state); + GeometryTransformForDaylighting(*state); EXPECT_NEAR(3.603, ZoneDaylight(1).DaylRefPtAbsCoord(1, 1), 0.001); EXPECT_NEAR(0.707, ZoneDaylight(1).DaylRefPtAbsCoord(2, 1), 0.001); @@ -2148,7 +2149,7 @@ TEST_F(EnergyPlusFixture, DaylightingManager_OutputFormats) DataHeatBalance::Zone(1).RelNorth = 90.; - GeometryTransformForDaylighting(state); + GeometryTransformForDaylighting(*state); EXPECT_NEAR(3.048, ZoneDaylight(1).DaylRefPtAbsCoord(1, 1), 0.001); EXPECT_NEAR(-2.048, ZoneDaylight(1).DaylRefPtAbsCoord(2, 1), 0.001); @@ -2158,17 +2159,17 @@ TEST_F(EnergyPlusFixture, DaylightingManager_OutputFormats) EXPECT_TRUE(has_eio_output(true)); EXPECT_FALSE(has_dfs_output(true)); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->WeightNow = 1.0; - state.dataGlobal->WeightPreviousHour = 0.0; - CalcDayltgCoefficients(state); + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->WeightNow = 1.0; + state->dataGlobal->WeightPreviousHour = 0.0; + CalcDayltgCoefficients(*state); int zoneNum = 1; // test that tmp arrays are allocated to correct dimension // zone 1 has only 1 daylighting reference point - DayltgInteriorIllum(state, zoneNum); + DayltgInteriorIllum(*state, zoneNum); zoneNum += 1; // zone 2 has 2 daylighting reference points and will crash if not dimensioned appropriately. - DayltgInteriorIllum(state, zoneNum); + DayltgInteriorIllum(*state, zoneNum); // EIO/DFS output uses specifically newline `\n`, so pass that in or on Windows it'll use '\r\n` std::string const delim = "\n"; @@ -2826,39 +2827,39 @@ TEST_F(EnergyPlusFixture, DaylightingManager_TDD_NoDaylightingControls) ASSERT_TRUE(process_idf(idf_objects)); bool foundErrors = false; - HeatBalanceManager::GetProjectControlData(state, foundErrors); // read project control data + HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetMaterialData(state, foundErrors); // read material data + HeatBalanceManager::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetConstructData(state, foundErrors); // read construction data + HeatBalanceManager::GetConstructData(*state, foundErrors); // read construction data compare_err_stream(""); EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetZoneData(state, foundErrors); // read zone data + HeatBalanceManager::GetZoneData(*state, foundErrors); // read zone data EXPECT_FALSE(foundErrors); // expect no errors - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, foundErrors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, foundErrors); // setup zone geometry and get zone data EXPECT_FALSE(foundErrors); // expect no errors - SurfaceGeometry::SetupZoneGeometry(state, foundErrors); // this calls GetSurfaceData() + SurfaceGeometry::SetupZoneGeometry(*state, foundErrors); // this calls GetSurfaceData() EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceIntRadExchange::InitSolarViewFactors(state); + HeatBalanceIntRadExchange::InitSolarViewFactors(*state); - state.dataConstruction->Construct(Surface(7).Construction).TransDiff = 0.001; // required for GetTDDInput function to work. - DaylightingDevices::GetTDDInput(state); - CalcDayltgCoefficients(state); + state->dataConstruction->Construct(Surface(7).Construction).TransDiff = 0.001; // required for GetTDDInput function to work. + DaylightingDevices::GetTDDInput(*state); + CalcDayltgCoefficients(*state); std::string const error_string = delimited_string({ " ** Warning ** DaylightingDevice:Tubular = PIPE1: is not connected to a Zone that has Daylighting, no visible transmittance will be modeled through the daylighting device.", diff --git a/tst/EnergyPlus/unit/DemandResponse.unit.cc b/tst/EnergyPlus/unit/DemandResponse.unit.cc index 6e393e7f052..6cbbf72fada 100644 --- a/tst/EnergyPlus/unit/DemandResponse.unit.cc +++ b/tst/EnergyPlus/unit/DemandResponse.unit.cc @@ -54,6 +54,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace ObjexxFCL; @@ -77,7 +78,7 @@ TEST_F(EnergyPlusFixture, DemandManagerGetInput) OAController.allocate(NumOAControllers); OAController(1).Name = "OA CONTROLLER 1"; - GetDemandManagerInput(state); + GetDemandManagerInput(*state); EXPECT_EQ(DataGlobalConstants::ScheduleAlwaysOn(), DemandMgr(1).AvailSchedule); EXPECT_EQ(ManagerLimitFixed, DemandMgr(1).LimitControl); diff --git a/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc b/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc index b3f35f26f5d..904e96e525c 100644 --- a/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc +++ b/tst/EnergyPlus/unit/DesiccantDehumidifiers.unit.cc @@ -69,6 +69,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -2811,30 +2812,30 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_OnOASystemTest) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - state.dataGlobal->DDOnlySimulation = true; + state->dataGlobal->DDOnlySimulation = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); createFacilityElectricPowerServiceObject(); - SetPreConstructionInputParameters(state); // establish array bounds for constructions early - BranchInputManager::ManageBranchInput(state); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->ZoneSizingCalc = true; - state.dataGlobal->SysSizingCalc = true; - SizingManager::ManageSizing(state); + SetPreConstructionInputParameters(*state); // establish array bounds for constructions early + BranchInputManager::ManageBranchInput(*state); + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; + SizingManager::ManageSizing(*state); DataSizing::CurSysNum = 1; DataSizing::CurOASysNum = 1; - GetDesiccantDehumidifierInput(state); + GetDesiccantDehumidifierInput(*state); EXPECT_EQ(1, NumDesicDehums); EXPECT_EQ("OA DESICCANT SYSTEM", DesicDehum(DesicDehumNum).Name); EXPECT_EQ("OA DESICCANT REGEN COIL", DesicDehum(DesicDehumNum).RegenCoilName); CompName = DesicDehum(DesicDehumNum).Name; CompIndex = NumGenericDesicDehums; - SimDesiccantDehumidifier(state, CompName, FirstHVACIteration, CompIndex); + SimDesiccantDehumidifier(*state, CompName, FirstHVACIteration, CompIndex); RegCoilDesInletTemp = FinalSysSizing(DataSizing::CurSysNum).HeatRetTemp; RegCoilDesOutletTemp = DesicDehum(DesicDehumNum).RegenSetPointTemp; @@ -3991,30 +3992,30 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_OnPrimaryAirSystemTest) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - state.dataGlobal->DDOnlySimulation = true; + state->dataGlobal->DDOnlySimulation = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); createFacilityElectricPowerServiceObject(); - SetPreConstructionInputParameters(state); // establish array bounds for constructions early - BranchInputManager::ManageBranchInput(state); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->ZoneSizingCalc = true; - state.dataGlobal->SysSizingCalc = true; - SizingManager::ManageSizing(state); + SetPreConstructionInputParameters(*state); // establish array bounds for constructions early + BranchInputManager::ManageBranchInput(*state); + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; + SizingManager::ManageSizing(*state); DataSizing::CurSysNum = 1; DataSizing::CurOASysNum = 0; - GetDesiccantDehumidifierInput(state); + GetDesiccantDehumidifierInput(*state); EXPECT_EQ(1, NumDesicDehums); EXPECT_EQ("DESICCANT 1", DesicDehum(DesicDehumNum).Name); EXPECT_EQ("DESICCANT REGEN COIL", DesicDehum(DesicDehumNum).RegenCoilName); CompName = DesicDehum(DesicDehumNum).Name; CompIndex = NumGenericDesicDehums; - SimDesiccantDehumidifier(state, CompName, FirstHVACIteration, CompIndex); + SimDesiccantDehumidifier(*state, CompName, FirstHVACIteration, CompIndex); RegCoilDesInletTemp = FinalSysSizing(DataSizing::CurSysNum).HeatOutTemp; RegCoilDesOutletTemp = DesicDehum(DesicDehumNum).RegenSetPointTemp; @@ -5409,23 +5410,23 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_RegenAirHeaterHWCoilSizingTest) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - state.dataGlobal->DDOnlySimulation = true; + state->dataGlobal->DDOnlySimulation = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); createFacilityElectricPowerServiceObject(); - SetPreConstructionInputParameters(state); // establish array bounds for constructions early - BranchInputManager::ManageBranchInput(state); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->ZoneSizingCalc = true; - state.dataGlobal->SysSizingCalc = true; - SizingManager::ManageSizing(state); + SetPreConstructionInputParameters(*state); // establish array bounds for constructions early + BranchInputManager::ManageBranchInput(*state); + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; + SizingManager::ManageSizing(*state); DataSizing::CurSysNum = 1; DataSizing::CurOASysNum = 0; - GetDesiccantDehumidifierInput(state); + GetDesiccantDehumidifierInput(*state); EXPECT_EQ(1, NumDesicDehums); EXPECT_EQ(1, NumGenericDesicDehums); EXPECT_EQ("DESICCANT 1", DesicDehum(DesicDehumNum).Name); @@ -5443,14 +5444,14 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_RegenAirHeaterHWCoilSizingTest) RegCoilCapacity = RegCoilInletAirMassFlowRate * PsyCpAirFnW(0.0) * (RegCoilDesOutletTemp - RegCoilDesInletTemp); // simulate to determine HW coil design capacity - SimDesiccantDehumidifier(state, CompName, FirstHVACIteration, CompIndex); - for (loop = 1; loop <= state.dataWaterCoils->NumWaterCoils; ++loop) { - if (state.dataWaterCoils->WaterCoil(loop).Name == DesicDehum(DesicDehumNum).RegenCoilName) { + SimDesiccantDehumidifier(*state, CompName, FirstHVACIteration, CompIndex); + for (loop = 1; loop <= state->dataWaterCoils->NumWaterCoils; ++loop) { + if (state->dataWaterCoils->WaterCoil(loop).Name == DesicDehum(DesicDehumNum).RegenCoilName) { CoilIndex = loop; } } // verify results - EXPECT_EQ(RegCoilCapacity, state.dataWaterCoils->WaterCoil(CoilIndex).DesWaterHeatingCoilRate); + EXPECT_EQ(RegCoilCapacity, state->dataWaterCoils->WaterCoil(CoilIndex).DesWaterHeatingCoilRate); } TEST_F(EnergyPlusFixture, DesiccantDehum_VSCoolingCoilOnPrimaryAirSystemTest) @@ -6652,23 +6653,23 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_VSCoolingCoilOnPrimaryAirSystemTest) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - state.dataGlobal->DDOnlySimulation = true; + state->dataGlobal->DDOnlySimulation = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); createFacilityElectricPowerServiceObject(); - SetPreConstructionInputParameters(state); // establish array bounds for constructions early - BranchInputManager::ManageBranchInput(state); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->ZoneSizingCalc = true; - state.dataGlobal->SysSizingCalc = true; - SizingManager::ManageSizing(state); + SetPreConstructionInputParameters(*state); // establish array bounds for constructions early + BranchInputManager::ManageBranchInput(*state); + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; + SizingManager::ManageSizing(*state); DataSizing::CurSysNum = 1; DataSizing::CurOASysNum = 0; - GetDesiccantDehumidifierInput(state); + GetDesiccantDehumidifierInput(*state); EXPECT_EQ(1, NumDesicDehums); EXPECT_EQ("DESICCANT 1", DesicDehum(DesicDehumNum).Name); EXPECT_EQ("DESICCANT REGEN COIL", DesicDehum(DesicDehumNum).RegenCoilName); @@ -6679,7 +6680,7 @@ TEST_F(EnergyPlusFixture, DesiccantDehum_VSCoolingCoilOnPrimaryAirSystemTest) CompName = DesicDehum(DesicDehumNum).Name; CompIndex = NumGenericDesicDehums; - SimDesiccantDehumidifier(state, CompName, FirstHVACIteration, CompIndex); + SimDesiccantDehumidifier(*state, CompName, FirstHVACIteration, CompIndex); RegCoilDesInletTemp = FinalSysSizing(DataSizing::CurSysNum).HeatOutTemp; RegCoilDesOutletTemp = DesicDehum(DesicDehumNum).RegenSetPointTemp; diff --git a/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc b/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc index cca15b9a0d0..83a210c98c6 100644 --- a/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc +++ b/tst/EnergyPlus/unit/DisplacementVentMgr.unit.cc @@ -60,6 +60,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::DataSurfaces; @@ -73,17 +74,17 @@ TEST_F(EnergyPlusFixture, DisplacementVentMgr_HcUCSDDV_Door_Test) // set up all conditions entering the HcUCSDDV for Issue #5533 to cause NAN when a floor door is entered // 3 door types are tested: wall, floor and ceiling - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; int TotSurfaces = 3; - IsZoneDV.allocate(state.dataGlobal->NumOfZones); + IsZoneDV.allocate(state->dataGlobal->NumOfZones); IsZoneDV(1) = true; Surface.allocate(TotSurfaces); TempEffBulkAir.allocate(TotSurfaces); EnergyPlus::DataHeatBalSurface::TempSurfIn.allocate(TotSurfaces); DVHcIn.allocate(TotSurfaces); - ZTMX.allocate(state.dataGlobal->NumOfZones); - ZTOC.allocate(state.dataGlobal->NumOfZones); + ZTMX.allocate(state->dataGlobal->NumOfZones); + ZTOC.allocate(state->dataGlobal->NumOfZones); // Surface 1 Vertical wall Surface(1).Name = "Class1_Wall_6_0_0_0_0_0_Subsurface"; @@ -160,21 +161,21 @@ TEST_F(EnergyPlusFixture, DisplacementVentMgr_HcUCSDDV_Door_Test) Surface(3).Vertex(4).y = -1.48693002; Surface(3).Vertex(4).z = 8.5343999852; - EnergyPlus::DataRoomAirModel::AirModel.allocate(state.dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::AirModel.allocate(state->dataGlobal->NumOfZones); AirModel(1).AirModelType = RoomAirModel_UCSDDV; APos_Wall.allocate(TotSurfaces); APos_Floor.allocate(TotSurfaces); APos_Ceiling.allocate(TotSurfaces); - PosZ_Wall.allocate(state.dataGlobal->NumOfZones * 2); - PosZ_Floor.allocate(state.dataGlobal->NumOfZones * 2); - PosZ_Ceiling.allocate(state.dataGlobal->NumOfZones * 2); + PosZ_Wall.allocate(state->dataGlobal->NumOfZones * 2); + PosZ_Floor.allocate(state->dataGlobal->NumOfZones * 2); + PosZ_Ceiling.allocate(state->dataGlobal->NumOfZones * 2); APos_Window.allocate(TotSurfaces); APos_Door.allocate(TotSurfaces); APos_Internal.allocate(TotSurfaces); - PosZ_Window.allocate(state.dataGlobal->NumOfZones * 2); - PosZ_Door.allocate(state.dataGlobal->NumOfZones * 2); - PosZ_Internal.allocate(state.dataGlobal->NumOfZones * 2); + PosZ_Window.allocate(state->dataGlobal->NumOfZones * 2); + PosZ_Door.allocate(state->dataGlobal->NumOfZones * 2); + PosZ_Internal.allocate(state->dataGlobal->NumOfZones * 2); HCeiling.allocate(TotSurfaces); HWall.allocate(TotSurfaces); HFloor.allocate(TotSurfaces); @@ -182,7 +183,7 @@ TEST_F(EnergyPlusFixture, DisplacementVentMgr_HcUCSDDV_Door_Test) HWindow.allocate(TotSurfaces); HDoor.allocate(TotSurfaces); - ZoneCeilingHeight.allocate(state.dataGlobal->NumOfZones * 2); + ZoneCeilingHeight.allocate(state->dataGlobal->NumOfZones * 2); ZoneCeilingHeight(1) = 4.9784; ZoneCeilingHeight(2) = 4.9784; @@ -212,7 +213,7 @@ TEST_F(EnergyPlusFixture, DisplacementVentMgr_HcUCSDDV_Door_Test) HWindow = 0.0; HDoor = 0.0; - EnergyPlus::DataRoomAirModel::ZoneUCSDCV.allocate(state.dataGlobal->NumOfZones); + EnergyPlus::DataRoomAirModel::ZoneUCSDCV.allocate(state->dataGlobal->NumOfZones); EnergyPlus::DataRoomAirModel::ZoneUCSDCV(1).ZonePtr = 1; PosZ_Door(1) = 1; PosZ_Door(2) = 3; @@ -226,7 +227,7 @@ TEST_F(EnergyPlusFixture, DisplacementVentMgr_HcUCSDDV_Door_Test) EnergyPlus::DataHeatBalSurface::TempSurfIn(2) = 23.0; EnergyPlus::DataHeatBalSurface::TempSurfIn(3) = 23.0; - HcUCSDDV(state, 1, 0.5); + HcUCSDDV(*state, 1, 0.5); EXPECT_NEAR(1.889346, DVHcIn(1), 0.0001); EXPECT_NEAR(1.650496, DVHcIn(2), 0.0001); diff --git a/tst/EnergyPlus/unit/DualDuct.unit.cc b/tst/EnergyPlus/unit/DualDuct.unit.cc index 54c217d1b5f..5b0f9155a6c 100644 --- a/tst/EnergyPlus/unit/DualDuct.unit.cc +++ b/tst/EnergyPlus/unit/DualDuct.unit.cc @@ -54,6 +54,7 @@ // EnergyPlus Headers #include "Fixtures/EnergyPlusFixture.hh" +#include #include #include #include @@ -69,6 +70,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace DualDuct; @@ -88,7 +90,7 @@ TEST_F(EnergyPlusFixture, TestDualDuctOAMassFlowRateUsingStdRhoAir) DataHeatBalance::Zone.allocate(1); DataSizing::OARequirements.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); DataHeatBalance::ZoneIntGain.allocate(1); DataHeatBalance::Zone(1).FloorArea = 10.0; @@ -109,9 +111,9 @@ TEST_F(EnergyPlusFixture, TestDualDuctOAMassFlowRateUsingStdRhoAir) DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum(1) = 1; - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirLoop->AirLoopFlow(1).OAFrac = 0.5; - state.dataAirLoop->AirLoopControlInfo(1).AirLoopDCVFlag = true; + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow(1).OAFrac = 0.5; + state->dataAirLoop->AirLoopControlInfo(1).AirLoopDCVFlag = true; DataSizing::OARequirements(1).Name = "CM DSOA WEST ZONE"; DataSizing::OARequirements(1).OAFlowMethod = DataSizing::OAFlowSum; @@ -120,22 +122,22 @@ TEST_F(EnergyPlusFixture, TestDualDuctOAMassFlowRateUsingStdRhoAir) DataEnvironment::StdRhoAir = 1.20; DataHeatBalance::ZoneIntGain(1).NOFOCC = 0.1; - DualDuct::dd_airterminal(1).CalcOAMassFlow(state, SAMassFlow, AirLoopOAFrac); + DualDuct::dd_airterminal(1).CalcOAMassFlow(*state, SAMassFlow, AirLoopOAFrac); EXPECT_NEAR(0.01052376, SAMassFlow, 0.00001); EXPECT_NEAR(0.5, AirLoopOAFrac, 0.00001); - DualDuct::dd_airterminal(2).CalcOAOnlyMassFlow(state, OAMassFlow); + DualDuct::dd_airterminal(2).CalcOAOnlyMassFlow(*state, OAMassFlow); EXPECT_NEAR(0.004884, OAMassFlow, 0.00001); // Cleanup DataHeatBalance::Zone.deallocate(); DataSizing::OARequirements.deallocate(); - state.dataAirLoop->AirLoopControlInfo.deallocate(); + state->dataAirLoop->AirLoopControlInfo.deallocate(); DataHeatBalance::ZoneIntGain.deallocate(); dd_airterminal.deallocate(); DataZoneEquipment::ZoneEquipConfig.deallocate(); - state.dataAirLoop->AirLoopFlow.deallocate(); + state->dataAirLoop->AirLoopFlow.deallocate(); } // TEST_F( EnergyPlusFixture, AirTerminalDualDuct_GetInputTest ) { @@ -291,12 +293,12 @@ TEST_F(EnergyPlusFixture, TestDualDuctOAMassFlowRateUsingStdRhoAir) // DataGlobals::MinutesPerTimeStep = 60; // must initialize this to get schedules initialized // ScheduleManager::ProcessScheduleInput(); // read schedules // -// HeatBalanceManager::GetZoneData(state, ErrorsFound ); +// HeatBalanceManager::GetZoneData(*state, ErrorsFound ); // ASSERT_FALSE( ErrorsFound ); // // DataZoneEquipment::GetZoneEquipmentData1(); // ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(); -// DualDuct::GetDualDuctInput(state); +// DualDuct::GetDualDuctInput(*state); // // EXPECT_EQ(3u, dd_airterminal.size()); // EXPECT_EQ( DualDuct::DualDuct_ConstantVolume, dd_airterminal( 1 ).dd_airterminalType ); @@ -346,8 +348,8 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_GetInputs) ASSERT_TRUE(process_idf(idf_objects)); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - DualDuct::GetDualDuctInput(state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + DualDuct::GetDualDuctInput(*state); //dual duct VAV air terminal get input test EXPECT_EQ(dd_airterminal(1).DamperType, DualDuct_VariableVolume); // dual duct VAV Type @@ -427,28 +429,28 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) bool ErrorsFound = false; bool FirstHVACIteration = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(state); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); + ScheduleManager::UpdateScheduleValues(*state); DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - DualDuct::GetDualDuctInput(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + DualDuct::GetDualDuctInput(*state); auto &thisDDAirTerminal = DualDuct::dd_airterminal(DDNum); @@ -478,13 +480,13 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) DataLoopNode::Node(OutNode).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(HotInNode).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(HotInNode).MassFlowRateMaxAvail = SysMaxMassFlowRes; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - DualDuct::dd_airterminal(DDNum).InitDualDuct(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + DualDuct::dd_airterminal(DDNum).InitDualDuct(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - thisDDAirTerminal.InitDualDuct(state, FirstHVACIteration); - thisDDAirTerminal.SimDualDuctVarVol(state, ZoneNum, ZoneNodeNum); + thisDDAirTerminal.InitDualDuct(*state, FirstHVACIteration); + thisDDAirTerminal.SimDualDuctVarVol(*state, ZoneNum, ZoneNodeNum); // check inputs and calculated values for turndown fraction set to 1.0 EXPECT_EQ(0.3, thisDDAirTerminal.ZoneMinAirFracDes); EXPECT_EQ(1.0, thisDDAirTerminal.ZoneTurndownMinAirFrac); @@ -502,13 +504,13 @@ TEST_F(EnergyPlusFixture, DualDuctVAVAirTerminals_MinFlowTurnDownTest) DataLoopNode::Node(OutNode).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(HotInNode).MassFlowRate = SysMaxMassFlowRes; DataLoopNode::Node(HotInNode).MassFlowRateMaxAvail = SysMaxMassFlowRes; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - DualDuct::dd_airterminal(DDNum).InitDualDuct(state, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + DualDuct::dd_airterminal(DDNum).InitDualDuct(*state, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - thisDDAirTerminal.InitDualDuct(state, FirstHVACIteration); - thisDDAirTerminal.SimDualDuctVarVol(state, ZoneNum, ZoneNodeNum); + thisDDAirTerminal.InitDualDuct(*state, FirstHVACIteration); + thisDDAirTerminal.SimDualDuctVarVol(*state, ZoneNum, ZoneNodeNum); // check inputs and calculated values for turndown fraction set to 0.5 EXPECT_EQ(0.3, thisDDAirTerminal.ZoneMinAirFracDes); EXPECT_EQ(0.5, thisDDAirTerminal.ZoneTurndownMinAirFrac); diff --git a/tst/EnergyPlus/unit/EMSManager.unit.cc b/tst/EnergyPlus/unit/EMSManager.unit.cc index bb6ba378e6b..537a363cd8b 100644 --- a/tst/EnergyPlus/unit/EMSManager.unit.cc +++ b/tst/EnergyPlus/unit/EMSManager.unit.cc @@ -52,6 +52,7 @@ // EnergyPlus Headers #include "Fixtures/EnergyPlusFixture.hh" +#include #include #include #include @@ -158,16 +159,16 @@ TEST_F(EnergyPlusFixture, Dual_NodeTempSetpoints) ASSERT_TRUE(process_idf(idf_objects)); - OutAirNodeManager::SetOutAirNodes(state); + OutAirNodeManager::SetOutAirNodes(*state); - EMSManager::CheckIfAnyEMS(state); + EMSManager::CheckIfAnyEMS(*state); EMSManager::FinishProcessingUserInput = true; bool anyRan; - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_NEAR(DataLoopNode::Node(1).TempSetPointHi, 20.0, 0.000001); @@ -199,8 +200,8 @@ TEST_F(EnergyPlusFixture, CheckActuatorInit) }); ASSERT_TRUE(process_idf(idf_objects)); - OutAirNodeManager::SetOutAirNodes(state); - EMSManager::GetEMSInput(state); + OutAirNodeManager::SetOutAirNodes(*state); + EMSManager::GetEMSInput(*state); // now check that Erl variable is Null EXPECT_EQ(DataRuntimeLanguage::ErlVariable(1).Value.Type, DataRuntimeLanguage::ValueNull); @@ -233,7 +234,7 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetActuatedBranchFlo ASSERT_TRUE(process_idf(idf_objects)); // sets number of EMS objects - EMSManager::CheckIfAnyEMS(state); + EMSManager::CheckIfAnyEMS(*state); // allows NodeSetpoint and AvailabilityManagers actuators to be setup EMSManager::FinishProcessingUserInput = true; @@ -283,20 +284,20 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetActuatedBranchFlo bool anyRan; // set up EMS - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); // set dummy EMS value PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideValue = 1.0; // dummy value set above should be zero'd on this call since EMS 0's values on begin environment (whether EMS program runs on this call or not) - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_FALSE(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideOn); EXPECT_NEAR(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideValue, 0.0, 0.000001); // expect node data to represent full flow - // SetActuatedBranchFlowRate(state, CompFlow, ActuatedNode, LoopNum, LoopSideNum, BranchNum, ResetMode ) - SetActuatedBranchFlowRate(state, NodeMdot, 1, 1, 1, 1, false); + // SetActuatedBranchFlowRate(*state, CompFlow, ActuatedNode, LoopNum, LoopSideNum, BranchNum, ResetMode ) + SetActuatedBranchFlowRate(*state, NodeMdot, 1, 1, 1, 1, false); EXPECT_EQ(Node(1).MassFlowRate, NodeMdot); EXPECT_EQ(Node(1).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(1).MassFlowRateMaxAvail, NodeMdot); @@ -305,7 +306,7 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetActuatedBranchFlo EXPECT_EQ(Node(2).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateRequest, NodeMdot); - SetActuatedBranchFlowRate(state, NodeMdot, 2, 1, 1, 1, false); + SetActuatedBranchFlowRate(*state, NodeMdot, 2, 1, 1, 1, false); EXPECT_EQ(Node(2).MassFlowRate, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); @@ -319,11 +320,11 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetActuatedBranchFlo PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideValue = 1.0; // dummy value set above should remain on this call since EMS calling manager uses BeginTimestepBeforePredictor as the calling point - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironmentAfterWarmUp, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginNewEnvironmentAfterWarmUp, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_FALSE(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideOn); EXPECT_NEAR(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideValue, 1.0, 0.000001); - SetActuatedBranchFlowRate(state, NodeMdot, 1, 1, 1, 1, false); + SetActuatedBranchFlowRate(*state, NodeMdot, 1, 1, 1, 1, false); EXPECT_EQ(Node(1).MassFlowRate, NodeMdot); EXPECT_EQ(Node(1).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(1).MassFlowRateMaxAvail, NodeMdot); @@ -332,7 +333,7 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetActuatedBranchFlo EXPECT_EQ(Node(2).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateRequest, NodeMdot); - SetActuatedBranchFlowRate(state, NodeMdot, 2, 1, 1, 1, false); + SetActuatedBranchFlowRate(*state, NodeMdot, 2, 1, 1, 1, false); EXPECT_EQ(Node(2).MassFlowRate, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); @@ -344,13 +345,13 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetActuatedBranchFlo // dummy value set above should reset to 0 on this call since EMS calling manager uses BeginTimestepBeforePredictor as the calling point // override flag should also be true - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_TRUE(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideOn); EXPECT_NEAR(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideValue, 0.0, 0.000001); // expect node data to represent no flow. Request is also 0's in this function. Max and MaxAvail are not changed - SetActuatedBranchFlowRate(state, NodeMdot, 1, 1, 1, 1, false); + SetActuatedBranchFlowRate(*state, NodeMdot, 1, 1, 1, 1, false); EXPECT_EQ(Node(1).MassFlowRate, 0.0); EXPECT_EQ(Node(1).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(1).MassFlowRateMaxAvail, NodeMdot); @@ -359,7 +360,7 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetActuatedBranchFlo EXPECT_EQ(Node(2).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateRequest, 0.0); - SetActuatedBranchFlowRate(state, NodeMdot, 2, 1, 1, 1, false); + SetActuatedBranchFlowRate(*state, NodeMdot, 2, 1, 1, 1, false); EXPECT_EQ(Node(2).MassFlowRate, 0.0); EXPECT_EQ(Node(2).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); @@ -397,7 +398,7 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetComponentFlowRate ASSERT_TRUE(process_idf(idf_objects)); // sets number of EMS objects - EMSManager::CheckIfAnyEMS(state); + EMSManager::CheckIfAnyEMS(*state); // allows NodeSetpoint and AvailabilityManagers actuators to be setup EMSManager::FinishProcessingUserInput = true; @@ -447,19 +448,19 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetComponentFlowRate bool anyRan; // set up EMS - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); // set dummy EMS value PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideValue = 1.0; // dummy value set above should be zero'd on this call since EMS 0's values on begin environment (whether EMS program runs on this call or not) - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_FALSE(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideOn); EXPECT_NEAR(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideValue, 0.0, 0.000001); // expect node data to represent full flow - // SetComponentFlowRate(state, CompFlow, InletNode, OutletNode, LoopNum, LoopSideNum, BranchIndex, CompIndex ) - SetComponentFlowRate(state, NodeMdot, 1, 2, 1, 1, 1, 1); + // SetComponentFlowRate(*state, CompFlow, InletNode, OutletNode, LoopNum, LoopSideNum, BranchIndex, CompIndex ) + SetComponentFlowRate(*state, NodeMdot, 1, 2, 1, 1, 1, 1); EXPECT_EQ(Node(1).MassFlowRate, NodeMdot); EXPECT_EQ(Node(1).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(1).MassFlowRateMaxAvail, NodeMdot); @@ -468,7 +469,7 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetComponentFlowRate EXPECT_EQ(Node(2).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateRequest, NodeMdot); - SetComponentFlowRate(state, NodeMdot, 2, 3, 1, 1, 1, 1); + SetComponentFlowRate(*state, NodeMdot, 2, 3, 1, 1, 1, 1); EXPECT_EQ(Node(2).MassFlowRate, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); @@ -482,13 +483,13 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetComponentFlowRate PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideValue = 1.0; // dummy value set above should remain on this call since EMS calling manager uses BeginTimestepBeforePredictor as the calling point - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironmentAfterWarmUp, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginNewEnvironmentAfterWarmUp, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_FALSE(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideOn); EXPECT_NEAR(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideValue, 1.0, 0.000001); // expect node data to represent full flow - SetComponentFlowRate(state, NodeMdot, 1, 2, 1, 1, 1, 1); + SetComponentFlowRate(*state, NodeMdot, 1, 2, 1, 1, 1, 1); EXPECT_EQ(Node(1).MassFlowRate, NodeMdot); EXPECT_EQ(Node(1).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(1).MassFlowRateMaxAvail, NodeMdot); @@ -497,7 +498,7 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetComponentFlowRate EXPECT_EQ(Node(2).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateRequest, NodeMdot); - SetComponentFlowRate(state, NodeMdot, 2, 3, 1, 1, 1, 1); + SetComponentFlowRate(*state, NodeMdot, 2, 3, 1, 1, 1, 1); EXPECT_EQ(Node(2).MassFlowRate, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); @@ -509,14 +510,14 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetComponentFlowRate // dummy value set above should reset to 0 on this call since EMS calling manager uses BeginTimestepBeforePredictor as the calling point // override flag should also be true - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_TRUE(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideOn); EXPECT_NEAR(PlantLoop(1).LoopSide(1).Branch(1).Comp(1).EMSLoadOverrideValue, 0.0, 0.000001); Real64 tempNodeMdot(NodeMdot); // expect node data to represent no flow. Max, MaxAvail, and Request are not changed - SetComponentFlowRate(state, tempNodeMdot, 1, 2, 1, 1, 1, 1); + SetComponentFlowRate(*state, tempNodeMdot, 1, 2, 1, 1, 1, 1); EXPECT_EQ(Node(1).MassFlowRate, 0.0); EXPECT_EQ(Node(1).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(1).MassFlowRateMaxAvail, NodeMdot); @@ -526,7 +527,7 @@ TEST_F(EnergyPlusFixture, SupervisoryControl_PlantComponent_SetComponentFlowRate EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateRequest, NodeMdot); tempNodeMdot = NodeMdot; - SetComponentFlowRate(state, tempNodeMdot, 2, 3, 1, 1, 1, 1); + SetComponentFlowRate(*state, tempNodeMdot, 2, 3, 1, 1, 1, 1); EXPECT_EQ(Node(2).MassFlowRate, 0.0); EXPECT_EQ(Node(2).MassFlowRateMax, NodeMdot); EXPECT_EQ(Node(2).MassFlowRateMaxAvail, NodeMdot); @@ -702,13 +703,13 @@ TEST_F(EnergyPlusFixture, Test_EMSLogic) ASSERT_TRUE(process_idf(idf_objects)); - OutAirNodeManager::SetOutAirNodes(state); + OutAirNodeManager::SetOutAirNodes(*state); - EMSManager::CheckIfAnyEMS(state); + EMSManager::CheckIfAnyEMS(*state); EMSManager::FinishProcessingUserInput = true; bool anyRan; - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_NEAR(DataLoopNode::Node(1).TempSetPoint, 11.0, 0.0000001); EXPECT_NEAR(DataLoopNode::Node(2).TempSetPoint, 12.0, 0.0000001); @@ -718,7 +719,7 @@ TEST_F(EnergyPlusFixture, Test_EMSLogic) EXPECT_NEAR(DataLoopNode::Node(6).TempSetPoint, 16.0, 0.0000001); EXPECT_NEAR(DataLoopNode::Node(7).TempSetPoint, 17.0, 0.0000001); - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_NEAR(DataLoopNode::Node(1).TempSetPoint, 21.0, 0.0000001); EXPECT_NEAR(DataLoopNode::Node(2).TempSetPoint, 22.0, 0.0000001); @@ -770,13 +771,13 @@ TEST_F(EnergyPlusFixture, Debug_EMSLogic) ASSERT_TRUE(process_idf(idf_objects)); - OutAirNodeManager::SetOutAirNodes(state); + OutAirNodeManager::SetOutAirNodes(*state); - EMSManager::CheckIfAnyEMS(state); + EMSManager::CheckIfAnyEMS(*state); EMSManager::FinishProcessingUserInput = true; bool anyRan; - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_NEAR(DataLoopNode::Node(1).TempSetPoint, 1.0, 0.0000001); } @@ -808,20 +809,20 @@ TEST_F(EnergyPlusFixture, TestAnyRanArgument) ASSERT_TRUE(process_idf(idf_objects)); - OutAirNodeManager::SetOutAirNodes(state); - NodeInputManager::SetupNodeVarsForReporting(state); - EMSManager::CheckIfAnyEMS(state); + OutAirNodeManager::SetOutAirNodes(*state); + NodeInputManager::SetupNodeVarsForReporting(*state); + EMSManager::CheckIfAnyEMS(*state); EMSManager::FinishProcessingUserInput = true; bool anyRan; - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_FALSE(anyRan); - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_FALSE(anyRan); - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::HVACIterationLoop, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::HVACIterationLoop, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_TRUE(anyRan); } @@ -847,17 +848,17 @@ TEST_F(EnergyPlusFixture, TestUnInitializedEMSVariable1) ASSERT_TRUE(process_idf(idf_objects)); - EMSManager::CheckIfAnyEMS(state); + EMSManager::CheckIfAnyEMS(*state); EMSManager::FinishProcessingUserInput = true; bool anyRan; - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); // Find the variable in the list int internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TempSetpoint1", 0); ASSERT_GT(internalVarNum, 0); // Expect the variable to not yet be initialized EXPECT_FALSE(ErlVariable(internalVarNum).Value.initialized); // next run a small program that sets the value - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginNewEnvironment, anyRan, ObjexxFCL::Optional_int_const()); // check that it worked and the value came thru EXPECT_NEAR(ErlVariable(internalVarNum).Value.Number, 21.0, 0.0000001); // check of state to see if now initialized @@ -903,27 +904,27 @@ TEST_F(EnergyPlusFixture, TestUnInitializedEMSVariable2) ASSERT_TRUE(process_idf(idf_objects)); - OutAirNodeManager::SetOutAirNodes(state); + OutAirNodeManager::SetOutAirNodes(*state); - EMSManager::CheckIfAnyEMS(state); + EMSManager::CheckIfAnyEMS(*state); EMSManager::FinishProcessingUserInput = true; bool anyRan; - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); // Expect the variable to not yet be initialized, call EvaluateExpresssion and check argument ErlValueType ReturnValue; bool seriousErrorFound = false; EMSManager::FinishProcessingUserInput = false; - ReturnValue = RuntimeLanguageProcessor::EvaluateExpression(state, + ReturnValue = RuntimeLanguageProcessor::EvaluateExpression(*state, ErlStack(UtilityRoutines::FindItemInList("SETNODESETPOINTTEST", ErlStack)).Instruction(1).Argument2, seriousErrorFound); // we just check the logic and don't throw the fatal errors. EXPECT_TRUE(seriousErrorFound); // next run a small program that sets the global variable value - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor, anyRan, ObjexxFCL::Optional_int_const()); // now check that it worked, should stay false seriousErrorFound = false; - ReturnValue = RuntimeLanguageProcessor::EvaluateExpression(state, + ReturnValue = RuntimeLanguageProcessor::EvaluateExpression(*state, ErlStack(UtilityRoutines::FindItemInList("SETNODESETPOINTTEST", ErlStack)).Instruction(1).Argument2, seriousErrorFound); EXPECT_FALSE(seriousErrorFound); } @@ -940,8 +941,8 @@ TEST_F(EnergyPlusFixture, EMSManager_CheckIfAnyEMS_OutEMS) ASSERT_TRUE(process_idf(idf_objects)); - CheckIfAnyEMS(state); - EXPECT_TRUE(state.dataGlobal->AnyEnergyManagementSystemInModel); + CheckIfAnyEMS(*state); + EXPECT_TRUE(state->dataGlobal->AnyEnergyManagementSystemInModel); } TEST_F(EnergyPlusFixture, EMSManager_TestFuntionCall) @@ -1080,16 +1081,16 @@ TEST_F(EnergyPlusFixture, EMSManager_TestFuntionCall) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZone = 0.25; - EMSManager::CheckIfAnyEMS(state); // get EMS input + EMSManager::CheckIfAnyEMS(*state); // get EMS input EMSManager::FinishProcessingUserInput = true; bool ErrorsFound(false); - CurveManager::GetCurveInputData(state, ErrorsFound); // process curve for use with EMS + CurveManager::GetCurveInputData(*state, ErrorsFound); // process curve for use with EMS EXPECT_FALSE(ErrorsFound); bool anyRan; - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::HVACIterationLoop, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::HVACIterationLoop, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_TRUE(anyRan); for (int i = 1; i <= 6; ++i) { @@ -1099,7 +1100,7 @@ TEST_F(EnergyPlusFixture, EMSManager_TestFuntionCall) DataRuntimeLanguage::TrendVariable(i).TrendValARR(4) = 4.4; } - EMSManager::ManageEMS(state, + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::HVACIterationLoop, anyRan, ObjexxFCL::Optional_int_const()); // process trend functions again using above data @@ -1586,7 +1587,7 @@ TEST_F(EnergyPlusFixture, EMSManager_TestWindowShadingControlExteriorScreenOptio // #7586 DataSurfaces::Surface.allocate(2); EnergyPlus::SurfaceGeometry::AllocateSurfaceWindows(2); - state.dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct.allocate(1); DataSurfaces::WindowShadingControl.allocate(2); DataDaylighting::ZoneDaylight.allocate(1); DataSurfaces::Surface(1).Name = "Surface1"; @@ -1607,17 +1608,17 @@ TEST_F(EnergyPlusFixture, EMSManager_TestWindowShadingControlExteriorScreenOptio DataSurfaces::Surface(1).activeShadedConstruction = 1; DataSurfaces::Surface(2).activeShadedConstruction = 1; - state.dataConstruction->Construct(1).Name = "Construction1"; + state->dataConstruction->Construct(1).Name = "Construction1"; DataSurfaces::WindowShadingControl(1).ShadingType = 0; DataSurfaces::WindowShadingControl(2).ShadingType = DataSurfaces::WSC_ST_ExteriorScreen; DataSurfaces::TotSurfaces = 2; - DataSurfaces::Surface(1).activeWindowShadingControl = DataSurfaces::Surface(1).windowShadingControlList[SolarShading::selectActiveWindowShadingControlIndex(state, 1)]; - DataSurfaces::Surface(2).activeWindowShadingControl = DataSurfaces::Surface(1).windowShadingControlList[SolarShading::selectActiveWindowShadingControlIndex(state, 2)]; + DataSurfaces::Surface(1).activeWindowShadingControl = DataSurfaces::Surface(1).windowShadingControlList[SolarShading::selectActiveWindowShadingControlIndex(*state, 1)]; + DataSurfaces::Surface(2).activeWindowShadingControl = DataSurfaces::Surface(1).windowShadingControlList[SolarShading::selectActiveWindowShadingControlIndex(*state, 2)]; - SetupWindowShadingControlActuators(state); + SetupWindowShadingControlActuators(*state); EXPECT_FALSE(DataSurfaces::SurfWinShadingFlagEMSOn(2)); EXPECT_EQ(DataSurfaces::SurfWinShadingFlagEMSValue(2), 0); @@ -1625,10 +1626,10 @@ TEST_F(EnergyPlusFixture, EMSManager_TestWindowShadingControlExteriorScreenOptio DataHeatBalance::Zone.allocate(1); DataHeatBalance::Zone(1).WindowSurfaceFirst = 1; DataHeatBalance::Zone(1).WindowSurfaceLast = 2; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataSurfaces::SurfWinShadingFlagEMSOn(2) = true; DataSurfaces::SurfWinShadingFlagEMSValue(2) = 1.0; - SolarShading::WindowShadingManager(state); + SolarShading::WindowShadingManager(*state); EXPECT_EQ(DataSurfaces::SurfWinShadingFlag(2), DataSurfaces::SurfWinShadingFlagEMSValue(2)); } @@ -1733,25 +1734,25 @@ TEST_F(EnergyPlusFixture, EMS_WeatherDataActuators) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataWeatherManager->LocationGathered = false; + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataWeatherManager->LocationGathered = false; - EMSManager::CheckIfAnyEMS(state); + EMSManager::CheckIfAnyEMS(*state); bool available = false; bool errorsFound = false; - WeatherManager::GetNextEnvironment(state, available, errorsFound); + WeatherManager::GetNextEnvironment(*state, available, errorsFound); ASSERT_FALSE(errorsFound); EMSManager::FinishProcessingUserInput = true; // Initialize all sorts of weather stuff - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->BeginDayFlag = true; - WeatherManager::ManageWeather(state); + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginDayFlag = true; + WeatherManager::ManageWeather(*state); EXPECT_NEAR(DataEnvironment::OutDryBulbTemp, 50.0, 0.000001); EXPECT_NEAR(DataEnvironment::OutDewPointTemp, 25.0, 0.000001); @@ -1761,12 +1762,12 @@ TEST_F(EnergyPlusFixture, EMS_WeatherDataActuators) EXPECT_NEAR(DataEnvironment::WindSpeed, 5.5, 0.000001); EXPECT_NEAR(DataEnvironment::WindDir, 32.1, 0.000001); - state.dataGlobal->TimeStep = 3; - state.dataGlobal->HourOfDay = 8; - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->BeginEnvrnFlag = false; - state.dataGlobal->BeginDayFlag = false; - WeatherManager::ManageWeather(state); + state->dataGlobal->TimeStep = 3; + state->dataGlobal->HourOfDay = 8; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginDayFlag = false; + WeatherManager::ManageWeather(*state); EXPECT_NEAR(DataEnvironment::OutDryBulbTemp, 50.0, 0.000001); EXPECT_NEAR(DataEnvironment::OutDewPointTemp, 25.0, 0.000001); @@ -1861,25 +1862,25 @@ TEST_F(EnergyPlusFixture, EMS_TodayTomorrowFunctions) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataWeatherManager->LocationGathered = false; + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataWeatherManager->LocationGathered = false; - EMSManager::CheckIfAnyEMS(state); + EMSManager::CheckIfAnyEMS(*state); bool available = false; bool errorsFound = false; - WeatherManager::GetNextEnvironment(state, available, errorsFound); + WeatherManager::GetNextEnvironment(*state, available, errorsFound); ASSERT_FALSE(errorsFound); EMSManager::FinishProcessingUserInput = true; // Initialize all sorts of weather stuff - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->BeginDayFlag = true; - WeatherManager::ManageWeather(state); + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginDayFlag = true; + WeatherManager::ManageWeather(*state); // Note that operands for these functions are Hour (0:23) then Timestep // In the EMS code above, they are all using Hour = 5 and Timestep=3 @@ -1889,117 +1890,117 @@ TEST_F(EnergyPlusFixture, EMS_TodayTomorrowFunctions) int internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayRain", 1); ASSERT_GT(internalVarNum, 0); bool rainTrueFalse = (ErlVariable(internalVarNum).Value.Number > 0.0); - EXPECT_EQ(state.dataWeatherManager->TodayIsRain(3,5+1), rainTrueFalse); + EXPECT_EQ(state->dataWeatherManager->TodayIsRain(3,5+1), rainTrueFalse); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodaySnow", 1); ASSERT_GT(internalVarNum, 0); bool snowTrueFalse = (ErlVariable(internalVarNum).Value.Number > 0.0); - EXPECT_EQ(state.dataWeatherManager->TodayIsRain(3, 5 + 1), snowTrueFalse); + EXPECT_EQ(state->dataWeatherManager->TodayIsRain(3, 5 + 1), snowTrueFalse); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayDryBulb", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodayOutDryBulbTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodayOutDryBulbTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayDewPoint", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodayOutDewPointTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodayOutDewPointTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayBaroPress", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodayOutBaroPress(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodayOutBaroPress(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayRelHum", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodayOutRelHum(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodayOutRelHum(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayWindSpd", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodayWindSpeed(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodayWindSpeed(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayWindDirect", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodayWindDir(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodayWindDir(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodaySkyT", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodaySkyTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodaySkyTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayHorIR", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodayHorizIRSky(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodayHorizIRSky(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayBeamSol", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodayBeamSolarRad(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodayBeamSolarRad(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayDifSol", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodayDifSolarRad(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodayDifSolarRad(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayAlb", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodayAlbedo(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodayAlbedo(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TodayPrecip", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TodayLiquidPrecip(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TodayLiquidPrecip(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); // TodayIsRain and TodayIsSnow are logicals, but the ems functions returns 0 or 1 internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowRain", 1); ASSERT_GT(internalVarNum, 0); rainTrueFalse = (ErlVariable(internalVarNum).Value.Number > 0.0); - EXPECT_EQ(state.dataWeatherManager->TomorrowIsRain(3, 5 + 1), rainTrueFalse); + EXPECT_EQ(state->dataWeatherManager->TomorrowIsRain(3, 5 + 1), rainTrueFalse); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowSnow", 1); ASSERT_GT(internalVarNum, 0); snowTrueFalse = (ErlVariable(internalVarNum).Value.Number > 0.0); - EXPECT_EQ(state.dataWeatherManager->TomorrowIsRain(3, 5 + 1), snowTrueFalse); + EXPECT_EQ(state->dataWeatherManager->TomorrowIsRain(3, 5 + 1), snowTrueFalse); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowDryBulb", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowOutDryBulbTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOutDryBulbTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowDewPoint", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowOutDewPointTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOutDewPointTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowBaroPress", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowOutBaroPress(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOutBaroPress(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowRelHum", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowOutRelHum(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowOutRelHum(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowWindSpd", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowWindSpeed(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowWindSpeed(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowWindDirect", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowWindDir(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowWindDir(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowSkyT", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowSkyTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowSkyTemp(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowHorIR", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowHorizIRSky(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowHorizIRSky(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowBeamSol", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowBeamSolarRad(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowBeamSolarRad(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowDifSol", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowDifSolarRad(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowDifSolarRad(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowAlb", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowAlbedo(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowAlbedo(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); internalVarNum = RuntimeLanguageProcessor::FindEMSVariable("TomorrowPrecip", 1); ASSERT_GT(internalVarNum, 0); - EXPECT_NEAR(state.dataWeatherManager->TomorrowLiquidPrecip(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowLiquidPrecip(3, 5 + 1), ErlVariable(internalVarNum).Value.Number, 0.000001); } diff --git a/tst/EnergyPlus/unit/EarthTube.unit.cc b/tst/EnergyPlus/unit/EarthTube.unit.cc index ba7f2aa1e56..186f8b519f2 100644 --- a/tst/EnergyPlus/unit/EarthTube.unit.cc +++ b/tst/EnergyPlus/unit/EarthTube.unit.cc @@ -56,6 +56,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::EarthTube; @@ -95,12 +96,12 @@ TEST_F(EnergyPlusFixture, EarthTube_CalcEarthTubeHumRatTest) EAMFL(ZNnum) = 0.05; // First case--no condensation so inside humidity ratio should be the same as the outdoor humidity ratio - CalcEarthTubeHumRat(state, ETnum, ZNnum); + CalcEarthTubeHumRat(*state, ETnum, ZNnum); EXPECT_EQ(EarthTubeSys(ETnum).HumRat, OutHumRat); // Second case--condensation so inside humidity should be less than outdoor humidity ratio EarthTubeSys(ETnum).InsideAirTemp = 10.0; - CalcEarthTubeHumRat(state, ETnum, ZNnum); + CalcEarthTubeHumRat(*state, ETnum, ZNnum); EXPECT_GT(OutHumRat, EarthTubeSys(ETnum).HumRat); } @@ -123,12 +124,12 @@ TEST_F(EnergyPlusFixture, EarthTube_CheckEarthTubesInZonesTest) EarthTubeSys(3).ZonePtr = 3; // First case--no conflicts, only one earth tube per zone (ErrorsFound = false) - CheckEarthTubesInZones(state, ZoneName, InputName, ErrorsFound); + CheckEarthTubesInZones(*state, ZoneName, InputName, ErrorsFound); EXPECT_EQ(ErrorsFound, false); // Second case--conflict with the last earth tube and first (ErrorsFound = true) EarthTubeSys(3).ZonePtr = 1; - CheckEarthTubesInZones(state, ZoneName, InputName, ErrorsFound); + CheckEarthTubesInZones(*state, ZoneName, InputName, ErrorsFound); EXPECT_EQ(ErrorsFound, true); EarthTubeSys.deallocate(); diff --git a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc index 219b304430a..0455674fa2a 100644 --- a/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc +++ b/tst/EnergyPlus/unit/EconomicLifeCycleCost.unit.cc @@ -57,6 +57,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -253,7 +254,7 @@ TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_GetInput) ASSERT_TRUE(process_idf(idf_objects)); - GetInputForLifeCycleCost(state); + GetInputForLifeCycleCost(*state); EXPECT_EQ(disConvEndOfYear, discountConvension); EXPECT_EQ(inflAppConstantDollar, inflationApproach); @@ -390,7 +391,7 @@ TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_ProcessMaxInput) ASSERT_TRUE(process_idf(idf_objects)); - GetInputForLifeCycleCost(state); + GetInputForLifeCycleCost(*state); EXPECT_EQ(disConvEndOfYear, discountConvension); EXPECT_EQ(inflAppConstantDollar, inflationApproach); @@ -545,7 +546,7 @@ TEST_F(EnergyPlusFixture, EconomicLifeCycleCost_ExpressAsCashFlows) NonrecurringCost(1).startOfCosts = startServicePeriod; NonrecurringCost(1).totalMonthsFromStart = 10; - ExpressAsCashFlows(state); + ExpressAsCashFlows(*state); EXPECT_NEAR(CashFlow(17).mnAmount(47), 123456., 0.001); // 36 months plus 10 months plus one month diff --git a/tst/EnergyPlus/unit/EconomicTariff.unit.cc b/tst/EnergyPlus/unit/EconomicTariff.unit.cc index 43f042f1269..51d574d9972 100644 --- a/tst/EnergyPlus/unit/EconomicTariff.unit.cc +++ b/tst/EnergyPlus/unit/EconomicTariff.unit.cc @@ -62,6 +62,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -191,7 +192,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_GetInput_Test) ASSERT_TRUE(process_idf(idf_objects)); - UpdateUtilityBills(state); + UpdateUtilityBills(*state); // tariff EXPECT_EQ(1, numTariff); @@ -263,7 +264,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_Water_DefaultConv_Test) EnergyMeters(1).Name = "WATER:FACILITY"; EnergyMeters(1).ResourceType = "WATER"; - UpdateUtilityBills(state); + UpdateUtilityBills(*state); // tariff EXPECT_EQ(1, numTariff); @@ -306,7 +307,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_Water_CCF_Test) EnergyMeters(1).Name = "WATER:FACILITY"; EnergyMeters(1).ResourceType = "WATER"; - UpdateUtilityBills(state);; + UpdateUtilityBills(*state);; // tariff EXPECT_EQ(1, numTariff); @@ -346,7 +347,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_Gas_CCF_Test) EnergyMeters(1).Name = "NATURALGAS:FACILITY"; EnergyMeters(1).ResourceType = "NATURALGAS"; - UpdateUtilityBills(state);; + UpdateUtilityBills(*state);; // tariff EXPECT_EQ(1, numTariff); @@ -387,7 +388,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_Electric_CCF_Test) EnergyMeters(1).Name = "ELECTRICITY:FACILITY"; EnergyMeters(1).ResourceType = "ELECTRICITY"; - UpdateUtilityBills(state);; + UpdateUtilityBills(*state);; // tariff EXPECT_EQ(1, numTariff); @@ -440,7 +441,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_LEEDtariffReporting_Test) tariff(4).totalAnnualEnergy = 1.47; tariff(4).reportMeterIndx = 4; - SetPredefinedTables(state); // need to setup the predefined table entry numbers + SetPredefinedTables(*state); // need to setup the predefined table entry numbers LEEDtariffReporting(); @@ -583,19 +584,19 @@ TEST_F(EnergyPlusFixture, EconomicTariff_GatherForEconomics) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - state.dataGlobal->TimeStepZone = 0.25; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); + state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); - ScheduleManager::ProcessScheduleInput(state); // read schedules - ExteriorEnergyUse::ManageExteriorEnergyUse(state); - EXPECT_EQ(1, state.dataExteriorEnergyUse->NumExteriorLights); - EXPECT_EQ(1000, state.dataExteriorEnergyUse->ExteriorLights(1).DesignLevel); + ScheduleManager::ProcessScheduleInput(*state); // read schedules + ExteriorEnergyUse::ManageExteriorEnergyUse(*state); + EXPECT_EQ(1, state->dataExteriorEnergyUse->NumExteriorLights); + EXPECT_EQ(1000, state->dataExteriorEnergyUse->ExteriorLights(1).DesignLevel); // This will only do the get input routines - EconomicTariff::UpdateUtilityBills(state);; + EconomicTariff::UpdateUtilityBills(*state);; // tariff EXPECT_EQ(1, EconomicTariff::numTariff); @@ -617,7 +618,7 @@ TEST_F(EnergyPlusFixture, EconomicTariff_GatherForEconomics) EXPECT_EQ(EconomicTariff::seasonSummer, EconomicTariff::chargeSimple(2).season); EXPECT_EQ(0.04, EconomicTariff::chargeSimple(2).costPerVal); - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::RunPeriodWeather; // fake a weather run + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::RunPeriodWeather; // fake a weather run // Unitialized: default initialized to 0 EXPECT_EQ(0, EconomicTariff::tariff(1).seasonForMonth(5)); @@ -625,56 +626,56 @@ TEST_F(EnergyPlusFixture, EconomicTariff_GatherForEconomics) DataEnvironment::Month = 5; DataEnvironment::DayOfMonth = 31; - state.dataGlobal->HourOfDay = 23; + state->dataGlobal->HourOfDay = 23; DataEnvironment::DSTIndicator = 1; // DST IS ON DataEnvironment::MonthTomorrow = 6; DataEnvironment::DayOfWeek = 4; DataEnvironment::DayOfWeekTomorrow = 5; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->TimeStep = 4; + state->dataGlobal->TimeStep = 4; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); - EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); - EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(state, tariff(1).seasonSchIndex)); + ScheduleManager::UpdateScheduleValues(*state); + EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); + EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(*state, tariff(1).seasonSchIndex)); EXPECT_EQ(1.0, ScheduleManager::Schedule(seasonSchPtr).CurrentValue); - ExteriorEnergyUse::ManageExteriorEnergyUse(state); + ExteriorEnergyUse::ManageExteriorEnergyUse(*state); - EXPECT_EQ(1000.0, state.dataExteriorEnergyUse->ExteriorLights(1).Power); - EXPECT_EQ(state.dataExteriorEnergyUse->ExteriorLights(1).Power * state.dataGlobal->TimeStepZoneSec, state.dataExteriorEnergyUse->ExteriorLights(1).CurrentUse); + EXPECT_EQ(1000.0, state->dataExteriorEnergyUse->ExteriorLights(1).Power); + EXPECT_EQ(state->dataExteriorEnergyUse->ExteriorLights(1).Power * state->dataGlobal->TimeStepZoneSec, state->dataExteriorEnergyUse->ExteriorLights(1).CurrentUse); int curPeriod = 1; EXPECT_EQ(0, EconomicTariff::tariff(1).gatherEnergy(DataEnvironment::Month, curPeriod)); // This Should now call GatherForEconomics - state.dataGlobal->DoOutputReporting = true; - EconomicTariff::UpdateUtilityBills(state);; + state->dataGlobal->DoOutputReporting = true; + EconomicTariff::UpdateUtilityBills(*state);; EXPECT_EQ(1, EconomicTariff::tariff(1).seasonForMonth(5)); EXPECT_EQ(0, EconomicTariff::tariff(1).seasonForMonth(6)); DataEnvironment::Month = 5; DataEnvironment::DayOfMonth = 31; - state.dataGlobal->HourOfDay = 24; + state->dataGlobal->HourOfDay = 24; DataEnvironment::DSTIndicator = 1; // DST IS ON DataEnvironment::MonthTomorrow = 6; DataEnvironment::DayOfWeek = 4; DataEnvironment::DayOfWeekTomorrow = 5; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); - EXPECT_EQ(3.0, ScheduleManager::GetCurrentScheduleValue(state, tariff(1).seasonSchIndex)); + ScheduleManager::UpdateScheduleValues(*state); + EXPECT_EQ(3.0, ScheduleManager::GetCurrentScheduleValue(*state, tariff(1).seasonSchIndex)); - ExteriorEnergyUse::ManageExteriorEnergyUse(state); + ExteriorEnergyUse::ManageExteriorEnergyUse(*state); - EXPECT_EQ(1000.0, state.dataExteriorEnergyUse->ExteriorLights(1).Power); - EXPECT_EQ(state.dataExteriorEnergyUse->ExteriorLights(1).Power * state.dataGlobal->TimeStepZoneSec, state.dataExteriorEnergyUse->ExteriorLights(1).CurrentUse); + EXPECT_EQ(1000.0, state->dataExteriorEnergyUse->ExteriorLights(1).Power); + EXPECT_EQ(state->dataExteriorEnergyUse->ExteriorLights(1).Power * state->dataGlobal->TimeStepZoneSec, state->dataExteriorEnergyUse->ExteriorLights(1).CurrentUse); // This Should now call GatherForEconomics - EconomicTariff::UpdateUtilityBills(state);; + EconomicTariff::UpdateUtilityBills(*state);; EXPECT_EQ(1, EconomicTariff::tariff(1).seasonForMonth(5)); EXPECT_EQ(3, EconomicTariff::tariff(1).seasonForMonth(6)); diff --git a/tst/EnergyPlus/unit/ElectricBaseboardRadiator.unit.cc b/tst/EnergyPlus/unit/ElectricBaseboardRadiator.unit.cc index e61db022d6f..0716a201394 100644 --- a/tst/EnergyPlus/unit/ElectricBaseboardRadiator.unit.cc +++ b/tst/EnergyPlus/unit/ElectricBaseboardRadiator.unit.cc @@ -59,6 +59,7 @@ #include #include #include +#include #include #include @@ -262,40 +263,40 @@ TEST_F(EnergyPlusFixture, RadConvElecBaseboard_Test1) ASSERT_TRUE(process_idf(idf_objects)); - 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 + 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 bool errorsFound(false); - HeatBalanceManager::GetProjectControlData(state, errorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetMaterialData(state, errorsFound); // read material data + HeatBalanceManager::GetMaterialData(*state, errorsFound); // read material data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetConstructData(state, errorsFound); // read construction data + HeatBalanceManager::GetConstructData(*state, errorsFound); // read construction data EXPECT_FALSE(errorsFound); // expect no errors - HeatBalanceManager::GetZoneData(state, errorsFound); + HeatBalanceManager::GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, errorsFound); + SurfaceGeometry::GetSurfaceData(*state, errorsFound); ASSERT_FALSE(errorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); - ElectricBaseboardRadiator::GetElectricBaseboardInput(state); + ElectricBaseboardRadiator::GetElectricBaseboardInput(*state); EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(1).ZonePtr, 1); EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(2).ZonePtr, 2); } @@ -553,43 +554,43 @@ TEST_F(EnergyPlusFixture, ElectricBaseboardRadConv_SizingTest) ASSERT_TRUE(process_idf(idf_objects)); - 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 + 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 bool errorsFound(false); - HeatBalanceManager::GetProjectControlData(state, errorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetMaterialData(state, errorsFound); // read material data + HeatBalanceManager::GetMaterialData(*state, errorsFound); // read material data EXPECT_FALSE(errorsFound); // expect no errors errorsFound = false; - HeatBalanceManager::GetConstructData(state, errorsFound); // read construction data + HeatBalanceManager::GetConstructData(*state, errorsFound); // read construction data EXPECT_FALSE(errorsFound); // expect no errors - HeatBalanceManager::GetZoneData(state, errorsFound); + HeatBalanceManager::GetZoneData(*state, errorsFound); ASSERT_FALSE(errorsFound); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(3); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(3); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(3); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(3); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, errorsFound); + SurfaceGeometry::GetSurfaceData(*state, errorsFound); ASSERT_FALSE(errorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); // get electric baseboard inputs - ElectricBaseboardRadiator::GetElectricBaseboardInput(state); + ElectricBaseboardRadiator::GetElectricBaseboardInput(*state); EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(1).ZonePtr, 1); EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(2).ZonePtr, 2); @@ -608,13 +609,13 @@ TEST_F(EnergyPlusFixture, ElectricBaseboardRadConv_SizingTest) ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).HeatingCapMethod; DataSizing::FinalZoneSizing(CntrlZoneNum).NonAirSysDesHeatLoad = 2000.0; // do electric baseboard sizing - ElectricBaseboardRadiator::SizeElectricBaseboard(state, BaseboardNum); + ElectricBaseboardRadiator::SizeElectricBaseboard(*state, BaseboardNum); // check user specified hardsized nominal capacity EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).ScaledHeatingCapacity, 1000.0); EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).NominalCapacity, 1000.0); // check nominal capacity autosize ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).ScaledHeatingCapacity = DataSizing::AutoSize; - ElectricBaseboardRadiator::SizeElectricBaseboard(state, BaseboardNum); + ElectricBaseboardRadiator::SizeElectricBaseboard(*state, BaseboardNum); EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).NominalCapacity, 2000.0); BaseboardNum = 2; @@ -627,14 +628,14 @@ TEST_F(EnergyPlusFixture, ElectricBaseboardRadConv_SizingTest) DataSizing::FinalZoneSizing(CntrlZoneNum).NonAirSysDesHeatLoad = 2000.0; DataHeatBalance::Zone(CntrlZoneNum).FloorArea = 100.0; // do electric baseboard sizing - ElectricBaseboardRadiator::SizeElectricBaseboard(state, BaseboardNum); + ElectricBaseboardRadiator::SizeElectricBaseboard(*state, BaseboardNum); // check user specified hardsized nominal capacity EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).ScaledHeatingCapacity, 30.0); EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).NominalCapacity, 3000.0); // check nominal capacity autosize ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).HeatingCapMethod = DataSizing::HeatingDesignCapacity; ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).ScaledHeatingCapacity = DataSizing::AutoSize; - ElectricBaseboardRadiator::SizeElectricBaseboard(state, BaseboardNum); + ElectricBaseboardRadiator::SizeElectricBaseboard(*state, BaseboardNum); EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).NominalCapacity, 2000.0); BaseboardNum = 3; @@ -647,14 +648,14 @@ TEST_F(EnergyPlusFixture, ElectricBaseboardRadConv_SizingTest) DataSizing::FinalZoneSizing(CntrlZoneNum).NonAirSysDesHeatLoad = 3000.0; DataHeatBalance::Zone(CntrlZoneNum).FloorArea = 100.0; // do electric baseboard sizing - ElectricBaseboardRadiator::SizeElectricBaseboard(state, BaseboardNum); + ElectricBaseboardRadiator::SizeElectricBaseboard(*state, BaseboardNum); // check user specified hardsized nominal capacity EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).ScaledHeatingCapacity, 0.50); EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).NominalCapacity, 1500.0); // check nominal capacity autosize ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).HeatingCapMethod = DataSizing::HeatingDesignCapacity; ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).ScaledHeatingCapacity = DataSizing::AutoSize; - ElectricBaseboardRadiator::SizeElectricBaseboard(state, BaseboardNum); + ElectricBaseboardRadiator::SizeElectricBaseboard(*state, BaseboardNum); EXPECT_EQ(ElectricBaseboardRadiator::ElecBaseboard(BaseboardNum).NominalCapacity, 3000.0); } diff --git a/tst/EnergyPlus/unit/ElectricPowerServiceManager.unit.cc b/tst/EnergyPlus/unit/ElectricPowerServiceManager.unit.cc index 08ea6f34329..c22fd1c4329 100644 --- a/tst/EnergyPlus/unit/ElectricPowerServiceManager.unit.cc +++ b/tst/EnergyPlus/unit/ElectricPowerServiceManager.unit.cc @@ -67,6 +67,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -199,7 +200,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_BatteryDischargeTest) ASSERT_TRUE(process_idf(idf_objects)); createFacilityElectricPowerServiceObject(); - facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(state, 1)); + facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); int CurveNum1 = 1; Real64 k = 0.5874; @@ -214,7 +215,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_BatteryDischargeTest) Real64 Pw = 2.0; Real64 q0 = 60.2; - EXPECT_TRUE(facilityElectricServiceObj->elecLoadCenterObjs[0]->storageObj->determineCurrentForBatteryDischarge(state, + EXPECT_TRUE(facilityElectricServiceObj->elecLoadCenterObjs[0]->storageObj->determineCurrentForBatteryDischarge(*state, I0, T0, Volt, Pw, q0, CurveNum1, k, c, qmax, E0c, InternalR)); I0 = -222.7; @@ -223,7 +224,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_BatteryDischargeTest) Pw = 48000; q0 = 0; - EXPECT_FALSE(facilityElectricServiceObj->elecLoadCenterObjs[0]->storageObj->determineCurrentForBatteryDischarge(state, + EXPECT_FALSE(facilityElectricServiceObj->elecLoadCenterObjs[0]->storageObj->determineCurrentForBatteryDischarge(*state, I0, T0, Volt, Pw, q0, CurveNum1, k, c, qmax, E0c, InternalR)); } @@ -267,7 +268,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case1) ASSERT_TRUE(process_idf(idf_objects)); createFacilityElectricPowerServiceObject(); - facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(state, 1)); + facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); // Case 1 ACBuss - Generators 1000+2000=3000, thermal 500+750=1250 facilityElectricServiceObj->elecLoadCenterObjs[0]->bussType = ElectPowerLoadCenter::ElectricBussType::aCBuss; @@ -282,7 +283,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case1) facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[1]->thermProdRate = 750.0; facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[0]->thermalProd = 500.0 * 3600.0; facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[1]->thermalProd = 750.0 * 3600.0; - facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(state); + facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(*state); EXPECT_NEAR(facilityElectricServiceObj->elecLoadCenterObjs[0]->genElectProdRate, 3000.0, 0.1); EXPECT_NEAR(facilityElectricServiceObj->elecLoadCenterObjs[0]->genElectricProd, 3000.0 * 3600.0, 0.1); @@ -342,12 +343,12 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case2) ASSERT_TRUE(process_idf(idf_objects)); createFacilityElectricPowerServiceObject(); - facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(state, 1)); + facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); // Case 2 ACBussStorage - Generators 1000+2000=3000, Storage 200-150=50 facilityElectricServiceObj->elecLoadCenterObjs[0]->bussType = ElectPowerLoadCenter::ElectricBussType::aCBussStorage; // ElectricPowerService::facilityElectricServiceObj->elecLoadCenterObjs[ 0 ]->storagePresent - facilityElectricServiceObj->elecLoadCenterObjs[0]->storageObj = std::unique_ptr(new ElectricStorage(state, "TEST STORAGE BANK")); + facilityElectricServiceObj->elecLoadCenterObjs[0]->storageObj = std::unique_ptr(new ElectricStorage(*state, "TEST STORAGE BANK")); facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[0]->electProdRate = 1000.0; @@ -363,7 +364,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case2) facilityElectricServiceObj->elecLoadCenterObjs[0]->storOpCVDischargeRate = 200.0; facilityElectricServiceObj->elecLoadCenterObjs[0]->storOpCVChargeRate = 150.0; - facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(state); + facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(*state); EXPECT_NEAR(facilityElectricServiceObj->elecLoadCenterObjs[0]->genElectProdRate, 3000.0, 0.1); EXPECT_NEAR(facilityElectricServiceObj->elecLoadCenterObjs[0]->genElectricProd, 3000.0 * 3600.0, 0.1); @@ -428,26 +429,26 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case3) ASSERT_TRUE(process_idf(idf_objects)); // get availability schedule to work - 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 + 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 ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); createFacilityElectricPowerServiceObject(); - facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(state, 1)); + facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); // Case 3 DCBussInverter Inverter = 3000, facilityElectricServiceObj->elecLoadCenterObjs[0]->bussType = ElectPowerLoadCenter::ElectricBussType::dCBussInverter; - facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj = std::unique_ptr(new DCtoACInverter(state, "TEST INVERTER")); + facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj = std::unique_ptr(new DCtoACInverter(*state, "TEST INVERTER")); facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterPresent = true; facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[0]->electProdRate = 1000.0; @@ -456,9 +457,9 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case3) facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[0]->electricityProd = 1000.0 * 3600.0; facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[1]->electricityProd = 2000.0 * 3600.0; - facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(state); - facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj->simulate(state, 3000.0); - facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(state); + facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(*state); + facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj->simulate(*state, 3000.0); + facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(*state); EXPECT_NEAR(facilityElectricServiceObj->elecLoadCenterObjs[0]->genElectProdRate, 3000.0, 0.1); EXPECT_NEAR(facilityElectricServiceObj->elecLoadCenterObjs[0]->genElectricProd, 3000.0 * 3600.0, 0.1); EXPECT_NEAR(facilityElectricServiceObj->elecLoadCenterObjs[0]->subpanelFeedInRate, 3000.0, 0.1); @@ -534,30 +535,30 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case4) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized createFacilityElectricPowerServiceObject(); - facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(state, 1)); + facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); // get availability schedule to work - 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 + 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 ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); // Case 4 DCBussInverterDCStorage Inverter = 5000, facilityElectricServiceObj->elecLoadCenterObjs[0]->bussType = ElectPowerLoadCenter::ElectricBussType::dCBussInverterDCStorage; - facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj = std::unique_ptr(new DCtoACInverter(state, "TEST INVERTER")); + facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj = std::unique_ptr(new DCtoACInverter(*state, "TEST INVERTER")); facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterPresent = true; facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[0]->electProdRate = 2000.0; @@ -565,9 +566,9 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case4) facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[0]->electricityProd = 2000.0 * 3600.0; facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[1]->electricityProd = 3000.0 * 3600.0; - facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(state); - facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj->simulate(state, 5000.0); - facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(state); + facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(*state); + facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj->simulate(*state, 5000.0); + facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(*state); EXPECT_NEAR(facilityElectricServiceObj->elecLoadCenterObjs[0]->genElectProdRate, 5000.0, 0.1); EXPECT_NEAR(facilityElectricServiceObj->elecLoadCenterObjs[0]->genElectricProd, 5000.0 * 3600.0, 0.1); @@ -633,28 +634,28 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case5) ASSERT_TRUE(process_idf(idf_objects)); // get availability schedule to work - 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 + 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 ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); createFacilityElectricPowerServiceObject(); - facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(state, 1)); + facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); // Case 5 DCBussInverterACStorage Inverter = 5000, , Storage 200-150=50, thermal should still be same as Case 1 facilityElectricServiceObj->elecLoadCenterObjs[0]->bussType = (ElectPowerLoadCenter::ElectricBussType::dCBussInverterACStorage); - facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj = std::unique_ptr(new DCtoACInverter(state, "TEST INVERTER")); + facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj = std::unique_ptr(new DCtoACInverter(*state, "TEST INVERTER")); facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterPresent = true; - facilityElectricServiceObj->elecLoadCenterObjs[0]->storageObj = std::unique_ptr(new ElectricStorage(state, "TEST STORAGE BANK")); + facilityElectricServiceObj->elecLoadCenterObjs[0]->storageObj = std::unique_ptr(new ElectricStorage(*state, "TEST STORAGE BANK")); facilityElectricServiceObj->elecLoadCenterObjs[0]->storOpCVDischargeRate = 200.0; facilityElectricServiceObj->elecLoadCenterObjs[0]->storOpCVChargeRate = 150.0; facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[0]->electProdRate = 2000.0; @@ -666,9 +667,9 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_UpdateLoadCenterRecords_Case5) facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[0]->thermalProd = 500.0 * 3600.0; facilityElectricServiceObj->elecLoadCenterObjs[0]->elecGenCntrlObj[1]->thermalProd = 750.0 * 3600.0; - facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(state); - facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj->simulate(state, 5000.0); - facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(state); + facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(*state); + facilityElectricServiceObj->elecLoadCenterObjs[0]->inverterObj->simulate(*state, 5000.0); + facilityElectricServiceObj->elecLoadCenterObjs[0]->updateLoadCenterGeneratorRecords(*state); EXPECT_NEAR(facilityElectricServiceObj->elecLoadCenterObjs[0]->subpanelFeedInRate, 5050.0, 0.1); EXPECT_NEAR(facilityElectricServiceObj->elecLoadCenterObjs[0]->subpanelDrawRate, 0.0, 0.1); @@ -694,7 +695,7 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_CheckOutputReporting) createFacilityElectricPowerServiceObject(); bool SimElecCircuitsFlag = false; // GetInput and other code will be executed and SimElectricCircuits will be true - facilityElectricServiceObj->manageElectricPowerService(state, true, SimElecCircuitsFlag, false); + facilityElectricServiceObj->manageElectricPowerService(*state, true, SimElecCircuitsFlag, false); EXPECT_TRUE(SimElecCircuitsFlag); EXPECT_EQ(facilityElectricServiceObj->elecLoadCenterObjs[0]->numGenerators, 0); // dummy generator has been added and report variables are available @@ -779,25 +780,25 @@ TEST_F(EnergyPlusFixture, ManageElectricPowerTest_TransformerLossTest) ASSERT_TRUE(process_idf(idf_objects)); // get availability schedule to work - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; DataHVACGlobals::TimeStepSys = 1.0; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; - ScheduleManager::ProcessScheduleInput(state); + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); createFacilityElectricPowerServiceObject(); - facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(state, 1)); - facilityElectricServiceObj->elecLoadCenterObjs[0]->transformerObj = std::unique_ptr(new ElectricTransformer(state, "TRANSFORMER")); - Real64 expectedtransformerObjLossRate = facilityElectricServiceObj->elecLoadCenterObjs[0]->transformerObj->getLossRateForOutputPower(state, 2000.0); + facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); + facilityElectricServiceObj->elecLoadCenterObjs[0]->transformerObj = std::unique_ptr(new ElectricTransformer(*state, "TRANSFORMER")); + Real64 expectedtransformerObjLossRate = facilityElectricServiceObj->elecLoadCenterObjs[0]->transformerObj->getLossRateForOutputPower(*state, 2000.0); // check the transformer loss rate for load and no load condition EXPECT_EQ(expectedtransformerObjLossRate, 0.0); } @@ -931,7 +932,7 @@ TEST_F(EnergyPlusFixture, ElectricLoadCenter_WarnAvailabilitySchedule_Photovolta ASSERT_TRUE(process_idf(idf_objects)); createFacilityElectricPowerServiceObject(); - facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(state, 1)); + facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); // Should warn only for SimplePV because SimplePV2 doesn't have a schedule, and the other one is a Perf One-Diode and not "Simple" std::string const error_string = delimited_string({ @@ -1018,7 +1019,7 @@ TEST_F(EnergyPlusFixture, ElectricLoadCenter_WarnAvailabilitySchedule_PVWatts) ASSERT_TRUE(process_idf(idf_objects)); createFacilityElectricPowerServiceObject(); - facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(state, 1)); + facilityElectricServiceObj->elecLoadCenterObjs.emplace_back(new ElectPowerLoadCenter(*state, 1)); // Should warn only for PVWatts1 because PVWatts2 doesn't have a schedule std::string const error_string = delimited_string({ diff --git a/tst/EnergyPlus/unit/EvaporativeCoolers.unit.cc b/tst/EnergyPlus/unit/EvaporativeCoolers.unit.cc index b3bdb5feb80..69543f6e740 100644 --- a/tst/EnergyPlus/unit/EvaporativeCoolers.unit.cc +++ b/tst/EnergyPlus/unit/EvaporativeCoolers.unit.cc @@ -61,6 +61,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -91,7 +92,7 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SecondaryAirOutletCondition) Real64 QHXLatent(0.0); // make the call for zero secondary air flow rate - CalcSecondaryAirOutletCondition(state, EvapCoolNum, OperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec, QHXTotal, QHXLatent); + CalcSecondaryAirOutletCondition(*state, EvapCoolNum, OperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec, QHXTotal, QHXLatent); // check outputs for evap cooler set off EXPECT_DOUBLE_EQ(EvapCond(EvapCoolNum).SecOutletEnthalpy, EvapCond(EvapCoolNum).SecInletEnthalpy); @@ -105,7 +106,7 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SecondaryAirOutletCondition) InitializePsychRoutines(); // make the call for dry operating mode - CalcSecondaryAirOutletCondition(state, EvapCoolNum, OperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec, QHXTotal, QHXLatent); + CalcSecondaryAirOutletCondition(*state, EvapCoolNum, OperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec, QHXTotal, QHXLatent); // check outputs for dry operating condition EXPECT_NEAR(25.0, EvapCond(EvapCoolNum).SecOutletTemp, 0.000001); @@ -117,7 +118,7 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SecondaryAirOutletCondition) QHXTotal = 10206.410750000941; // make the call for wet operating condition - CalcSecondaryAirOutletCondition(state, EvapCoolNum, OperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec, QHXTotal, QHXLatent); + CalcSecondaryAirOutletCondition(*state, EvapCoolNum, OperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec, QHXTotal, QHXLatent); // check outputs for wet operating condition EXPECT_DOUBLE_EQ(20.0, EvapCond(EvapCoolNum).SecOutletTemp); @@ -147,7 +148,7 @@ TEST_F(EnergyPlusFixture, EvapCoolers_IndEvapCoolerOutletTemp) Real64 const EHumRatSec(0.0075); // testing full capacity in dry operating mode - CalcIndirectRDDEvapCoolerOutletTemp(state, EvapCoolNum, DryOrWetOperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec); + CalcIndirectRDDEvapCoolerOutletTemp(*state, EvapCoolNum, DryOrWetOperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec); EXPECT_DOUBLE_EQ(16.0, EvapCond(EvapCoolNum).OutletTemp); @@ -155,7 +156,7 @@ TEST_F(EnergyPlusFixture, EvapCoolers_IndEvapCoolerOutletTemp) DryOrWetOperatingMode = EvaporativeCoolers::WetFull; EvapCond(EvapCoolNum).WetCoilMaxEfficiency = 0.75; - CalcIndirectRDDEvapCoolerOutletTemp(state, EvapCoolNum, DryOrWetOperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec); + CalcIndirectRDDEvapCoolerOutletTemp(*state, EvapCoolNum, DryOrWetOperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec); EXPECT_DOUBLE_EQ(14.25, EvapCond(EvapCoolNum).OutletTemp); @@ -179,14 +180,14 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SizeIndEvapCoolerTest) FinalSysSizing.allocate(CurSysNum); DataSizing::FinalSysSizing(1).DesMainVolFlow = 1.0; DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 0.4; - state.dataAirSystemsData->PrimaryAirSystems.allocate(CurSysNum); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "INDRDD EVAP COOLER"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(CurSysNum); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "INDRDD EVAP COOLER"; // Set Primary Air Data - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).TotalComponents = 1; std::string const idf_objects = delimited_string({ " EvaporativeCooler:Indirect:ResearchSpecial,", @@ -219,10 +220,10 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SizeIndEvapCoolerTest) ASSERT_TRUE(process_idf(idf_objects)); - GetEvapInput(state); + GetEvapInput(*state); // Set Parameters for Evap Cooler on Main Air Loop System - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp(1).Name = EvapCond(EvapCoolNum).EvapCoolerName; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp(1).Name = EvapCond(EvapCoolNum).EvapCoolerName; EvapCond(EvapCoolNum).DesVolFlowRate = DataSizing::AutoSize; EvapCond(EvapCoolNum).IndirectVolFlowRate = DataSizing::AutoSize; FinalSysSizing(CurSysNum).DesMainVolFlow = 1.0; @@ -231,7 +232,7 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SizeIndEvapCoolerTest) SecondaryAirDesignFlow = PrimaryAirDesignFlow * EvapCond(EvapCoolNum).IndirectVolFlowScalingFactor; // Test Indirect Evaporative Cooler Primary/Secondary Air Design Flow Rate on Main Air Loop - SizeEvapCooler(state, EvapCoolNum); + SizeEvapCooler(*state, EvapCoolNum); EXPECT_EQ(PrimaryAirDesignFlow, EvapCond(EvapCoolNum).DesVolFlowRate); EXPECT_EQ(SecondaryAirDesignFlow, EvapCond(EvapCoolNum).IndirectVolFlowRate); @@ -245,12 +246,12 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SizeIndEvapCoolerTest) SecondaryAirDesignFlow = SecondaryAirDesignFlow * EvapCond(EvapCoolNum).IndirectVolFlowScalingFactor; // Test Indirect Evaporative Cooler Primary/Secondary Air Design Flow Rate on OA System - SizeEvapCooler(state, EvapCoolNum); + SizeEvapCooler(*state, EvapCoolNum); EXPECT_EQ(0.5, EvapCond(EvapCoolNum).DesVolFlowRate); EXPECT_EQ(SecondaryAirDesignFlow, EvapCond(EvapCoolNum).IndirectVolFlowRate); EvapCond.deallocate(); - state.dataAirSystemsData->PrimaryAirSystems.deallocate(); + state->dataAirSystemsData->PrimaryAirSystems.deallocate(); FinalSysSizing.deallocate(); } @@ -270,14 +271,14 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SizeDirEvapCoolerTest) FinalSysSizing.allocate(CurSysNum); DataSizing::FinalSysSizing(1).DesMainVolFlow = 1.0; DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 0.4; - state.dataAirSystemsData->PrimaryAirSystems.allocate(CurSysNum); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "DIRECTEVAPCOOLER"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(CurSysNum); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "DIRECTEVAPCOOLER"; // Set Primary Air Data - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).TotalComponents = 1; std::string const idf_objects = delimited_string({ " EvaporativeCooler:Direct:ResearchSpecial,", @@ -299,24 +300,24 @@ TEST_F(EnergyPlusFixture, EvapCoolers_SizeDirEvapCoolerTest) ASSERT_TRUE(process_idf(idf_objects)); - GetEvapInput(state); + GetEvapInput(*state); // check autosized input fields from idf snippet read EXPECT_EQ(DataSizing::AutoSize, EvapCond(EvapCoolNum).DesVolFlowRate); EXPECT_EQ(DataSizing::AutoSize, EvapCond(EvapCoolNum).RecircPumpPower); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp(1).Name = EvapCond(EvapCoolNum).EvapCoolerName; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp(1).Name = EvapCond(EvapCoolNum).EvapCoolerName; FinalSysSizing(CurSysNum).DesMainVolFlow = 0.50; PrimaryAirDesignFlow = FinalSysSizing(CurSysNum).DesMainVolFlow; RecirWaterPumpDesignPower = PrimaryAirDesignFlow * EvapCond(EvapCoolNum).RecircPumpSizingFactor; // Test Direct Evaporative Cooler Primary Air Design Flow Rate sizing - SizeEvapCooler(state, 1); + SizeEvapCooler(*state, 1); EXPECT_EQ(PrimaryAirDesignFlow, EvapCond(EvapCoolNum).DesVolFlowRate); EXPECT_EQ(RecirWaterPumpDesignPower, EvapCond(EvapCoolNum).RecircPumpPower); EvapCond.deallocate(); - state.dataAirSystemsData->PrimaryAirSystems.deallocate(); + state->dataAirSystemsData->PrimaryAirSystems.deallocate(); FinalSysSizing.deallocate(); } @@ -337,7 +338,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_CalcSecondaryAirOutletCondition) Real64 QHXLatent(0.0); // make the call for zero secondary air flow rate - EvaporativeCoolers::CalcSecondaryAirOutletCondition(state, + EvaporativeCoolers::CalcSecondaryAirOutletCondition(*state, EvapCoolNum, OperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec, QHXTotal, QHXLatent); // check outputs for evap cooler set off @@ -352,7 +353,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_CalcSecondaryAirOutletCondition) InitializePsychRoutines(); // make the call for dry operating mode - EvaporativeCoolers::CalcSecondaryAirOutletCondition(state, + EvaporativeCoolers::CalcSecondaryAirOutletCondition(*state, EvapCoolNum, OperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec, QHXTotal, QHXLatent); // check outputs for dry operating condition @@ -365,7 +366,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_CalcSecondaryAirOutletCondition) QHXTotal = 10206.410750000941; // make the call for wet operating condition - EvaporativeCoolers::CalcSecondaryAirOutletCondition(state, + EvaporativeCoolers::CalcSecondaryAirOutletCondition(*state, EvapCoolNum, OperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec, QHXTotal, QHXLatent); // check outputs for wet operating condition @@ -395,7 +396,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_CalcIndirectRDDEvapCoolerOutletTemp Real64 const EHumRatSec(0.0075); // testing full capacity in dry operating mode - EvaporativeCoolers::CalcIndirectRDDEvapCoolerOutletTemp(state, EvapCoolNum, DryOrWetOperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec); + EvaporativeCoolers::CalcIndirectRDDEvapCoolerOutletTemp(*state, EvapCoolNum, DryOrWetOperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec); EXPECT_DOUBLE_EQ(16.0, EvaporativeCoolers::EvapCond(EvapCoolNum).OutletTemp); @@ -403,7 +404,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_CalcIndirectRDDEvapCoolerOutletTemp DryOrWetOperatingMode = EvaporativeCoolers::WetFull; EvaporativeCoolers::EvapCond(EvapCoolNum).WetCoilMaxEfficiency = 0.75; - EvaporativeCoolers::CalcIndirectRDDEvapCoolerOutletTemp(state, EvapCoolNum, DryOrWetOperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec); + EvaporativeCoolers::CalcIndirectRDDEvapCoolerOutletTemp(*state, EvapCoolNum, DryOrWetOperatingMode, AirMassFlowSec, EDBTSec, EWBTSec, EHumRatSec); EXPECT_DOUBLE_EQ(14.25, EvaporativeCoolers::EvapCond(EvapCoolNum).OutletTemp); @@ -426,24 +427,24 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_IndEvapCoolerPower) CurveNum = 1; EvaporativeCoolers::EvapCond(EvapCoolNum).FanPowerModifierCurveIndex = CurveNum; - state.dataCurveManager->NumCurves = 1; - state.dataCurveManager->PerfCurve.allocate(1); - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 1.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 1.0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 0; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 0; + state->dataCurveManager->NumCurves = 1; + state->dataCurveManager->PerfCurve.allocate(1); + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Quadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 1.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 1.0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 0; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 0; // make the call for dry full load operating condition - EvaporativeCoolers::EvapCond(EvapCoolNum).EvapCoolerPower = EvaporativeCoolers::IndEvapCoolerPower(state, EvapCoolNum, DryWetMode, FlowRatio); + EvaporativeCoolers::EvapCond(EvapCoolNum).EvapCoolerPower = EvaporativeCoolers::IndEvapCoolerPower(*state, EvapCoolNum, DryWetMode, FlowRatio); // check outputs for dry full load operating condition EXPECT_EQ(200.0, EvaporativeCoolers::EvapCond(EvapCoolNum).EvapCoolerPower); @@ -454,14 +455,14 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_IndEvapCoolerPower) EvaporativeCoolers::EvapCond(EvapCoolNum).PartLoadFract = 0.5; // make the call for wet modulated operating condition - EvaporativeCoolers::EvapCond(EvapCoolNum).EvapCoolerPower = EvaporativeCoolers::IndEvapCoolerPower(state, EvapCoolNum, DryWetMode, FlowRatio); + EvaporativeCoolers::EvapCond(EvapCoolNum).EvapCoolerPower = EvaporativeCoolers::IndEvapCoolerPower(*state, EvapCoolNum, DryWetMode, FlowRatio); // check outputs for wet modulated operating condition // Power expected = curved fan power + linear scaled pump power EXPECT_EQ(200 * 0.8 + 100 * 0.8 * 0.5, EvaporativeCoolers::EvapCond(EvapCoolNum).EvapCoolerPower); EvaporativeCoolers::EvapCond.deallocate(); - state.dataCurveManager->PerfCurve.deallocate(); + state->dataCurveManager->PerfCurve.deallocate(); } TEST_F(EnergyPlusFixture, EvaporativeCoolers_SizeEvapCooler) @@ -479,12 +480,12 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_SizeEvapCooler) DataSizing::NumSysSizInput = 1; DataSizing::SysSizInput.allocate(1); DataSizing::SysSizInput(1).AirLoopNum = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "MyEvapCooler"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "MyEvapCooler"; thisEvapCooler.EvapCoolerName = "MyEvapCooler"; DataSizing::FinalSysSizing.allocate(1); DataSizing::FinalSysSizing(1).DesMainVolFlow = 1.0; @@ -501,7 +502,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_SizeEvapCooler) thisEvapCooler.IndirectVolFlowScalingFactor = 0.3; // make the call for sizing the flow rates - EvaporativeCoolers::SizeEvapCooler(state, EvapCoolNum); + EvaporativeCoolers::SizeEvapCooler(*state, EvapCoolNum); EXPECT_NEAR(0.3, thisEvapCooler.IndirectVolFlowRate, 0.0001); EXPECT_NEAR(1.0, thisEvapCooler.DesVolFlowRate, 0.0001); @@ -515,12 +516,12 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_SizeEvapCooler) thisEvapCooler.IndirectVolFlowRate = 1.0; // make the call for sizing the pad properties - EvaporativeCoolers::SizeEvapCooler(state, EvapCoolNum); + EvaporativeCoolers::SizeEvapCooler(*state, EvapCoolNum); EXPECT_NEAR(0.333333, thisEvapCooler.PadArea, 0.0001); EXPECT_NEAR(0.17382, thisEvapCooler.PadDepth, 0.0001); // now let's try 'not' finding it on the air loop; thus it is in the OA path - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "NOT-MyEvapCooler"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "NOT-MyEvapCooler"; // set up the structure to size the flow rates for an indirect celdekpad thisEvapCooler.evapCoolerType = EvapCoolerType::IndirectCELDEKPAD; @@ -533,14 +534,14 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_SizeEvapCooler) thisEvapCooler.IndirectVolFlowScalingFactor = 0.3; // make the call for sizing the flow rates - EvaporativeCoolers::SizeEvapCooler(state, EvapCoolNum); + EvaporativeCoolers::SizeEvapCooler(*state, EvapCoolNum); EXPECT_NEAR(0.5, thisEvapCooler.IndirectVolFlowRate, 0.0001); EXPECT_NEAR(0.5, thisEvapCooler.DesVolFlowRate, 0.0001); // clean up EvaporativeCoolers::EvapCond.deallocate(); DataSizing::FinalSysSizing.deallocate(); - state.dataAirSystemsData->PrimaryAirSystems.deallocate(); + state->dataAirSystemsData->PrimaryAirSystems.deallocate(); DataSizing::SysSizInput.deallocate(); } @@ -563,14 +564,14 @@ TEST_F(EnergyPlusFixture, DefaultAutosizeIndEvapCoolerTest) FinalSysSizing.allocate(CurSysNum); DataSizing::FinalSysSizing(1).DesMainVolFlow = 1.0; DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 0.4; - state.dataAirSystemsData->PrimaryAirSystems.allocate(CurSysNum); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "INDRDD EVAP COOLER"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(CurSysNum); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "INDRDD EVAP COOLER"; // Set Primary Air Data - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).TotalComponents = 1; std::string const idf_objects = delimited_string({ " EvaporativeCooler:Indirect:ResearchSpecial,", @@ -608,7 +609,7 @@ TEST_F(EnergyPlusFixture, DefaultAutosizeIndEvapCoolerTest) ASSERT_TRUE(process_idf(idf_objects)); - GetEvapInput(state); + GetEvapInput(*state); // check blank autosizable input fields default to autosize EXPECT_EQ(DataSizing::AutoSize, EvapCond(EvapCoolNum).DesVolFlowRate); @@ -617,26 +618,26 @@ TEST_F(EnergyPlusFixture, DefaultAutosizeIndEvapCoolerTest) EXPECT_EQ(DataSizing::AutoSize, EvapCond(EvapCoolNum).IndirectRecircPumpPower); // Set Parameters for Evap Cooler on Main Air Loop System - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp(1).Name = EvapCond(EvapCoolNum).EvapCoolerName; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp(1).Name = EvapCond(EvapCoolNum).EvapCoolerName; FinalSysSizing(CurSysNum).DesMainVolFlow = 1.0; FinalSysSizing(CurSysNum).DesOutAirVolFlow = 0.2; PrimaryAirDesignFlow = FinalSysSizing(CurSysNum).DesMainVolFlow; SecondaryAirDesignFlow = PrimaryAirDesignFlow * EvapCond(EvapCoolNum).IndirectVolFlowScalingFactor; // Test Indirect Evaporative Cooler Primary/Secondary Air Design Flow Rate on Main Air Loop - SizeEvapCooler(state, EvapCoolNum); + SizeEvapCooler(*state, EvapCoolNum); EXPECT_EQ(PrimaryAirDesignFlow, EvapCond(EvapCoolNum).DesVolFlowRate); EXPECT_EQ(SecondaryAirDesignFlow, EvapCond(EvapCoolNum).IndirectVolFlowRate); // Test Secondary Fan Power and reciculating water pump power SecondaryFanPower = SecondaryAirDesignFlow * EvapCond(EvapCoolNum).FanSizingSpecificPower; RecirculatingWaterPumpPower = SecondaryAirDesignFlow * EvapCond(EvapCoolNum).RecircPumpSizingFactor; - // SizeEvapCooler(state, EvapCoolNum ); + // SizeEvapCooler(*state, EvapCoolNum ); EXPECT_EQ(SecondaryFanPower, EvapCond(EvapCoolNum).IndirectFanPower); EXPECT_EQ(RecirculatingWaterPumpPower, EvapCond(EvapCoolNum).IndirectRecircPumpPower); EvapCond.deallocate(); - state.dataAirSystemsData->PrimaryAirSystems.deallocate(); + state->dataAirSystemsData->PrimaryAirSystems.deallocate(); FinalSysSizing.deallocate(); } @@ -656,14 +657,14 @@ TEST_F(EnergyPlusFixture, DefaultAutosizeDirEvapCoolerTest) FinalSysSizing.allocate(CurSysNum); DataSizing::FinalSysSizing(1).DesMainVolFlow = 1.0; DataSizing::FinalSysSizing(1).DesOutAirVolFlow = 0.4; - state.dataAirSystemsData->PrimaryAirSystems.allocate(CurSysNum); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "DIRECTEVAPCOOLER"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(CurSysNum); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "DIRECTEVAPCOOLER"; // Set Primary Air Data - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).TotalComponents = 1; std::string const idf_objects = delimited_string({ " EvaporativeCooler:Direct:ResearchSpecial,", @@ -685,24 +686,24 @@ TEST_F(EnergyPlusFixture, DefaultAutosizeDirEvapCoolerTest) ASSERT_TRUE(process_idf(idf_objects)); - GetEvapInput(state); + GetEvapInput(*state); // check blank autosizable input fields default to autosize EXPECT_EQ(DataSizing::AutoSize, EvapCond(EvapCoolNum).DesVolFlowRate); EXPECT_EQ(DataSizing::AutoSize, EvapCond(EvapCoolNum).RecircPumpPower); // do local sizing calculations - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp(1).Name = EvapCond(EvapCoolNum).EvapCoolerName; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp(1).Name = EvapCond(EvapCoolNum).EvapCoolerName; FinalSysSizing(CurSysNum).DesMainVolFlow = 0.50; PrimaryAirDesignFlow = FinalSysSizing(CurSysNum).DesMainVolFlow; RecirWaterPumpDesignPower = PrimaryAirDesignFlow * EvapCond(EvapCoolNum).RecircPumpSizingFactor; // Test Direct Evaporative Cooler Primary Air Design Flow Rate sizing - SizeEvapCooler(state, 1); + SizeEvapCooler(*state, 1); EXPECT_EQ(PrimaryAirDesignFlow, EvapCond(EvapCoolNum).DesVolFlowRate); EXPECT_EQ(RecirWaterPumpDesignPower, EvapCond(EvapCoolNum).RecircPumpPower); EvapCond.deallocate(); - state.dataAirSystemsData->PrimaryAirSystems.deallocate(); + state->dataAirSystemsData->PrimaryAirSystems.deallocate(); FinalSysSizing.deallocate(); } @@ -717,15 +718,15 @@ TEST_F(EnergyPlusFixture, DirectEvapCoolerResearchSpecialCalcTest) DataEnvironment::OutBaroPress = 101325.0; int const CurveNum = 1; - state.dataCurveManager->NumCurves = 1; - state.dataCurveManager->PerfCurve.allocate(1); - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Linear"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 1.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 1.0; + state->dataCurveManager->NumCurves = 1; + state->dataCurveManager->PerfCurve.allocate(1); + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Quadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Linear"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 1.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 1.0; // set up the flow rates for a direct RDDSpecial thisEvapCooler.evapCoolerType = EvapCoolerType::DirectResearchSpecial; @@ -737,7 +738,7 @@ TEST_F(EnergyPlusFixture, DirectEvapCoolerResearchSpecialCalcTest) thisEvapCooler.InletNode = 1; thisEvapCooler.InletTemp = 25.0; thisEvapCooler.InletWetBulbTemp = 21.0; - thisEvapCooler.InletHumRat = PsyWFnTdbTwbPb(state, thisEvapCooler.InletTemp, thisEvapCooler.InletWetBulbTemp, OutBaroPress); + thisEvapCooler.InletHumRat = PsyWFnTdbTwbPb(*state, thisEvapCooler.InletTemp, thisEvapCooler.InletWetBulbTemp, OutBaroPress); // set full flow rate test condition DataLoopNode::Node(thisEvapCooler.InletNode).MassFlowRateMax = 1.0; @@ -746,14 +747,14 @@ TEST_F(EnergyPlusFixture, DirectEvapCoolerResearchSpecialCalcTest) thisEvapCooler.PartLoadFract = 1.0; // check water pump power at full primary air flow - EvaporativeCoolers::CalcDirectResearchSpecialEvapCooler(state, EvapCoolNum); + EvaporativeCoolers::CalcDirectResearchSpecialEvapCooler(*state, EvapCoolNum); EXPECT_DOUBLE_EQ(200.0, thisEvapCooler.RecircPumpPower); EXPECT_DOUBLE_EQ(200.0, thisEvapCooler.EvapCoolerPower); // reduce primary air flow rate by half thisEvapCooler.InletMassFlowRate = 0.5; // check water pump power at half primary air flow - EvaporativeCoolers::CalcDirectResearchSpecialEvapCooler(state, EvapCoolNum); + EvaporativeCoolers::CalcDirectResearchSpecialEvapCooler(*state, EvapCoolNum); EXPECT_DOUBLE_EQ(200.0, thisEvapCooler.RecircPumpPower); EXPECT_DOUBLE_EQ(100.0, thisEvapCooler.EvapCoolerPower); } @@ -774,7 +775,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_IndirectRDDEvapCoolerOperatingMode) thisEvapCooler.WetCoilMaxEfficiency = 0.8; thisEvapCooler.InletTemp = 25.5; thisEvapCooler.InletHumRat = 0.0140; - thisEvapCooler.InletWetBulbTemp = PsyTwbFnTdbWPb(state, EvapCond(EvapCoolNum).InletTemp, EvapCond(EvapCoolNum).InletHumRat, OutBaroPress); + thisEvapCooler.InletWetBulbTemp = PsyTwbFnTdbWPb(*state, EvapCond(EvapCoolNum).InletTemp, EvapCond(EvapCoolNum).InletHumRat, OutBaroPress); thisEvapCooler.SecInletTemp = thisEvapCooler.InletTemp; thisEvapCooler.SecInletHumRat = thisEvapCooler.InletHumRat; thisEvapCooler.SecInletWetBulbTemp = thisEvapCooler.InletWetBulbTemp; @@ -791,7 +792,7 @@ TEST_F(EnergyPlusFixture, EvaporativeCoolers_IndirectRDDEvapCoolerOperatingMode) // check operating mode EXPECT_EQ(Result_WetFullOperatingMode, EvaporativeCoolers::WetFull); // get outlet temperature in full wet operating mode - EvaporativeCoolers::CalcIndirectRDDEvapCoolerOutletTemp(state, EvapCoolNum, + EvaporativeCoolers::CalcIndirectRDDEvapCoolerOutletTemp(*state, EvapCoolNum, Result_WetFullOperatingMode, thisEvapCooler.SecInletMassFlowRate, thisEvapCooler.SecInletTemp, @@ -810,14 +811,14 @@ TEST_F(EnergyPlusFixture, DirectEvapCoolerAutosizeWithoutSysSizingRunDone) DataSizing::SysSizInput(1).AirLoopNum = 1; DataSizing::CurSysNum = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(CurSysNum); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "DIRECTEVAPCOOLER"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(CurSysNum); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "DIRECTEVAPCOOLER"; // Set Primary Air Data - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).TotalComponents = 1; std::string const idf_objects = delimited_string({ " EvaporativeCooler:Direct:ResearchSpecial,", @@ -839,16 +840,16 @@ TEST_F(EnergyPlusFixture, DirectEvapCoolerAutosizeWithoutSysSizingRunDone) ASSERT_TRUE(process_idf(idf_objects)); - GetEvapInput(state); + GetEvapInput(*state); // check blank autosizable input fields default to autosize EXPECT_EQ(DataSizing::AutoSize, EvapCond(EvapCoolNum).DesVolFlowRate); // set component name on primary air branch - state.dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp(1).Name = EvapCond(EvapCoolNum).EvapCoolerName; + state->dataAirSystemsData->PrimaryAirSystems(CurSysNum).Branch(1).Comp(1).Name = EvapCond(EvapCoolNum).EvapCoolerName; DataSizing::SysSizingRunDone = false; // catch Primary Air Design Flow Rate autosize fatal error message - ASSERT_THROW(EvaporativeCoolers::SizeEvapCooler(state, 1), std::runtime_error); + ASSERT_THROW(EvaporativeCoolers::SizeEvapCooler(*state, 1), std::runtime_error); std::string const error_string = delimited_string({ " ** Severe ** For autosizing of EvaporativeCooler:Direct:ResearchSpecial DIRECTEVAPCOOLER, a system sizing run must be done.", @@ -883,7 +884,7 @@ TEST_F(EnergyPlusFixture, EvapCoolerAirLoopPumpCycling) ASSERT_TRUE(process_idf(idf_objects)); - EvaporativeCoolers::GetEvapInput(state); + EvaporativeCoolers::GetEvapInput(*state); ASSERT_FALSE(ErrorsFound); int AirLoopNum = 1; @@ -892,9 +893,9 @@ TEST_F(EnergyPlusFixture, EvapCoolerAirLoopPumpCycling) DataEnvironment::OutBaroPress = 101325.0; // Air loop fan PLR - state.dataAirLoop->AirLoopFlow.allocate(AirLoopNum); - state.dataAirLoop->AirLoopControlInfo.allocate(AirLoopNum); - state.dataAirLoop->AirLoopFlow(1).FanPLR = 0.8; + state->dataAirLoop->AirLoopFlow.allocate(AirLoopNum); + state->dataAirLoop->AirLoopControlInfo.allocate(AirLoopNum); + state->dataAirLoop->AirLoopFlow(1).FanPLR = 0.8; // Evap cooler conditions DataLoopNode::Node(EvapCond(EvapCoolNum).InletNode).MassFlowRate = 0.5; @@ -902,11 +903,11 @@ TEST_F(EnergyPlusFixture, EvapCoolerAirLoopPumpCycling) DataLoopNode::Node(EvapCond(EvapCoolNum).InletNode).HumRat = 0.001; DataLoopNode::Node(EvapCond(EvapCoolNum).InletNode).Press = DataEnvironment::OutBaroPress; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; // Simulate air loop component calls SimEvapCooler // SimEvapCooler calls InitEvapCooler(EvapCoolNum) and CalcDirectEvapCooler - SimAirServingZones::SimAirLoopComponent(state, EvapCond(EvapCoolNum).EvapCoolerName, Evap_Cooler_CompType, false, AirLoopNum, EvapCoolNum, 0); + SimAirServingZones::SimAirLoopComponent(*state, EvapCond(EvapCoolNum).EvapCoolerName, Evap_Cooler_CompType, false, AirLoopNum, EvapCoolNum, 0); // air loop FanPLR successfully passed for pump power calculation EXPECT_EQ(EvapCond(EvapCoolNum).EvapCoolerPower, 60 * 0.8); diff --git a/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc b/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc index 3e8d5d6460c..756d492cf74 100644 --- a/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/EvaporativeFluidCoolers.unit.cc @@ -60,6 +60,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -108,7 +109,7 @@ TEST_F(EvapFluidCoolersFixture, EvapFluidCoolerSpecs_getDesignCapacitiesTest) thisEFC.MyOneTimeFlag = false; thisEFC.OneTimeFlagForEachEvapFluidCooler = false; thisEFC.MyEnvrnFlag = false; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; thisEFC.WaterInletNodeNum = 1; thisEFC.WaterOutletNodeNum = 2; thisEFC.OutdoorAirInletNodeNum = 0; @@ -162,8 +163,8 @@ TEST_F(EvapFluidCoolersFixture, EvapFluidCoolerSpecs_getDesignCapacitiesTest) // Call the routine to be tested and see if the fix is correct PlantLocation loc = PlantLocation(1, 1, 1, 1); - thisEFC.onInitLoopEquip(state, loc); - thisEFC.getDesignCapacities(state, pl, MaxLoad, MinLoad, OptLoad); + thisEFC.onInitLoopEquip(*state, loc); + thisEFC.getDesignCapacities(*state, pl, MaxLoad, MinLoad, OptLoad); EXPECT_NEAR(MaxLoad, ExpectedMaxLoad,0.01); EXPECT_NEAR(MinLoad, ExpectedMinLoad,0.01); EXPECT_NEAR(OptLoad, ExpectedOptLoad,0.01); diff --git a/tst/EnergyPlus/unit/ExteriorEnergyUse.unit.cc b/tst/EnergyPlus/unit/ExteriorEnergyUse.unit.cc index a5404831c9b..2d393836d81 100644 --- a/tst/EnergyPlus/unit/ExteriorEnergyUse.unit.cc +++ b/tst/EnergyPlus/unit/ExteriorEnergyUse.unit.cc @@ -54,6 +54,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -65,19 +66,19 @@ using namespace EnergyPlus::ScheduleManager; TEST_F(EnergyPlusFixture, ExteriorEquipmentTest_Test1) { - state.dataExteriorEnergyUse->NumExteriorLights = 0; - state.dataExteriorEnergyUse->NumExteriorEqs = 2; - state.dataGlobal->TimeStepZone = 0.25; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); - state.dataExteriorEnergyUse->ExteriorEquipment.allocate(state.dataExteriorEnergyUse->NumExteriorEqs); - state.dataExteriorEnergyUse->ExteriorEquipment(1).DesignLevel = 1000.0; - state.dataExteriorEnergyUse->ExteriorEquipment(2).DesignLevel = 0.0; - state.dataExteriorEnergyUse->ExteriorEquipment(1).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); // From dataglobals, always returns a 1 for schedule value - state.dataExteriorEnergyUse->ExteriorEquipment(2).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); // From dataglobals, always returns a 1 for schedule value - ReportExteriorEnergyUse(state); + state->dataExteriorEnergyUse->NumExteriorLights = 0; + state->dataExteriorEnergyUse->NumExteriorEqs = 2; + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); + state->dataExteriorEnergyUse->ExteriorEquipment.allocate(state->dataExteriorEnergyUse->NumExteriorEqs); + state->dataExteriorEnergyUse->ExteriorEquipment(1).DesignLevel = 1000.0; + state->dataExteriorEnergyUse->ExteriorEquipment(2).DesignLevel = 0.0; + state->dataExteriorEnergyUse->ExteriorEquipment(1).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); // From dataglobals, always returns a 1 for schedule value + state->dataExteriorEnergyUse->ExteriorEquipment(2).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); // From dataglobals, always returns a 1 for schedule value + ReportExteriorEnergyUse(*state); - EXPECT_EQ(1000.0, state.dataExteriorEnergyUse->ExteriorEquipment(1).Power); - EXPECT_EQ(0.0, state.dataExteriorEnergyUse->ExteriorEquipment(2).Power); - EXPECT_EQ(900000.0, state.dataExteriorEnergyUse->ExteriorEquipment(1).CurrentUse); - EXPECT_EQ(0.0, state.dataExteriorEnergyUse->ExteriorEquipment(2).CurrentUse); + EXPECT_EQ(1000.0, state->dataExteriorEnergyUse->ExteriorEquipment(1).Power); + EXPECT_EQ(0.0, state->dataExteriorEnergyUse->ExteriorEquipment(2).Power); + EXPECT_EQ(900000.0, state->dataExteriorEnergyUse->ExteriorEquipment(1).CurrentUse); + EXPECT_EQ(0.0, state->dataExteriorEnergyUse->ExteriorEquipment(2).CurrentUse); } diff --git a/tst/EnergyPlus/unit/FanCoilUnits.unit.cc b/tst/EnergyPlus/unit/FanCoilUnits.unit.cc index 22ee9b87250..8b81d726a6a 100644 --- a/tst/EnergyPlus/unit/FanCoilUnits.unit.cc +++ b/tst/EnergyPlus/unit/FanCoilUnits.unit.cc @@ -78,6 +78,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -127,11 +128,11 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; InitializePsychRoutines(); @@ -257,16 +258,16 @@ namespace EnergyPlus { ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanInput(state); + GetFanInput(*state); EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); - GetFanCoilUnits(state); + GetFanCoilUnits(*state); EXPECT_EQ("MULTISPEEDFAN", FanCoil(1).CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", FanCoil(1).OAMixType); EXPECT_EQ("FAN:ONOFF", FanCoil(1).FanType); @@ -287,11 +288,11 @@ namespace EnergyPlus { Node(OAMixer(1).RetNode).Temp = 22.0; Node(OAMixer(1).RetNode).Enthalpy = 36000; - Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); + Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); Node(OAMixer(1).InletNode).Temp = 10.0; Node(OAMixer(1).InletNode).Enthalpy = 18000; - Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); + Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); Node(FanCoil(1).AirInNode).MassFlowRate = AirMassFlow; Node(FanCoil(1).AirInNode).MassFlowRateMin = AirMassFlow; @@ -311,34 +312,34 @@ namespace EnergyPlus { Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - state.dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; - state.dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; - state.dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; - state.dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; - - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - state.dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; + state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; + state->dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; + state->dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; + + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + state->dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -351,31 +352,31 @@ namespace EnergyPlus { loopsidebranch.Comp.allocate(1); } - state.dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(2).Name = "ChilledWaterLoop"; PlantLoop(2).FluidName = "ChilledWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(2).Name; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; CoolingLoad = false; HeatingLoad = true; @@ -386,36 +387,36 @@ namespace EnergyPlus { QUnitOut = 0.0; QZnReq = 4000.0; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; - state.dataGlobal->DoingSizing = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; + state->dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); - CalcMultiStage4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QZnReq, SpeedRatio, PartLoadRatio, QUnitOut); + CalcMultiStage4PipeFanCoil(*state, FanCoilNum, ZoneNum, FirstHVACIteration, QZnReq, SpeedRatio, PartLoadRatio, QUnitOut); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); - state.dataGlobal->DoingSizing = false; + state->dataGlobal->DoingSizing = false; PlantLoop.deallocate(); ZoneSysEnergyDemand.deallocate(); FanCoil.deallocate(); Node.deallocate(); - state.dataWaterCoils->WaterCoil.deallocate(); + state->dataWaterCoils->WaterCoil.deallocate(); ZoneEquipConfig.deallocate(); Zone.deallocate(); CoilNames.clear(); @@ -438,11 +439,11 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; InitializePsychRoutines(); @@ -570,16 +571,16 @@ namespace EnergyPlus { ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanInput(state); + GetFanInput(*state); EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); - GetFanCoilUnits(state); + GetFanCoilUnits(*state); EXPECT_EQ("MULTISPEEDFAN", FanCoil(1).CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", FanCoil(1).OAMixType); EXPECT_EQ("FAN:ONOFF", FanCoil(1).FanType); @@ -601,11 +602,11 @@ namespace EnergyPlus { Node(OAMixer(1).RetNode).Temp = 24.0; Node(OAMixer(1).RetNode).Enthalpy = 36000; - Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); + Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); Node(OAMixer(1).InletNode).Temp = 30.0; Node(OAMixer(1).InletNode).Enthalpy = 53000; - Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); + Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); Node(FanCoil(1).AirInNode).MassFlowRate = AirMassFlow; Node(FanCoil(1).AirInNode).MassFlowRateMin = AirMassFlow; @@ -625,34 +626,34 @@ namespace EnergyPlus { Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - state.dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; - state.dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; - state.dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; - state.dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; - - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - state.dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; + state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; + state->dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; + state->dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; + + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + state->dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -665,31 +666,31 @@ namespace EnergyPlus { loopsidebranch.Comp.allocate(1); } - state.dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(2).Name = "ChilledWaterLoop"; PlantLoop(2).FluidName = "ChilledWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(2).Name; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; HeatingLoad = false; CoolingLoad = true; @@ -700,35 +701,35 @@ namespace EnergyPlus { QUnitOut = 0.0; QZnReq = -4000.0; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; - state.dataGlobal->DoingSizing = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; + state->dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); - CalcMultiStage4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QZnReq, SpeedRatio, PartLoadRatio, QUnitOut); + CalcMultiStage4PipeFanCoil(*state, FanCoilNum, ZoneNum, FirstHVACIteration, QZnReq, SpeedRatio, PartLoadRatio, QUnitOut); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); - state.dataGlobal->DoingSizing = false; + state->dataGlobal->DoingSizing = false; PlantLoop.deallocate(); ZoneSysEnergyDemand.deallocate(); FanCoil.deallocate(); Node.deallocate(); - state.dataWaterCoils->WaterCoil.deallocate(); + state->dataWaterCoils->WaterCoil.deallocate(); ZoneEquipConfig.deallocate(); Zone.deallocate(); CoilNames.clear(); @@ -751,11 +752,11 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; InitializePsychRoutines(); @@ -881,16 +882,16 @@ namespace EnergyPlus { ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanInput(state); + GetFanInput(*state); EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); - GetFanCoilUnits(state); + GetFanCoilUnits(*state); EXPECT_EQ("CONSTANTFANVARIABLEFLOW", FanCoil(1).CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", FanCoil(1).OAMixType); EXPECT_EQ("FAN:ONOFF", FanCoil(1).FanType); @@ -911,11 +912,11 @@ namespace EnergyPlus { Node(OAMixer(1).RetNode).Temp = 22.0; Node(OAMixer(1).RetNode).Enthalpy = 36000; - Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); + Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); Node(OAMixer(1).InletNode).Temp = 10.0; Node(OAMixer(1).InletNode).Enthalpy = 18000; - Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); + Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); Node(FanCoil(1).AirInNode).MassFlowRate = AirMassFlow; Node(FanCoil(1).AirInNode).MassFlowRateMin = AirMassFlow; @@ -942,34 +943,34 @@ namespace EnergyPlus { Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - state.dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; - state.dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; - state.dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; - state.dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; - - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - state.dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; + state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; + state->dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; + state->dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; + + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + state->dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -985,42 +986,42 @@ namespace EnergyPlus { TempControlType.allocate(1); TempControlType(1) = 4; - state.dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(2).Name = "ChilledWaterLoop"; PlantLoop(2).FluidName = "ChilledWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(2).Name; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; PlantLoop(2).LoopSide(1).FlowLock = 0; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; PlantLoop(1).LoopSide(1).FlowLock = 0; FanCoil(1).CoolCoilLoopNum = 2; FanCoil(1).HeatCoilLoopNum = 1; FanCoil(1).CoolCoilLoopSide = 1; FanCoil(1).HeatCoilLoopSide = 1; - FanCoil(1).HeatCoilFluidOutletNodeNum = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; - FanCoil(1).CoolCoilFluidOutletNodeNum = state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; + FanCoil(1).HeatCoilFluidOutletNodeNum = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + FanCoil(1).CoolCoilFluidOutletNodeNum = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; FanCoil(1).CoolCoilBranchNum = 1; FanCoil(1).CoolCoilCompNum = 1; FanCoil(1).HeatCoilBranchNum = 1; @@ -1035,25 +1036,25 @@ namespace EnergyPlus { QUnitOut = 0.0; QZnReq = 4000.0; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; - state.dataGlobal->DoingSizing = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; + state->dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); // Normal heating simulation for fan coil with constant fan, variable water flow - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); @@ -1061,14 +1062,14 @@ namespace EnergyPlus { PlantLoop(1).LoopSide(1).FlowLock = 1; Node(FanCoil(1).HeatCoilFluidInletNode).MassFlowRate = 0.2; // Simulate with flow lock on and locked flow > demand flow; bypass extra flow - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); EXPECT_NEAR(55.31, Node(10).Temp, 0.1); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); // heating simulation with flow lock on and locked flow < flow required for load; use locked flow Node(FanCoil(1).HeatCoilFluidInletNode).MassFlowRate = 0.05; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); EXPECT_NEAR(3780.0, QUnitOut, 5.0); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); @@ -1076,7 +1077,7 @@ namespace EnergyPlus { QZnReq = 5000.0; ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 5000.00; PlantLoop(1).LoopSide(1).FlowLock = 0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); EXPECT_NEAR(4420.0, QUnitOut, 5.0); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); @@ -1085,7 +1086,7 @@ namespace EnergyPlus { QZnReq = 80.0; ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 80.00; PlantLoop(1).LoopSide(1).FlowLock = 0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); // FC hits the 80 W target load EXPECT_NEAR(80.0, QUnitOut, 1.0); EXPECT_NEAR(75.0, FanCoil(1).QUnitOutNoHC, 1.0); @@ -1098,7 +1099,7 @@ namespace EnergyPlus { PlantLoop(1).LoopSide(1).FlowLock = 1; Node(OAMixer(1).RetNode).Temp = 25.0; // change inlet air condition so off capacity will change to see if QUnitOutNoHC remains fixed Node(OAMixer(1).RetNode).Enthalpy = 39000; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); // FC does not hit the 80 W target load since flow is locked at a low value EXPECT_NEAR(52.0, QUnitOut, 1.0); // off coil capacity is same as just prior to flow being locked @@ -1110,7 +1111,7 @@ namespace EnergyPlus { // Coil Off Capacity Test #3 - unlock plant flow to ensure that water flow rate would have been different had flow not been locked PlantLoop(1).LoopSide(1).FlowLock = 0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); // FC hits the 80 W target load EXPECT_NEAR(80.0, QUnitOut, 1.0); // actual coil off output when inlet air temp = 25 C and h = 39000 J/kg @@ -1138,11 +1139,11 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; InitializePsychRoutines(); @@ -1259,16 +1260,16 @@ namespace EnergyPlus { ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanInput(state); + GetFanInput(*state); EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); - GetFanCoilUnits(state); + GetFanCoilUnits(*state); EXPECT_EQ("CONSTANTFANVARIABLEFLOW", FanCoil(1).CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", FanCoil(1).OAMixType); EXPECT_EQ("FAN:ONOFF", FanCoil(1).FanType); @@ -1289,11 +1290,11 @@ namespace EnergyPlus { Node(OAMixer(1).RetNode).Temp = 22.0; Node(OAMixer(1).RetNode).Enthalpy = 36000; - Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); + Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); Node(OAMixer(1).InletNode).Temp = 10.0; Node(OAMixer(1).InletNode).Enthalpy = 18000; - Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); + Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); Node(FanCoil(1).AirInNode).MassFlowRate = AirMassFlow; Node(FanCoil(1).AirInNode).MassFlowRateMin = AirMassFlow; @@ -1318,26 +1319,26 @@ namespace EnergyPlus { Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - state.dataWaterCoils->WaterCoil(1).UACoilTotal = 470.0; - state.dataWaterCoils->WaterCoil(1).UACoilExternal = 611.0; - state.dataWaterCoils->WaterCoil(1).UACoilInternal = 2010.0; - state.dataWaterCoils->WaterCoil(1).TotCoilOutsideSurfArea = 50.0; + state->dataWaterCoils->WaterCoil(1).UACoilTotal = 470.0; + state->dataWaterCoils->WaterCoil(1).UACoilExternal = 611.0; + state->dataWaterCoils->WaterCoil(1).UACoilInternal = 2010.0; + state->dataWaterCoils->WaterCoil(1).TotCoilOutsideSurfArea = 50.0; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMin = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMax = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMin = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMax = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - state.dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = ColdWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 6.0; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = ColdWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 6.0; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -1353,19 +1354,19 @@ namespace EnergyPlus { TempControlType.allocate(1); TempControlType(1) = 4; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(1).Name = "ChilledWaterLoop"; PlantLoop(1).FluidName = "ChilledWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; PlantLoop(1).LoopSide(1).FlowLock = 0; FanCoil(1).CoolCoilLoopNum = 1; @@ -1373,7 +1374,7 @@ namespace EnergyPlus { FanCoil(1).CoolCoilLoopSide = 1; FanCoil(1).HeatCoilLoopSide = 0; FanCoil(1).HeatCoilFluidOutletNodeNum = 0; - FanCoil(1).CoolCoilFluidOutletNodeNum = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + FanCoil(1).CoolCoilFluidOutletNodeNum = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; FanCoil(1).CoolCoilBranchNum = 1; FanCoil(1).CoolCoilCompNum = 1; FanCoil(1).HeatCoilBranchNum = 0; @@ -1388,42 +1389,42 @@ namespace EnergyPlus { QUnitOut = 0.0; QZnReq = 4000.0; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; - state.dataGlobal->DoingSizing = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; + state->dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); // Normal heating simulation for fan coil with constant fan, electric heating - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); // normal heating, heating capacity exceeded QZnReq = 5000.0; ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 5000.00; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); EXPECT_NEAR(4575.0, QUnitOut, 5.0); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); - state.dataGlobal->DoingSizing = false; + state->dataGlobal->DoingSizing = false; PlantLoop.deallocate(); ZoneSysEnergyDemand.deallocate(); FanCoil.deallocate(); Node.deallocate(); - state.dataWaterCoils->WaterCoil.deallocate(); + state->dataWaterCoils->WaterCoil.deallocate(); ZoneEquipConfig.deallocate(); Zone.deallocate(); CoilNames.clear(); @@ -1446,11 +1447,11 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; InitializePsychRoutines(); @@ -1578,16 +1579,16 @@ namespace EnergyPlus { ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanInput(state); + GetFanInput(*state); EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); - GetFanCoilUnits(state); + GetFanCoilUnits(*state); EXPECT_EQ("CONSTANTFANVARIABLEFLOW", FanCoil(1).CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", FanCoil(1).OAMixType); EXPECT_EQ("FAN:ONOFF", FanCoil(1).FanType); @@ -1609,11 +1610,11 @@ namespace EnergyPlus { Node(OAMixer(1).RetNode).Temp = 24.0; Node(OAMixer(1).RetNode).Enthalpy = 36000; - Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); + Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); Node(OAMixer(1).InletNode).Temp = 30.0; Node(OAMixer(1).InletNode).Enthalpy = 53000; - Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); + Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); Node(FanCoil(1).AirInNode).MassFlowRate = AirMassFlow; Node(FanCoil(1).AirInNode).MassFlowRateMin = AirMassFlow; @@ -1640,34 +1641,34 @@ namespace EnergyPlus { Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - state.dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; - state.dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; - state.dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; - state.dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; - - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - state.dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; + state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; + state->dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; + state->dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; + + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + state->dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -1683,42 +1684,42 @@ namespace EnergyPlus { TempControlType.allocate(1); TempControlType(1) = 4; - state.dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(2).Name = "ChilledWaterLoop"; PlantLoop(2).FluidName = "ChilledWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(2).Name; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; PlantLoop(2).LoopSide(1).FlowLock = 0; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; PlantLoop(1).LoopSide(1).FlowLock = 0; FanCoil(1).CoolCoilLoopNum = 2; FanCoil(1).HeatCoilLoopNum = 1; FanCoil(1).CoolCoilLoopSide = 1; FanCoil(1).HeatCoilLoopSide = 1; - FanCoil(1).HeatCoilFluidOutletNodeNum = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; - FanCoil(1).CoolCoilFluidOutletNodeNum = state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; + FanCoil(1).HeatCoilFluidOutletNodeNum = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + FanCoil(1).CoolCoilFluidOutletNodeNum = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; FanCoil(1).CoolCoilBranchNum = 1; FanCoil(1).CoolCoilCompNum = 1; FanCoil(1).HeatCoilBranchNum = 1; @@ -1733,24 +1734,24 @@ namespace EnergyPlus { QUnitOut = 0.0; QZnReq = -4000.0; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; - state.dataGlobal->DoingSizing = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; + state->dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); // normal cooling simulation for constant fan variable flow fan coil - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); @@ -1759,7 +1760,7 @@ namespace EnergyPlus { PlantLoop(2).LoopSide(1).FlowLock = 1; Node(FanCoil(1).CoolCoilFluidInletNode).MassFlowRate = 0.2; // cooling simulation with flow lock on and locked flow > flow that meets load; bypass extra flow - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); EXPECT_NEAR(10.86, Node(13).Temp, 0.1); // expect inlet and outlet node air mass flow rates are equal @@ -1767,7 +1768,7 @@ namespace EnergyPlus { // cooling simulation with flow lock on and locked flow < flow required for load; use locked flow Node(FanCoil(1).CoolCoilFluidInletNode).MassFlowRate = 0.05; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); EXPECT_NEAR(-3000.0, QUnitOut, 5.0); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); @@ -1776,7 +1777,7 @@ namespace EnergyPlus { QZnReq = -5000.0; ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -5000.00; PlantLoop(2).LoopSide(1).FlowLock = 0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); EXPECT_NEAR(-4420.0, QUnitOut, 5.0); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); @@ -1798,11 +1799,11 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataSizing::CurZoneEqNum = 1; InitializePsychRoutines(); @@ -1934,16 +1935,16 @@ namespace EnergyPlus { ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanInput(state); + GetFanInput(*state); EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); - GetFanCoilUnits(state); + GetFanCoilUnits(*state); EXPECT_EQ("ASHRAE90VARIABLEFAN", FanCoil(1).CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", FanCoil(1).OAMixType); EXPECT_EQ("FAN:ONOFF", FanCoil(1).FanType); @@ -1964,11 +1965,11 @@ namespace EnergyPlus { Node(OAMixer(1).RetNode).Temp = 22.0; Node(OAMixer(1).RetNode).Enthalpy = 36000; - Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); + Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); Node(OAMixer(1).InletNode).Temp = 10.0; Node(OAMixer(1).InletNode).Enthalpy = 18000; - Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); + Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); Node(FanCoil(1).AirInNode).MassFlowRate = AirMassFlow; Node(FanCoil(1).AirInNode).MassFlowRateMin = AirMassFlow; @@ -1989,34 +1990,34 @@ namespace EnergyPlus { Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - state.dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; - state.dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; - state.dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; - state.dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; - - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - state.dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; + state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; + state->dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; + state->dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; + + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + state->dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -2029,33 +2030,33 @@ namespace EnergyPlus { loopsidebranch.Comp.allocate(1); } - state.dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(2).Name = "ChilledWaterLoop"; PlantLoop(2).FluidName = "ChilledWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(2).Name; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; CoolingLoad = false; HeatingLoad = true; @@ -2067,22 +2068,22 @@ namespace EnergyPlus { QLatOut = 0.0; QZnReq = 4000.0; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; - state.dataGlobal->DoingSizing = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; + state->dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); ZoneEqSizing(CurZoneEqNum).SizingMethod.allocate(DataHVACGlobals::NumOfSizingTypes); @@ -2103,9 +2104,9 @@ namespace EnergyPlus { FinalZoneSizing(CurZoneEqNum).DesHeatLoad = 4000.0; StdRhoAir = 1.2; - state.dataGlobal->BeginEnvrnFlag = true; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + state->dataGlobal->BeginEnvrnFlag = true; + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect full flow and meet capacity EXPECT_NEAR(QZnReq, QUnitOut, 5.0); @@ -2116,7 +2117,7 @@ namespace EnergyPlus { // expect minimum flow and meet capacity ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 1000.0; QZnReq = 1000.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); EXPECT_NEAR(Node(1).MassFlowRate, FanCoil(1).MaxAirMassFlow * FanCoil(1).LowSpeedRatio, 0.0000000001); // expect inlet and outlet node air mass flow rates are equal @@ -2125,7 +2126,7 @@ namespace EnergyPlus { // expect modulated flow and meet capacity ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 2500.0; QZnReq = 2500.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); EXPECT_GT(Node(1).MassFlowRate, FanCoil(1).MaxAirMassFlow * FanCoil(1).LowSpeedRatio); EXPECT_LT(Node(1).MassFlowRate, FanCoil(1).MaxAirMassFlow); @@ -2136,7 +2137,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = -5000.0; ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -4000.0; QZnReq = -4000.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); EXPECT_NEAR(Node(1).MassFlowRate, FanCoil(1).MaxAirMassFlow, 0.0000000001); // expect inlet and outlet node air mass flow rates are equal @@ -2146,7 +2147,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = -5000.0; ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -4255.0; QZnReq = -4255.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); EXPECT_NEAR(Node(1).MassFlowRate, FanCoil(1).MaxAirMassFlow, 0.0000000001); // expect inlet and outlet node air mass flow rates are equal @@ -2155,7 +2156,7 @@ namespace EnergyPlus { // expect minimum flow and meet capacity ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -1000.0; QZnReq = -1000.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); EXPECT_NEAR(Node(1).MassFlowRate, FanCoil(1).MaxAirMassFlow * FanCoil(1).LowSpeedRatio, 0.0000000001); // expect inlet and outlet node air mass flow rates are equal @@ -2164,20 +2165,20 @@ namespace EnergyPlus { // expect modulated flow and meet capacity ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -2500.0; QZnReq = -2500.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); EXPECT_NEAR(QZnReq, QUnitOut, 5.0); EXPECT_GT(Node(1).MassFlowRate, FanCoil(1).MaxAirMassFlow * FanCoil(1).LowSpeedRatio); EXPECT_LT(Node(1).MassFlowRate, FanCoil(1).MaxAirMassFlow); // expect inlet and outlet node air mass flow rates are equal EXPECT_EQ(Node(FanCoil(1).AirInNode).MassFlowRate, Node(FanCoil(1).AirOutNode).MassFlowRate); - state.dataGlobal->DoingSizing = false; + state->dataGlobal->DoingSizing = false; PlantLoop.deallocate(); ZoneSysEnergyDemand.deallocate(); FanCoil.deallocate(); Node.deallocate(); - state.dataWaterCoils->WaterCoil.deallocate(); + state->dataWaterCoils->WaterCoil.deallocate(); ZoneEquipConfig.deallocate(); Zone.deallocate(); CoilNames.clear(); @@ -2216,11 +2217,11 @@ namespace EnergyPlus { DataPlant::TotNumLoops = 2; DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; InitializePsychRoutines(); @@ -2272,13 +2273,13 @@ namespace EnergyPlus { // OutputProcessor::TimeValue.allocate(2); - GetZoneData(state, ErrorsFound); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneData(*state, ErrorsFound); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - SetPredefinedTables(state); - GetFanInput(state); - GetFanCoilUnits(state); + SetPredefinedTables(*state); + GetFanInput(*state); + GetFanCoilUnits(*state); PlantLoop.allocate(TotNumLoops); for (int l = 1; l <= TotNumLoops; ++l) { @@ -2292,33 +2293,33 @@ namespace EnergyPlus { loopsidebranch.Comp.allocate(1); } - state.dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(2).Name = "ChilledWaterLoop"; PlantLoop(2).FluidName = "ChilledWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(2).Name; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; bool CoolingLoad = true; bool HeatingLoad = false; @@ -2333,12 +2334,12 @@ namespace EnergyPlus { Node(6).MassFlowRateMaxAvail = 0.72; Node(5).MassFlowRateMaxAvail = 0.72; FanCoil(FanCoilNum).CCoilName_Index = 2; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::DayOfYear_Schedule = 1; DataEnvironment::DayOfWeek = 2; - state.dataGlobal->HourOfDay = 1; - ProcessScheduleInput(state); - UpdateScheduleValues(state); + state->dataGlobal->HourOfDay = 1; + ProcessScheduleInput(*state); + UpdateScheduleValues(*state); // fan coil can hit maximum iterations while trying to find the water mass flow rate to meet the load. In this case RegulaFalsi will return -1. // When this happens, this routine will find tighter limits on min/max water flow rate passed to RegulaFalsi @@ -2349,12 +2350,12 @@ namespace EnergyPlus { // tighten limits on water flow rate to see if this allows convergence // CoolingLoad = true; // HeatingLoad = false; - // TightenWaterFlowLimits(state, FanCoilNum, CoolingLoad, HeatingLoad, FanCoil( FanCoilNum ).CoolCoilFluidInletNode, ControlledZoneNum, + // TightenWaterFlowLimits(*state, FanCoilNum, CoolingLoad, HeatingLoad, FanCoil( FanCoilNum ).CoolCoilFluidInletNode, ControlledZoneNum, // FirstHVACIteration, // QZnReq, MinWaterFlow, MaxWaterFlow ); // run once to set up fan coil data - TightenWaterFlowLimits(state, FanCoilNum, + TightenWaterFlowLimits(*state, FanCoilNum, CoolingLoad, HeatingLoad, FanCoil(FanCoilNum).CoolCoilFluidInletNode, @@ -2368,7 +2369,7 @@ namespace EnergyPlus { MinWaterFlow = 0.0; MaxWaterFlow = 1.5; QZnReq = -8000.0; - TightenWaterFlowLimits(state, FanCoilNum, + TightenWaterFlowLimits(*state, FanCoilNum, CoolingLoad, HeatingLoad, FanCoil(FanCoilNum).CoolCoilFluidInletNode, @@ -2385,7 +2386,7 @@ namespace EnergyPlus { MinWaterFlow = 0.0; MaxWaterFlow = 1.5; QZnReq = -800.0; - TightenWaterFlowLimits(state, FanCoilNum, + TightenWaterFlowLimits(*state, FanCoilNum, CoolingLoad, HeatingLoad, FanCoil(FanCoilNum).CoolCoilFluidInletNode, @@ -2402,7 +2403,7 @@ namespace EnergyPlus { MinWaterFlow = 0.0; MaxWaterFlow = 1.5; QZnReq = -10.0; - TightenWaterFlowLimits(state, FanCoilNum, + TightenWaterFlowLimits(*state, FanCoilNum, CoolingLoad, HeatingLoad, FanCoil(FanCoilNum).CoolCoilFluidInletNode, @@ -2418,7 +2419,7 @@ namespace EnergyPlus { MinWaterFlow = 0.0; MaxWaterFlow = 1.5; QZnReq = 40.0; - TightenWaterFlowLimits(state, FanCoilNum, + TightenWaterFlowLimits(*state, FanCoilNum, CoolingLoad, HeatingLoad, FanCoil(FanCoilNum).CoolCoilFluidInletNode, @@ -2434,7 +2435,7 @@ namespace EnergyPlus { MinWaterFlow = 0.0; MaxWaterFlow = 1.5; QZnReq = 110.0; - TightenWaterFlowLimits(state, FanCoilNum, + TightenWaterFlowLimits(*state, FanCoilNum, CoolingLoad, HeatingLoad, FanCoil(FanCoilNum).CoolCoilFluidInletNode, @@ -2450,7 +2451,7 @@ namespace EnergyPlus { MinWaterFlow = 0.0; MaxWaterFlow = 1.5; QZnReq = 120.0; - TightenWaterFlowLimits(state, FanCoilNum, + TightenWaterFlowLimits(*state, FanCoilNum, CoolingLoad, HeatingLoad, FanCoil(FanCoilNum).CoolCoilFluidInletNode, @@ -2474,13 +2475,13 @@ namespace EnergyPlus { Par(1) = -1000.0; Par(2) = 0.0; - TempSolveRoot::SolveRoot(state, ErrorToler, MaxIte, SolFla, mdot, ResidualFancoil, MinWaterFlow, MaxWaterFlow, Par, 2, minFlow, maxFlow); + TempSolveRoot::SolveRoot(*state, ErrorToler, MaxIte, SolFla, mdot, ResidualFancoil, MinWaterFlow, MaxWaterFlow, Par, 2, minFlow, maxFlow); EXPECT_EQ(-1, SolFla); EXPECT_NEAR(minFlow, 0.0, 0.0000001); EXPECT_NEAR(maxFlow, 0.09375, 0.0000001); MaxIte = 20; HVACSystemRootFinding.HVACSystemRootSolver = DataHVACGlobals::HVACSystemRootSolverAlgorithm::RegulaFalsi; - TempSolveRoot::SolveRoot(state, ErrorToler, MaxIte, SolFla, mdot, ResidualFancoil, minFlow, maxFlow, Par); + TempSolveRoot::SolveRoot(*state, ErrorToler, MaxIte, SolFla, mdot, ResidualFancoil, minFlow, maxFlow, Par); EXPECT_EQ(3, SolFla); } @@ -2501,11 +2502,11 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataSizing::CurZoneEqNum = 1; InitializePsychRoutines(); @@ -2644,16 +2645,16 @@ namespace EnergyPlus { ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanInput(state); + GetFanInput(*state); EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); - GetFanCoilUnits(state); + GetFanCoilUnits(*state); EXPECT_EQ("CYCLINGFAN", FanCoil(1).CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", FanCoil(1).OAMixType); EXPECT_EQ("FAN:ONOFF", FanCoil(1).FanType); @@ -2674,11 +2675,11 @@ namespace EnergyPlus { Node(OAMixer(1).RetNode).Temp = 22.0; Node(OAMixer(1).RetNode).Enthalpy = 36000; - Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); + Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); Node(OAMixer(1).InletNode).Temp = 10.0; Node(OAMixer(1).InletNode).Enthalpy = 18000; - Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); + Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); Node(FanCoil(1).AirInNode).MassFlowRate = AirMassFlow; Node(FanCoil(1).AirInNode).MassFlowRateMin = AirMassFlow; @@ -2698,34 +2699,34 @@ namespace EnergyPlus { Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - state.dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; - state.dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; - state.dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; - state.dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; - - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - state.dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; + state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; + state->dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; + state->dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; + + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + state->dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -2738,33 +2739,33 @@ namespace EnergyPlus { loopsidebranch.Comp.allocate(1); } - state.dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(2).Name = "ChilledWaterLoop"; PlantLoop(2).FluidName = "ChilledWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(2).Name; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; CoolingLoad = false; HeatingLoad = true; @@ -2777,22 +2778,22 @@ namespace EnergyPlus { QLatOut = 0.0; QZnReq = 4000.0; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; - state.dataGlobal->DoingSizing = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; + state->dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); ZoneEqSizing(CurZoneEqNum).SizingMethod.allocate(DataHVACGlobals::NumOfSizingTypes); @@ -2813,9 +2814,9 @@ namespace EnergyPlus { FinalZoneSizing(CurZoneEqNum).DesHeatLoad = 4000.0; StdRhoAir = 1.2; - state.dataGlobal->BeginEnvrnFlag = true; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + state->dataGlobal->BeginEnvrnFlag = true; + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 3 and near full air and water flow and meet capacity EXPECT_EQ(3, FanCoil(1).SpeedFanSel); EXPECT_GT(FanCoil(1).PLR, 0.95); @@ -2827,7 +2828,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 1000.0; ZoneSysEnergyDemand(1).RemainingOutputRequired = 1000.0; QZnReq = 1000.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 1 and moderate air and water flow and meet capacity EXPECT_EQ(1, FanCoil(1).SpeedFanSel); EXPECT_GT(FanCoil(1).PLR, 0.6); @@ -2840,7 +2841,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 2500.0; ZoneSysEnergyDemand(1).RemainingOutputRequired = 2500.0; QZnReq = 2500.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 2 and moderate air and water flow and meet capacity EXPECT_EQ(2, FanCoil(1).SpeedFanSel); EXPECT_GT(FanCoil(1).PLR, 0.8); @@ -2854,7 +2855,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -4000.0; ZoneSysEnergyDemand(1).RemainingOutputRequired = -4000.0; QZnReq = -4000.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 3 and near full air and water flow and meet capacity EXPECT_EQ(3, FanCoil(1).SpeedFanSel); EXPECT_GT(FanCoil(1).PLR, 0.9); @@ -2867,7 +2868,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -1000.0; ZoneSysEnergyDemand(1).RemainingOutputRequired = -1000.0; QZnReq = -1000.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 1 and moderate air and water flow and meet capacity EXPECT_EQ(1, FanCoil(1).SpeedFanSel); EXPECT_GT(FanCoil(1).PLR, 0.5); @@ -2880,7 +2881,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -2500.0; ZoneSysEnergyDemand(1).RemainingOutputRequired = -2500.0; QZnReq = -2500.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 2 and moderate air and water flow and meet capacity EXPECT_EQ(2, FanCoil(1).SpeedFanSel); EXPECT_GT(FanCoil(1).PLR, 0.75); @@ -2906,11 +2907,11 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataSizing::CurZoneEqNum = 1; InitializePsychRoutines(); @@ -3062,14 +3063,14 @@ namespace EnergyPlus { ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanCoilUnits(state); + GetFanCoilUnits(*state); auto &thisFanCoil(FanCoil(1)); @@ -3104,13 +3105,13 @@ namespace EnergyPlus { Node(MixerOA.RetNode).MassFlowRateMax = MaxAirMassFlow; Node(MixerOA.RetNode).Temp = 22.0; Node(MixerOA.RetNode).Enthalpy = 36000; - Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(state, Node(MixerOA.RetNode).Temp, Node(MixerOA.RetNode).Enthalpy); + Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(*state, Node(MixerOA.RetNode).Temp, Node(MixerOA.RetNode).Enthalpy); Node(MixerOA.InletNode).Temp = 10.0; Node(MixerOA.InletNode).Enthalpy = 18000; - Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(state, Node(MixerOA.InletNode).Temp, Node(MixerOA.InletNode).Enthalpy); + Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(*state, Node(MixerOA.InletNode).Temp, Node(MixerOA.InletNode).Enthalpy); // chilled water coil - auto &CWCoil(state.dataWaterCoils->WaterCoil(2)); + auto &CWCoil(state->dataWaterCoils->WaterCoil(2)); CWCoil.UACoilTotal = 470.0; CWCoil.UACoilExternal = 611.0; CWCoil.UACoilInternal = 2010.0; @@ -3132,7 +3133,7 @@ namespace EnergyPlus { CWCoil.WaterLoopCompNum = 1; // hot water coil - auto &HWCoil(state.dataWaterCoils->WaterCoil(1)); + auto &HWCoil(state->dataWaterCoils->WaterCoil(1)); HWCoil.InletWaterMassFlowRate = HotWaterMassFlowRate; HWCoil.MaxWaterMassFlowRate = HotWaterMassFlowRate; Node(HWCoil.AirInletNodeNum).MassFlowRate = AirMassFlow; @@ -3164,7 +3165,7 @@ namespace EnergyPlus { CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; // hot water plant loop @@ -3174,7 +3175,7 @@ namespace EnergyPlus { HWLoop.FluidIndex = 1; HWLoop.FluidName = "WATER"; HWLoop.LoopSide(1).Branch(1).Comp(1).Name = HWCoil.Name; - HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; + HWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = HWCoil.WaterInletNodeNum; HWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = HWCoil.WaterOutletNodeNum; @@ -3190,22 +3191,22 @@ namespace EnergyPlus { QLatOut = 0.0; QZnReq = 4000.0; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; - state.dataGlobal->DoingSizing = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; + state->dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); ZoneEqSizing(CurZoneEqNum).SizingMethod.allocate(DataHVACGlobals::NumOfSizingTypes); @@ -3226,9 +3227,9 @@ namespace EnergyPlus { FinalZoneSizing(CurZoneEqNum).DesHeatLoad = 4000.0; StdRhoAir = 1.2; - state.dataGlobal->BeginEnvrnFlag = true; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + state->dataGlobal->BeginEnvrnFlag = true; + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 3 and near full air and water flow and meet capacity EXPECT_EQ(thisFanCoil.SpeedFanSel, 3); EXPECT_NEAR(thisFanCoil.PLR, 0.961, 0.001); @@ -3239,7 +3240,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 1000.0; ZoneSysEnergyDemand(1).RemainingOutputRequired = 1000.0; QZnReq = 1000.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 1 and moderate air and water flow and meet capacity EXPECT_EQ(thisFanCoil.SpeedFanSel, 1); EXPECT_NEAR(thisFanCoil.PLR, 0.632, 0.001); @@ -3250,7 +3251,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 2500.0; ZoneSysEnergyDemand(1).RemainingOutputRequired = 2500.0; QZnReq = 2500.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 2 and moderate air and water flow and meet capacity EXPECT_EQ(thisFanCoil.SpeedFanSel, 2); EXPECT_NEAR(thisFanCoil.PLR, 0.850, 0.001); @@ -3264,7 +3265,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -4000.0; ZoneSysEnergyDemand(1).RemainingOutputRequired = -4000.0; QZnReq = -4000.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 3 and near full air and water flow and meet capacity EXPECT_EQ(3, FanCoil(1).SpeedFanSel); EXPECT_NEAR(FanCoil(1).PLR, 0.950, 0.001); @@ -3275,7 +3276,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -1000.0; ZoneSysEnergyDemand(1).RemainingOutputRequired = -1000.0; QZnReq = -1000.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 1 and moderate air and water flow and meet capacity EXPECT_EQ(1, FanCoil(1).SpeedFanSel); EXPECT_NEAR(FanCoil(1).PLR, 0.501, 0.001); @@ -3286,7 +3287,7 @@ namespace EnergyPlus { ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -2500.0; ZoneSysEnergyDemand(1).RemainingOutputRequired = -2500.0; QZnReq = -2500.0; - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect fan speed 2 and moderate air and water flow and meet capacity EXPECT_EQ(2, FanCoil(1).SpeedFanSel); EXPECT_NEAR(FanCoil(1).PLR, 0.756, 0.001); @@ -3310,11 +3311,11 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataSizing::CurZoneEqNum = 1; InitializePsychRoutines(); @@ -3465,12 +3466,12 @@ namespace EnergyPlus { ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanCoilUnits(state); + GetFanCoilUnits(*state); auto &thisFanCoil(FanCoil(1)); EXPECT_EQ("MULTISPEEDFAN", thisFanCoil.CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", thisFanCoil.OAMixType); @@ -3498,12 +3499,12 @@ namespace EnergyPlus { Node(MixerOA.RetNode).MassFlowRateMax = MaxAirMassFlow; Node(MixerOA.RetNode).Temp = 22.0; Node(MixerOA.RetNode).Enthalpy = 36000; - Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(state, Node(MixerOA.RetNode).Temp, Node(MixerOA.RetNode).Enthalpy); + Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(*state, Node(MixerOA.RetNode).Temp, Node(MixerOA.RetNode).Enthalpy); Node(MixerOA.InletNode).Temp = 10.0; Node(MixerOA.InletNode).Enthalpy = 18000; - Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(state, Node(MixerOA.InletNode).Temp, Node(MixerOA.InletNode).Enthalpy); + Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(*state, Node(MixerOA.InletNode).Temp, Node(MixerOA.InletNode).Enthalpy); // chilled water coil - auto &CWCoil(state.dataWaterCoils->WaterCoil(1)); + auto &CWCoil(state->dataWaterCoils->WaterCoil(1)); CWCoil.UACoilTotal = 470.0; CWCoil.UACoilExternal = 611.0; CWCoil.UACoilInternal = 2010.0; @@ -3545,15 +3546,15 @@ namespace EnergyPlus { CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataGlobal->DoingSizing = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; // heating mode tests CoolingLoad = false; HeatingLoad = true; @@ -3563,12 +3564,12 @@ namespace EnergyPlus { StdRhoAir = 1.2; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); ZoneEqSizing(CurZoneEqNum).SizingMethod.allocate(DataHVACGlobals::NumOfSizingTypes); ZoneEqSizing(CurZoneEqNum).SizingMethod = 0; @@ -3596,9 +3597,9 @@ namespace EnergyPlus { QZnReq = 2000.0; QUnitOut = 0.0; QLatOut = 0.0; - state.dataGlobal->BeginEnvrnFlag = true; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + state->dataGlobal->BeginEnvrnFlag = true; + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); Real64 expectedAirFlowRate = thisFanCoil.PLR * thisFanCoil.MaxAirMassFlow * thisFanCoil.LowSpeedRatio; // expect fan speed 1 and fan and coil cycling to meet load EXPECT_EQ(thisFanCoil.SpeedFanSel, 1); @@ -3614,8 +3615,8 @@ namespace EnergyPlus { QZnReq = 4000.0; QUnitOut = 0.0; QLatOut = 0.0; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); expectedAirFlowRate = (1.0 - thisFanCoil.SpeedRatio) * (thisFanCoil.LowSpeedRatio * thisFanCoil.MaxAirMassFlow) + thisFanCoil.SpeedRatio * (thisFanCoil.MedSpeedRatio * thisFanCoil.MaxAirMassFlow); // expect fan speed 2 and fan and fancoil cycling b/n speed 1 and 2 @@ -3632,8 +3633,8 @@ namespace EnergyPlus { QZnReq = 8000.0; QUnitOut = 0.0; QLatOut = 0.0; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); expectedAirFlowRate = (1.0 - thisFanCoil.SpeedRatio) * (thisFanCoil.MedSpeedRatio * thisFanCoil.MaxAirMassFlow) + thisFanCoil.SpeedRatio * (1.0 * thisFanCoil.MaxAirMassFlow); // expect fan speed 3 and fan and fancoil cycling b/n speed 2 and 3 @@ -3650,8 +3651,8 @@ namespace EnergyPlus { QZnReq = 10200; QUnitOut = 0.0; QLatOut = 0.0; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); expectedAirFlowRate = thisFanCoil.MaxAirMassFlow; // expect fan speed 3 and fancoil running at max speed EXPECT_EQ(thisFanCoil.SpeedFanSel, 3); @@ -3677,11 +3678,11 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataSizing::CurZoneEqNum = 1; InitializePsychRoutines(); @@ -3832,12 +3833,12 @@ namespace EnergyPlus { ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanCoilUnits(state); + GetFanCoilUnits(*state); auto &thisFanCoil(FanCoil(1)); EXPECT_EQ("MULTISPEEDFAN", thisFanCoil.CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", thisFanCoil.OAMixType); @@ -3865,12 +3866,12 @@ namespace EnergyPlus { Node(MixerOA.RetNode).MassFlowRateMax = MaxAirMassFlow; Node(MixerOA.RetNode).Temp = 22.0; Node(MixerOA.RetNode).Enthalpy = 36000; - Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(state, Node(MixerOA.RetNode).Temp, Node(MixerOA.RetNode).Enthalpy); + Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(*state, Node(MixerOA.RetNode).Temp, Node(MixerOA.RetNode).Enthalpy); Node(MixerOA.InletNode).Temp = 10.0; Node(MixerOA.InletNode).Enthalpy = 18000; - Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(state, Node(MixerOA.InletNode).Temp, Node(MixerOA.InletNode).Enthalpy); + Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(*state, Node(MixerOA.InletNode).Temp, Node(MixerOA.InletNode).Enthalpy); // chilled water coil - auto &CWCoil(state.dataWaterCoils->WaterCoil(1)); + auto &CWCoil(state->dataWaterCoils->WaterCoil(1)); CWCoil.UACoilTotal = 470.0; CWCoil.UACoilExternal = 611.0; CWCoil.UACoilInternal = 2010.0; @@ -3912,15 +3913,15 @@ namespace EnergyPlus { CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataGlobal->DoingSizing = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; // heating mode tests CoolingLoad = false; HeatingLoad = true; @@ -3930,12 +3931,12 @@ namespace EnergyPlus { StdRhoAir = 1.2; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); ZoneEqSizing(CurZoneEqNum).SizingMethod.allocate(DataHVACGlobals::NumOfSizingTypes); ZoneEqSizing(CurZoneEqNum).SizingMethod = 0; @@ -3963,9 +3964,9 @@ namespace EnergyPlus { QZnReq = 2000.0; QUnitOut = 0.0; QLatOut = 0.0; - state.dataGlobal->BeginEnvrnFlag = true; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + state->dataGlobal->BeginEnvrnFlag = true; + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); Real64 expectedAirFlowRate = thisFanCoil.MaxAirMassFlow * thisFanCoil.LowSpeedRatio; // expect fan speed 1, fan runs continuously and only heating coil cycle on/off to meet load EXPECT_EQ(thisFanCoil.SpeedFanSel, 1); @@ -3981,8 +3982,8 @@ namespace EnergyPlus { QZnReq = 4000.0; QUnitOut = 0.0; QLatOut = 0.0; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); expectedAirFlowRate = (1.0 - thisFanCoil.SpeedRatio) * (thisFanCoil.LowSpeedRatio * thisFanCoil.MaxAirMassFlow) + thisFanCoil.SpeedRatio * (thisFanCoil.MedSpeedRatio * thisFanCoil.MaxAirMassFlow); // expect fan speed 2 and fan and fancoil cycling b/n speed 1 and 2 @@ -3999,8 +4000,8 @@ namespace EnergyPlus { QZnReq = 8000.0; QUnitOut = 0.0; QLatOut = 0.0; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); expectedAirFlowRate = (1.0 - thisFanCoil.SpeedRatio) * (thisFanCoil.MedSpeedRatio * thisFanCoil.MaxAirMassFlow) + thisFanCoil.SpeedRatio * (1.0 * thisFanCoil.MaxAirMassFlow); // expect fan speed 3 and fan and fancoil cycling b/n speed 2 and 3 @@ -4017,8 +4018,8 @@ namespace EnergyPlus { QZnReq = 10200; QUnitOut = 0.0; QLatOut = 0.0; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); expectedAirFlowRate = thisFanCoil.MaxAirMassFlow; // expect fan speed 3 and fancoil running at max speed EXPECT_EQ(thisFanCoil.SpeedFanSel, 3); @@ -4044,11 +4045,11 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataSizing::CurZoneEqNum = 1; InitializePsychRoutines(); @@ -4199,12 +4200,12 @@ namespace EnergyPlus { ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanCoilUnits(state); + GetFanCoilUnits(*state); auto &thisFanCoil(FanCoil(1)); EXPECT_EQ("MULTISPEEDFAN", thisFanCoil.CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", thisFanCoil.OAMixType); @@ -4232,12 +4233,12 @@ namespace EnergyPlus { Node(MixerOA.RetNode).MassFlowRateMax = MaxAirMassFlow; Node(MixerOA.RetNode).Temp = 22.0; Node(MixerOA.RetNode).Enthalpy = 36000; - Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(state, Node(MixerOA.RetNode).Temp, Node(MixerOA.RetNode).Enthalpy); + Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(*state, Node(MixerOA.RetNode).Temp, Node(MixerOA.RetNode).Enthalpy); Node(MixerOA.InletNode).Temp = 10.0; Node(MixerOA.InletNode).Enthalpy = 18000; - Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(state, Node(MixerOA.InletNode).Temp, Node(MixerOA.InletNode).Enthalpy); + Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(*state, Node(MixerOA.InletNode).Temp, Node(MixerOA.InletNode).Enthalpy); // chilled water coil - auto &CWCoil(state.dataWaterCoils->WaterCoil(1)); + auto &CWCoil(state->dataWaterCoils->WaterCoil(1)); CWCoil.UACoilTotal = 470.0; CWCoil.UACoilExternal = 611.0; CWCoil.UACoilInternal = 2010.0; @@ -4279,15 +4280,15 @@ namespace EnergyPlus { CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataGlobal->DoingSizing = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; // heating mode tests CoolingLoad = false; HeatingLoad = true; @@ -4297,12 +4298,12 @@ namespace EnergyPlus { StdRhoAir = 1.2; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); ZoneEqSizing(CurZoneEqNum).SizingMethod.allocate(DataHVACGlobals::NumOfSizingTypes); ZoneEqSizing(CurZoneEqNum).SizingMethod = 0; @@ -4330,8 +4331,8 @@ namespace EnergyPlus { int InletNode = thisFanCoil.AirInNode; Real64 QUnitOutMaxLS = 0.0; // low speed maximum output - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); FanCoil(FanCoilNum).SpeedFanSel = 1; FanCoil(FanCoilNum).SpeedFanRatSel = FanCoil(FanCoilNum).LowSpeedRatio; @@ -4341,7 +4342,7 @@ namespace EnergyPlus { Node(InletNode).MassFlowRateMax = AirMassFlow; Node(InletNode).MassFlowRateMaxAvail = AirMassFlow; Node(InletNode).MassFlowRateMinAvail = AirMassFlow; - Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOutMaxLS, _, 1.0); + Calc4PipeFanCoil(*state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOutMaxLS, _, 1.0); EXPECT_NEAR(QUnitOutMaxLS, 3022.5, 1.0); int MaxIter = 10; @@ -4357,7 +4358,7 @@ namespace EnergyPlus { Par(3) = ZoneNum; Par(4) = QZnReq; Par(5) = double(FanCoil(FanCoilNum).HeatCoilFluidInletNode); - TempSolveRoot::SolveRoot(state, 0.001, MaxIter, SolFlag, CyclingRatio, CalcFanCoilHeatCoilPLRResidual, 0.0, 1.0, Par); + TempSolveRoot::SolveRoot(*state, 0.001, MaxIter, SolFlag, CyclingRatio, CalcFanCoilHeatCoilPLRResidual, 0.0, 1.0, Par); Real64 expectedAirFlowRate = thisFanCoil.MaxAirMassFlow * thisFanCoil.LowSpeedRatio; EXPECT_EQ(thisFanCoil.SpeedFanSel, 1); EXPECT_EQ(Node(InletNode).MassFlowRate, expectedAirFlowRate); @@ -4374,7 +4375,7 @@ namespace EnergyPlus { Par(3) = ZoneNum; Par(4) = QZnReq; Par(5) = double(FanCoil(FanCoilNum).HeatCoilFluidInletNode); - TempSolveRoot::SolveRoot(state, 0.001, MaxIter, SolFlag, CyclingRatio, CalcFanCoilHeatCoilPLRResidual, 0.0, 1.0, Par); + TempSolveRoot::SolveRoot(*state, 0.001, MaxIter, SolFlag, CyclingRatio, CalcFanCoilHeatCoilPLRResidual, 0.0, 1.0, Par); expectedAirFlowRate = thisFanCoil.MaxAirMassFlow * thisFanCoil.LowSpeedRatio; EXPECT_EQ(thisFanCoil.SpeedFanSel, 1); EXPECT_EQ(Node(InletNode).MassFlowRate, expectedAirFlowRate); @@ -4513,20 +4514,20 @@ namespace EnergyPlus { DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; //NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataSizing::CurZoneEqNum = 1; InitializePsychRoutines(); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("WEST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanCoilUnits(state); + GetFanCoilUnits(*state); auto &thisFanCoil(FanCoil(1)); EXPECT_EQ("ASHRAE90VARIABLEFAN", thisFanCoil.CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", thisFanCoil.OAMixType); @@ -4547,12 +4548,12 @@ namespace EnergyPlus { Node(MixerOA.RetNode).MassFlowRateMax = MaxAirMassFlow; Node(MixerOA.RetNode).Temp = 20.0; Node(MixerOA.RetNode).Enthalpy = 36000; - Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(state, Node(MixerOA.RetNode).Temp, Node(MixerOA.RetNode).Enthalpy); + Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(*state, Node(MixerOA.RetNode).Temp, Node(MixerOA.RetNode).Enthalpy); Node(MixerOA.InletNode).Temp = 10.0; Node(MixerOA.InletNode).Enthalpy = 18000; - Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(state, Node(MixerOA.InletNode).Temp, Node(MixerOA.InletNode).Enthalpy); + Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(*state, Node(MixerOA.InletNode).Temp, Node(MixerOA.InletNode).Enthalpy); // chilled water coil - auto &CWCoil(state.dataWaterCoils->WaterCoil(1)); + auto &CWCoil(state->dataWaterCoils->WaterCoil(1)); CWCoil.UACoilTotal = 470.0; CWCoil.UACoilExternal = 611.0; CWCoil.UACoilInternal = 2010.0; @@ -4591,15 +4592,15 @@ namespace EnergyPlus { CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataGlobal->DoingSizing = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; // heating mode tests CoolingLoad = false; HeatingLoad = true; @@ -4608,19 +4609,19 @@ namespace EnergyPlus { DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); CurDeadBandOrSetback.allocate(1); CurDeadBandOrSetback(1) = false; TempControlType.allocate(1); TempControlType(1) = 4; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; thisFanCoil.DesignHeatingCapacity = 6000.0; // test 1: load larger than fancoil full capacity @@ -4630,9 +4631,9 @@ namespace EnergyPlus { QZnReq = 10000.0; QUnitOut = 0.0; QLatOut = 0.0; - state.dataGlobal->BeginEnvrnFlag = true; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + state->dataGlobal->BeginEnvrnFlag = true; + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect output full capacity EXPECT_EQ(Node(thisFanCoil.AirInNode).MassFlowRate, thisFanCoil.MaxAirMassFlow); EXPECT_EQ(thisFanCoil.PLR, 1.0); @@ -4645,9 +4646,9 @@ namespace EnergyPlus { QZnReq = 3000.0; QUnitOut = 0.0; QLatOut = 0.0; - state.dataGlobal->BeginEnvrnFlag = true; - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + state->dataGlobal->BeginEnvrnFlag = true; + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // expect part load operation with about 3000W output EXPECT_NEAR(Node(thisFanCoil.AirInNode).MassFlowRate, thisFanCoil.MaxAirMassFlow, 0.00001); EXPECT_NEAR(thisFanCoil.PLR, 0.487, 0.001); diff --git a/tst/EnergyPlus/unit/Fans.unit.cc b/tst/EnergyPlus/unit/Fans.unit.cc index f578282f52c..403a75bde9d 100644 --- a/tst/EnergyPlus/unit/Fans.unit.cc +++ b/tst/EnergyPlus/unit/Fans.unit.cc @@ -58,6 +58,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::DataSizing; @@ -69,10 +70,10 @@ TEST_F(EnergyPlusFixture, Fans_FanSizing) CurZoneEqNum = 0; CurSysNum = 0; CurOASysNum = 0; - state.dataFans->NumFans = 1; - Fan.allocate(state.dataFans->NumFans); - FanNumericFields.allocate(state.dataFans->NumFans); - FanNumericFields(state.dataFans->NumFans).FieldNames.allocate(3); + state->dataFans->NumFans = 1; + Fan.allocate(state->dataFans->NumFans); + FanNumericFields.allocate(state->dataFans->NumFans); + FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(3); int FanNum = 1; Fan(FanNum).FanName = "Test Fan"; @@ -92,7 +93,7 @@ TEST_F(EnergyPlusFixture, Fans_FanSizing) // DataNonZoneNonAirloopValue must be set when CurZoneEqNum and CurSysNum = 0 DataNonZoneNonAirloopValue = 1.00635; - SizeFan(state, FanNum); + SizeFan(*state, FanNum); EXPECT_DOUBLE_EQ(1.00635, Fan(FanNum).MaxAirFlowRate); DataNonZoneNonAirloopValue = 0.0; EXPECT_NEAR(1.0371, Fan(FanNum).DesignPointFEI, 0.0001); @@ -101,10 +102,10 @@ TEST_F(EnergyPlusFixture, Fans_FanSizing) TEST_F(EnergyPlusFixture, Fans_ConstantVolume_EMSPressureRiseResetTest) { - state.dataFans->NumFans = 1; - Fans::Fan.allocate(state.dataFans->NumFans); - Fans::FanNumericFields.allocate(state.dataFans->NumFans); - Fans::FanNumericFields(state.dataFans->NumFans).FieldNames.allocate(2); + state->dataFans->NumFans = 1; + Fans::Fan.allocate(state->dataFans->NumFans); + Fans::FanNumericFields.allocate(state->dataFans->NumFans); + Fans::FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(2); // set standard air density DataEnvironment::StdRhoAir = 1.0; // set fan model inputs @@ -128,10 +129,10 @@ TEST_F(EnergyPlusFixture, Fans_ConstantVolume_EMSPressureRiseResetTest) thisFan.RhoAirStdInit = DataEnvironment::StdRhoAir; thisFan.EMSFanPressureOverrideOn = false; thisFan.EMSFanPressureValue = 0.0; - state.dataFans->LocalTurnFansOn = true; - state.dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; + state->dataFans->LocalTurnFansOff = false; // simulate the fan - Fans::SimSimpleFan(state, FanNum); + Fans::SimSimpleFan(*state, FanNum); // fan power = MassFlow * DeltaPress / (FanEff * RhoAir) Real64 Result_FanPower = max(0.0, thisFan.MaxAirMassFlowRate * thisFan.DeltaPress / (thisFan.FanEff * thisFan.RhoAirStdInit)); EXPECT_DOUBLE_EQ(Result_FanPower, thisFan.FanPower); // expects 300 W @@ -141,17 +142,17 @@ TEST_F(EnergyPlusFixture, Fans_ConstantVolume_EMSPressureRiseResetTest) thisFan.EMSFanPressureValue = -300.0; // simulate the fan with negative pressure rise // set using fans EMS actuator for Pressure Rise - Fans::SimSimpleFan(state, FanNum); + Fans::SimSimpleFan(*state, FanNum); Real64 Result2_FanPower = max(0.0, thisFan.MaxAirMassFlowRate * thisFan.EMSFanPressureValue / (thisFan.FanEff * thisFan.RhoAirStdInit)); EXPECT_DOUBLE_EQ(Result2_FanPower, thisFan.FanPower); // expects zero } TEST_F(EnergyPlusFixture, Fans_OnOff_EMSPressureRiseResetTest) { - state.dataFans->NumFans = 1; - Fans::Fan.allocate(state.dataFans->NumFans); - Fans::FanNumericFields.allocate(state.dataFans->NumFans); - Fans::FanNumericFields(state.dataFans->NumFans).FieldNames.allocate(2); + state->dataFans->NumFans = 1; + Fans::Fan.allocate(state->dataFans->NumFans); + Fans::FanNumericFields.allocate(state->dataFans->NumFans); + Fans::FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(2); // set standard air density DataEnvironment::StdRhoAir = 1.0; // set fan model inputs @@ -175,10 +176,10 @@ TEST_F(EnergyPlusFixture, Fans_OnOff_EMSPressureRiseResetTest) thisFan.RhoAirStdInit = DataEnvironment::StdRhoAir; thisFan.EMSFanPressureOverrideOn = false; thisFan.EMSFanPressureValue = 0.0; - state.dataFans->LocalTurnFansOn = true; - state.dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; + state->dataFans->LocalTurnFansOff = false; // simulate the fan - Fans::SimOnOffFan(state, FanNum); + Fans::SimOnOffFan(*state, FanNum); // fan power = MassFlow * DeltaPress / (FanEff * RhoAir) Real64 Result_FanPower = max(0.0, thisFan.MaxAirMassFlowRate * thisFan.DeltaPress / (thisFan.FanEff * thisFan.RhoAirStdInit)); EXPECT_DOUBLE_EQ(Result_FanPower, thisFan.FanPower); // expects 300 W @@ -188,17 +189,17 @@ TEST_F(EnergyPlusFixture, Fans_OnOff_EMSPressureRiseResetTest) thisFan.EMSFanPressureValue = -300.0; // simulate the fan with negative pressure rise // set using fans EMS actuator for Pressure Rise - Fans::SimOnOffFan(state, FanNum); + Fans::SimOnOffFan(*state, FanNum); Real64 Result2_FanPower = max(0.0, thisFan.MaxAirMassFlowRate * thisFan.EMSFanPressureValue / (thisFan.FanEff * thisFan.RhoAirStdInit)); EXPECT_DOUBLE_EQ(Result2_FanPower, thisFan.FanPower); // expects zero } TEST_F(EnergyPlusFixture, Fans_VariableVolume_EMSPressureRiseResetTest) { - state.dataFans->NumFans = 1; - Fans::Fan.allocate(state.dataFans->NumFans); - Fans::FanNumericFields.allocate(state.dataFans->NumFans); - Fans::FanNumericFields(state.dataFans->NumFans).FieldNames.allocate(2); + state->dataFans->NumFans = 1; + Fans::Fan.allocate(state->dataFans->NumFans); + Fans::FanNumericFields.allocate(state->dataFans->NumFans); + Fans::FanNumericFields(state->dataFans->NumFans).FieldNames.allocate(2); // set standard air density DataEnvironment::StdRhoAir = 1.0; // set fan model inputs @@ -228,10 +229,10 @@ TEST_F(EnergyPlusFixture, Fans_VariableVolume_EMSPressureRiseResetTest) thisFan.FanCoeff(5) = 0.000; thisFan.EMSFanPressureOverrideOn = false; thisFan.EMSFanPressureValue = 0.0; - state.dataFans->LocalTurnFansOn = true; - state.dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; + state->dataFans->LocalTurnFansOff = false; // simulate the fan - Fans::SimVariableVolumeFan(state, FanNum); + Fans::SimVariableVolumeFan(*state, FanNum); // fan power = PartLoadFrac * MassFlow * DeltaPress / (FanEff * RhoAir) Real64 FlowRatio = 1.0; Real64 PartLoadFrac = thisFan.FanCoeff(1) + thisFan.FanCoeff(2) * FlowRatio + thisFan.FanCoeff(3) * FlowRatio * FlowRatio + @@ -245,7 +246,7 @@ TEST_F(EnergyPlusFixture, Fans_VariableVolume_EMSPressureRiseResetTest) thisFan.EMSFanPressureValue = -300.0; // simulate the fan with negative pressure rise // set using fans EMS actuator for Pressure Rise - Fans::SimVariableVolumeFan(state, FanNum); + Fans::SimVariableVolumeFan(*state, FanNum); Real64 Result2_FanPower = max(0.0, PartLoadFrac * thisFan.MaxAirMassFlowRate * thisFan.EMSFanPressureValue / (thisFan.FanEff * thisFan.RhoAirStdInit)); EXPECT_DOUBLE_EQ(Result2_FanPower, thisFan.FanPower); // expects zero diff --git a/tst/EnergyPlus/unit/FaultsManager.unit.cc b/tst/EnergyPlus/unit/FaultsManager.unit.cc index 31169c6bfbf..6b360807bd0 100644 --- a/tst/EnergyPlus/unit/FaultsManager.unit.cc +++ b/tst/EnergyPlus/unit/FaultsManager.unit.cc @@ -72,6 +72,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -96,26 +97,26 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil bool TestRestult; // Allocate - state.dataCurveManager->NumCurves = 1; - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->NumCurves = 1; + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); - state.dataFans->NumFans = 2; - Fan.allocate(state.dataFans->NumFans); - FaultsFouledAirFilters.allocate(state.dataFans->NumFans); + state->dataFans->NumFans = 2; + Fan.allocate(state->dataFans->NumFans); + FaultsFouledAirFilters.allocate(state->dataFans->NumFans); // Inputs: fan curve CurveNum = 1; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Cubic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Cubic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1151.1; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 13.509; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = -0.9105; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = -0.0129; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 7.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 21.0; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Cubic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Cubic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1151.1; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 13.509; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = -0.9105; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = -0.0129; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 7.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 21.0; // Inputs: FanNum = 1; @@ -137,15 +138,15 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil // Run and Check // (1)The rated operational point of Fan_1 falls on the fan curve FanNum = 1; - TestRestult = FaultsFouledAirFilters(FanNum).CheckFaultyAirFilterFanCurve(state); + TestRestult = FaultsFouledAirFilters(FanNum).CheckFaultyAirFilterFanCurve(*state); EXPECT_TRUE(TestRestult); // (2)The rated operational point of Fan_2 does not fall on the fan curve FanNum = 2; - TestRestult = FaultsFouledAirFilters(FanNum).CheckFaultyAirFilterFanCurve(state); + TestRestult = FaultsFouledAirFilters(FanNum).CheckFaultyAirFilterFanCurve(*state); EXPECT_FALSE(TestRestult); // Clean up - state.dataCurveManager->PerfCurve.deallocate(); + state->dataCurveManager->PerfCurve.deallocate(); Fan.deallocate(); } @@ -224,7 +225,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil DataEnvironment::StdRhoAir = 1.2; // Run CheckAndReadFaults which will call GetFanInput if not done yet - EXPECT_NO_THROW(CheckAndReadFaults(state)); + EXPECT_NO_THROW(CheckAndReadFaults(*state)); compare_err_stream("", true); DataSizing::CurZoneEqNum = 0; @@ -235,7 +236,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil DataSizing::DataNonZoneNonAirloopValue = 0.114; // We expect this one to throw, I changed the fan design pressure to 400, and made it non autosized. int FanNum = 1; - EXPECT_NO_THROW(Fans::SizeFan(state, FanNum)); + EXPECT_NO_THROW(Fans::SizeFan(*state, FanNum)); EXPECT_DOUBLE_EQ(0.114, Fans::Fan(FanNum).MaxAirFlowRate); } @@ -313,7 +314,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil DataEnvironment::StdRhoAir = 1.2; // Run CheckAndReadFaults which will call GetFanInput if not done yet - EXPECT_NO_THROW(CheckAndReadFaults(state)); + EXPECT_NO_THROW(CheckAndReadFaults(*state)); compare_err_stream("", true); DataSizing::CurZoneEqNum = 0; @@ -324,7 +325,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CheckFaultyAirFil DataSizing::DataNonZoneNonAirloopValue = 0.15; // We expect this one to throw, I changed the fan design pressure to 400, and made it non autosized. int FanNum = 1; - EXPECT_ANY_THROW(Fans::SizeFan(state, FanNum)); + EXPECT_ANY_THROW(Fans::SizeFan(*state, FanNum)); EXPECT_DOUBLE_EQ(0.114, Fans::Fan(FanNum).MaxAirFlowRate); std::string const error_string = delimited_string({ " ** Severe ** FaultModel:Fouling:AirFilter = \"FAN CV FOULING AIR FILTER\"", @@ -351,25 +352,25 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CalFaultyFanAirFl double FanFaultyDeltaPressInc = 0.10; // Increase by 10% // Allocate - state.dataCurveManager->NumCurves = 1; - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->NumCurves = 1; + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); - state.dataFans->NumFans = 1; - Fan.allocate(state.dataFans->NumFans); + state->dataFans->NumFans = 1; + Fan.allocate(state->dataFans->NumFans); // Inputs: fan curve CurveNum = 1; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Cubic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Cubic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1151.1; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 13.509; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = -0.9105; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = -0.0129; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 7.0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 21.0; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Cubic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Cubic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 1151.1; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 13.509; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = -0.9105; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = -0.0129; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 7.0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 21.0; // Inputs: fans FanNum = 1; @@ -379,13 +380,13 @@ TEST_F(EnergyPlusFixture, FaultsManager_FaultFoulingAirFilters_CalFaultyFanAirFl Fan(FanNum).DeltaPress = 1017.59; // Run and Check - FanDesignFlowRateDec = CalFaultyFanAirFlowReduction(state, + FanDesignFlowRateDec = CalFaultyFanAirFlowReduction(*state, Fan(FanNum).FanName, Fan(FanNum).MaxAirFlowRate, Fan(FanNum).DeltaPress, FanFaultyDeltaPressInc * Fan(FanNum).DeltaPress, CurveNum); EXPECT_NEAR(3.845, FanDesignFlowRateDec, 0.005); // Clean up - state.dataCurveManager->PerfCurve.deallocate(); + state->dataCurveManager->PerfCurve.deallocate(); Fan.deallocate(); } @@ -463,11 +464,11 @@ TEST_F(EnergyPlusFixture, FaultsManager_TemperatureSensorOffset_CoilSAT) ASSERT_TRUE(process_idf(idf_objects)); // Readin inputs - SetPointManager::GetSetPointManagerInputs(state); - HVACControllers::GetControllerInput(state); + SetPointManager::GetSetPointManagerInputs(*state); + HVACControllers::GetControllerInput(*state); // Run - CheckAndReadFaults(state); + CheckAndReadFaults(*state); // Check EXPECT_EQ(2.0, FaultsCoilSATSensor(1).Offset); @@ -532,7 +533,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_CalFaultOffsetAct) Fault.Offset = 10; // Run and Check - OffsetAct = Fault.CalFaultOffsetAct(state); + OffsetAct = Fault.CalFaultOffsetAct(*state); EXPECT_EQ(10, OffsetAct); } @@ -651,9 +652,9 @@ TEST_F(EnergyPlusFixture, FaultsManager_EconomizerFaultGetInput) // Process inputs ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules - MixedAir::GetOAControllerInputs(state); + MixedAir::GetOAControllerInputs(*state); // there are two OA controller objects EXPECT_EQ(MixedAir::NumOAControllers, 2); @@ -698,7 +699,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_CoilNotFound) // Process inputs ASSERT_TRUE(process_idf(idf_objects)); - ASSERT_THROW(FaultsManager::CheckAndReadFaults(state), std::runtime_error); + ASSERT_THROW(FaultsManager::CheckAndReadFaults(*state), std::runtime_error); std::string const error_string = delimited_string({ " ** Severe ** FaultModel:Fouling:Coil = \"FOULEDHEATINGCOIL\". Referenced Coil named \"NON EXISTENT COOLING COIL\" was not found.", @@ -762,7 +763,7 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_BadCoilType) // Process inputs ASSERT_TRUE(process_idf(idf_objects)); - ASSERT_THROW(FaultsManager::CheckAndReadFaults(state), std::runtime_error); + ASSERT_THROW(FaultsManager::CheckAndReadFaults(*state), std::runtime_error); std::string const error_string = delimited_string({ " ** Severe ** FaultModel:Fouling:Coil = \"FOULEDHEATINGCOIL\" invalid Coil Name = \"DETAILED PRE COOLING COIL\".", @@ -878,13 +879,13 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_AssignmentAndCalc) ASSERT_TRUE(process_idf(idf_objects)); DataHVACGlobals::TimeStepSys = 1; - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 60 / state.dataGlobal->NumOfTimeStepInHour; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; - ScheduleManager::ProcessScheduleInput(state); // read schedule data - int avaiSchedIndex = ScheduleManager::GetScheduleIndex(state, "AVAILSCHED"); + ScheduleManager::ProcessScheduleInput(*state); // read schedule data + int avaiSchedIndex = ScheduleManager::GetScheduleIndex(*state, "AVAILSCHED"); EXPECT_EQ(1, avaiSchedIndex); - int severitySchedIndex = ScheduleManager::GetScheduleIndex(state, "SEVERITYSCHED"); + int severitySchedIndex = ScheduleManager::GetScheduleIndex(*state, "SEVERITYSCHED"); EXPECT_EQ(2, severitySchedIndex); @@ -893,33 +894,33 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_AssignmentAndCalc) //HVACControllers::GetControllerInput(); // Run - ASSERT_NO_THROW(FaultsManager::CheckAndReadFaults(state)); + ASSERT_NO_THROW(FaultsManager::CheckAndReadFaults(*state)); // Read schedule values - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DayOfWeek = 1; DataEnvironment::DayOfYear_Schedule = 1; - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); EXPECT_EQ(2, FaultsManager::NumFouledCoil); // This should also have called WaterCoil::GetWaterCoilInput - EXPECT_EQ(3, state.dataWaterCoils->NumWaterCoils); + EXPECT_EQ(3, state->dataWaterCoils->NumWaterCoils); // Check that fault association actually happened { int CoilNum = 1; int FaultIndex = 1; - EXPECT_EQ("AHU HW HEATING COIL", state.dataWaterCoils->WaterCoil(CoilNum).Name); - EXPECT_NEAR(6.64, state.dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.0001); - EXPECT_EQ(state.dataWaterCoils->WaterCoil_SimpleHeating, state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num); + EXPECT_EQ("AHU HW HEATING COIL", state->dataWaterCoils->WaterCoil(CoilNum).Name); + EXPECT_NEAR(6.64, state->dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.0001); + EXPECT_EQ(state->dataWaterCoils->WaterCoil_SimpleHeating, state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num); EXPECT_EQ(CoilNum, FaultsManager::FouledCoils(FaultIndex).FouledCoilNum); - EXPECT_EQ(state.dataWaterCoils->WaterCoil_SimpleHeating, FaultsManager::FouledCoils(FaultIndex).FouledCoiledType); + EXPECT_EQ(state->dataWaterCoils->WaterCoil_SimpleHeating, FaultsManager::FouledCoils(FaultIndex).FouledCoiledType); - EXPECT_TRUE(state.dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFlag); - EXPECT_EQ(FaultIndex, state.dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex); + EXPECT_TRUE(state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFlag); + EXPECT_EQ(FaultIndex, state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex); // Doesn't have an Availability Schedule EXPECT_EQ(-1, FaultsManager::FouledCoils(FaultIndex).AvaiSchedPtr); @@ -940,14 +941,14 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_AssignmentAndCalc) { int CoilNum = 2; int FaultIndex = 2; - EXPECT_EQ("AHU CHW COOLING COIL", state.dataWaterCoils->WaterCoil(CoilNum).Name); - EXPECT_EQ(state.dataWaterCoils->WaterCoil_Cooling, state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num); + EXPECT_EQ("AHU CHW COOLING COIL", state->dataWaterCoils->WaterCoil(CoilNum).Name); + EXPECT_EQ(state->dataWaterCoils->WaterCoil_Cooling, state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num); EXPECT_EQ(CoilNum, FaultsManager::FouledCoils(FaultIndex).FouledCoilNum); - EXPECT_EQ(state.dataWaterCoils->WaterCoil_Cooling, FaultsManager::FouledCoils(FaultIndex).FouledCoiledType); + EXPECT_EQ(state->dataWaterCoils->WaterCoil_Cooling, FaultsManager::FouledCoils(FaultIndex).FouledCoiledType); - EXPECT_TRUE(state.dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFlag); - EXPECT_EQ(FaultIndex, state.dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex); + EXPECT_TRUE(state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFlag); + EXPECT_EQ(FaultIndex, state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex); // Has an Availabity Schedule EXPECT_EQ("AVAILSCHED", FaultsManager::FouledCoils(FaultIndex).AvaiSchedule); @@ -973,11 +974,11 @@ TEST_F(EnergyPlusFixture, FaultsManager_FoulingCoil_AssignmentAndCalc) // No association if not meant! { int CoilNum = 3; - EXPECT_EQ("AHU CHW COIL WITH NO FAULT", state.dataWaterCoils->WaterCoil(CoilNum).Name); - EXPECT_EQ(state.dataWaterCoils->WaterCoil_Cooling, state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num); + EXPECT_EQ("AHU CHW COIL WITH NO FAULT", state->dataWaterCoils->WaterCoil(CoilNum).Name); + EXPECT_EQ(state->dataWaterCoils->WaterCoil_Cooling, state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num); - EXPECT_FALSE(state.dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFlag); - EXPECT_EQ(0, state.dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex); + EXPECT_FALSE(state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingFlag); + EXPECT_EQ(0, state->dataWaterCoils->WaterCoil(CoilNum).FaultyCoilFoulingIndex); } } diff --git a/tst/EnergyPlus/unit/FileSystem.unit.cc b/tst/EnergyPlus/unit/FileSystem.unit.cc index 25f64672c1a..e74d720240a 100644 --- a/tst/EnergyPlus/unit/FileSystem.unit.cc +++ b/tst/EnergyPlus/unit/FileSystem.unit.cc @@ -55,6 +55,7 @@ #include #include #include +#include TEST(FileSystem, movefile_test) diff --git a/tst/EnergyPlus/unit/FiniteDifferenceGroundTemperatureModel.unit.cc b/tst/EnergyPlus/unit/FiniteDifferenceGroundTemperatureModel.unit.cc index 208354af244..8123997c791 100644 --- a/tst/EnergyPlus/unit/FiniteDifferenceGroundTemperatureModel.unit.cc +++ b/tst/EnergyPlus/unit/FiniteDifferenceGroundTemperatureModel.unit.cc @@ -60,6 +60,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -86,7 +87,7 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModelTest) thisModel->developMesh(); // Setting weather data manually here - thisModel->weatherDataArray.dimension(state.dataWeatherManager->NumDaysInYear); + thisModel->weatherDataArray.dimension(state->dataWeatherManager->NumDaysInYear); Real64 drybulb_minTemp = 5; Real64 drybulb_amp = 10; @@ -95,11 +96,11 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModelTest) Real64 solar_min = 100; Real64 solar_amp = 100; - for (int day = 1; day <= state.dataWeatherManager->NumDaysInYear; ++day) { + for (int day = 1; day <= state->dataWeatherManager->NumDaysInYear; ++day) { auto &tdwd = thisModel->weatherDataArray(day); // "This day weather data" - Real64 theta = 2 * DataGlobalConstants::Pi() * day / state.dataWeatherManager->NumDaysInYear; - Real64 omega = 2 * DataGlobalConstants::Pi() * 130 / state.dataWeatherManager->NumDaysInYear; // Shifts min to around the end of Jan + Real64 theta = 2 * DataGlobalConstants::Pi() * day / state->dataWeatherManager->NumDaysInYear; + Real64 omega = 2 * DataGlobalConstants::Pi() * 130 / state->dataWeatherManager->NumDaysInYear; // Shifts min to around the end of Jan tdwd.dryBulbTemp = drybulb_amp * std::sin(theta - omega) + (drybulb_minTemp + drybulb_amp); tdwd.relativeHumidity = relHum_const; @@ -114,33 +115,33 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModelTest) thisModel->minDailyAirTemp = 5.0; thisModel->dayOfMinDailyAirTemp = 30; - thisModel->performSimulation(state); + thisModel->performSimulation(*state); - EXPECT_NEAR(4.51, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 1), 0.01); - EXPECT_NEAR(19.14, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 6), 0.01); - EXPECT_NEAR(7.96, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 12), 0.01); - EXPECT_NEAR(3.46, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 14), 0.01); + EXPECT_NEAR(4.51, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.01); + EXPECT_NEAR(19.14, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 6), 0.01); + EXPECT_NEAR(7.96, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.01); + EXPECT_NEAR(3.46, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 14), 0.01); - EXPECT_NEAR(14.36, thisModel->getGroundTempAtTimeInMonths(state, 3.0, 1), 0.01); - EXPECT_NEAR(11.78, thisModel->getGroundTempAtTimeInMonths(state, 3.0, 6), 0.01); - EXPECT_NEAR(15.57, thisModel->getGroundTempAtTimeInMonths(state, 3.0, 12), 0.01); + EXPECT_NEAR(14.36, thisModel->getGroundTempAtTimeInMonths(*state, 3.0, 1), 0.01); + EXPECT_NEAR(11.78, thisModel->getGroundTempAtTimeInMonths(*state, 3.0, 6), 0.01); + EXPECT_NEAR(15.57, thisModel->getGroundTempAtTimeInMonths(*state, 3.0, 12), 0.01); - EXPECT_NEAR(14.58, thisModel->getGroundTempAtTimeInMonths(state, 25.0, 1), 0.01); - EXPECT_NEAR(14.55, thisModel->getGroundTempAtTimeInMonths(state, 25.0, 6), 0.01); - EXPECT_NEAR(14.53, thisModel->getGroundTempAtTimeInMonths(state, 25.0, 12), 0.01); + EXPECT_NEAR(14.58, thisModel->getGroundTempAtTimeInMonths(*state, 25.0, 1), 0.01); + EXPECT_NEAR(14.55, thisModel->getGroundTempAtTimeInMonths(*state, 25.0, 6), 0.01); + EXPECT_NEAR(14.53, thisModel->getGroundTempAtTimeInMonths(*state, 25.0, 12), 0.01); - EXPECT_NEAR(5.04, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 0.0), 0.01); - EXPECT_NEAR(19.28, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 14342400), 0.01); - EXPECT_NEAR(7.32, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 30153600), 0.01); - EXPECT_NEAR(3.53, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 35510400), 0.01); + EXPECT_NEAR(5.04, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 0.0), 0.01); + EXPECT_NEAR(19.28, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 14342400), 0.01); + EXPECT_NEAR(7.32, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 30153600), 0.01); + EXPECT_NEAR(3.53, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 35510400), 0.01); - EXPECT_NEAR(14.36, thisModel->getGroundTempAtTimeInSeconds(state, 3.0, 1296000), 0.01); - EXPECT_NEAR(11.80, thisModel->getGroundTempAtTimeInSeconds(state, 3.0, 14342400), 0.01); - EXPECT_NEAR(15.46, thisModel->getGroundTempAtTimeInSeconds(state, 3.0, 30153600), 0.01); + EXPECT_NEAR(14.36, thisModel->getGroundTempAtTimeInSeconds(*state, 3.0, 1296000), 0.01); + EXPECT_NEAR(11.80, thisModel->getGroundTempAtTimeInSeconds(*state, 3.0, 14342400), 0.01); + EXPECT_NEAR(15.46, thisModel->getGroundTempAtTimeInSeconds(*state, 3.0, 30153600), 0.01); - EXPECT_NEAR(14.52, thisModel->getGroundTempAtTimeInSeconds(state, 25.0, 0.0), 0.01); - EXPECT_NEAR(14.55, thisModel->getGroundTempAtTimeInSeconds(state, 25.0, 14342400), 0.01); - EXPECT_NEAR(14.52, thisModel->getGroundTempAtTimeInSeconds(state, 25.0, 30153600), 0.01); + EXPECT_NEAR(14.52, thisModel->getGroundTempAtTimeInSeconds(*state, 25.0, 0.0), 0.01); + EXPECT_NEAR(14.55, thisModel->getGroundTempAtTimeInSeconds(*state, 25.0, 14342400), 0.01); + EXPECT_NEAR(14.52, thisModel->getGroundTempAtTimeInSeconds(*state, 25.0, 30153600), 0.01); } TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModel_GetWeather_NoWeather) { @@ -157,7 +158,7 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModel_GetWeather_NoWeather) { thisModel->evapotransCoeff = 0.408; // No Weather file specified, so we expect it to fail - ASSERT_THROW(thisModel->getWeatherData(state), std::runtime_error); + ASSERT_THROW(thisModel->getWeatherData(*state), std::runtime_error); std::string const error_string = delimited_string({ " ** Severe ** Site:GroundTemperature:Undisturbed:FiniteDifference -- using this model requires specification of a weather file.", @@ -174,9 +175,9 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModel_GetWeather_NoWeather) { TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModel_GetWeather_Weather) { - // I have to actually specify the RunPerod and SizingPeriods because in getWeatherData calls state.dataWeatherManager->GetNextEnvironment + // I have to actually specify the RunPerod and SizingPeriods because in getWeatherData calls state->dataWeatherManager->GetNextEnvironment // I cannot hard set WeatherManager's GetBranchInputOneTimeFlag (in anonymous namespace) to false, - // so it'll end up calling >state.dataWeatherManager->ReadUserWeatherInput which calls the inputProcessor to set the NumOfEnvrn in particular. + // so it'll end up calling >state->dataWeatherManager->ReadUserWeatherInput which calls the inputProcessor to set the NumOfEnvrn in particular. std::string const idf_objects = delimited_string({ "Timestep,4;" @@ -272,24 +273,24 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModel_GetWeather_Weather) { ASSERT_TRUE(process_idf(idf_objects)); // Set an actual weather file to Chicago EPW - state.dataWeatherManager->WeatherFileExists = true; - state.files.inputWeatherFileName.fileName = configured_source_directory() + "/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"; + state->dataWeatherManager->WeatherFileExists = true; + state->files.inputWeatherFileName.fileName = configured_source_directory() + "/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"; // Read the project data, such as Timestep - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); - EXPECT_EQ(state.dataGlobal->NumOfTimeStepInHour, 4); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); + EXPECT_EQ(state->dataGlobal->NumOfTimeStepInHour, 4); // Needed to avoid crash in SetupSimulation (from ElectricPowerServiceManager.hh) createFacilityElectricPowerServiceObject(); bool ErrorsFound(false); - SimulationManager::SetupSimulation(state, ErrorsFound); + SimulationManager::SetupSimulation(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - EXPECT_EQ(state.dataWeatherManager->NumOfEnvrn, 3); + EXPECT_EQ(state->dataWeatherManager->NumOfEnvrn, 3); EXPECT_EQ(DataEnvironment::TotDesDays, 2); - EXPECT_EQ(state.dataWeatherManager->TotRunPers, 1); + EXPECT_EQ(state->dataWeatherManager->TotRunPers, 1); std::shared_ptr thisModel(new EnergyPlus::FiniteDiffGroundTempsModel()); @@ -303,12 +304,12 @@ TEST_F(EnergyPlusFixture, FiniteDiffGroundTempModel_GetWeather_Weather) { thisModel->evapotransCoeff = 0.408; // Shouldn't throw - thisModel->getWeatherData(state); + thisModel->getWeatherData(*state); // It should have reverted the added period - EXPECT_EQ(state.dataWeatherManager->NumOfEnvrn, 3); + EXPECT_EQ(state->dataWeatherManager->NumOfEnvrn, 3); EXPECT_EQ(DataEnvironment::TotDesDays, 2); - EXPECT_EQ(state.dataWeatherManager->TotRunPers, 1); + EXPECT_EQ(state->dataWeatherManager->TotRunPers, 1); // And should have populated a 365-day array of averages EXPECT_EQ(365u, thisModel->weatherDataArray.size()); diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc index 9a36c5fe524..a2dd3a232b2 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc @@ -52,6 +52,7 @@ #include "EnergyPlusFixture.hh" // A to Z order +#include #include #include #include @@ -91,18 +92,19 @@ void EnergyPlusFixture::openOutputFiles(EnergyPlusData &state) void EnergyPlusFixture::SetUp() { - EnergyPlus::clearAllStates(state); + this->state = new EnergyPlusData; + EnergyPlus::clearAllStates(*state); EnergyPlus::inputProcessor->clear_state(); show_message(); - openOutputFiles(state); + openOutputFiles(*state); this->err_stream = new std::ostringstream; this->json_stream = new std::ostringstream; - state.files.err_stream = std::unique_ptr(this->err_stream); - state.files.json.json_stream = std::unique_ptr(this->json_stream); + state->files.err_stream = std::unique_ptr(this->err_stream); + state->files.json.json_stream = std::unique_ptr(this->json_stream); m_cout_buffer = std::unique_ptr(new std::ostringstream); m_redirect_cout = std::unique_ptr(new RedirectCout(m_cout_buffer)); @@ -110,7 +112,7 @@ void EnergyPlusFixture::SetUp() m_cerr_buffer = std::unique_ptr(new std::ostringstream); m_redirect_cerr = std::unique_ptr(new RedirectCerr(m_cerr_buffer)); - state.dataUtilityRoutines->outputErrorHeader = false; + state->dataUtilityRoutines->outputErrorHeader = false; Psychrometrics::InitializePsychRoutines(); FluidProperties::InitializeGlycRoutines(); @@ -119,17 +121,26 @@ void EnergyPlusFixture::SetUp() void EnergyPlusFixture::TearDown() { - state.files.mtd.del(); - state.files.eso.del(); - state.files.err_stream.reset(); - state.files.eio.del(); - state.files.debug.del(); - state.files.zsz.del(); - state.files.ssz.del(); - state.files.mtr.del(); - state.files.bnd.del(); - state.files.shade.del(); - clearAllStates(this->state); + state->files.mtd.del(); + state->files.eso.del(); + state->files.err_stream.reset(); + state->files.eio.del(); + state->files.debug.del(); + state->files.zsz.del(); + state->files.ssz.del(); + state->files.mtr.del(); + state->files.bnd.del(); + state->files.shade.del(); + clearAllStates(*this->state); + delete this->state; +} + +void EnergyPlusFixture::show_message() +{ + // Gets information about the currently running test. + // Do NOT delete the returned object - it's managed by the UnitTest class. + const ::testing::TestInfo *const test_info = ::testing::UnitTest::GetInstance()->current_test_info(); + ShowMessage(*state, "Begin Test: " + std::string(test_info->test_case_name()) + ", " + std::string(test_info->name())); } std::string EnergyPlusFixture::delimited_string(std::vector const &strings, std::string const &delimiter) @@ -163,28 +174,28 @@ bool EnergyPlusFixture::compare_json_stream(std::string const &expected_string, bool EnergyPlusFixture::compare_eso_stream(std::string const &expected_string, bool reset_stream) { - auto const stream_str = state.files.eso.get_output(); + auto const stream_str = state->files.eso.get_output(); EXPECT_EQ(expected_string, stream_str); bool are_equal = (expected_string == stream_str); - if (reset_stream) state.files.eso.open_as_stringstream(); + if (reset_stream) state->files.eso.open_as_stringstream(); return are_equal; } bool EnergyPlusFixture::compare_eio_stream(std::string const &expected_string, bool reset_stream) { - auto const stream_str = state.files.eio.get_output(); + auto const stream_str = state->files.eio.get_output(); EXPECT_EQ(expected_string, stream_str); bool are_equal = (expected_string == stream_str); - if (reset_stream) state.files.eio.open_as_stringstream(); + if (reset_stream) state->files.eio.open_as_stringstream(); return are_equal; } bool EnergyPlusFixture::compare_mtr_stream(std::string const &expected_string, bool reset_stream) { - auto const stream_str = state.files.mtr.get_output(); + auto const stream_str = state->files.mtr.get_output(); EXPECT_EQ(expected_string, stream_str); bool are_equal = (expected_string == stream_str); - if (reset_stream) state.files.mtr.open_as_stringstream(); + if (reset_stream) state->files.mtr.open_as_stringstream(); return are_equal; } @@ -217,10 +228,10 @@ bool EnergyPlusFixture::compare_cerr_stream(std::string const &expected_string, bool EnergyPlusFixture::compare_dfs_stream(std::string const &expected_string, bool reset_stream) { - auto const stream_str = state.files.dfs.get_output(); + auto const stream_str = state->files.dfs.get_output(); EXPECT_EQ(expected_string, stream_str); bool are_equal = (expected_string == stream_str); - if (reset_stream) state.files.dfs.open_as_stringstream(); + if (reset_stream) state->files.dfs.open_as_stringstream(); return are_equal; } @@ -233,22 +244,22 @@ bool EnergyPlusFixture::has_json_output(bool reset_stream) bool EnergyPlusFixture::has_eso_output(bool reset_stream) { - auto const has_output = !state.files.eso.get_output().empty(); - if (reset_stream) state.files.eso.open_as_stringstream(); + auto const has_output = !state->files.eso.get_output().empty(); + if (reset_stream) state->files.eso.open_as_stringstream(); return has_output; } bool EnergyPlusFixture::has_eio_output(bool reset_stream) { - auto const has_output = !state.files.eio.get_output().empty(); - if (reset_stream) state.files.eio.open_as_stringstream(); + auto const has_output = !state->files.eio.get_output().empty(); + if (reset_stream) state->files.eio.open_as_stringstream(); return has_output; } bool EnergyPlusFixture::has_mtr_output(bool reset_stream) { - auto const has_output = !state.files.mtr.get_output().empty(); - if (reset_stream) state.files.mtr.open_as_stringstream(); + auto const has_output = !state->files.mtr.get_output().empty(); + if (reset_stream) state->files.mtr.open_as_stringstream(); return has_output; } @@ -275,8 +286,8 @@ bool EnergyPlusFixture::has_cerr_output(bool reset_stream) bool EnergyPlusFixture::has_dfs_output(bool reset_stream) { - auto const has_output = !state.files.dfs.get_output().empty(); - if (reset_stream) state.files.dfs.open_as_stringstream(); + auto const has_output = !state->files.dfs.get_output().empty(); + if (reset_stream) state->files.dfs.open_as_stringstream(); return has_output; } @@ -336,10 +347,10 @@ bool EnergyPlusFixture::process_idf(std::string const &idf_snippet, bool use_ass DataIPShortCuts::lNumericFieldBlanks.dimension(MaxNumeric, false); bool is_valid = inputProcessor->validation->validate(inputProcessor->epJSON); - bool hasErrors = inputProcessor->processErrors(state); + bool hasErrors = inputProcessor->processErrors(*state); inputProcessor->initializeMaps(); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); // inputProcessor->state->printErrors(); bool successful_processing = success && is_valid && !hasErrors; diff --git a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh index eec0d0e3564..0d7dd4bbc09 100644 --- a/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh +++ b/tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.hh @@ -52,10 +52,9 @@ #include // EnergyPlus Headers -#include +//#include #include #include -#include #include #include @@ -118,13 +117,7 @@ protected: // This will output the "Begin Test" ShowMessage for every unit test that uses or inherits from this fixture. // Now this does not need to be manually entered for every unit test as well as it will automatically be updated as the // unit test names change. - inline void show_message() - { - // Gets information about the currently running test. - // Do NOT delete the returned object - it's managed by the UnitTest class. - const ::testing::TestInfo *const test_info = ::testing::UnitTest::GetInstance()->current_test_info(); - ShowMessage(state, "Begin Test: " + std::string(test_info->test_case_name()) + ", " + std::string(test_info->name())); - } + void show_message(); // This will compare either a STL container or ObjexxFCL container // Pass a container you want to compare against an expected container. You can pass in an existing @@ -278,7 +271,7 @@ protected: void openOutputFiles(EnergyPlusData &state); public: - EnergyPlusData state; + EnergyPlusData* state; private: friend class InputProcessorFixture; diff --git a/tst/EnergyPlus/unit/FluidCoolers.unit.cc b/tst/EnergyPlus/unit/FluidCoolers.unit.cc index be6abc04aeb..750f1763407 100644 --- a/tst/EnergyPlus/unit/FluidCoolers.unit.cc +++ b/tst/EnergyPlus/unit/FluidCoolers.unit.cc @@ -57,6 +57,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::FluidCoolers; @@ -108,22 +109,22 @@ TEST_F(EnergyPlusFixture, TwoSpeedFluidCoolerInput_Test1) SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = 0; SimpleFluidCooler(FluidCoolerNum).LowSpeedFluidCoolerUA = 0; SimpleFluidCooler(1).DesignEnteringWaterTemp = 50; - bool testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + bool testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered SimpleFluidCooler(1).DesignEnteringWaterTemp = -10; - testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_TRUE(testResult); // error message triggered SimpleFluidCooler(1).DesignEnteringWaterTemp = 50; SimpleFluidCooler(1).FluidCoolerLowSpeedNomCap = AutoSize; SimpleFluidCooler(1).FluidCoolerLowSpeedNomCapWasAutoSized = true; - testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered SimpleFluidCooler(1).FluidCoolerLowSpeedNomCap = 0; // this should trigger the original error condition SimpleFluidCooler(1).FluidCoolerLowSpeedNomCapWasAutoSized = false; - testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_TRUE(testResult); // error message triggered SimpleFluidCooler.deallocate(); @@ -173,13 +174,13 @@ TEST_F(EnergyPlusFixture, TwoSpeedFluidCoolerInput_Test2) AlphArray(4) = "UFactorTimesAreaAndDesignWaterFlowRate"; SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = AutoSize; SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = false; - bool testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + bool testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_TRUE(testResult); // error message triggered ErrrorsFound = false; SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUA = AutoSize; SimpleFluidCooler(FluidCoolerNum).HighSpeedFluidCoolerUAWasAutoSized = true; - testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + testResult = SimpleFluidCooler(1).validateTwoSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered SimpleFluidCooler.deallocate(); @@ -226,22 +227,22 @@ TEST_F(EnergyPlusFixture, SingleSpeedFluidCoolerInput_Test3) AlphArray(4) = "UFactorTimesAreaAndDesignWaterFlowRate"; SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 1; - bool testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + bool testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = true; SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 0; - testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = false; SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 1; - testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRateWasAutoSized = false; SimpleFluidCooler(FluidCoolerNum).DesignWaterFlowRate = 0; - testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + testResult = SimpleFluidCooler(1).validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_TRUE(testResult); // error message triggered } @@ -267,7 +268,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedFluidCoolerInput_Test4) ASSERT_TRUE(process_idf(idf_objects)); - GetFluidCoolerInput(state); + GetFluidCoolerInput(*state); auto &thisFluidCooler = FluidCoolers::SimpleFluidCooler(FluidCoolerNum); EXPECT_TRUE(thisFluidCooler.HighSpeedFluidCoolerUAWasAutoSized); EXPECT_EQ(thisFluidCooler.HighSpeedFluidCoolerUA, DataSizing::AutoSize); @@ -313,7 +314,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedFluidCoolerInput_Test5) thisFluidCooler.HighSpeedFluidCoolerUA = 500.0; thisFluidCooler.HighSpeedFluidCoolerUAWasAutoSized = false; // test input error check, if the nominal capacity specified and UA value is not zero, then it does not fatal out - bool testResult = thisFluidCooler.validateSingleSpeedInputs(state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); + bool testResult = thisFluidCooler.validateSingleSpeedInputs(*state, cCurrentModuleObject, AlphArray, cNumericFieldNames, cAlphaFieldNames); EXPECT_FALSE(testResult); // no error message triggered EXPECT_EQ(thisFluidCooler.PerformanceInputMethod_Num, PerfInputMethod::NOMINAL_CAPACITY); // UA value is reset to zero if nominal capacity is specified and input method is "NOMINAL_CAPACITY" @@ -342,7 +343,7 @@ TEST_F(EnergyPlusFixture, SizeFunctionTestWhenPlantSizingIndexIsZero) ASSERT_TRUE(process_idf(idf_objects)); - GetFluidCoolerInput(state); + GetFluidCoolerInput(*state); auto &thisFluidCooler = FluidCoolers::SimpleFluidCooler(FluidCoolerNum); @@ -355,5 +356,5 @@ TEST_F(EnergyPlusFixture, SizeFunctionTestWhenPlantSizingIndexIsZero) EXPECT_FALSE(thisFluidCooler.HighSpeedAirFlowRateWasAutoSized); EXPECT_FALSE(thisFluidCooler.HighSpeedFluidCoolerUAWasAutoSized); - thisFluidCooler.size(state); + thisFluidCooler.size(*state); } diff --git a/tst/EnergyPlus/unit/FluidProperties.unit.cc b/tst/EnergyPlus/unit/FluidProperties.unit.cc index 7cdf278c3bc..0a81609697c 100644 --- a/tst/EnergyPlus/unit/FluidProperties.unit.cc +++ b/tst/EnergyPlus/unit/FluidProperties.unit.cc @@ -52,6 +52,7 @@ // EnergyPlus Headers #include +#include #include #include @@ -74,15 +75,15 @@ TEST_F(EnergyPlusFixture, FluidProperties_GetDensityGlycol) int FluidIndex = 0; - EXPECT_NEAR(1037.89, GetDensityGlycol(state, "GLHXFLUID", -35.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1037.89, GetDensityGlycol(state, "GLHXFLUID", -15.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1034.46, GetDensityGlycol(state, "GLHXFLUID", 5.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1030.51, GetDensityGlycol(state, "GLHXFLUID", 15.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1026.06, GetDensityGlycol(state, "GLHXFLUID", 25.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1021.09, GetDensityGlycol(state, "GLHXFLUID", 35.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1015.62, GetDensityGlycol(state, "GLHXFLUID", 45.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(1003.13, GetDensityGlycol(state, "GLHXFLUID", 65.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(988.60, GetDensityGlycol(state, "GLHXFLUID", 85.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(972.03, GetDensityGlycol(state, "GLHXFLUID", 105.0, FluidIndex, "UnitTest"), 0.01); - EXPECT_NEAR(953.41, GetDensityGlycol(state, "GLHXFLUID", 125.0, FluidIndex, "UnitTest"), 0.01); + EXPECT_NEAR(1037.89, GetDensityGlycol(*state, "GLHXFLUID", -35.0, FluidIndex, "UnitTest"), 0.01); + EXPECT_NEAR(1037.89, GetDensityGlycol(*state, "GLHXFLUID", -15.0, FluidIndex, "UnitTest"), 0.01); + EXPECT_NEAR(1034.46, GetDensityGlycol(*state, "GLHXFLUID", 5.0, FluidIndex, "UnitTest"), 0.01); + EXPECT_NEAR(1030.51, GetDensityGlycol(*state, "GLHXFLUID", 15.0, FluidIndex, "UnitTest"), 0.01); + EXPECT_NEAR(1026.06, GetDensityGlycol(*state, "GLHXFLUID", 25.0, FluidIndex, "UnitTest"), 0.01); + EXPECT_NEAR(1021.09, GetDensityGlycol(*state, "GLHXFLUID", 35.0, FluidIndex, "UnitTest"), 0.01); + EXPECT_NEAR(1015.62, GetDensityGlycol(*state, "GLHXFLUID", 45.0, FluidIndex, "UnitTest"), 0.01); + EXPECT_NEAR(1003.13, GetDensityGlycol(*state, "GLHXFLUID", 65.0, FluidIndex, "UnitTest"), 0.01); + EXPECT_NEAR(988.60, GetDensityGlycol(*state, "GLHXFLUID", 85.0, FluidIndex, "UnitTest"), 0.01); + EXPECT_NEAR(972.03, GetDensityGlycol(*state, "GLHXFLUID", 105.0, FluidIndex, "UnitTest"), 0.01); + EXPECT_NEAR(953.41, GetDensityGlycol(*state, "GLHXFLUID", 125.0, FluidIndex, "UnitTest"), 0.01); } diff --git a/tst/EnergyPlus/unit/FuelCellElectricGenerator.unit.cc b/tst/EnergyPlus/unit/FuelCellElectricGenerator.unit.cc index b0d9a1608b0..ad88c355d61 100644 --- a/tst/EnergyPlus/unit/FuelCellElectricGenerator.unit.cc +++ b/tst/EnergyPlus/unit/FuelCellElectricGenerator.unit.cc @@ -56,6 +56,7 @@ // EnergyPlus Headers #include "Fixtures/EnergyPlusFixture.hh" #include +#include using namespace EnergyPlus; using namespace ObjexxFCL; diff --git a/tst/EnergyPlus/unit/Furnaces.unit.cc b/tst/EnergyPlus/unit/Furnaces.unit.cc index 78c31739a51..1ce6ef632b1 100644 --- a/tst/EnergyPlus/unit/Furnaces.unit.cc +++ b/tst/EnergyPlus/unit/Furnaces.unit.cc @@ -67,6 +67,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -143,7 +144,7 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) Furnace(FurnaceNum).SchedPtr = -1; // denotes missing schedule name in Furnace input ( returns 1.0 ) HeatingLoad = true; CoolingLoad = false; - SetVSHPAirFlow(state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); + SetVSHPAirFlow(*state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); EXPECT_DOUBLE_EQ(0.0, CompOffMassFlow); EXPECT_DOUBLE_EQ(0.5, CompOnMassFlow); @@ -154,7 +155,7 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) Furnace(FurnaceNum).NumOfSpeedCooling = 0; HeatingLoad = true; CoolingLoad = false; - SetVSHPAirFlow(state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); + SetVSHPAirFlow(*state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); EXPECT_DOUBLE_EQ(0.25, MSHPMassFlowRateLow); EXPECT_DOUBLE_EQ(0.25, MSHPMassFlowRateHigh); EXPECT_DOUBLE_EQ(0.0, CompOffMassFlow); @@ -166,7 +167,7 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) Furnace(FurnaceNum).NumOfSpeedCooling = 0; HeatingLoad = true; CoolingLoad = false; - SetVSHPAirFlow(state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); + SetVSHPAirFlow(*state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); EXPECT_DOUBLE_EQ(0.5, MSHPMassFlowRateLow); EXPECT_DOUBLE_EQ(0.5, MSHPMassFlowRateHigh); EXPECT_DOUBLE_EQ(0.0, CompOffMassFlow); @@ -178,7 +179,7 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) Furnace(FurnaceNum).NumOfSpeedCooling = 0; HeatingLoad = true; CoolingLoad = false; - SetVSHPAirFlow(state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); + SetVSHPAirFlow(*state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); EXPECT_DOUBLE_EQ(1.0, MSHPMassFlowRateLow); EXPECT_DOUBLE_EQ(1.0, MSHPMassFlowRateHigh); EXPECT_DOUBLE_EQ(0.0, CompOffMassFlow); @@ -190,7 +191,7 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) Furnace(FurnaceNum).NumOfSpeedCooling = 1; HeatingLoad = false; CoolingLoad = true; - SetVSHPAirFlow(state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); + SetVSHPAirFlow(*state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); EXPECT_DOUBLE_EQ(0.3, MSHPMassFlowRateLow); EXPECT_DOUBLE_EQ(0.3, MSHPMassFlowRateHigh); EXPECT_DOUBLE_EQ(0.0, CompOffMassFlow); @@ -202,7 +203,7 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) Furnace(FurnaceNum).NumOfSpeedCooling = 2; HeatingLoad = false; CoolingLoad = true; - SetVSHPAirFlow(state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); + SetVSHPAirFlow(*state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); EXPECT_DOUBLE_EQ(0.6, MSHPMassFlowRateLow); EXPECT_DOUBLE_EQ(0.6, MSHPMassFlowRateHigh); EXPECT_DOUBLE_EQ(0.0, CompOffMassFlow); @@ -214,7 +215,7 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) Furnace(FurnaceNum).NumOfSpeedCooling = 3; HeatingLoad = false; CoolingLoad = true; - SetVSHPAirFlow(state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); + SetVSHPAirFlow(*state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); EXPECT_DOUBLE_EQ(1.2, MSHPMassFlowRateLow); EXPECT_DOUBLE_EQ(1.2, MSHPMassFlowRateHigh); EXPECT_DOUBLE_EQ(0.0, CompOffMassFlow); @@ -229,7 +230,7 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) Furnace(FurnaceNum).NumOfSpeedCooling = 0; HeatingLoad = true; CoolingLoad = false; - SetVSHPAirFlow(state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); + SetVSHPAirFlow(*state, FurnaceNum, PartLoadRatio, OnOffAirFlowRatio); EXPECT_EQ(0.0, MSHPMassFlowRateLow); EXPECT_EQ(0.0, MSHPMassFlowRateHigh); EXPECT_DOUBLE_EQ(0.2, CompOffMassFlow); @@ -254,7 +255,7 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) Furnaces::HeatingLoad = false; Furnaces::CoolingLoad = false; - CalcNewZoneHeatCoolFlowRates(state, + CalcNewZoneHeatCoolFlowRates(*state, FurnaceNum, firstHVACIteration, compOp, zoneLoad, moistureLoad, heatCoilLoad, reheatCoilLoad, onOffAirFlowRatio, hXUnitOn); EXPECT_EQ(Furnace(1).MdotFurnace, 0.5); // CompOnMassFlow rate EXPECT_EQ(DataLoopNode::Node(1).MassFlowRate, 0.5); // furnace inlet node mass flow rate @@ -264,30 +265,30 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) firstHVACIteration = false; // now the coils will be called Furnace(FurnaceNum).CoolingCoilIndex = 1; Furnace(FurnaceNum).HeatingCoilIndex = 2; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP.allocate(2); - state.dataWaterToAirHeatPumpSimple->NumWatertoAirHPs = 2; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).Name = "WATERCOOLINGCOIL"; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).WAHPPlantTypeOfNum = DataPlant::TypeOf_CoilWAHPCoolingEquationFit; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).Name = "WATERHEATINGCOIL"; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).WAHPPlantTypeOfNum = DataPlant::TypeOf_CoilWAHPHeatingEquationFit; - state.dataWaterToAirHeatPumpSimple->SimpleHPTimeStepFlag.allocate(2); - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).AirInletNodeNum = 1; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).AirOutletNodeNum = 3; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).WaterInletNodeNum = 5; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).WaterOutletNodeNum = 6; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).LoopNum = 1; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).LoopSide = 1; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).BranchNum = 1; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).CompNum = 1; - - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).AirInletNodeNum = 3; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).AirOutletNodeNum = 2; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).WaterInletNodeNum = 7; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).WaterOutletNodeNum = 8; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).LoopNum = 2; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).LoopSide = 1; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).BranchNum = 1; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).CompNum = 1; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP.allocate(2); + state->dataWaterToAirHeatPumpSimple->NumWatertoAirHPs = 2; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).Name = "WATERCOOLINGCOIL"; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).WAHPPlantTypeOfNum = DataPlant::TypeOf_CoilWAHPCoolingEquationFit; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).Name = "WATERHEATINGCOIL"; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).WAHPPlantTypeOfNum = DataPlant::TypeOf_CoilWAHPHeatingEquationFit; + state->dataWaterToAirHeatPumpSimple->SimpleHPTimeStepFlag.allocate(2); + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).AirInletNodeNum = 1; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).AirOutletNodeNum = 3; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).WaterInletNodeNum = 5; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).WaterOutletNodeNum = 6; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).LoopNum = 1; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).LoopSide = 1; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).BranchNum = 1; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).CompNum = 1; + + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).AirInletNodeNum = 3; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).AirOutletNodeNum = 2; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).WaterInletNodeNum = 7; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).WaterOutletNodeNum = 8; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).LoopNum = 2; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).LoopSide = 1; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).BranchNum = 1; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(2).CompNum = 1; // set up plant loop DataPlant::TotNumLoops = 2; @@ -318,8 +319,8 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) DataHeatBalance::HeatReclaimSimple_WAHPCoil.allocate(2); - state.dataWaterToAirHeatPumpSimple->GetCoilsInputFlag = false; // turn off water source coil GetInput - CalcNewZoneHeatCoolFlowRates(state, + state->dataWaterToAirHeatPumpSimple->GetCoilsInputFlag = false; // turn off water source coil GetInput + CalcNewZoneHeatCoolFlowRates(*state, FurnaceNum, firstHVACIteration, compOp, zoneLoad, moistureLoad, heatCoilLoad, reheatCoilLoad, onOffAirFlowRatio, hXUnitOn); EXPECT_EQ(Furnace(1).MdotFurnace, 0.2); // flow rate is at idle speed flow rate EXPECT_EQ(DataLoopNode::Node(1).MassFlowRate, 0.2); // furnace inlet node mass flow rate is at idle speed flow rate @@ -328,7 +329,7 @@ TEST_F(EnergyPlusFixture, SetVSHPAirFlowTest_VSFurnaceFlowTest) Furnace(1).HeatPartLoadRatio = 1.0; Furnaces::HeatingLoad = true; - CalcNewZoneHeatCoolFlowRates(state, + CalcNewZoneHeatCoolFlowRates(*state, FurnaceNum, firstHVACIteration, compOp, zoneLoad, moistureLoad, heatCoilLoad, reheatCoilLoad, onOffAirFlowRatio, hXUnitOn); EXPECT_EQ(Furnace(1).HeatPartLoadRatio, 1.0); @@ -339,7 +340,7 @@ TEST_F(EnergyPlusFixture, FurnaceTest_PartLoadRatioTest) { // Test passing variables between Furnace and AirflowNetwork #5134 - state.dataAirLoop->AirLoopAFNInfo.allocate(1); + state->dataAirLoop->AirLoopAFNInfo.allocate(1); int FurnaceNum; @@ -356,12 +357,12 @@ TEST_F(EnergyPlusFixture, FurnaceTest_PartLoadRatioTest) Furnace(FurnaceNum).CoolPartLoadRatio = 0.0; AirflowNetwork::SimulateAirflowNetwork = AirflowNetwork::AirflowNetworkControlMultiADS; - ReportFurnace(state, FurnaceNum, 1); + ReportFurnace(*state, FurnaceNum, 1); - EXPECT_EQ(2.0, state.dataAirLoop->AirLoopAFNInfo(1).LoopSystemOnMassFlowrate); - EXPECT_EQ(0.0, state.dataAirLoop->AirLoopAFNInfo(1).LoopSystemOffMassFlowrate); - EXPECT_EQ(1.0, state.dataAirLoop->AirLoopAFNInfo(1).LoopFanOperationMode); - EXPECT_EQ(1.0, state.dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio); + EXPECT_EQ(2.0, state->dataAirLoop->AirLoopAFNInfo(1).LoopSystemOnMassFlowrate); + EXPECT_EQ(0.0, state->dataAirLoop->AirLoopAFNInfo(1).LoopSystemOffMassFlowrate); + EXPECT_EQ(1.0, state->dataAirLoop->AirLoopAFNInfo(1).LoopFanOperationMode); + EXPECT_EQ(1.0, state->dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio); Furnace(FurnaceNum).FurnaceType_Num = UnitarySys_HeatCool; Furnace(FurnaceNum).HeatPartLoadRatio = 0.0; @@ -369,9 +370,9 @@ TEST_F(EnergyPlusFixture, FurnaceTest_PartLoadRatioTest) Furnace(FurnaceNum).MaxCoolAirMassFlow = 2.2; Furnace(FurnaceNum).MaxHeatAirMassFlow = 2.0; - ReportFurnace(state, FurnaceNum, 1); + ReportFurnace(*state, FurnaceNum, 1); - EXPECT_EQ(1.0, state.dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio); + EXPECT_EQ(1.0, state->dataAirLoop->AirLoopAFNInfo(1).LoopOnOffFanPartLoadRatio); AirflowNetwork::SimulateAirflowNetwork = 0; Furnace.deallocate(); @@ -1162,13 +1163,13 @@ TEST_F(EnergyPlusFixture, UnitaryHeatPumpAirToAir_MaxSuppAirTempTest) bool FirstHVACIteration(false); // OutputProcessor::TimeValue.allocate(2); - ManageSimulation(state); + ManageSimulation(*state); // check the design max air outlet temperature EXPECT_DOUBLE_EQ(45.0, Furnace(1).DesignMaxOutletTemp); ZoneSysEnergyDemand(1).SequencedOutputRequiredToCoolingSP(1) = 25000.0; ZoneSysEnergyDemand(1).SequencedOutputRequiredToHeatingSP(1) = 25000.0; - SimFurnace(state, Furnace(1).Name, FirstHVACIteration, AirLoopNum, CompIndex); + SimFurnace(*state, Furnace(1).Name, FirstHVACIteration, AirLoopNum, CompIndex); // check the heating mode is On EXPECT_TRUE(Furnaces::HeatingLoad); // check the cooling mode is Off diff --git a/tst/EnergyPlus/unit/General.unit.cc b/tst/EnergyPlus/unit/General.unit.cc index c9fa17c30c5..78cb3affb14 100644 --- a/tst/EnergyPlus/unit/General.unit.cc +++ b/tst/EnergyPlus/unit/General.unit.cc @@ -58,6 +58,7 @@ #include #include #include +#include namespace EnergyPlus { diff --git a/tst/EnergyPlus/unit/GeneralRoutines.unit.cc b/tst/EnergyPlus/unit/GeneralRoutines.unit.cc index b30116998cf..fa02eea1f4b 100644 --- a/tst/EnergyPlus/unit/GeneralRoutines.unit.cc +++ b/tst/EnergyPlus/unit/GeneralRoutines.unit.cc @@ -51,6 +51,7 @@ // EnergyPlus Headers #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" diff --git a/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc b/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc index acb5c5be571..d9ae2174f90 100644 --- a/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc +++ b/tst/EnergyPlus/unit/GroundHeatExchangers.unit.cc @@ -61,6 +61,7 @@ #include #include #include +#include // Testing Headers #include "Fixtures/EnergyPlusFixture.hh" @@ -196,19 +197,19 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_Slinky_CalcHXResistance) thisGLHE.pipe.k = 0.4; // Re < 2300 mass flow rate - EXPECT_NEAR(0.13487, thisGLHE.calcHXResistance(state), 0.0001); + EXPECT_NEAR(0.13487, thisGLHE.calcHXResistance(*state), 0.0001); // 4000 > Re > 2300 mass flow rate thisGLHE.massFlowRate = 0.07; - EXPECT_NEAR(0.08582, thisGLHE.calcHXResistance(state), 0.0001); + EXPECT_NEAR(0.08582, thisGLHE.calcHXResistance(*state), 0.0001); // Re > 4000 mass flow rate thisGLHE.massFlowRate = 0.1; - EXPECT_NEAR(0.077185, thisGLHE.calcHXResistance(state), 0.0001); + EXPECT_NEAR(0.077185, thisGLHE.calcHXResistance(*state), 0.0001); // Zero mass flow rate thisGLHE.massFlowRate = 0.0; - EXPECT_NEAR(0.07094, thisGLHE.calcHXResistance(state), 0.0001); + EXPECT_NEAR(0.07094, thisGLHE.calcHXResistance(*state), 0.0001); } TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_Slinky_CalcGroundHeatExchanger) @@ -233,12 +234,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_Slinky_CalcGroundHeatExchanger thisGLHE.SubAGG = 15; // Horizontal G-Functions - thisGLHE.calcGFunctions(state); + thisGLHE.calcGFunctions(*state); EXPECT_NEAR(19.08237, thisGLHE.myRespFactors->GFNC(28), 0.0001); // Vertical G-Functions thisGLHE.verticalConfig = true; - thisGLHE.calcGFunctions(state); + thisGLHE.calcGFunctions(*state); EXPECT_NEAR(18.91819, thisGLHE.myRespFactors->GFNC(28), 0.0001); } @@ -254,7 +255,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Properties_IDF_Check) ASSERT_TRUE(process_idf(idf_objects)); - GetGroundHeatExchangerInput(state); + GetGroundHeatExchangerInput(*state); EXPECT_EQ(1u, vertPropsVector.size()); @@ -448,7 +449,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Resp_Factors_IDF_Check) ASSERT_TRUE(process_idf(idf_objects)); - GetGroundHeatExchangerInput(state); + GetGroundHeatExchangerInput(*state); EXPECT_EQ(1u, responseFactorsVector.size()); @@ -491,7 +492,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Vertical_Array_IDF_Chec ASSERT_TRUE(process_idf(idf_objects)); - GetGroundHeatExchangerInput(state); + GetGroundHeatExchangerInput(*state); EXPECT_EQ(1u, vertArraysVector.size()); @@ -700,7 +701,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Given_Response_Factors_ ASSERT_TRUE(process_idf(idf_objects)); - GetGroundHeatExchangerInput(state); + GetGroundHeatExchangerInput(*state); EXPECT_EQ(1u, vertPropsVector.size()); EXPECT_EQ(1u, responseFactorsVector.size()); @@ -770,7 +771,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Given_Array_IDF_Check) ASSERT_TRUE(process_idf(idf_objects)); - GetGroundHeatExchangerInput(state); + GetGroundHeatExchangerInput(*state); EXPECT_EQ(1u, vertPropsVector.size()); EXPECT_EQ(1u, vertArraysVector.size()); @@ -861,7 +862,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_Given_Single_BHs_IDF_Ch ASSERT_TRUE(process_idf(idf_objects)); - GetGroundHeatExchangerInput(state); + GetGroundHeatExchangerInput(*state); EXPECT_EQ(2u, vertPropsVector.size()); EXPECT_EQ(4u, singleBoreholesVector.size()); @@ -1179,12 +1180,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcGFunction_Check) // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetPlantLoopData(state); - GetPlantInput(state); + GetPlantLoopData(*state); + GetPlantInput(*state); SetupInitialPlantCallingOrder(); - SetupBranchControlTypes(state); + SetupBranchControlTypes(*state); auto &thisGLHE(verticalGLHE[0]); thisGLHE.loopNum = 1; @@ -1196,7 +1197,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcGFunction_Check) thisGLHE.myRespFactors->maxSimYears = 1; - thisGLHE.calcGFunctions(state); + thisGLHE.calcGFunctions(*state); Real64 const tolerance = 0.1; @@ -1286,7 +1287,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calc_pipe_conduction_re ASSERT_TRUE(process_idf(idf_objects)); - GetGroundHeatExchangerInput(state); + GetGroundHeatExchangerInput(*state); auto &thisGLHE(verticalGLHE[0]); @@ -1347,7 +1348,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_friction_factor) // Setup ASSERT_TRUE(process_idf(idf_objects)); - GetGroundHeatExchangerInput(state); + GetGroundHeatExchangerInput(*state); auto &thisGLHE(verticalGLHE[0]); @@ -1661,12 +1662,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calc_pipe_convection_re // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetPlantLoopData(state); - GetPlantInput(state); + GetPlantLoopData(*state); + GetPlantInput(*state); SetupInitialPlantCallingOrder(); - SetupBranchControlTypes(state); + SetupBranchControlTypes(*state); auto &thisGLHE(verticalGLHE[0]); thisGLHE.loopNum = 1; @@ -1679,15 +1680,15 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calc_pipe_convection_re Real64 const tolerance = 0.00001; // Turbulent - EXPECT_NEAR(thisGLHE.calcPipeConvectionResistance(state), 0.004453, tolerance); + EXPECT_NEAR(thisGLHE.calcPipeConvectionResistance(*state), 0.004453, tolerance); // Transitional thisGLHE.massFlowRate = thisGLHE.designFlow * rho / 4; - EXPECT_NEAR(thisGLHE.calcPipeConvectionResistance(state), 0.019185, tolerance); + EXPECT_NEAR(thisGLHE.calcPipeConvectionResistance(*state), 0.019185, tolerance); // Laminar thisGLHE.massFlowRate = thisGLHE.designFlow * rho / 10; - EXPECT_NEAR(thisGLHE.calcPipeConvectionResistance(state), 0.135556, tolerance); + EXPECT_NEAR(thisGLHE.calcPipeConvectionResistance(*state), 0.135556, tolerance); } TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calc_pipe_resistance) @@ -1965,12 +1966,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calc_pipe_resistance) // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetPlantLoopData(state); - GetPlantInput(state); + GetPlantLoopData(*state); + GetPlantInput(*state); SetupInitialPlantCallingOrder(); - SetupBranchControlTypes(state); + SetupBranchControlTypes(*state); auto &thisGLHE(verticalGLHE[0]); thisGLHE.loopNum = 1; @@ -1982,7 +1983,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calc_pipe_resistance) Real64 const tolerance = 0.00001; - EXPECT_NEAR(thisGLHE.calcPipeResistance(state), 0.082204 + 0.004453, tolerance); + EXPECT_NEAR(thisGLHE.calcPipeResistance(*state), 0.082204 + 0.004453, tolerance); } TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_1) @@ -2261,12 +2262,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_1 // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetPlantLoopData(state); - GetPlantInput(state); + GetPlantLoopData(*state); + GetPlantInput(*state); SetupInitialPlantCallingOrder(); - SetupBranchControlTypes(state); + SetupBranchControlTypes(*state); auto &thisGLHE(verticalGLHE[0]); thisGLHE.loopNum = 1; @@ -2280,7 +2281,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_1 EXPECT_NEAR(thisGLHE.theta_2, 3.0, tolerance); EXPECT_NEAR(thisGLHE.theta_3, 1 / (2 * thisGLHE.theta_1 * thisGLHE.theta_2), tolerance); EXPECT_NEAR(thisGLHE.sigma, (thisGLHE.grout.k - thisGLHE.soil.k) / (thisGLHE.grout.k + thisGLHE.soil.k), tolerance); - EXPECT_NEAR(thisGLHE.calcBHGroutResistance(state), 0.17701, tolerance); + EXPECT_NEAR(thisGLHE.calcBHGroutResistance(*state), 0.17701, tolerance); } TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_2) @@ -2559,12 +2560,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_2 // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetPlantLoopData(state); - GetPlantInput(state); + GetPlantLoopData(*state); + GetPlantInput(*state); SetupInitialPlantCallingOrder(); - SetupBranchControlTypes(state); + SetupBranchControlTypes(*state); auto &thisGLHE(verticalGLHE[0]); thisGLHE.loopNum = 1; @@ -2578,7 +2579,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_2 EXPECT_NEAR(thisGLHE.theta_2, 3.0, tolerance); EXPECT_NEAR(thisGLHE.theta_3, 1 / (2 * thisGLHE.theta_1 * thisGLHE.theta_2), tolerance); EXPECT_NEAR(thisGLHE.sigma, (thisGLHE.grout.k - thisGLHE.soil.k) / (thisGLHE.grout.k + thisGLHE.soil.k), tolerance); - EXPECT_NEAR(thisGLHE.calcBHGroutResistance(state), 0.14724, tolerance); + EXPECT_NEAR(thisGLHE.calcBHGroutResistance(*state), 0.14724, tolerance); } TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_3) @@ -2857,12 +2858,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_3 // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetPlantLoopData(state); - GetPlantInput(state); + GetPlantLoopData(*state); + GetPlantInput(*state); SetupInitialPlantCallingOrder(); - SetupBranchControlTypes(state); + SetupBranchControlTypes(*state); auto &thisGLHE(verticalGLHE[0]); thisGLHE.loopNum = 1; @@ -2876,7 +2877,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHGroutResistance_3 EXPECT_NEAR(thisGLHE.theta_2, 9.0, tolerance); EXPECT_NEAR(thisGLHE.theta_3, 1 / (2 * thisGLHE.theta_1 * thisGLHE.theta_2), tolerance); EXPECT_NEAR(thisGLHE.sigma, (thisGLHE.grout.k - thisGLHE.soil.k) / (thisGLHE.grout.k + thisGLHE.soil.k), tolerance); - EXPECT_NEAR(thisGLHE.calcBHGroutResistance(state), 0.11038, tolerance); + EXPECT_NEAR(thisGLHE.calcBHGroutResistance(*state), 0.11038, tolerance); } TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResistance_1) @@ -3155,12 +3156,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResi // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetPlantLoopData(state); - GetPlantInput(state); + GetPlantLoopData(*state); + GetPlantInput(*state); SetupInitialPlantCallingOrder(); - SetupBranchControlTypes(state); + SetupBranchControlTypes(*state); auto &thisGLHE(verticalGLHE[0]); thisGLHE.loopNum = 1; @@ -3174,7 +3175,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResi EXPECT_NEAR(thisGLHE.theta_2, 3.0, tolerance); EXPECT_NEAR(thisGLHE.theta_3, 1 / (2 * thisGLHE.theta_1 * thisGLHE.theta_2), tolerance); EXPECT_NEAR(thisGLHE.sigma, (thisGLHE.grout.k - thisGLHE.soil.k) / (thisGLHE.grout.k + thisGLHE.soil.k), tolerance); - EXPECT_NEAR(thisGLHE.calcBHTotalInternalResistance(state), 0.32365, tolerance); + EXPECT_NEAR(thisGLHE.calcBHTotalInternalResistance(*state), 0.32365, tolerance); } TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResistance_2) @@ -3453,12 +3454,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResi // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetPlantLoopData(state); - GetPlantInput(state); + GetPlantLoopData(*state); + GetPlantInput(*state); SetupInitialPlantCallingOrder(); - SetupBranchControlTypes(state); + SetupBranchControlTypes(*state); auto &thisGLHE(verticalGLHE[0]); thisGLHE.loopNum = 1; @@ -3472,7 +3473,7 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResi EXPECT_NEAR(thisGLHE.theta_2, 6.0, tolerance); EXPECT_NEAR(thisGLHE.theta_3, 1 / (2 * thisGLHE.theta_1 * thisGLHE.theta_2), tolerance); EXPECT_NEAR(thisGLHE.sigma, (thisGLHE.grout.k - thisGLHE.soil.k) / (thisGLHE.grout.k + thisGLHE.soil.k), tolerance); - EXPECT_NEAR(thisGLHE.calcBHTotalInternalResistance(state), 0.16310, tolerance); + EXPECT_NEAR(thisGLHE.calcBHTotalInternalResistance(*state), 0.16310, tolerance); } TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResistance_3) @@ -3751,12 +3752,12 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResi // Setup ASSERT_TRUE(process_idf(idf_objects)); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetPlantLoopData(state); - GetPlantInput(state); + GetPlantLoopData(*state); + GetPlantInput(*state); SetupInitialPlantCallingOrder(); - SetupBranchControlTypes(state); + SetupBranchControlTypes(*state); auto &thisGLHE(verticalGLHE[0]); thisGLHE.loopNum = 1; @@ -3770,5 +3771,5 @@ TEST_F(EnergyPlusFixture, GroundHeatExchangerTest_System_calcBHTotalInternalResi EXPECT_NEAR(thisGLHE.theta_2, 9.0, tolerance); EXPECT_NEAR(thisGLHE.theta_3, 1 / (2 * thisGLHE.theta_1 * thisGLHE.theta_2), tolerance); EXPECT_NEAR(thisGLHE.sigma, (thisGLHE.grout.k - thisGLHE.soil.k) / (thisGLHE.grout.k + thisGLHE.soil.k), tolerance); - EXPECT_NEAR(thisGLHE.calcBHTotalInternalResistance(state), 0.31582, tolerance); + EXPECT_NEAR(thisGLHE.calcBHTotalInternalResistance(*state), 0.31582, tolerance); } diff --git a/tst/EnergyPlus/unit/HVACControllers.unit.cc b/tst/EnergyPlus/unit/HVACControllers.unit.cc index 313fad74637..5b5c1e196a8 100644 --- a/tst/EnergyPlus/unit/HVACControllers.unit.cc +++ b/tst/EnergyPlus/unit/HVACControllers.unit.cc @@ -65,6 +65,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -130,16 +131,16 @@ TEST_F(EnergyPlusFixture, HVACControllers_ResetHumidityRatioCtrlVarType) ASSERT_TRUE(process_idf(idf_objects)); - GetSetPointManagerInputs(state); + GetSetPointManagerInputs(*state); // check specified control variable type is "HumidityRatio" ASSERT_EQ(iCtrlVarType_HumRat, AllSetPtMgr(1).CtrlTypeMode); - GetControllerInput(state); + GetControllerInput(*state); // check control variable type in AllSetPtMgr is reset to "MaximumHumidityRatio" ASSERT_EQ(iCtrlVarType_MaxHumRat, AllSetPtMgr(1).CtrlTypeMode); // ControllerProps always expects the control variable type to be "HumididtyRatio" - ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(state, ControllerProps(1).SensedNode); + ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(*state, ControllerProps(1).SensedNode); ASSERT_EQ(iCtrlVarType_HumRat, ControllerProps(1).HumRatCntrlType); ASSERT_EQ(ControllerProps.size(), 1u); @@ -202,33 +203,33 @@ TEST_F(EnergyPlusFixture, HVACControllers_TestTempAndHumidityRatioCtrlVarType) ASSERT_TRUE(process_idf(idf_objects)); - GetSetPointManagerInputs(state); + GetSetPointManagerInputs(*state); // check specified control variable type is "HumidityRatio" ASSERT_EQ(iCtrlVarType_MaxHumRat, AllSetPtMgr(1).CtrlTypeMode); - GetControllerInput(state); + GetControllerInput(*state); // check control variable type in AllSetPtMgr is reset to "MaximumHumidityRatio" ASSERT_EQ(iCtrlVarType_MaxHumRat, AllSetPtMgr(1).CtrlTypeMode); // ControllerProps expects the control variable type to be "MaximumHumididtyRatio" - ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(state, ControllerProps(1).SensedNode); + ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(*state, ControllerProps(1).SensedNode); ASSERT_EQ(iCtrlVarType_MaxHumRat, ControllerProps(1).HumRatCntrlType); // test index for air loop controllers // before controllers are simulated, AirLoopControllerIndex = 0 ASSERT_EQ(0, ControllerProps(1).AirLoopControllerIndex); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); SimAirServingZones::GetAirLoopInputFlag = false; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirLoop->PriAirSysAvailMgr.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(1).NumSupplyNodes = 1; - state.dataAirLoop->AirToZoneNodeInfo(1).AirLoopSupplyNodeNum.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(1).AirLoopSupplyNodeNum(1) = 1; - state.dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipSupplyNodeNum.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipSupplyNodeNum(1) = 4; + state->dataAirLoop->PriAirSysAvailMgr.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(1).NumSupplyNodes = 1; + state->dataAirLoop->AirToZoneNodeInfo(1).AirLoopSupplyNodeNum.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(1).AirLoopSupplyNodeNum(1) = 1; + state->dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipSupplyNodeNum.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipSupplyNodeNum(1) = 4; DataConvergParams::AirLoopConvergence.allocate(1); DataConvergParams::AirLoopConvergence(1).HVACMassFlowNotConverged.allocate(2); DataConvergParams::AirLoopConvergence(1).HVACHumRatNotConverged.allocate(2); @@ -236,24 +237,24 @@ TEST_F(EnergyPlusFixture, HVACControllers_TestTempAndHumidityRatioCtrlVarType) DataConvergParams::AirLoopConvergence(1).HVACEnergyNotConverged.allocate(2); DataConvergParams::AirLoopConvergence(1).HVACEnthalpyNotConverged.allocate(2); DataConvergParams::AirLoopConvergence(1).HVACPressureNotConverged.allocate(2); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).NumControllers = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1) = 0; - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerName.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerName(1) = "CW COIL CONTROLLER"; - state.dataAirSystemsData->PrimaryAirSystems(1).ControlConverged.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumIn = 4; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumOut = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalNodes = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum(1) = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "CHILLED WATER COIL"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).CompType_Num = 5; // state.dataWaterCoils->WaterCoil_Cooling + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).NumControllers = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1) = 0; + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerName.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerName(1) = "CW COIL CONTROLLER"; + state->dataAirSystemsData->PrimaryAirSystems(1).ControlConverged.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumIn = 4; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumOut = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalNodes = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum(1) = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "CHILLED WATER COIL"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).CompType_Num = 5; // state->dataWaterCoils->WaterCoil_Cooling DataPlant::PlantLoop.allocate(1); DataPlant::TotNumLoops = 1; DataPlant::PlantLoop(1).LoopSide.allocate(2); @@ -266,11 +267,11 @@ TEST_F(EnergyPlusFixture, HVACControllers_TestTempAndHumidityRatioCtrlVarType) DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = 3; DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = "CHILLED WATER COIL"; bool SimZoneEquipment(false); - SimAirServingZones::SimAirLoops(state, true, SimZoneEquipment); + SimAirServingZones::SimAirLoops(*state, true, SimZoneEquipment); // after controllers are simulated, AirLoopControllerIndex = index to this controller on this air loop (e.g., n of num contollers on air loop) - ASSERT_EQ(1, state.dataAirSystemsData->PrimaryAirSystems(1).NumControllers); - ASSERT_EQ(1, state.dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1)); + ASSERT_EQ(1, state->dataAirSystemsData->PrimaryAirSystems(1).NumControllers); + ASSERT_EQ(1, state->dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1)); ASSERT_EQ(1, ControllerProps(1).AirLoopControllerIndex); } @@ -346,7 +347,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_SchSetPointMgrsOrderTest) ASSERT_TRUE(process_idf(idf_objects)); - GetSetPointManagerInputs(state); + GetSetPointManagerInputs(*state); // There are two setpoint managers and are schedule type ASSERT_EQ(2, NumSchSetPtMgrs); // 2 schedule set point managers ASSERT_EQ(2, NumAllSetPtMgrs); // 2 all set point managers @@ -354,9 +355,9 @@ TEST_F(EnergyPlusFixture, HVACControllers_SchSetPointMgrsOrderTest) ASSERT_EQ(iTemperature, AllSetPtMgr(1).CtrlTypeMode); // is "Temperature" ASSERT_EQ(iCtrlVarType_MaxHumRat, AllSetPtMgr(2).CtrlTypeMode); // is "MaximumHumidityRatio" - GetControllerInput(state); + GetControllerInput(*state); // check ControllerProps control variable is set to "MaximumHumidityRatio" - ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(state, ControllerProps(1).SensedNode); + ControllerProps(1).HumRatCntrlType = GetHumidityRatioVariableType(*state, ControllerProps(1).SensedNode); ASSERT_EQ(iCtrlVarType_MaxHumRat, ControllerProps(1).HumRatCntrlType); // MaximumHumidityRatio } @@ -401,56 +402,56 @@ TEST_F(EnergyPlusFixture, HVACControllers_WaterCoilOnPrimaryLoopCheckTest) ASSERT_TRUE(process_idf(idf_objects)); - GetControllerInput(state); + GetControllerInput(*state); - ASSERT_EQ(state.dataWaterCoils->WaterCoil(1).Name, "CHILLED WATER COIL"); - ASSERT_EQ(state.dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state.dataWaterCoils->WaterCoil_Cooling); + ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).Name, "CHILLED WATER COIL"); + ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state->dataWaterCoils->WaterCoil_Cooling); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); SimAirServingZones::GetAirLoopInputFlag = false; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).NumControllers = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1) = 0; - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerName.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerName(1) = "CW COIL CONTROLLER"; - state.dataAirSystemsData->PrimaryAirSystems(1).ControlConverged.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumIn = 4; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumOut = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalNodes = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum(1) = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).CompType_Num = SimAirServingZones::WaterCoil_Cooling; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).NumControllers = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1) = 0; + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerName.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerName(1) = "CW COIL CONTROLLER"; + state->dataAirSystemsData->PrimaryAirSystems(1).ControlConverged.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumIn = 4; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumOut = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalNodes = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum(1) = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).CompType_Num = SimAirServingZones::WaterCoil_Cooling; bool WaterCoilOnAirLoop = true; std::string CompType = DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWater); //"Coil:Cooling:Water"; std::string CompName = "CHILLED WATER COIL"; int CoilTypeNum = SimAirServingZones::WaterCoil_Cooling; - WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnPrimaryAirLoopBranch(state, CoilTypeNum, CompName); + WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnPrimaryAirLoopBranch(*state, CoilTypeNum, CompName); EXPECT_TRUE(WaterCoilOnAirLoop); WaterCoilOnAirLoop = true; - WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnOASystem(state, CoilTypeNum, CompName); + WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnOASystem(*state, CoilTypeNum, CompName); EXPECT_FALSE(WaterCoilOnAirLoop); WaterCoilOnAirLoop = true; - WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilSystemOnAirLoopOrOASystem(state, CoilTypeNum, CompName); + WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilSystemOnAirLoopOrOASystem(*state, CoilTypeNum, CompName); EXPECT_FALSE(WaterCoilOnAirLoop); WaterCoilOnAirLoop = true; - SimAirServingZones::CheckWaterCoilIsOnAirLoop(state, CoilTypeNum, CompType, CompName, WaterCoilOnAirLoop); + SimAirServingZones::CheckWaterCoilIsOnAirLoop(*state, CoilTypeNum, CompType, CompName, WaterCoilOnAirLoop); EXPECT_TRUE(WaterCoilOnAirLoop); // now test a different water coil type - CoilTypeNum = state.dataWaterCoils->WaterCoil_DetFlatFinCooling; - WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnPrimaryAirLoopBranch(state, CoilTypeNum, CompName); + CoilTypeNum = state->dataWaterCoils->WaterCoil_DetFlatFinCooling; + WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnPrimaryAirLoopBranch(*state, CoilTypeNum, CompName); EXPECT_FALSE(WaterCoilOnAirLoop); } @@ -494,65 +495,65 @@ TEST_F(EnergyPlusFixture, HVACControllers_WaterCoilOnOutsideAirSystemCheckTest) ASSERT_TRUE(process_idf(idf_objects)); - GetControllerInput(state); + GetControllerInput(*state); - ASSERT_EQ(state.dataWaterCoils->WaterCoil(1).Name, "OA PREHEAT HW COIL"); - ASSERT_EQ(state.dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state.dataWaterCoils->WaterCoil_SimpleHeating); + ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).Name, "OA PREHEAT HW COIL"); + ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state->dataWaterCoils->WaterCoil_SimpleHeating); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); SimAirServingZones::GetAirLoopInputFlag = false; - state.dataAirLoop->NumOASystems = 1; - state.dataAirLoop->OutsideAirSys.allocate(1); - state.dataAirLoop->OutsideAirSys(1).Name = "AIRLOOP OASYSTEM"; - state.dataAirLoop->OutsideAirSys(1).NumControllers = 1; - state.dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA CONTROLLER 1"; - state.dataAirLoop->OutsideAirSys(1).NumComponents = 2; - state.dataAirLoop->OutsideAirSys(1).ComponentType.allocate(2); - state.dataAirLoop->OutsideAirSys(1).ComponentType(1) = DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater); - state.dataAirLoop->OutsideAirSys(1).ComponentType(2) = "OutdoorAir:Mixer"; - state.dataAirLoop->OutsideAirSys(1).ComponentName.allocate(2); - state.dataAirLoop->OutsideAirSys(1).ComponentName(1) = state.dataWaterCoils->WaterCoil(1).Name; - state.dataAirLoop->OutsideAirSys(1).ComponentName(2) = "OAMixer"; - state.dataAirLoop->OutsideAirSys(1).ComponentType_Num.allocate(2); - state.dataAirLoop->OutsideAirSys(1).ComponentType_Num(1) = SimAirServingZones::WaterCoil_SimpleHeat; - state.dataAirLoop->OutsideAirSys(1).ComponentType_Num(2) = SimAirServingZones::OAMixer_Num; + state->dataAirLoop->NumOASystems = 1; + state->dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys(1).Name = "AIRLOOP OASYSTEM"; + state->dataAirLoop->OutsideAirSys(1).NumControllers = 1; + state->dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA CONTROLLER 1"; + state->dataAirLoop->OutsideAirSys(1).NumComponents = 2; + state->dataAirLoop->OutsideAirSys(1).ComponentType.allocate(2); + state->dataAirLoop->OutsideAirSys(1).ComponentType(1) = DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater); + state->dataAirLoop->OutsideAirSys(1).ComponentType(2) = "OutdoorAir:Mixer"; + state->dataAirLoop->OutsideAirSys(1).ComponentName.allocate(2); + state->dataAirLoop->OutsideAirSys(1).ComponentName(1) = state->dataWaterCoils->WaterCoil(1).Name; + state->dataAirLoop->OutsideAirSys(1).ComponentName(2) = "OAMixer"; + state->dataAirLoop->OutsideAirSys(1).ComponentType_Num.allocate(2); + state->dataAirLoop->OutsideAirSys(1).ComponentType_Num(1) = SimAirServingZones::WaterCoil_SimpleHeat; + state->dataAirLoop->OutsideAirSys(1).ComponentType_Num(2) = SimAirServingZones::OAMixer_Num; OAMixer.allocate(1); OAMixer(1).Name = "OAMixer"; OAMixer(1).InletNode = 2; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Name = "PrimaryAirLoop"; - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = state.dataAirLoop->OutsideAirSys(1).Name; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Name = "PrimaryAirLoop"; + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = state->dataAirLoop->OutsideAirSys(1).Name; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; bool WaterCoilOnAirLoop = true; std::string CompType = DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_HeatingWater); - std::string CompName = state.dataWaterCoils->WaterCoil(1).Name; + std::string CompName = state->dataWaterCoils->WaterCoil(1).Name; int CoilTypeNum = SimAirServingZones::WaterCoil_SimpleHeat; - WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnPrimaryAirLoopBranch(state, CoilTypeNum, CompName); + WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnPrimaryAirLoopBranch(*state, CoilTypeNum, CompName); EXPECT_FALSE(WaterCoilOnAirLoop); WaterCoilOnAirLoop = false; - WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnOASystem(state, CoilTypeNum, CompName); + WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnOASystem(*state, CoilTypeNum, CompName); EXPECT_TRUE(WaterCoilOnAirLoop); WaterCoilOnAirLoop = false; - SimAirServingZones::CheckWaterCoilIsOnAirLoop(state, CoilTypeNum, CompType, CompName, WaterCoilOnAirLoop); + SimAirServingZones::CheckWaterCoilIsOnAirLoop(*state, CoilTypeNum, CompType, CompName, WaterCoilOnAirLoop); EXPECT_TRUE(WaterCoilOnAirLoop); // test a different water coil type CoilTypeNum = SimAirServingZones::WaterCoil_DetailedCool; WaterCoilOnAirLoop = true; - WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnOASystem(state, CoilTypeNum, CompName); + WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnOASystem(*state, CoilTypeNum, CompName); EXPECT_FALSE(WaterCoilOnAirLoop); } TEST_F(EnergyPlusFixture, HVACControllers_CoilSystemCoolingWaterOnOutsideAirSystemCheckTest) @@ -626,63 +627,63 @@ TEST_F(EnergyPlusFixture, HVACControllers_CoilSystemCoolingWaterOnOutsideAirSyst ASSERT_TRUE(process_idf(idf_objects)); - GetControllerInput(state); + GetControllerInput(*state); - ASSERT_EQ(state.dataWaterCoils->WaterCoil(1).Name, "DETAILED PRE COOLING COIL"); - ASSERT_EQ(state.dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state.dataWaterCoils->WaterCoil_DetFlatFinCooling); + ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).Name, "DETAILED PRE COOLING COIL"); + ASSERT_EQ(state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num, state->dataWaterCoils->WaterCoil_DetFlatFinCooling); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); SimAirServingZones::GetAirLoopInputFlag = false; - state.dataAirLoop->NumOASystems = 1; - state.dataAirLoop->OutsideAirSys.allocate(1); - state.dataAirLoop->OutsideAirSys(1).Name = "AIRLOOP OASYSTEM"; - state.dataAirLoop->OutsideAirSys(1).NumControllers = 1; - state.dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA CONTROLLER 1"; - state.dataAirLoop->OutsideAirSys(1).NumComponents = 2; - state.dataAirLoop->OutsideAirSys(1).ComponentType.allocate(2); - state.dataAirLoop->OutsideAirSys(1).ComponentType(1) = DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilWater_CoolingHXAssisted); - state.dataAirLoop->OutsideAirSys(1).ComponentType(2) = "OutdoorAir:Mixer"; - state.dataAirLoop->OutsideAirSys(1).ComponentName.allocate(2); - state.dataAirLoop->OutsideAirSys(1).ComponentName(1) = "HXAssisting Cooling Coil"; - state.dataAirLoop->OutsideAirSys(1).ComponentName(2) = "OAMixer"; - state.dataAirLoop->OutsideAirSys(1).ComponentType_Num.allocate(2); - state.dataAirLoop->OutsideAirSys(1).ComponentType_Num(1) = SimAirServingZones::WaterCoil_CoolingHXAsst; - state.dataAirLoop->OutsideAirSys(1).ComponentType_Num(2) = SimAirServingZones::OAMixer_Num; + state->dataAirLoop->NumOASystems = 1; + state->dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys(1).Name = "AIRLOOP OASYSTEM"; + state->dataAirLoop->OutsideAirSys(1).NumControllers = 1; + state->dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA CONTROLLER 1"; + state->dataAirLoop->OutsideAirSys(1).NumComponents = 2; + state->dataAirLoop->OutsideAirSys(1).ComponentType.allocate(2); + state->dataAirLoop->OutsideAirSys(1).ComponentType(1) = DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::CoilWater_CoolingHXAssisted); + state->dataAirLoop->OutsideAirSys(1).ComponentType(2) = "OutdoorAir:Mixer"; + state->dataAirLoop->OutsideAirSys(1).ComponentName.allocate(2); + state->dataAirLoop->OutsideAirSys(1).ComponentName(1) = "HXAssisting Cooling Coil"; + state->dataAirLoop->OutsideAirSys(1).ComponentName(2) = "OAMixer"; + state->dataAirLoop->OutsideAirSys(1).ComponentType_Num.allocate(2); + state->dataAirLoop->OutsideAirSys(1).ComponentType_Num(1) = SimAirServingZones::WaterCoil_CoolingHXAsst; + state->dataAirLoop->OutsideAirSys(1).ComponentType_Num(2) = SimAirServingZones::OAMixer_Num; OAMixer.allocate(1); OAMixer(1).Name = "OAMixer"; OAMixer(1).InletNode = 2; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Name = "PrimaryAirLoop"; - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = state.dataAirLoop->OutsideAirSys(1).Name; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Name = "PrimaryAirLoop"; + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = state->dataAirLoop->OutsideAirSys(1).Name; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; bool WaterCoilOnAirLoop = true; std::string CompType = DataHVACGlobals::cAllCoilTypes(DataHVACGlobals::Coil_CoolingWaterDetailed); - std::string CompName = state.dataWaterCoils->WaterCoil(1).Name; + std::string CompName = state->dataWaterCoils->WaterCoil(1).Name; int CoilTypeNum = SimAirServingZones::WaterCoil_DetailedCool; - WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnPrimaryAirLoopBranch(state, CoilTypeNum, CompName); + WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnPrimaryAirLoopBranch(*state, CoilTypeNum, CompName); EXPECT_FALSE(WaterCoilOnAirLoop); WaterCoilOnAirLoop = true; - WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnOASystem(state, CoilTypeNum, CompName); + WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilOnOASystem(*state, CoilTypeNum, CompName); EXPECT_FALSE(WaterCoilOnAirLoop); WaterCoilOnAirLoop = false; - WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilSystemOnAirLoopOrOASystem(state, CoilTypeNum, CompName); + WaterCoilOnAirLoop = SimAirServingZones::CheckWaterCoilSystemOnAirLoopOrOASystem(*state, CoilTypeNum, CompName); EXPECT_TRUE(WaterCoilOnAirLoop); WaterCoilOnAirLoop = false; - SimAirServingZones::CheckWaterCoilIsOnAirLoop(state, CoilTypeNum, CompType, CompName, WaterCoilOnAirLoop); + SimAirServingZones::CheckWaterCoilIsOnAirLoop(*state, CoilTypeNum, CompType, CompName, WaterCoilOnAirLoop); EXPECT_TRUE(WaterCoilOnAirLoop); } TEST_F(EnergyPlusFixture, HVACControllers_CheckTempAndHumRatCtrl) @@ -712,7 +713,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_CheckTempAndHumRatCtrl) thisController.NumCalcCalls = 5; DataLoopNode::Node(sensedNode).HumRat = 0.0011; - HVACControllers::CheckTempAndHumRatCtrl(state, controlNum, isConverged); + HVACControllers::CheckTempAndHumRatCtrl(*state, controlNum, isConverged); EXPECT_FALSE(isConverged); EXPECT_FALSE(thisController.HumRatCtrlOverride); EXPECT_NEAR(thisController.SetPointValue, 21.1, 0.0001); @@ -727,7 +728,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_CheckTempAndHumRatCtrl) thisController.NumCalcCalls = 5; DataLoopNode::Node(sensedNode).HumRat = 0.0011; - HVACControllers::CheckTempAndHumRatCtrl(state, controlNum, isConverged); + HVACControllers::CheckTempAndHumRatCtrl(*state, controlNum, isConverged); EXPECT_TRUE(isConverged); EXPECT_TRUE(thisController.HumRatCtrlOverride); EXPECT_NEAR(thisController.SetPointValue, 21.1, 0.0001); @@ -742,7 +743,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_CheckTempAndHumRatCtrl) thisController.NumCalcCalls = 5; DataLoopNode::Node(sensedNode).HumRat = DataLoopNode::Node(sensedNode).HumRatMax - 0.001; - HVACControllers::CheckTempAndHumRatCtrl(state, controlNum, isConverged); + HVACControllers::CheckTempAndHumRatCtrl(*state, controlNum, isConverged); EXPECT_TRUE(isConverged); EXPECT_FALSE(thisController.HumRatCtrlOverride); EXPECT_NEAR(thisController.SetPointValue, 21.1, 0.0001); @@ -757,7 +758,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_CheckTempAndHumRatCtrl) thisController.NumCalcCalls = 5; DataLoopNode::Node(sensedNode).HumRat = DataLoopNode::Node(sensedNode).HumRatMax + 0.002; - HVACControllers::CheckTempAndHumRatCtrl(state, controlNum, isConverged); + HVACControllers::CheckTempAndHumRatCtrl(*state, controlNum, isConverged); EXPECT_FALSE(isConverged); EXPECT_TRUE(thisController.HumRatCtrlOverride); EXPECT_NEAR(thisController.SetPointValue, 0.0, 0.0001); @@ -773,7 +774,7 @@ TEST_F(EnergyPlusFixture, HVACControllers_CheckTempAndHumRatCtrl) DataLoopNode::Node(sensedNode).HumRat = DataLoopNode::Node(sensedNode).HumRatMax - 0.001; thisController.ControlVar = HVACControllers::iTemperature; - HVACControllers::CheckTempAndHumRatCtrl(state, controlNum, isConverged); + HVACControllers::CheckTempAndHumRatCtrl(*state, controlNum, isConverged); EXPECT_TRUE(isConverged); EXPECT_FALSE(thisController.HumRatCtrlOverride); EXPECT_NEAR(thisController.SetPointValue, 21.1, 0.0001); @@ -835,9 +836,9 @@ TEST_F(EnergyPlusFixture, HVACControllers_BlankAutosized) ASSERT_TRUE(process_idf(idf_objects)); - GetSetPointManagerInputs(state); + GetSetPointManagerInputs(*state); - GetControllerInput(state); + GetControllerInput(*state); ASSERT_EQ(ControllerProps.size(), 1u); EXPECT_EQ(ControllerProps(1).MaxVolFlowActuated, DataSizing::AutoSize); @@ -910,9 +911,9 @@ TEST_F(EnergyPlusFixture, HVACControllers_MaxFlowZero) ASSERT_TRUE(process_idf(idf_objects)); - GetSetPointManagerInputs(state); + GetSetPointManagerInputs(*state); - GetControllerInput(state); + GetControllerInput(*state); ASSERT_EQ(ControllerProps.size(), 1u); EXPECT_EQ(ControllerProps(1).MaxVolFlowActuated, DataSizing::AutoSize); @@ -923,17 +924,17 @@ TEST_F(EnergyPlusFixture, HVACControllers_MaxFlowZero) // before controllers are simulated, AirLoopControllerIndex = 0 ASSERT_EQ(0, ControllerProps(1).AirLoopControllerIndex); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); SimAirServingZones::GetAirLoopInputFlag = false; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirLoop->PriAirSysAvailMgr.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(1).NumSupplyNodes = 1; - state.dataAirLoop->AirToZoneNodeInfo(1).AirLoopSupplyNodeNum.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(1).AirLoopSupplyNodeNum(1) = 1; - state.dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipSupplyNodeNum.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipSupplyNodeNum(1) = 4; + state->dataAirLoop->PriAirSysAvailMgr.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(1).NumSupplyNodes = 1; + state->dataAirLoop->AirToZoneNodeInfo(1).AirLoopSupplyNodeNum.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(1).AirLoopSupplyNodeNum(1) = 1; + state->dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipSupplyNodeNum.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipSupplyNodeNum(1) = 4; DataConvergParams::AirLoopConvergence.allocate(1); DataConvergParams::AirLoopConvergence(1).HVACMassFlowNotConverged.allocate(2); DataConvergParams::AirLoopConvergence(1).HVACHumRatNotConverged.allocate(2); @@ -941,24 +942,24 @@ TEST_F(EnergyPlusFixture, HVACControllers_MaxFlowZero) DataConvergParams::AirLoopConvergence(1).HVACEnergyNotConverged.allocate(2); DataConvergParams::AirLoopConvergence(1).HVACEnthalpyNotConverged.allocate(2); DataConvergParams::AirLoopConvergence(1).HVACPressureNotConverged.allocate(2); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).NumControllers = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1) = 0; - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerName.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).ControllerName(1) = "CW COIL CONTROLLER"; - state.dataAirSystemsData->PrimaryAirSystems(1).ControlConverged.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumIn = 4; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumOut = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalNodes = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum(1) = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "CHILLED WATER COIL"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).CompType_Num = 5; // WaterCoil_Cooling + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).NumControllers = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1) = 0; + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerName.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).ControllerName(1) = "CW COIL CONTROLLER"; + state->dataAirSystemsData->PrimaryAirSystems(1).ControlConverged.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumIn = 4; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumOut = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalNodes = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNum(1) = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "CHILLED WATER COIL"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).CompType_Num = 5; // WaterCoil_Cooling DataPlant::PlantLoop.allocate(1); DataPlant::TotNumLoops = 1; DataPlant::PlantLoop(1).Name = "CHW LOOP"; @@ -997,11 +998,11 @@ TEST_F(EnergyPlusFixture, HVACControllers_MaxFlowZero) // This will call ManageController, which calls SizeController which should autosize the controller max actuated flow rate to zero // and issue a warning - SimAirServingZones::SimAirLoops(state, true, SimZoneEquipment); + SimAirServingZones::SimAirLoops(*state, true, SimZoneEquipment); // after controllers are simulated, AirLoopControllerIndex = index to this controller on this air loop (e.g., n of num contollers on air loop) - ASSERT_EQ(1, state.dataAirSystemsData->PrimaryAirSystems(1).NumControllers); - ASSERT_EQ(1, state.dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1)); + ASSERT_EQ(1, state->dataAirSystemsData->PrimaryAirSystems(1).NumControllers); + ASSERT_EQ(1, state->dataAirSystemsData->PrimaryAirSystems(1).ControllerIndex(1)); ASSERT_EQ(1, ControllerProps(1).AirLoopControllerIndex); // This should have been autosized to zero diff --git a/tst/EnergyPlus/unit/HVACDXSystem.unit.cc b/tst/EnergyPlus/unit/HVACDXSystem.unit.cc index e7e87caa31e..bc0a7ae96d6 100644 --- a/tst/EnergyPlus/unit/HVACDXSystem.unit.cc +++ b/tst/EnergyPlus/unit/HVACDXSystem.unit.cc @@ -58,6 +58,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -399,14 +400,14 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_DOASDXCoilTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ScheduleManager::ProcessScheduleInput(*state); - HVACDXSystem::GetDXCoolingSystemInput(state); + HVACDXSystem::GetDXCoolingSystemInput(*state); EXPECT_EQ(HVACDXSystem::DXCoolingSystem(1).Name, "DX COOLING COIL SYSTEM"); EXPECT_FALSE(HVACDXSystem::DXCoolingSystem(1).ISHundredPercentDOASDXCoil); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).Name, "VS DX COOLING COIL"); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "VS DX COOLING COIL"); } TEST_F(EnergyPlusFixture, VariableSpeedCoils_RHControl) @@ -514,10 +515,10 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_RHControl) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - OutputReportPredefined::SetPredefinedTables(state); - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + OutputReportPredefined::SetPredefinedTables(*state); + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager int DXSystemNum = 1; @@ -526,10 +527,10 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_RHControl) int InletNode = 1; int ControlNode = 2; // same as outlet node number - HVACDXSystem::GetDXCoolingSystemInput(state); + HVACDXSystem::GetDXCoolingSystemInput(*state); EXPECT_EQ(HVACDXSystem::DXCoolingSystem(DXSystemNum).Name, "DX COOLING COIL SYSTEM"); EXPECT_FALSE(HVACDXSystem::DXCoolingSystem(DXSystemNum).ISHundredPercentDOASDXCoil); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(DXSystemNum).Name, "VS DX COOLING COIL"); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(DXSystemNum).Name, "VS DX COOLING COIL"); EXPECT_EQ(2, HVACDXSystem::DXCoolingSystem(DXSystemNum).DXSystemControlNodeNum); // set up outdoor environment @@ -551,7 +552,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_RHControl) DataLoopNode::Node(ControlNode).HumRatMax = RHControlHumRat; // test sensible control - HVACDXSystem::ControlDXSystem(state, DXSystemNum, FirstHVACIteration, HXUnitOn); + HVACDXSystem::ControlDXSystem(*state, DXSystemNum, FirstHVACIteration, HXUnitOn); // system meets temperature set point EXPECT_NEAR(HVACDXSystem::DXCoolingSystem(DXSystemNum).DesiredOutletTemp, DataLoopNode::Node(ControlNode).Temp, 0.00001); // system was not told to meet humidity ratio set point (since DesiredOutletHumRat = 1.0) @@ -561,7 +562,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_RHControl) // test latent control HVACDXSystem::DXCoolingSystem(DXSystemNum).DesiredOutletHumRat = RHControlHumRat; - HVACDXSystem::ControlDXSystem(state, DXSystemNum, FirstHVACIteration, HXUnitOn); + HVACDXSystem::ControlDXSystem(*state, DXSystemNum, FirstHVACIteration, HXUnitOn); // system over cools past temperature set point EXPECT_GT(HVACDXSystem::DXCoolingSystem(DXSystemNum).DesiredOutletTemp, DataLoopNode::Node(ControlNode).Temp); @@ -675,10 +676,10 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_LatentDegradation_Test) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - OutputReportPredefined::SetPredefinedTables(state); - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + OutputReportPredefined::SetPredefinedTables(*state); + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager int DXSystemNum = 1; @@ -687,7 +688,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_LatentDegradation_Test) int InletNode = 1; int ControlNode = 2; // same as outlet node number - HVACDXSystem::GetDXCoolingSystemInput(state); + HVACDXSystem::GetDXCoolingSystemInput(*state); // set up outdoor environment DataEnvironment::OutDryBulbTemp = 35.0; @@ -706,20 +707,20 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_LatentDegradation_Test) DataLoopNode::Node(ControlNode).TempSetPoint = HVACDXSystem::DXCoolingSystem(DXSystemNum).DesiredOutletTemp; // test sensible control - HVACDXSystem::ControlDXSystem(state, DXSystemNum, FirstHVACIteration, HXUnitOn); - Real64 SHR = state.dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state.dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; + HVACDXSystem::ControlDXSystem(*state, DXSystemNum, FirstHVACIteration, HXUnitOn); + Real64 SHR = state->dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state->dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; EXPECT_NEAR(SHR, 0.49605, 0.0001); - EXPECT_EQ(1, state.dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed - EXPECT_NEAR(0.199, state.dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is low + EXPECT_EQ(1, state->dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed + EXPECT_NEAR(0.199, state->dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is low // add latent degradation model - state.dataVariableSpeedCoils->VarSpeedCoil(1).Twet_Rated = 1000.0; - state.dataVariableSpeedCoils->VarSpeedCoil(1).Gamma_Rated = 1.5; - HVACDXSystem::ControlDXSystem(state, DXSystemNum, FirstHVACIteration, HXUnitOn); - SHR = state.dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state.dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; + state->dataVariableSpeedCoils->VarSpeedCoil(1).Twet_Rated = 1000.0; + state->dataVariableSpeedCoils->VarSpeedCoil(1).Gamma_Rated = 1.5; + HVACDXSystem::ControlDXSystem(*state, DXSystemNum, FirstHVACIteration, HXUnitOn); + SHR = state->dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state->dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; EXPECT_NEAR(SHR, 1.0, 0.0001); // more sensible capacity so PLR should be lower - EXPECT_EQ(1, state.dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed - EXPECT_NEAR(0.099, state.dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is lower, latent capacity is 0 + EXPECT_EQ(1, state->dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed + EXPECT_NEAR(0.099, state->dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is lower, latent capacity is 0 // test more reasonable zone RH,about 50% DataLoopNode::Node(InletNode).HumRat = 0.0092994; @@ -728,23 +729,23 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_LatentDegradation_Test) DataLoopNode::Node(ControlNode).TempSetPoint = HVACDXSystem::DXCoolingSystem(DXSystemNum).DesiredOutletTemp; // remove latent degradation model - state.dataVariableSpeedCoils->VarSpeedCoil(1).Twet_Rated = 0.0; - state.dataVariableSpeedCoils->VarSpeedCoil(1).Gamma_Rated = 0.0; + state->dataVariableSpeedCoils->VarSpeedCoil(1).Twet_Rated = 0.0; + state->dataVariableSpeedCoils->VarSpeedCoil(1).Gamma_Rated = 0.0; - HVACDXSystem::ControlDXSystem(state, DXSystemNum, FirstHVACIteration, HXUnitOn); - SHR = state.dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state.dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; + HVACDXSystem::ControlDXSystem(*state, DXSystemNum, FirstHVACIteration, HXUnitOn); + SHR = state->dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state->dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; EXPECT_NEAR(SHR, 0.7624, 0.0001); - EXPECT_EQ(1, state.dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed - EXPECT_NEAR(0.143, state.dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is low + EXPECT_EQ(1, state->dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed + EXPECT_NEAR(0.143, state->dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is low // add latent degradation model - state.dataVariableSpeedCoils->VarSpeedCoil(1).Twet_Rated = 1000.0; - state.dataVariableSpeedCoils->VarSpeedCoil(1).Gamma_Rated = 1.5; - HVACDXSystem::ControlDXSystem(state, DXSystemNum, FirstHVACIteration, HXUnitOn); - SHR = state.dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state.dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; + state->dataVariableSpeedCoils->VarSpeedCoil(1).Twet_Rated = 1000.0; + state->dataVariableSpeedCoils->VarSpeedCoil(1).Gamma_Rated = 1.5; + HVACDXSystem::ControlDXSystem(*state, DXSystemNum, FirstHVACIteration, HXUnitOn); + SHR = state->dataVariableSpeedCoils->VarSpeedCoil(1).QSensible / state->dataVariableSpeedCoils->VarSpeedCoil(1).QLoadTotal; EXPECT_NEAR(SHR, 1.0, 0.0001); // more sensible capacity so PLR should be lower - EXPECT_EQ(1, state.dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed - EXPECT_NEAR(0.109, state.dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is lower, latent capacity is 0 + EXPECT_EQ(1, state->dataVariableSpeedCoils->VarSpeedCoil(1).SpeedNumReport); // latent degradation only works at low speed + EXPECT_NEAR(0.109, state->dataVariableSpeedCoils->VarSpeedCoil(1).PartLoadRatio, 0.001); // PLR is lower, latent capacity is 0 } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/HVACFan.unit.cc b/tst/EnergyPlus/unit/HVACFan.unit.cc index 10048507b12..c1094772523 100644 --- a/tst/EnergyPlus/unit/HVACFan.unit.cc +++ b/tst/EnergyPlus/unit/HVACFan.unit.cc @@ -57,6 +57,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -91,17 +92,17 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TestGetFunctions1) ASSERT_TRUE(process_idf(idf_objects)); std::string fanName = "TEST FAN"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 0; DataSizing::CurOASysNum = 0; DataEnvironment::StdRhoAir = 1.2; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _); // triggers sizing call + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _); // triggers sizing call Real64 locFanSizeVdot = HVACFan::fanObjs[0]->designAirVolFlowRate; // get function EXPECT_NEAR(1.0000, locFanSizeVdot, 0.00000001); - Real64 locDesignTempRise = HVACFan::fanObjs[0]->getFanDesignTemperatureRise(state); + Real64 locDesignTempRise = HVACFan::fanObjs[0]->getFanDesignTemperatureRise(*state); EXPECT_NEAR(locDesignTempRise, 0.166, 0.001); - Real64 locDesignHeatGain = HVACFan::fanObjs[0]->getFanDesignHeatGain(state, locFanSizeVdot); + Real64 locDesignHeatGain = HVACFan::fanObjs[0]->getFanDesignHeatGain(*state, locFanSizeVdot); EXPECT_NEAR(locDesignHeatGain, 200.0, 0.1); EXPECT_FALSE(HVACFan::fanObjs[0]->speedControl == HVACFan::FanSystem::SpeedControlMethod::Continuous); } @@ -134,12 +135,12 @@ TEST_F(EnergyPlusFixture, SystemFanObj_FanSizing1) ASSERT_TRUE(process_idf(idf_objects)); DataEnvironment::StdRhoAir = 1.0; std::string fanName = "TEST FAN"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 0; DataSizing::CurOASysNum = 0; DataSizing::DataNonZoneNonAirloopValue = 1.00635; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _); // triggers sizing call + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _); // triggers sizing call Real64 locFanSizeVdot = HVACFan::fanObjs[0]->designAirVolFlowRate; // get function EXPECT_NEAR(1.00635, locFanSizeVdot, 0.00001); DataSizing::DataNonZoneNonAirloopValue = 0.0; @@ -183,21 +184,21 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc1) ASSERT_TRUE(process_idf(idf_objects)); std::string fanName = "TEST FAN"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 0; DataSizing::CurOASysNum = 0; DataEnvironment::StdRhoAir = 1.2; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _); Real64 locFanSizeVdot = HVACFan::fanObjs[0]->designAirVolFlowRate; // get function EXPECT_NEAR(1.00, locFanSizeVdot, 0.00001); - HVACFan::fanObjs[0]->simulate(state, 0.75, _, _, _); // call for flow fraction of 0.75 + HVACFan::fanObjs[0]->simulate(*state, 0.75, _, _, _); // call for flow fraction of 0.75 Real64 locFanElecPower = HVACFan::fanObjs[0]->fanPower(); Real64 locExpectPower = (0.5 * 0.125 * 100.0) + (0.5 * 1.0 * 100.0); EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); - HVACFan::fanObjs[0]->simulate(state, 0.5, _, _, _); // call for flow fraction of 0.5 + HVACFan::fanObjs[0]->simulate(*state, 0.5, _, _, _); // call for flow fraction of 0.5 locFanElecPower = HVACFan::fanObjs[0]->fanPower(); locExpectPower = 0.125 * 100.0; EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); @@ -253,23 +254,23 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc2) }); ASSERT_TRUE(process_idf(idf_objects)); - CurveManager::GetCurveInput(state); + CurveManager::GetCurveInput(*state); std::string fanName = "TEST FAN"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 0; DataSizing::CurOASysNum = 0; DataEnvironment::StdRhoAir = 1.2; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _); Real64 locFanSizeVdot = HVACFan::fanObjs[0]->designAirVolFlowRate; EXPECT_NEAR(1.00, locFanSizeVdot, 0.00001); - HVACFan::fanObjs[0]->simulate(state, 0.75, _, _, _); // call for flow fraction of 0.75 + HVACFan::fanObjs[0]->simulate(*state, 0.75, _, _, _); // call for flow fraction of 0.75 Real64 locFanElecPower = HVACFan::fanObjs[0]->fanPower(); Real64 locExpectPower = (0.5 * 0.125 * 100.0) + (0.5 * 1.0 * 100.0); EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); - HVACFan::fanObjs[0]->simulate(state, 0.5, _, _, _); // call for flow fraction of 0.5 + HVACFan::fanObjs[0]->simulate(*state, 0.5, _, _, _); // call for flow fraction of 0.5 locFanElecPower = HVACFan::fanObjs[0]->fanPower(); locExpectPower = 0.125 * 100.0; EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); @@ -314,12 +315,12 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc3) ASSERT_TRUE(process_idf(idf_objects)); std::string fanName = "TEST FAN"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 0; DataSizing::CurOASysNum = 0; DataEnvironment::StdRhoAir = 1.2; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _); Real64 locFanSizeVdot = HVACFan::fanObjs[0]->designAirVolFlowRate; // get function EXPECT_NEAR(1.00, locFanSizeVdot, 0.00001); @@ -329,7 +330,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc3) Real64 massFlow2 = designMassFlowRate; Real64 runTimeFrac1 = 0.5; Real64 runTimeFrac2 = 0.5; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); Real64 locFanElecPower = HVACFan::fanObjs[0]->fanPower(); Real64 locExpectPower = (runTimeFrac1 * 0.125 * 100.0) + (runTimeFrac2 * 1.0 * 100.0); EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); @@ -339,7 +340,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc3) massFlow2 = 0.75 * designMassFlowRate; runTimeFrac1 = 0.0; runTimeFrac2 = 1.0; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); locFanElecPower = HVACFan::fanObjs[0]->fanPower(); // locExpectPower expect the same power as the previous case EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); @@ -349,7 +350,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc3) massFlow2 = 1.0 * designMassFlowRate; runTimeFrac1 = 0.0; runTimeFrac2 = 1.0; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); locFanElecPower = HVACFan::fanObjs[0]->fanPower(); locExpectPower = HVACFan::fanObjs[0]->designElecPower; // expect full power EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); @@ -359,13 +360,13 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc3) massFlow2 = 1.0 * designMassFlowRate; runTimeFrac1 = 0.0; runTimeFrac2 = 0.85; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); locFanElecPower = HVACFan::fanObjs[0]->fanPower(); locExpectPower = 0.85 * HVACFan::fanObjs[0]->designElecPower; // expect 85% of full power EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); // reverse the 1 and 2 arguments, expect the same result - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow2, runTimeFrac2, massFlow1, runTimeFrac1); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow2, runTimeFrac2, massFlow1, runTimeFrac1); locFanElecPower = HVACFan::fanObjs[0]->fanPower(); EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); } @@ -411,14 +412,14 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc4) }); ASSERT_TRUE(process_idf(idf_objects)); - CurveManager::GetCurveInput(state); + CurveManager::GetCurveInput(*state); std::string fanName = "TEST FAN"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 0; DataSizing::CurOASysNum = 0; DataEnvironment::StdRhoAir = 1.2; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _); Real64 locFanSizeVdot = HVACFan::fanObjs[0]->designAirVolFlowRate; EXPECT_NEAR(1.00, locFanSizeVdot, 0.00001); @@ -428,7 +429,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc4) Real64 massFlow2 = designMassFlowRate; Real64 runTimeFrac1 = 0.5; Real64 runTimeFrac2 = 0.5; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); Real64 locFanElecPower = HVACFan::fanObjs[0]->fanPower(); Real64 locExpectPower = (0.5 * pow(0.5, 3) + 0.5 * 1.0) * HVACFan::fanObjs[0]->designElecPower; EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); @@ -438,7 +439,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc4) massFlow2 = 0.75 * designMassFlowRate; runTimeFrac1 = 0.0; runTimeFrac2 = 1.0; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); locFanElecPower = HVACFan::fanObjs[0]->fanPower(); locExpectPower = pow(0.75, 3) * HVACFan::fanObjs[0]->designElecPower; EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); @@ -448,7 +449,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc4) massFlow2 = 1.0 * designMassFlowRate; runTimeFrac1 = 0.0; runTimeFrac2 = 1.0; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); locFanElecPower = HVACFan::fanObjs[0]->fanPower(); locExpectPower = HVACFan::fanObjs[0]->designElecPower; // expect full power EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); @@ -458,7 +459,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_TwoSpeedFanPowerCalc4) massFlow2 = 1.0 * designMassFlowRate; runTimeFrac1 = 0.0; runTimeFrac2 = 0.85; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); locFanElecPower = HVACFan::fanObjs[0]->fanPower(); locExpectPower = 0.85 * HVACFan::fanObjs[0]->designElecPower; // expect 85% of full power EXPECT_NEAR(locFanElecPower, locExpectPower, 0.01); @@ -502,12 +503,12 @@ TEST_F(EnergyPlusFixture, SystemFanObj_DiscreteMode_noPowerFFlowCurve) ASSERT_TRUE(process_idf(idf_objects)); std::string fanName = "TEST FAN"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 0; DataSizing::CurOASysNum = 0; DataEnvironment::StdRhoAir = 1.2; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _); Real64 locFanSizeVdot = HVACFan::fanObjs[0]->designAirVolFlowRate; EXPECT_NEAR(1.00, locFanSizeVdot, 0.00001); @@ -517,7 +518,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_DiscreteMode_noPowerFFlowCurve) Real64 massFlow2 = designMassFlowRate; Real64 runTimeFrac1 = 0.5; Real64 runTimeFrac2 = 0.5; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); Real64 locFanElecPower = HVACFan::fanObjs[0]->fanPower(); // uses flow weighted power calculation. 50% of time at 50% flow and 50% of time at 100% flow Real64 locExpectPower = (0.5 * 0.5 + 0.5 * 1.0) * HVACFan::fanObjs[0]->designElecPower; // expect 75% of power @@ -528,7 +529,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_DiscreteMode_noPowerFFlowCurve) massFlow2 = 0.75 * designMassFlowRate; runTimeFrac1 = 0.0; runTimeFrac2 = 1.0; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); locFanElecPower = HVACFan::fanObjs[0]->fanPower(); // uses flow weighted power calculation. 0% of time at 0% flow and 100% of time at 75% flow locExpectPower = (0.0 * 0.0 + 1.0 * 0.75) * HVACFan::fanObjs[0]->designElecPower; // expect 75% of power @@ -539,7 +540,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_DiscreteMode_noPowerFFlowCurve) massFlow2 = 1.0 * designMassFlowRate; runTimeFrac1 = 0.0; runTimeFrac2 = 1.0; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); locFanElecPower = HVACFan::fanObjs[0]->fanPower(); // uses flow weighted power calculation. 0% of time at 0% flow and 100% of time at 100% flow locExpectPower = (0.0 * 0.0 + 1.0 * 1.0) * HVACFan::fanObjs[0]->designElecPower; // expect full power @@ -550,7 +551,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_DiscreteMode_noPowerFFlowCurve) massFlow2 = 1.0 * designMassFlowRate; runTimeFrac1 = 0.0; runTimeFrac2 = 0.85; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); locFanElecPower = HVACFan::fanObjs[0]->fanPower(); // uses flow weighted power calculation. 0% of time at 0% flow and 85% of time at 100% flow locExpectPower = (0.0 * 0.25 + 0.85 * 1.0) * HVACFan::fanObjs[0]->designElecPower; // expect 85% of full power @@ -600,17 +601,17 @@ TEST_F(EnergyPlusFixture, SystemFanObj_DiscreteMode_EMSPressureRiseResetTest) ASSERT_TRUE(process_idf(idf_objects)); - EMSManager::CheckIfAnyEMS(state); + EMSManager::CheckIfAnyEMS(*state); EMSManager::FinishProcessingUserInput = true; std::string fanName = "TEST FAN"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 0; DataSizing::CurOASysNum = 0; DataEnvironment::StdRhoAir = 1.0; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _); Real64 locFanSizeVdot = HVACFan::fanObjs[0]->designAirVolFlowRate; EXPECT_NEAR(1.00, locFanSizeVdot, 0.00001); @@ -621,7 +622,7 @@ TEST_F(EnergyPlusFixture, SystemFanObj_DiscreteMode_EMSPressureRiseResetTest) Real64 massFlow2 = designMassFlowRate; Real64 runTimeFrac1 = 0.5; Real64 runTimeFrac2 = 0.5; - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); Real64 locFanElecPower = HVACFan::fanObjs[0]->fanPower(); // uses flow weighted power calculation. 50% of time at 50% flow and 50% of time at 100% flow Real64 locExpectPower = (0.5 * 0.5 + 0.5 * 1.0) * HVACFan::fanObjs[0]->designElecPower; // expect 75% of power @@ -629,11 +630,11 @@ TEST_F(EnergyPlusFixture, SystemFanObj_DiscreteMode_EMSPressureRiseResetTest) // reset the pressure rise to -100.0 using EMS program bool anyRan(false); - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::BeginTimestepBeforePredictor, anyRan, ObjexxFCL::Optional_int_const()); EXPECT_TRUE(anyRan); // simulate the fan with -100.0 Pa fan pressure rise - HVACFan::fanObjs[0]->simulate(state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); + HVACFan::fanObjs[0]->simulate(*state, _, _, _, _, massFlow1, runTimeFrac1, massFlow2, runTimeFrac2); locFanElecPower = HVACFan::fanObjs[0]->fanPower(); // negative fan pressure rise results in zero fan power locExpectPower = 0.0; diff --git a/tst/EnergyPlus/unit/HVACFourPipeBeam.unit.cc b/tst/EnergyPlus/unit/HVACFourPipeBeam.unit.cc index 8cb06d8f303..c7e5d61ebef 100644 --- a/tst/EnergyPlus/unit/HVACFourPipeBeam.unit.cc +++ b/tst/EnergyPlus/unit/HVACFourPipeBeam.unit.cc @@ -72,6 +72,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -211,9 +212,9 @@ TEST_F(EnergyPlusFixture, Beam_FactoryAllAutosize) }); ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataZoneEquipment::ZoneEquipConfig.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).NumInletNodes = 1; @@ -224,7 +225,7 @@ TEST_F(EnergyPlusFixture, Beam_FactoryAllAutosize) DataZoneEquipment::ZoneEquipConfig(1).InletNode(1) = 3; bool ErrorsFound = false; - DataZoneEquipment::ZoneEquipConfig(1).ZoneNode = NodeInputManager::GetOnlySingleNode(state, "Zone 1 Node", + DataZoneEquipment::ZoneEquipConfig(1).ZoneNode = NodeInputManager::GetOnlySingleNode(*state, "Zone 1 Node", ErrorsFound, "Zone", "BeamTest", @@ -240,7 +241,7 @@ TEST_F(EnergyPlusFixture, Beam_FactoryAllAutosize) "PERIMETER_TOP_ZN_4 4PIPE BEAM"; // needs to be uppercased, or item will not be found at line 2488 in IP DataDefineEquip::AirDistUnit(1).OutletNodeNum = 3; - DataDefineEquip::AirDistUnit(1).airTerminalPtr = FourPipeBeam::HVACFourPipeBeam::fourPipeBeamFactory(state, DataDefineEquip::AirDistUnit(1).EquipName(1)); + DataDefineEquip::AirDistUnit(1).airTerminalPtr = FourPipeBeam::HVACFourPipeBeam::fourPipeBeamFactory(*state, DataDefineEquip::AirDistUnit(1).EquipName(1)); // EXPECT_EQ( DataDefineEquip::AirDistUnit( 1 ).airTerminalPtr->name, "PERIMETER_TOP_ZN_4 4PIPE BEAM"); @@ -1714,30 +1715,30 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); - OutputReportPredefined::SetPredefinedTables(state); - HeatBalanceManager::SetPreConstructionInputParameters(state); // establish array bounds for constructions early + OutputReportPredefined::SetPredefinedTables(*state); + HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); - PlantManager::CheckIfAnyPlant(state); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); + PlantManager::CheckIfAnyPlant(*state); createFacilityElectricPowerServiceObject(); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. - state.dataGlobal->DoingSizing = true; - SizingManager::ManageSizing(state); - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. + state->dataGlobal->DoingSizing = true; + SizingManager::ManageSizing(*state); + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); - TestAirPathIntegrity(state, ErrorsFound); // Needed to initialize return node connections to airloops and inlet nodes - SimulationManager::SetupSimulation(state, ErrorsFound); - state.dataGlobal->KickOffSimulation = false; + WeatherManager::ResetEnvironmentCounter(*state); + TestAirPathIntegrity(*state, ErrorsFound); // Needed to initialize return node connections to airloops and inlet nodes + SimulationManager::SetupSimulation(*state, ErrorsFound); + state->dataGlobal->KickOffSimulation = false; DataHVACGlobals::SimZoneEquipmentFlag = true; DataHVACGlobals::SimNonZoneEquipmentFlag = false; @@ -1766,7 +1767,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) // DataLoopNode::Node( 38 ).Temp = 45.0; // hot water inlet node Real64 NonAirSysOutput = 0.0; - DataDefineEquip::AirDistUnit(1).airTerminalPtr->simulate(state, FirstHVACIteration, NonAirSysOutput); + DataDefineEquip::AirDistUnit(1).airTerminalPtr->simulate(*state, FirstHVACIteration, NonAirSysOutput); EXPECT_NEAR(DataLoopNode::Node(1).MassFlowRate, 0.36165246721684446, 0.00001); EXPECT_NEAR(DataLoopNode::Node(15).Temp, 17.835648923740127, 0.00001); @@ -1782,7 +1783,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = 6000.0; DataLoopNode::Node(40).Temp = 21.0; // zone node - DataDefineEquip::AirDistUnit(1).airTerminalPtr->simulate(state, FirstHVACIteration, NonAirSysOutput); + DataDefineEquip::AirDistUnit(1).airTerminalPtr->simulate(*state, FirstHVACIteration, NonAirSysOutput); EXPECT_DOUBLE_EQ(DataLoopNode::Node(15).Temp, 14.0); EXPECT_DOUBLE_EQ(DataLoopNode::Node(15).MassFlowRate, 0.0); @@ -1804,7 +1805,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) DataLoopNode::Node(38).Temp = 45.0; // hot water inlet node NonAirSysOutput = 0.0; - DataDefineEquip::AirDistUnit(1).airTerminalPtr->simulate(state, FirstHVACIteration, NonAirSysOutput); + DataDefineEquip::AirDistUnit(1).airTerminalPtr->simulate(*state, FirstHVACIteration, NonAirSysOutput); EXPECT_NEAR(DataLoopNode::Node(15).Temp, 18.549803918626715, 0.00001); EXPECT_NEAR(DataLoopNode::Node(15).MassFlowRate, 0.22613768427540518, 0.00001); @@ -1825,7 +1826,7 @@ TEST_F(EnergyPlusFixture, Beam_sizeandSimulateOneZone) DataLoopNode::Node(40).Temp = 21.0; // zone node NonAirSysOutput = 0.0; - DataDefineEquip::AirDistUnit(1).airTerminalPtr->simulate(state, FirstHVACIteration, NonAirSysOutput); + DataDefineEquip::AirDistUnit(1).airTerminalPtr->simulate(*state, FirstHVACIteration, NonAirSysOutput); EXPECT_DOUBLE_EQ(DataLoopNode::Node(15).Temp, 14.0); EXPECT_DOUBLE_EQ(DataLoopNode::Node(15).MassFlowRate, 0.0); @@ -3288,29 +3289,29 @@ TEST_F(EnergyPlusFixture, Beam_fatalWhenSysSizingOff) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); - OutputReportPredefined::SetPredefinedTables(state); - HeatBalanceManager::SetPreConstructionInputParameters(state); // establish array bounds for constructions early + OutputReportPredefined::SetPredefinedTables(*state); + HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); - PlantManager::CheckIfAnyPlant(state); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); + PlantManager::CheckIfAnyPlant(*state); createFacilityElectricPowerServiceObject(); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. - state.dataGlobal->DoingSizing = true; - SizingManager::ManageSizing(state); - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. + state->dataGlobal->DoingSizing = true; + SizingManager::ManageSizing(*state); + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); + WeatherManager::ResetEnvironmentCounter(*state); - ASSERT_ANY_THROW(SimulationManager::SetupSimulation(state, ErrorsFound)); + ASSERT_ANY_THROW(SimulationManager::SetupSimulation(*state, ErrorsFound)); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/HVACHXAssistedCoolingCoil.unit.cc b/tst/EnergyPlus/unit/HVACHXAssistedCoolingCoil.unit.cc index 51c5ac44efe..0dff2751bfb 100644 --- a/tst/EnergyPlus/unit/HVACHXAssistedCoolingCoil.unit.cc +++ b/tst/EnergyPlus/unit/HVACHXAssistedCoolingCoil.unit.cc @@ -68,6 +68,7 @@ #include #include #include +#include using namespace EnergyPlus; @@ -382,10 +383,10 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_VStest1) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData1(state); // read zone equipment configuration and list objects + DataZoneEquipment::GetZoneEquipmentData1(*state); // read zone equipment configuration and list objects DataSizing::ZoneEqSizing.allocate(1); DataZoneEquipment::ZoneEquipList(1).EquipIndex.allocate(1); @@ -401,15 +402,15 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_VStest1) bool zoneEquipment = true; Real64 sensOut = 0.0; Real64 latOut = 0.0; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above - ASSERT_EQ(1, state.dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects + ASSERT_EQ(1, state->dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects // DISABLE SIZING - don't call UnitarySystems::sizeUnitarySystem, much more work needed to set up sizing arrays - state.dataGlobal->SysSizingCalc = false; + state->dataGlobal->SysSizingCalc = false; InletNode = thisSys->AirInNode; OutletNode = thisSys->AirOutNode; @@ -454,12 +455,12 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_VStest1) DataZoneEnergyDemands::CurDeadBandOrSetback.allocate(1); DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; ScheduleManager::Schedule(1).CurrentValue = 1.0; - state.dataGlobal->BeginEnvrnFlag = true; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); // initialize RhoAir + state->dataGlobal->BeginEnvrnFlag = true; + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir DataLoopNode::Node(InletNode).MassFlowRateMaxAvail = thisSys->m_MaxCoolAirVolFlow * DataEnvironment::StdRhoAir; - OutputReportPredefined::SetPredefinedTables(state); - thisSys->simulate(state, + OutputReportPredefined::SetPredefinedTables(*state); + thisSys->simulate(*state, compName, FirstHVACIteration, AirLoopNum, CompIndex, HeatingActive, CoolingActive, OAUnitNum, OAUCoilOutTemp, zoneEquipment, sensOut, latOut); ZoneTemp = DataLoopNode::Node(ControlZoneNum).Temp; @@ -486,7 +487,7 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_VStest1) DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::OutWetBulbTemp = 30.0; - thisSys->simulate(state, + thisSys->simulate(*state, compName, FirstHVACIteration, AirLoopNum, CompIndex, HeatingActive, CoolingActive, OAUnitNum, OAUCoilOutTemp, zoneEquipment, sensOut, latOut); ZoneTemp = DataLoopNode::Node(ControlZoneNum).Temp; @@ -509,7 +510,7 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_VStest1) // Test 2: HX is off, cooling load is met, dehumidification control mode = CoolReheat but no moisture load thisSys->m_DehumidControlType_Num = UnitarySystems::UnitarySys::DehumCtrlType::CoolReheat; - thisSys->simulate(state, + thisSys->simulate(*state, compName, FirstHVACIteration, AirLoopNum, CompIndex, HeatingActive, CoolingActive, OAUnitNum, OAUCoilOutTemp, zoneEquipment, sensOut, latOut); EXPECT_NEAR(DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired, Qsens_sys, 1.0); // Watts @@ -526,7 +527,7 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_VStest1) // Test 3: HX is off, cooling load is met, dehumidification control mode = Multimode but no moisture load thisSys->m_DehumidControlType_Num = UnitarySystems::UnitarySys::DehumCtrlType::Multimode; - thisSys->simulate(state, + thisSys->simulate(*state, compName, FirstHVACIteration, AirLoopNum, CompIndex, HeatingActive, CoolingActive, OAUnitNum, OAUCoilOutTemp, zoneEquipment, sensOut, latOut); EXPECT_NEAR(DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired, Qsens_sys, 1.0); // Watts @@ -547,7 +548,7 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_VStest1) thisSys->m_Humidistat = true; DataLoopNode::Node(thisSys->NodeNumOfControlledZone).HumRat = 0.009; // set zone humidity ratio as reference for latent met DataZoneEnergyDemands::ZoneSysMoistureDemand(ControlZoneNum).RemainingOutputReqToDehumidSP = -0.000001; // -2 W - thisSys->simulate(state, + thisSys->simulate(*state, compName, FirstHVACIteration, AirLoopNum, CompIndex, HeatingActive, CoolingActive, OAUnitNum, OAUCoilOutTemp, zoneEquipment, sensOut, latOut); EXPECT_NEAR(DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired, Qsens_sys, 1.0); // Watts @@ -566,7 +567,7 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_VStest1) // Latent output with HX off is greater than the moisture load so HX did not turn on DataLoopNode::Node(thisSys->NodeNumOfControlledZone).HumRat = 0.0092; // set zone humidity ratio as reference for latent met thisSys->m_DehumidControlType_Num = UnitarySystems::UnitarySys::DehumCtrlType::CoolReheat; - thisSys->simulate(state, + thisSys->simulate(*state, compName, FirstHVACIteration, AirLoopNum, CompIndex, HeatingActive, CoolingActive, OAUnitNum, OAUCoilOutTemp, zoneEquipment, sensOut, latOut); EXPECT_NEAR(DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired, Qsens_sys, 1.0); // Watts @@ -586,7 +587,7 @@ TEST_F(EnergyPlusFixture, HXAssistCCUnitarySystem_VStest1) DataLoopNode::Node(thisSys->NodeNumOfControlledZone).HumRat = 0.01; // set zone humidity ratio as reference for latent met DataZoneEnergyDemands::ZoneSysMoistureDemand(ControlZoneNum).RemainingOutputReqToDehumidSP = -0.0002; // -400 W thisSys->m_DehumidControlType_Num = UnitarySystems::UnitarySys::DehumCtrlType::CoolReheat; - thisSys->simulate(state, + thisSys->simulate(*state, compName, FirstHVACIteration, AirLoopNum, CompIndex, HeatingActive, CoolingActive, OAUnitNum, OAUCoilOutTemp, zoneEquipment, sensOut, latOut); EXPECT_NEAR(DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired, Qsens_sys, 1.0); // Watts diff --git a/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc b/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc index 7864aaa1c3d..e2878dec8dc 100644 --- a/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HVACInterfaceManager.unit.cc @@ -59,6 +59,7 @@ #include #include #include +#include namespace EnergyPlus { TEST_F(EnergyPlusFixture, ExcessiveHeatStorage_Test) @@ -88,7 +89,7 @@ TEST_F(EnergyPlusFixture, ExcessiveHeatStorage_Test) // LoopSideInlet_MdotCpDeltaT should be < LoopSideInlet_McpDTdt // Therefore CapExcessStorageTime AND TotalTime will increase by 1 timestep - UpdateHalfLoopInletTemp(state, 1, 1, TankOutletTemp); + UpdateHalfLoopInletTemp(*state, 1, 1, TankOutletTemp); EXPECT_NEAR(-500, PlantLoop(1).LoopSide(2).LoopSideInlet_MdotCpDeltaT, 0.001); EXPECT_NEAR(2928.82, PlantLoop(1).LoopSide(2).LoopSideInlet_McpDTdt, 0.001); EXPECT_EQ(1, PlantLoop(1).LoopSide(2).LoopSideInlet_CapExcessStorageTime); @@ -98,7 +99,7 @@ TEST_F(EnergyPlusFixture, ExcessiveHeatStorage_Test) // LoopSideInlet_MdotCpDeltaT should be > LoopSideInlet_McpDTdt // Therefore TotalTime will increase by 1 more timestep, but CapExcessStorageTime will NOT increase - UpdateHalfLoopInletTemp(state, 1, 1, TankOutletTemp); + UpdateHalfLoopInletTemp(*state, 1, 1, TankOutletTemp); EXPECT_NEAR(-500, PlantLoop(1).LoopSide(2).LoopSideInlet_MdotCpDeltaT, .001); EXPECT_NEAR(-588.264, PlantLoop(1).LoopSide(2).LoopSideInlet_McpDTdt, .001); EXPECT_EQ(1, PlantLoop(1).LoopSide(2).LoopSideInlet_CapExcessStorageTime); diff --git a/tst/EnergyPlus/unit/HVACManager.unit.cc b/tst/EnergyPlus/unit/HVACManager.unit.cc index cf74213b496..1c0d328bd1f 100644 --- a/tst/EnergyPlus/unit/HVACManager.unit.cc +++ b/tst/EnergyPlus/unit/HVACManager.unit.cc @@ -66,6 +66,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -76,20 +77,20 @@ TEST_F(EnergyPlusFixture, CrossMixingReportTest) { // Test for #5007 - state.dataGlobal->NumOfZones = 2; + state->dataGlobal->NumOfZones = 2; int NumOfCrossMixing = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MAT.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneAirHumRat.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MAT.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneAirHumRat.allocate(state->dataGlobal->NumOfZones); DataHeatBalance::CrossMixing.allocate(NumOfCrossMixing); - DataHeatBalance::ZnAirRpt.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::ZnAirRpt.allocate(state->dataGlobal->NumOfZones); DataZoneEquipment::CrossMixingReportFlag.allocate(NumOfCrossMixing); - DataHeatBalFanSys::MCPI.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MCPV.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneAirHumRatAvg.allocate(state.dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPI.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPV.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneAirHumRatAvg.allocate(state->dataGlobal->NumOfZones); - state.dataGlobal->NumOfZones = state.dataGlobal->NumOfZones; + state->dataGlobal->NumOfZones = state->dataGlobal->NumOfZones; DataHeatBalance::TotCrossMixing = NumOfCrossMixing; DataZoneEquipment::CrossMixingReportFlag(1) = true; DataHVACGlobals::TimeStepSys = 1.0; @@ -106,7 +107,7 @@ TEST_F(EnergyPlusFixture, CrossMixingReportTest) DataHeatBalance::CrossMixing(1).ZonePtr = 1; DataHeatBalance::CrossMixing(1).FromZone = 2; DataHeatBalance::CrossMixing(1).DesiredAirFlowRate = 0.1; - DataZoneEquipment::ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); DataZoneEquipment::ZoneEquipConfig(1).NumInletNodes = 0; DataZoneEquipment::ZoneEquipConfig(2).NumInletNodes = 0; DataZoneEquipment::ZoneEquipConfig(1).NumExhaustNodes = 0; @@ -115,7 +116,7 @@ TEST_F(EnergyPlusFixture, CrossMixingReportTest) DataZoneEquipment::ZoneEquipConfig(2).NumReturnNodes = 0; // Call HVACManager - ReportAirHeatBalance(state); + ReportAirHeatBalance(*state); EXPECT_NEAR(DataHeatBalance::ZnAirRpt(1).MixVolume, DataHeatBalance::ZnAirRpt(2).MixVolume, 0.0001); EXPECT_NEAR(DataHeatBalance::ZnAirRpt(1).MixVdotCurDensity, DataHeatBalance::ZnAirRpt(2).MixVdotCurDensity, 0.0001); @@ -144,20 +145,20 @@ TEST_F(EnergyPlusFixture, CrossMixingReportTest) TEST_F(EnergyPlusFixture, InfiltrationReportTest) { - state.dataGlobal->NumOfZones = 2; + state->dataGlobal->NumOfZones = 2; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MAT.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneAirHumRat.allocate(state.dataGlobal->NumOfZones); - DataHeatBalance::ZnAirRpt.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MCPI.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MCPV.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneAirHumRatAvg.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MAT.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneAirHumRat.allocate(state->dataGlobal->NumOfZones); + DataHeatBalance::ZnAirRpt.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPI.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPV.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneAirHumRatAvg.allocate(state->dataGlobal->NumOfZones); DataHeatBalance::TotVentilation = 1; DataHeatBalance::Ventilation.allocate(DataHeatBalance::TotVentilation); DataZoneEquipment::VentMCP.allocate(1); - state.dataGlobal->NumOfZones = state.dataGlobal->NumOfZones; + state->dataGlobal->NumOfZones = state->dataGlobal->NumOfZones; DataHVACGlobals::TimeStepSys = 1.0; DataHeatBalFanSys::MCPI(1) = 1.0; DataHeatBalFanSys::MCPI(2) = 1.5; @@ -173,7 +174,7 @@ TEST_F(EnergyPlusFixture, InfiltrationReportTest) DataEnvironment::StdRhoAir = 1.20; DataHeatBalance::Zone(1).OutDryBulbTemp = 20.0; DataHeatBalance::Zone(2).OutDryBulbTemp = 20.0; - DataZoneEquipment::ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); DataZoneEquipment::ZoneEquipConfig(1).NumInletNodes = 0; DataZoneEquipment::ZoneEquipConfig(2).NumInletNodes = 0; DataZoneEquipment::ZoneEquipConfig(1).NumExhaustNodes = 0; @@ -184,7 +185,7 @@ TEST_F(EnergyPlusFixture, InfiltrationReportTest) DataHeatBalance::Ventilation(1).AirTemp = DataHeatBalance::Zone(1).OutDryBulbTemp; DataZoneEquipment::VentMCP(1) = DataHeatBalFanSys::MCPV(1); // Call HVACManager - ReportAirHeatBalance(state); + ReportAirHeatBalance(*state); EXPECT_NEAR(2.9971591, DataHeatBalance::ZnAirRpt(1).InfilVolumeCurDensity, 0.0001); EXPECT_NEAR(5.9943183, DataHeatBalance::ZnAirRpt(1).VentilVolumeCurDensity, 0.0001); @@ -209,17 +210,17 @@ TEST_F(EnergyPlusFixture, InfiltrationReportTest) TEST_F(EnergyPlusFixture, ExfilAndExhaustReportTest) { - state.dataGlobal->NumOfZones = 2; + state->dataGlobal->NumOfZones = 2; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MAT.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneAirHumRat.allocate(state.dataGlobal->NumOfZones); - DataHeatBalance::ZnAirRpt.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MCPI.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MCPV.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneAirHumRatAvg.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MAT.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneAirHumRat.allocate(state->dataGlobal->NumOfZones); + DataHeatBalance::ZnAirRpt.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPI.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPV.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneAirHumRatAvg.allocate(state->dataGlobal->NumOfZones); - state.dataGlobal->NumOfZones = state.dataGlobal->NumOfZones; + state->dataGlobal->NumOfZones = state->dataGlobal->NumOfZones; DataHVACGlobals::TimeStepSys = 1.0; DataHeatBalFanSys::MCPI(1) = 1.0; DataHeatBalFanSys::MCPI(2) = 1.5; @@ -235,7 +236,7 @@ TEST_F(EnergyPlusFixture, ExfilAndExhaustReportTest) DataEnvironment::StdRhoAir = 1.20; DataHeatBalance::Zone(1).OutDryBulbTemp = 20.0; DataHeatBalance::Zone(2).OutDryBulbTemp = 20.0; - DataZoneEquipment::ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); DataZoneEquipment::ZoneEquipConfig(1).NumInletNodes = 0; DataZoneEquipment::ZoneEquipConfig(2).NumInletNodes = 0; DataZoneEquipment::ZoneEquipConfig(1).NumExhaustNodes = 1; @@ -246,7 +247,7 @@ TEST_F(EnergyPlusFixture, ExfilAndExhaustReportTest) DataZoneEquipment::ZoneEquipConfig(1).ExhaustNode(1) = 1; Fans::Fan.allocate(1); - state.dataFans->NumFans = 1; + state->dataFans->NumFans = 1; Fans::Fan(1).FanType_Num = DataHVACGlobals::FanType_ZoneExhaust; Fans::Fan(1).OutletAirMassFlowRate = 1.0; Fans::Fan(1).OutletAirTemp = 22.0; @@ -257,7 +258,7 @@ TEST_F(EnergyPlusFixture, ExfilAndExhaustReportTest) DataLoopNode::Node(1).MassFlowRate = 0.0; // Call HVACManager - ReportAirHeatBalance(state); + ReportAirHeatBalance(*state); EXPECT_NEAR(9.7853391, DataHeatBalance::ZnAirRpt(1).ExfilTotalLoss, 0.0001); EXPECT_NEAR(26.056543, DataHeatBalance::ZnAirRpt(2).ExfilTotalLoss, 0.0001); @@ -272,19 +273,19 @@ TEST_F(EnergyPlusFixture, ExfilAndExhaustReportTest) TEST_F(EnergyPlusFixture, AirloopFlowBalanceTest) { - state.dataGlobal->isPulseZoneSizing = false; + state->dataGlobal->isPulseZoneSizing = false; DataHeatBalance::ZoneAirMassFlow.EnforceZoneMassBalance = false; - state.dataGlobal->WarmupFlag = false; + state->dataGlobal->WarmupFlag = false; DataHVACGlobals::AirLoopsSimOnce = true; DataEnvironment::StdRhoAir = 1.0; DataHVACGlobals::NumPrimaryAirSys = 2; - state.dataAirSystemsData->PrimaryAirSystems.allocate(DataHVACGlobals::NumPrimaryAirSys); - state.dataAirSystemsData->PrimaryAirSystems(1).Name = "System 1"; - state.dataAirSystemsData->PrimaryAirSystems(2).Name = "System 2"; - state.dataAirLoop->AirLoopFlow.allocate(DataHVACGlobals::NumPrimaryAirSys); - auto &thisAirLoopFlow1(state.dataAirLoop->AirLoopFlow(1)); - auto &thisAirLoopFlow2(state.dataAirLoop->AirLoopFlow(2)); + state->dataAirSystemsData->PrimaryAirSystems.allocate(DataHVACGlobals::NumPrimaryAirSys); + state->dataAirSystemsData->PrimaryAirSystems(1).Name = "System 1"; + state->dataAirSystemsData->PrimaryAirSystems(2).Name = "System 2"; + state->dataAirLoop->AirLoopFlow.allocate(DataHVACGlobals::NumPrimaryAirSys); + auto &thisAirLoopFlow1(state->dataAirLoop->AirLoopFlow(1)); + auto &thisAirLoopFlow2(state->dataAirLoop->AirLoopFlow(2)); // Case 1 - No flow - no error thisAirLoopFlow1.SupFlow = 0.0; @@ -295,7 +296,7 @@ TEST_F(EnergyPlusFixture, AirloopFlowBalanceTest) thisAirLoopFlow2.SysRetFlow = 0.0; thisAirLoopFlow2.OAFlow = 0.0; - HVACManager::CheckAirLoopFlowBalance(state); + HVACManager::CheckAirLoopFlowBalance(*state); EXPECT_FALSE(has_err_output(true)); //Case 2 - Both loops are balanced @@ -307,7 +308,7 @@ TEST_F(EnergyPlusFixture, AirloopFlowBalanceTest) thisAirLoopFlow2.SysRetFlow = 3.0; thisAirLoopFlow2.OAFlow = 0.0; - HVACManager::CheckAirLoopFlowBalance(state); + HVACManager::CheckAirLoopFlowBalance(*state); EXPECT_FALSE(has_err_output(true)); //Case 3 - Loop 1 is unbalanced @@ -319,7 +320,7 @@ TEST_F(EnergyPlusFixture, AirloopFlowBalanceTest) thisAirLoopFlow2.SysRetFlow = 3.0; thisAirLoopFlow2.OAFlow = 0.0; - HVACManager::CheckAirLoopFlowBalance(state); + HVACManager::CheckAirLoopFlowBalance(*state); EXPECT_TRUE(has_err_output(false)); std::string error_string = delimited_string({ " ** Severe ** CheckAirLoopFlowBalance: AirLoopHVAC System 1 is unbalanced. Supply is > return plus outdoor air.", @@ -338,7 +339,7 @@ TEST_F(EnergyPlusFixture, AirloopFlowBalanceTest) thisAirLoopFlow2.SysRetFlow = 2.0; thisAirLoopFlow2.OAFlow = 0.99; - HVACManager::CheckAirLoopFlowBalance(state); + HVACManager::CheckAirLoopFlowBalance(*state); EXPECT_TRUE(has_err_output(false)); error_string = delimited_string({ " ** Severe ** CheckAirLoopFlowBalance: AirLoopHVAC System 2 is unbalanced. Supply is > return plus outdoor air.", diff --git a/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc b/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc index 72421f137f9..a30bded1d51 100644 --- a/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/HVACMultiSpeedHeatPump.unit.cc @@ -51,6 +51,7 @@ #include "Fixtures/EnergyPlusFixture.hh" #include +#include // ObjexxFCL Headers #include @@ -1245,30 +1246,30 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) }); ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // zones are specified in the idf snippet // Get Zone Equipment Configuration data - DataZoneEquipment::GetZoneEquipmentData(state); + DataZoneEquipment::GetZoneEquipmentData(*state); DataZoneEquipment::ZoneEquipList(1).EquipIndex(1) = 2; // 1st zone is 402, so this is 2nd direct air unit DataZoneEquipment::ZoneEquipList(2).EquipIndex(1) = 1; // 2nd zone is 401, so this is 1st direct air unit - MixedAir::GetOutsideAirSysInputs(state); - MixedAir::GetOAControllerInputs(state); - SplitterComponent::GetSplitterInput(state); - BranchInputManager::GetMixerInput(state); - BranchInputManager::ManageBranchInput(state); - GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); + MixedAir::GetOutsideAirSysInputs(*state); + MixedAir::GetOAControllerInputs(*state); + SplitterComponent::GetSplitterInput(*state); + BranchInputManager::GetMixerInput(*state); + BranchInputManager::ManageBranchInput(*state); + GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); // Get Air Loop HVAC Data - SimAirServingZones::GetAirPathData(state); - SimAirServingZones::InitAirLoops(state, FirstHVACIteration); + SimAirServingZones::GetAirPathData(*state); + SimAirServingZones::InitAirLoops(*state, FirstHVACIteration); - ZoneTempPredictorCorrector::GetZoneAirSetPoints(state); + ZoneTempPredictorCorrector::GetZoneAirSetPoints(*state); CurDeadBandOrSetback.allocate(2); CurDeadBandOrSetback(1) = false; @@ -1296,9 +1297,9 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) ZoneSysEnergyDemand(2).SequencedOutputRequiredToCoolingSP(1) = ZoneSysEnergyDemand(2).OutputRequiredToCoolingSP; ZoneSysEnergyDemand(2).SequencedOutputRequiredToHeatingSP(1) = ZoneSysEnergyDemand(2).OutputRequiredToHeatingSP; - HVACMultiSpeedHeatPump::GetMSHeatPumpInput(state); + HVACMultiSpeedHeatPump::GetMSHeatPumpInput(*state); - state.dataGlobal->SysSizingCalc = true; // disable sizing calculation + state->dataGlobal->SysSizingCalc = true; // disable sizing calculation MSHeatPump(1).TotHeatEnergyRate = 1000.0; MSHeatPump(1).TotCoolEnergyRate = 1000.0; MSHeatPump(2).TotHeatEnergyRate = 1000.0; @@ -1314,7 +1315,7 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) DataEnvironment::OutBaroPress = 101325.0; // InitMSHeatPump resets the current MSHeatPumpNum only - HVACMultiSpeedHeatPump::InitMSHeatPump(state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QZnReq, OnOffAirFlowRatio); + HVACMultiSpeedHeatPump::InitMSHeatPump(*state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QZnReq, OnOffAirFlowRatio); EXPECT_DOUBLE_EQ(1000.0, MSHeatPump(1).TotHeatEnergyRate); EXPECT_DOUBLE_EQ(1000.0, MSHeatPump(1).TotCoolEnergyRate); @@ -1345,7 +1346,7 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) Real64 QSensUnitOut; // Cooling - SimMSHP(state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); + SimMSHP(*state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); // Check outlet conditions EXPECT_NEAR(DataLoopNode::Node(22).Temp, 23.363295, 0.0001); EXPECT_NEAR(DataLoopNode::Node(22).HumRat, 0.00796611, 0.0001); @@ -1353,9 +1354,9 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) EXPECT_NEAR(MSHeatPump(2).CompPartLoadRatio, 0.123500, 0.0001); // Direct solution - state.dataGlobal->DoCoilDirectSolutions = true; + state->dataGlobal->DoCoilDirectSolutions = true; MSHeatPump(2).FullOutput.allocate(2); - SimMSHP(state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); + SimMSHP(*state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); // Check outlet conditions EXPECT_NEAR(DataLoopNode::Node(22).Temp, 23.3641, 0.0001); EXPECT_NEAR(DataLoopNode::Node(22).HumRat, 0.00796613, 0.0001); @@ -1364,15 +1365,15 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) QZnReq = -10000.00; - state.dataGlobal->DoCoilDirectSolutions = false; - SimMSHP(state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); + state->dataGlobal->DoCoilDirectSolutions = false; + SimMSHP(*state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); EXPECT_NEAR(DataLoopNode::Node(22).Temp, 21.4545, 0.0001); EXPECT_NEAR(DataLoopNode::Node(22).HumRat, 0.00792169, 0.0001); EXPECT_NEAR(DataLoopNode::Node(22).Enthalpy, 41684.8507, 0.0001); EXPECT_NEAR(MSHeatPump(2).CompPartLoadRatio, 0.285914, 0.0001); - state.dataGlobal->DoCoilDirectSolutions = true; - SimMSHP(state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); + state->dataGlobal->DoCoilDirectSolutions = true; + SimMSHP(*state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); EXPECT_NEAR(DataLoopNode::Node(22).Temp, 21.4545, 0.0001); EXPECT_NEAR(DataLoopNode::Node(22).HumRat, 0.00792169, 0.0001); EXPECT_NEAR(DataLoopNode::Node(22).Enthalpy, 41684.8507, 0.0001); @@ -1383,20 +1384,20 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_ReportVariableInitTest) MSHeatPump(2).HeatCoolMode = HeatingMode; DataEnvironment::OutDryBulbTemp = 5.0; DataEnvironment::OutHumRat = 0.008; - state.dataGlobal->DoCoilDirectSolutions = false; - SimMSHP(state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); + state->dataGlobal->DoCoilDirectSolutions = false; + SimMSHP(*state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); EXPECT_NEAR(DataLoopNode::Node(22).Temp, 26.546664, 0.0001); EXPECT_NEAR(DataLoopNode::Node(22).HumRat, 0.008, 0.0001); EXPECT_NEAR(DataLoopNode::Node(22).Enthalpy, 47077.4613, 0.0001); EXPECT_NEAR(MSHeatPump(2).CompPartLoadRatio, 0.1530992, 0.0001); - state.dataGlobal->DoCoilDirectSolutions = true; - SimMSHP(state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); + state->dataGlobal->DoCoilDirectSolutions = true; + SimMSHP(*state, MSHeatPumpNum, FirstHVACIteration, AirLoopNum, QSensUnitOut, QZnReq, OnOffAirFlowRatio); EXPECT_NEAR(DataLoopNode::Node(22).Temp, 26.546664, 0.0001); EXPECT_NEAR(DataLoopNode::Node(22).HumRat, 0.008, 0.0001); EXPECT_NEAR(DataLoopNode::Node(22).Enthalpy, 47077.4613, 0.0001); EXPECT_NEAR(MSHeatPump(2).CompPartLoadRatio, 0.1530992, 0.0001); - state.dataGlobal->DoCoilDirectSolutions = false; + state->dataGlobal->DoCoilDirectSolutions = false; ZoneSysEnergyDemand.deallocate(); CurDeadBandOrSetback.deallocate(); } @@ -1420,7 +1421,7 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_HeatRecoveryTest) DataPlant::PlantLoop(1).FluidIndex = 1; DataLoopNode::Node(HeatRecInNode).MassFlowRate = 0.0; // test heat recovery result with 0 water flow rate - HVACMultiSpeedHeatPump::MSHPHeatRecovery(state, 1); + HVACMultiSpeedHeatPump::MSHPHeatRecovery(*state, 1); // outlet temp should equal inlet temp since mass flow rate = 0 Real64 calculatedOutletTemp = @@ -1431,7 +1432,7 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_HeatRecoveryTest) EXPECT_DOUBLE_EQ(0.0, MSHeatPump(1).HeatRecoveryMassFlowRate); DataLoopNode::Node(HeatRecInNode).MassFlowRate = 0.1; // initialize flow rate and test heat recovery result using 1 kW heat transfer to fluid - HVACMultiSpeedHeatPump::MSHPHeatRecovery(state, 1); + HVACMultiSpeedHeatPump::MSHPHeatRecovery(*state, 1); // outlet temp should equal temperature rise due to 1 kW of heat input at 0.1 kg/s calculatedOutletTemp = @@ -1444,7 +1445,7 @@ TEST_F(EnergyPlusFixture, HVACMultiSpeedHeatPump_HeatRecoveryTest) DataHVACGlobals::MSHPWasteHeat = 100000.0; // test very high heat transfer that would limit outlet water temperature DataLoopNode::Node(HeatRecInNode).MassFlowRate = 0.1; - HVACMultiSpeedHeatPump::MSHPHeatRecovery(state, 1); + HVACMultiSpeedHeatPump::MSHPHeatRecovery(*state, 1); // outlet temp should equal max limit of 80 C since 100 kW would cause outlet water temperature to exceed 80 C EXPECT_DOUBLE_EQ(50.0, MSHeatPump(1).HeatRecoveryInletTemp); diff --git a/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc b/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc index 917769a19f1..7f2060e9d31 100644 --- a/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc +++ b/tst/EnergyPlus/unit/HVACSizingSimulationManager.unit.cc @@ -62,6 +62,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace DataPlant; @@ -80,13 +81,13 @@ class HVACSizingSimulationManagerTest : public EnergyPlusFixture EnergyPlusFixture::SetUp(); // Sets up the base fixture first. // setup weather manager state needed - state.dataWeatherManager->NumOfEnvrn = 2; - state.dataWeatherManager->Environment.allocate(state.dataWeatherManager->NumOfEnvrn); - state.dataWeatherManager->Environment(1).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; - state.dataWeatherManager->Environment(1).DesignDayNum = 1; + state->dataWeatherManager->NumOfEnvrn = 2; + state->dataWeatherManager->Environment.allocate(state->dataWeatherManager->NumOfEnvrn); + state->dataWeatherManager->Environment(1).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; + state->dataWeatherManager->Environment(1).DesignDayNum = 1; - state.dataWeatherManager->Environment(2).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; - state.dataWeatherManager->Environment(2).DesignDayNum = 2; + state->dataWeatherManager->Environment(2).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; + state->dataWeatherManager->Environment(2).DesignDayNum = 2; // setup plant sizing data structure NumPltSizInput = 1; @@ -115,19 +116,19 @@ class HVACSizingSimulationManagerTest : public EnergyPlusFixture PlantLoop(1).FluidIndex = 1; PlantLoop(1).LoopSide(SupplySide).NodeNumIn = 1; - SetPredefinedTables(state); + SetPredefinedTables(*state); // need a node to log mass flow rate from Node.allocate(1); // OutputProcessor::TimeValue.allocate(2); // set up time related - SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - SetupTimePointers(state, "HVAC", TimeStepSys); + SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + SetupTimePointers(*state, "HVAC", TimeStepSys); - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataWeatherManager->TimeStepFraction = 1.0 / double(state.dataGlobal->NumOfTimeStepInHour); + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataWeatherManager->TimeStepFraction = 1.0 / double(state->dataGlobal->NumOfTimeStepInHour); - TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep = &state.dataGlobal->TimeStepZone; + TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep = &state->dataGlobal->TimeStepZone; TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 0; // init TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep = &TimeStepSys; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 0; @@ -146,138 +147,138 @@ TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) // calls code related to coincident plant sizing with HVAC sizing simulation // this test runs 3 system timesteps for each zone timestep - state.dataWeatherManager->Environment.deallocate(); + state->dataWeatherManager->Environment.deallocate(); // setup weather manager state needed - state.dataWeatherManager->NumOfEnvrn = 4; - state.dataWeatherManager->Environment.allocate(state.dataWeatherManager->NumOfEnvrn); - state.dataWeatherManager->Environment(1).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; - state.dataWeatherManager->Environment(1).DesignDayNum = 1; + state->dataWeatherManager->NumOfEnvrn = 4; + state->dataWeatherManager->Environment.allocate(state->dataWeatherManager->NumOfEnvrn); + state->dataWeatherManager->Environment(1).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; + state->dataWeatherManager->Environment(1).DesignDayNum = 1; - state.dataWeatherManager->Environment(2).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; - state.dataWeatherManager->Environment(2).DesignDayNum = 2; + state->dataWeatherManager->Environment(2).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; + state->dataWeatherManager->Environment(2).DesignDayNum = 2; - state.dataWeatherManager->Environment(3).KindOfEnvrn = DataGlobalConstants::KindOfSim::RunPeriodDesign; - state.dataWeatherManager->Environment(3).DesignDayNum = 0; - state.dataWeatherManager->Environment(3).TotalDays = 4; + state->dataWeatherManager->Environment(3).KindOfEnvrn = DataGlobalConstants::KindOfSim::RunPeriodDesign; + state->dataWeatherManager->Environment(3).DesignDayNum = 0; + state->dataWeatherManager->Environment(3).TotalDays = 4; - state.dataWeatherManager->Environment(4).KindOfEnvrn = DataGlobalConstants::KindOfSim::RunPeriodDesign; - state.dataWeatherManager->Environment(4).DesignDayNum = 0; - state.dataWeatherManager->Environment(4).TotalDays = 4; + state->dataWeatherManager->Environment(4).KindOfEnvrn = DataGlobalConstants::KindOfSim::RunPeriodDesign; + state->dataWeatherManager->Environment(4).DesignDayNum = 0; + state->dataWeatherManager->Environment(4).TotalDays = 4; HVACSizingSimulationManager testSizeSimManagerObj; - testSizeSimManagerObj.DetermineSizingAnalysesNeeded(state); + testSizeSimManagerObj.DetermineSizingAnalysesNeeded(*state); EXPECT_EQ(1, testSizeSimManagerObj.plantCoincAnalyObjs[0].supplySideInletNodeNum); - testSizeSimManagerObj.SetupSizingAnalyses(state); + testSizeSimManagerObj.SetupSizingAnalyses(*state); - EXPECT_EQ(4, state.dataWeatherManager->NumOfEnvrn); - AddDesignSetToEnvironmentStruct(state, 1); - EXPECT_EQ(8, state.dataWeatherManager->NumOfEnvrn); + EXPECT_EQ(4, state->dataWeatherManager->NumOfEnvrn); + AddDesignSetToEnvironmentStruct(*state, 1); + EXPECT_EQ(8, state->dataWeatherManager->NumOfEnvrn); // now fill with three system timesteps for each zone timestep - state.dataGlobal->TimeStepZone = 15.0 / 60.0; + state->dataGlobal->TimeStepZone = 15.0 / 60.0; NumOfSysTimeSteps = 3; - TimeStepSys = state.dataGlobal->TimeStepZone / NumOfSysTimeSteps; + TimeStepSys = state->dataGlobal->TimeStepZone / NumOfSysTimeSteps; // first HVAC Sizing Simulation DD emulation - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; - state.dataGlobal->DayOfSim = 1; - state.dataWeatherManager->Envrn = 5; - state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum = 1; - testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(state); + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->DayOfSim = 1; + state->dataWeatherManager->Envrn = 5; + state->dataWeatherManager->Environment(state->dataWeatherManager->Envrn).DesignDayNum = 1; + testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(*state); - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 0.0; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 0.0; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= NumOfSysTimeSteps; ++SysTimestepLoop) { TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep) * 60.0; - Node(1).MassFlowRate = state.dataGlobal->HourOfDay * 0.1; + Node(1).MassFlowRate = state->dataGlobal->HourOfDay * 0.1; Node(1).Temp = 10.0; - PlantLoop(1).HeatingDemand = state.dataGlobal->HourOfDay * 10.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(state); + PlantLoop(1).HeatingDemand = state->dataGlobal->HourOfDay * 10.0; + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(*state); } TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep) * 60.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(*state); } // TimeStep loop } // ... End hour loop. // second HVAC Sizing Simulation DD emulation - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; - state.dataGlobal->DayOfSim = 1; - state.dataWeatherManager->Envrn = 6; + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->DayOfSim = 1; + state->dataWeatherManager->Envrn = 6; - state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum = 2; - testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(state); - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + state->dataWeatherManager->Environment(state->dataWeatherManager->Envrn).DesignDayNum = 2; + testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(*state); + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 0.0; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 0.0; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= NumOfSysTimeSteps; ++SysTimestepLoop) { TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep) * 60.0; - Node(1).MassFlowRate = state.dataGlobal->HourOfDay * 0.1; + Node(1).MassFlowRate = state->dataGlobal->HourOfDay * 0.1; Node(1).Temp = 10.0; - PlantLoop(1).HeatingDemand = state.dataGlobal->HourOfDay * 10.0; + PlantLoop(1).HeatingDemand = state->dataGlobal->HourOfDay * 10.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(*state); } TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep) * 60.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(*state); } // TimeStep loop } // End hour loop. // first HVAC Sizing Simulation WeatherFileDays emulation - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeRunPeriodDesign; - state.dataGlobal->DayOfSim = 0; - state.dataWeatherManager->Envrn = 7; - state.dataGlobal->NumOfDayInEnvrn = 4; - testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(state); - while (state.dataGlobal->DayOfSim < state.dataGlobal->NumOfDayInEnvrn) { - ++state.dataGlobal->DayOfSim; - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeRunPeriodDesign; + state->dataGlobal->DayOfSim = 0; + state->dataWeatherManager->Envrn = 7; + state->dataGlobal->NumOfDayInEnvrn = 4; + testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(*state); + while (state->dataGlobal->DayOfSim < state->dataGlobal->NumOfDayInEnvrn) { + ++state->dataGlobal->DayOfSim; + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 0.0; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 0.0; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= NumOfSysTimeSteps; ++SysTimestepLoop) { TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep) * 60.0; - Node(1).MassFlowRate = state.dataGlobal->HourOfDay * 0.1; + Node(1).MassFlowRate = state->dataGlobal->HourOfDay * 0.1; Node(1).Temp = 10.0; - PlantLoop(1).HeatingDemand = state.dataGlobal->HourOfDay * 10.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(state); + PlantLoop(1).HeatingDemand = state->dataGlobal->HourOfDay * 10.0; + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(*state); } TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep) * 60.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(*state); } // TimeStep loop } // ... End hour loop. } // day loop // second HVAC Sizing Simulation WEatherFileDAys emulation - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeRunPeriodDesign; - state.dataGlobal->DayOfSim = 0; - state.dataWeatherManager->Envrn = 8; - state.dataGlobal->NumOfDayInEnvrn = 4; - testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(state); - while (state.dataGlobal->DayOfSim < state.dataGlobal->NumOfDayInEnvrn) { - ++state.dataGlobal->DayOfSim; - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeRunPeriodDesign; + state->dataGlobal->DayOfSim = 0; + state->dataWeatherManager->Envrn = 8; + state->dataGlobal->NumOfDayInEnvrn = 4; + testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(*state); + while (state->dataGlobal->DayOfSim < state->dataGlobal->NumOfDayInEnvrn) { + ++state->dataGlobal->DayOfSim; + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 0.0; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 0.0; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= NumOfSysTimeSteps; ++SysTimestepLoop) { TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep) * 60.0; - Node(1).MassFlowRate = state.dataGlobal->HourOfDay * 0.1; + Node(1).MassFlowRate = state->dataGlobal->HourOfDay * 0.1; Node(1).Temp = 10.0; - PlantLoop(1).HeatingDemand = state.dataGlobal->HourOfDay * 10.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(state); + PlantLoop(1).HeatingDemand = state->dataGlobal->HourOfDay * 10.0; + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(*state); } TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep) * 60.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(*state); } // TimeStep loop } // ... End hour loop. } // day loop @@ -286,7 +287,7 @@ TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) // check plant resizing EXPECT_DOUBLE_EQ(2.0, PlantLoop(1).MaxMassFlowRate); // original size - testSizeSimManagerObj.ProcessCoincidentPlantSizeAdjustments(state, 1); + testSizeSimManagerObj.ProcessCoincidentPlantSizeAdjustments(*state, 1); EXPECT_DOUBLE_EQ(2.4, PlantLoop(1).MaxMassFlowRate); // resize check // check that the data are as expected in the logs @@ -340,12 +341,12 @@ TEST_F(HVACSizingSimulationManagerTest, WeatherFileDaysTest3) .ztStepObj[96] .runningAvgDataValue); - // first timestep of third sizing state.dataWeatherManager->Environment WeatherFileDays + // first timestep of third sizing state->dataWeatherManager->Environment WeatherFileDays EXPECT_DOUBLE_EQ(0.1, testSizeSimManagerObj.sizingLogger.logObjs[testSizeSimManagerObj.plantCoincAnalyObjs[0].supplyInletNodeFlow_LogIndex] .ztStepObj[192] .runningAvgDataValue); - // first timestep of fourth sizing state.dataWeatherManager->Environment WeatherFileDays + // first timestep of fourth sizing state->dataWeatherManager->Environment WeatherFileDays EXPECT_DOUBLE_EQ(0.1, testSizeSimManagerObj.sizingLogger.logObjs[testSizeSimManagerObj.plantCoincAnalyObjs[0].supplyInletNodeFlow_LogIndex] .ztStepObj[576] .runningAvgDataValue); @@ -359,66 +360,66 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep3) HVACSizingSimulationManager testSizeSimManagerObj; - testSizeSimManagerObj.DetermineSizingAnalysesNeeded(state); + testSizeSimManagerObj.DetermineSizingAnalysesNeeded(*state); EXPECT_EQ(1, testSizeSimManagerObj.plantCoincAnalyObjs[0].supplySideInletNodeNum); - testSizeSimManagerObj.SetupSizingAnalyses(state); + testSizeSimManagerObj.SetupSizingAnalyses(*state); - EXPECT_EQ(2, state.dataWeatherManager->NumOfEnvrn); - AddDesignSetToEnvironmentStruct(state, 1); + EXPECT_EQ(2, state->dataWeatherManager->NumOfEnvrn); + AddDesignSetToEnvironmentStruct(*state, 1); - EXPECT_EQ(4, state.dataWeatherManager->NumOfEnvrn); + EXPECT_EQ(4, state->dataWeatherManager->NumOfEnvrn); // now fill with three system timesteps for each zone timestep - state.dataGlobal->TimeStepZone = 15.0 / 60.0; + state->dataGlobal->TimeStepZone = 15.0 / 60.0; NumOfSysTimeSteps = 3; - TimeStepSys = state.dataGlobal->TimeStepZone / NumOfSysTimeSteps; + TimeStepSys = state->dataGlobal->TimeStepZone / NumOfSysTimeSteps; // first HVAC Sizing Simulation DD emulation - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; - state.dataGlobal->DayOfSim = 1; - state.dataWeatherManager->Envrn = 3; - state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum = 1; - testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(state); - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->DayOfSim = 1; + state->dataWeatherManager->Envrn = 3; + state->dataWeatherManager->Environment(state->dataWeatherManager->Envrn).DesignDayNum = 1; + testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(*state); + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 0.0; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 0.0; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= NumOfSysTimeSteps; ++SysTimestepLoop) { TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep) * 60.0; - Node(1).MassFlowRate = state.dataGlobal->HourOfDay * 0.1; + Node(1).MassFlowRate = state->dataGlobal->HourOfDay * 0.1; Node(1).Temp = 10.0; - PlantLoop(1).HeatingDemand = state.dataGlobal->HourOfDay * 10.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(state); + PlantLoop(1).HeatingDemand = state->dataGlobal->HourOfDay * 10.0; + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(*state); } TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep) * 60.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(*state); } // TimeStep loop } // ... End hour loop. // second HVAC Sizing Simulation DD emulation - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; - state.dataGlobal->DayOfSim = 1; - state.dataWeatherManager->Envrn = 4; - state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum = 2; - testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(state); - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->DayOfSim = 1; + state->dataWeatherManager->Envrn = 4; + state->dataWeatherManager->Environment(state->dataWeatherManager->Envrn).DesignDayNum = 2; + testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(*state); + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 0.0; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 0.0; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= NumOfSysTimeSteps; ++SysTimestepLoop) { TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep) * 60.0; - Node(1).MassFlowRate = state.dataGlobal->HourOfDay * 0.1; + Node(1).MassFlowRate = state->dataGlobal->HourOfDay * 0.1; Node(1).Temp = 10.0; - PlantLoop(1).HeatingDemand = state.dataGlobal->HourOfDay * 10.0; + PlantLoop(1).HeatingDemand = state->dataGlobal->HourOfDay * 10.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(*state); } TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep) * 60.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(*state); } // TimeStep loop } // End hour loop. @@ -426,7 +427,7 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep3) // check plant resizing EXPECT_DOUBLE_EQ(2.0, PlantLoop(1).MaxMassFlowRate); // original size - testSizeSimManagerObj.ProcessCoincidentPlantSizeAdjustments(state, 1); + testSizeSimManagerObj.ProcessCoincidentPlantSizeAdjustments(*state, 1); EXPECT_DOUBLE_EQ(2.4, PlantLoop(1).MaxMassFlowRate); // resize check // check that the data are as expected in the logs @@ -492,75 +493,75 @@ TEST_F(HVACSizingSimulationManagerTest, TopDownTestSysTimestep1) HVACSizingSimulationManager testSizeSimManagerObj; - testSizeSimManagerObj.DetermineSizingAnalysesNeeded(state); + testSizeSimManagerObj.DetermineSizingAnalysesNeeded(*state); EXPECT_EQ(1, testSizeSimManagerObj.plantCoincAnalyObjs[0].supplySideInletNodeNum); - testSizeSimManagerObj.SetupSizingAnalyses(state); + testSizeSimManagerObj.SetupSizingAnalyses(*state); - EXPECT_EQ(2, state.dataWeatherManager->NumOfEnvrn); - AddDesignSetToEnvironmentStruct(state, 1); - EXPECT_EQ(4, state.dataWeatherManager->NumOfEnvrn); + EXPECT_EQ(2, state->dataWeatherManager->NumOfEnvrn); + AddDesignSetToEnvironmentStruct(*state, 1); + EXPECT_EQ(4, state->dataWeatherManager->NumOfEnvrn); // now fill with one system timesteps for each zone timestep - state.dataGlobal->TimeStepZone = 15.0 / 60.0; + state->dataGlobal->TimeStepZone = 15.0 / 60.0; NumOfSysTimeSteps = 1; - TimeStepSys = state.dataGlobal->TimeStepZone / NumOfSysTimeSteps; + TimeStepSys = state->dataGlobal->TimeStepZone / NumOfSysTimeSteps; // first HVAC Sizing Simulation DD emulation - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; - state.dataGlobal->DayOfSim = 1; - state.dataWeatherManager->Envrn = 3; - state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum = 1; - testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(state); - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->DayOfSim = 1; + state->dataWeatherManager->Envrn = 3; + state->dataWeatherManager->Environment(state->dataWeatherManager->Envrn).DesignDayNum = 1; + testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(*state); + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 0.0; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 0.0; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= NumOfSysTimeSteps; ++SysTimestepLoop) { TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep) * 60.0; - Node(1).MassFlowRate = state.dataGlobal->HourOfDay * 0.1; + Node(1).MassFlowRate = state->dataGlobal->HourOfDay * 0.1; Node(1).Temp = 10.0; - PlantLoop(1).HeatingDemand = state.dataGlobal->HourOfDay * 10.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(state); + PlantLoop(1).HeatingDemand = state->dataGlobal->HourOfDay * 10.0; + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(*state); } // E+ doesn't really update zone step data until system steps are done TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep) * 60.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(*state); } // TimeStep loop } // ... End hour loop. // second HVAC Sizing Simulation DD emulation - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; - state.dataGlobal->DayOfSim = 1; - state.dataWeatherManager->Envrn = 4; - state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum = 2; - testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(state); - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->DayOfSim = 1; + state->dataWeatherManager->Envrn = 4; + state->dataWeatherManager->Environment(state->dataWeatherManager->Envrn).DesignDayNum = 2; + testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(*state); + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 0.0; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 0.0; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { for (int SysTimestepLoop = 1; SysTimestepLoop <= NumOfSysTimeSteps; ++SysTimestepLoop) { TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep) * 60.0; - Node(1).MassFlowRate = state.dataGlobal->HourOfDay * 0.1; + Node(1).MassFlowRate = state->dataGlobal->HourOfDay * 0.1; Node(1).Temp = 10.0; - PlantLoop(1).HeatingDemand = state.dataGlobal->HourOfDay * 10.0; + PlantLoop(1).HeatingDemand = state->dataGlobal->HourOfDay * 10.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(*state); } TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep) * 60.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(*state); } // TimeStep loop } // End hour loop. testSizeSimManagerObj.PostProcessLogs(); EXPECT_DOUBLE_EQ(2.0, PlantLoop(1).MaxMassFlowRate); // original size - testSizeSimManagerObj.ProcessCoincidentPlantSizeAdjustments(state, 1); + testSizeSimManagerObj.ProcessCoincidentPlantSizeAdjustments(*state, 1); EXPECT_DOUBLE_EQ(2.4, PlantLoop(1).MaxMassFlowRate); // resize check } @@ -576,83 +577,83 @@ TEST_F(HVACSizingSimulationManagerTest, VarySysTimesteps) HVACSizingSimulationManager testSizeSimManagerObj; - testSizeSimManagerObj.DetermineSizingAnalysesNeeded(state); + testSizeSimManagerObj.DetermineSizingAnalysesNeeded(*state); EXPECT_EQ(1, testSizeSimManagerObj.plantCoincAnalyObjs[0].supplySideInletNodeNum); - testSizeSimManagerObj.SetupSizingAnalyses(state); + testSizeSimManagerObj.SetupSizingAnalyses(*state); - EXPECT_EQ(2, state.dataWeatherManager->NumOfEnvrn); - AddDesignSetToEnvironmentStruct(state, 1); - EXPECT_EQ(4, state.dataWeatherManager->NumOfEnvrn); + EXPECT_EQ(2, state->dataWeatherManager->NumOfEnvrn); + AddDesignSetToEnvironmentStruct(*state, 1); + EXPECT_EQ(4, state->dataWeatherManager->NumOfEnvrn); // now fill with one system timesteps for each zone timestep - state.dataGlobal->TimeStepZone = 15.0 / 60.0; + state->dataGlobal->TimeStepZone = 15.0 / 60.0; NumOfSysTimeSteps = 1; - TimeStepSys = state.dataGlobal->TimeStepZone / NumOfSysTimeSteps; + TimeStepSys = state->dataGlobal->TimeStepZone / NumOfSysTimeSteps; // first HVAC Sizing Simulation DD emulation - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; - state.dataGlobal->DayOfSim = 1; - state.dataWeatherManager->Envrn = 3; - state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum = 1; - testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(state); - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->DayOfSim = 1; + state->dataWeatherManager->Envrn = 3; + state->dataWeatherManager->Environment(state->dataWeatherManager->Envrn).DesignDayNum = 1; + testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(*state); + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 0.0; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 0.0; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { - NumOfSysTimeSteps = state.dataGlobal->TimeStep; - TimeStepSys = state.dataGlobal->TimeStepZone / NumOfSysTimeSteps; + NumOfSysTimeSteps = state->dataGlobal->TimeStep; + TimeStepSys = state->dataGlobal->TimeStepZone / NumOfSysTimeSteps; for (int SysTimestepLoop = 1; SysTimestepLoop <= NumOfSysTimeSteps; ++SysTimestepLoop) { TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep) * 60.0; - Node(1).MassFlowRate = state.dataGlobal->HourOfDay * 0.1; + Node(1).MassFlowRate = state->dataGlobal->HourOfDay * 0.1; Node(1).Temp = 10.0; - PlantLoop(1).HeatingDemand = state.dataGlobal->HourOfDay * 10.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(state); + PlantLoop(1).HeatingDemand = state->dataGlobal->HourOfDay * 10.0; + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(*state); } // E+ doesn't really update zone step data until system steps are done TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep) * 60.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(*state); } // TimeStep loop } // ... End hour loop. // second HVAC Sizing Simulation DD emulation - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; - state.dataGlobal->DayOfSim = 1; - state.dataWeatherManager->Envrn = 4; - state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum = 2; - testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(state); - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->DayOfSim = 1; + state->dataWeatherManager->Envrn = 4; + state->dataWeatherManager->Environment(state->dataWeatherManager->Envrn).DesignDayNum = 2; + testSizeSimManagerObj.sizingLogger.SetupSizingLogsNewEnvironment(*state); + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 0.0; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 0.0; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { - NumOfSysTimeSteps = state.dataGlobal->TimeStep; - TimeStepSys = state.dataGlobal->TimeStepZone / NumOfSysTimeSteps; + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { + NumOfSysTimeSteps = state->dataGlobal->TimeStep; + TimeStepSys = state->dataGlobal->TimeStepZone / NumOfSysTimeSteps; for (int SysTimestepLoop = 1; SysTimestepLoop <= NumOfSysTimeSteps; ++SysTimestepLoop) { TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep) * 60.0; - Node(1).MassFlowRate = state.dataGlobal->HourOfDay * 0.1; + Node(1).MassFlowRate = state->dataGlobal->HourOfDay * 0.1; Node(1).Temp = 10.0; - PlantLoop(1).HeatingDemand = state.dataGlobal->HourOfDay * 10.0; + PlantLoop(1).HeatingDemand = state->dataGlobal->HourOfDay * 10.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesSystemStep(*state); } TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute += (*TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep) * 60.0; - testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(state); + testSizeSimManagerObj.sizingLogger.UpdateSizingLogValuesZoneStep(*state); } // TimeStep loop } // End hour loop. testSizeSimManagerObj.PostProcessLogs(); EXPECT_DOUBLE_EQ(2.0, PlantLoop(1).MaxMassFlowRate); // original size - testSizeSimManagerObj.ProcessCoincidentPlantSizeAdjustments(state, 1); + testSizeSimManagerObj.ProcessCoincidentPlantSizeAdjustments(*state, 1); EXPECT_DOUBLE_EQ(2.4, PlantLoop(1).MaxMassFlowRate); // resize check - testSizeSimManagerObj.ProcessCoincidentPlantSizeAdjustments(state, 1); + testSizeSimManagerObj.ProcessCoincidentPlantSizeAdjustments(*state, 1); testSizeSimManagerObj.sizingLogger.IncrementSizingPeriodSet(); } diff --git a/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc b/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc index 15ac01b7e59..7f5e8d0c866 100644 --- a/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc +++ b/tst/EnergyPlus/unit/HVACStandaloneERV.unit.cc @@ -62,6 +62,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::HVACStandAloneERV; @@ -142,7 +143,7 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test1) StandAloneERV(1).ExhaustAirFanIndex = 2; Zone(1).Multiplier = 1.0; Zone(1).FloorArea = 1000.0; - SizeStandAloneERV(state, 1); + SizeStandAloneERV(*state, 1); EXPECT_EQ(1000.0, StandAloneERV(1).SupplyAirVolFlow); // size on occupancy @@ -152,7 +153,7 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test1) StandAloneERV(1).AirVolFlowPerOccupant = 10.0; Zone(1).Multiplier = 1.0; Zone(1).FloorArea = 1000.0; - SizeStandAloneERV(state, 1); + SizeStandAloneERV(*state, 1); EXPECT_EQ(3000.0, StandAloneERV(1).SupplyAirVolFlow); // size on floor area and occupancy @@ -162,14 +163,14 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test1) StandAloneERV(1).AirVolFlowPerOccupant = 10.0; Zone(1).Multiplier = 1.0; Zone(1).FloorArea = 1000.0; - SizeStandAloneERV(state, 1); + SizeStandAloneERV(*state, 1); EXPECT_EQ(4000.0, StandAloneERV(1).SupplyAirVolFlow); // size on floor area and occupancy using zone multiplier StandAloneERV(1).SupplyAirVolFlow = AutoSize; StandAloneERV(1).ExhaustAirVolFlow = AutoSize; Zone(1).Multiplier = 5.0; - SizeStandAloneERV(state, 1); + SizeStandAloneERV(*state, 1); EXPECT_EQ(20000.0, StandAloneERV(1).SupplyAirVolFlow); } @@ -210,11 +211,11 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test2) ASSERT_TRUE(process_idf(idf_objects)); DataEnvironment::StdRhoAir = 1.0; - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetFanInput(state); + GetFanInput(*state); EnergyPlus::DataSizing::CurZoneEqNum = 1; @@ -260,7 +261,7 @@ TEST_F(EnergyPlusFixture, HVACStandAloneERV_Test2) StandAloneERV(1).AirVolFlowPerOccupant = 0.0; StandAloneERV(1).HighRHOAFlowRatio = 1.2; - SizeStandAloneERV(state, 1); + SizeStandAloneERV(*state, 1); EXPECT_EQ(1.0, StandAloneERV(1).SupplyAirVolFlow); EXPECT_EQ(1.2, StandAloneERV(1).DesignSAFanVolFlowRate); diff --git a/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc b/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc index 155352dec66..d8f4b5f69e2 100644 --- a/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc +++ b/tst/EnergyPlus/unit/HVACUnitaryBypassVAV.unit.cc @@ -75,6 +75,7 @@ #include #include #include +#include using namespace EnergyPlus; @@ -94,16 +95,16 @@ class CBVAVSys : public EnergyPlusFixture { EnergyPlusFixture::SetUp(); // Sets up the base fixture first. - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->HourOfDay = 1; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); // initialize StdRhoAir + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize StdRhoAir DataEnvironment::OutBaroPress = 101325.0; - state.dataGlobal->NumOfZones = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); - DataZoneEquipment::ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); - DataZoneEquipment::ZoneEquipList.allocate(state.dataGlobal->NumOfZones); - DataZoneEquipment::ZoneEquipAvail.dimension(state.dataGlobal->NumOfZones, DataHVACGlobals::NoAction); + state->dataGlobal->NumOfZones = 1; + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipList.allocate(state->dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipAvail.dimension(state->dataGlobal->NumOfZones, DataHVACGlobals::NoAction); DataHeatBalance::Zone(1).Name = "EAST ZONE"; DataZoneEquipment::NumOfZoneEquipLists = 1; DataHeatBalance::Zone(1).IsControlled = true; @@ -284,21 +285,21 @@ class CBVAVSys : public EnergyPlusFixture cbvav.CBVAVBoxOutletNode.allocate(1); cbvav.CBVAVBoxOutletNode(1) = 11; - state.dataCurveManager->PerfCurve.allocate(1); - state.dataCurveManager->NumCurves = 1; - state.dataCurveManager->PerfCurve(1).InterpolationType = CurveManager::InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(1).CurveType = CurveManager::CurveTypeEnum::Linear; - state.dataCurveManager->PerfCurve(1).Coeff1 = 1.0; + state->dataCurveManager->PerfCurve.allocate(1); + state->dataCurveManager->NumCurves = 1; + state->dataCurveManager->PerfCurve(1).InterpolationType = CurveManager::InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(1).CurveType = CurveManager::CurveTypeEnum::Linear; + state->dataCurveManager->PerfCurve(1).Coeff1 = 1.0; DataEnvironment::OutDryBulbTemp = 35.0; DataEnvironment::OutHumRat = 0.0141066; DataEnvironment::OutWetBulbTemp = 23.9; DataEnvironment::OutBaroPress = 101325.0; - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); - OutputReportPredefined::SetPredefinedTables(state); + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); + OutputReportPredefined::SetPredefinedTables(*state); } virtual void TearDown() @@ -642,28 +643,28 @@ TEST_F(EnergyPlusFixture, UnitaryBypassVAV_GetInputZoneEquipment) bool ErrorsFound = false; bool firstHVACIteration = true; // Read objects - SimulationManager::GetProjectData(state); - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + SimulationManager::GetProjectData(*state); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetHeatBalanceInput(state); - HeatBalanceManager::AllocateHeatBalArrays(state); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetHeatBalanceInput(*state); + HeatBalanceManager::AllocateHeatBalArrays(*state); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - HeatBalanceManager::AllocateHeatBalArrays(state); - ZoneTempPredictorCorrector::InitZoneAirSetPoints(state); + HeatBalanceManager::AllocateHeatBalArrays(*state); + ZoneTempPredictorCorrector::InitZoneAirSetPoints(*state); bool simZone = false; bool simAir = false; - DataHeatBalance::MassConservation.allocate(state.dataGlobal->NumOfZones); - ZoneEquipmentManager::ManageZoneEquipment(state, firstHVACIteration, simZone, simAir); - SimAirServingZones::GetAirPathData(state); - SplitterComponent::GetSplitterInput(state); - SimAirServingZones::InitAirLoops(state, firstHVACIteration); + DataHeatBalance::MassConservation.allocate(state->dataGlobal->NumOfZones); + ZoneEquipmentManager::ManageZoneEquipment(*state, firstHVACIteration, simZone, simAir); + SimAirServingZones::GetAirPathData(*state); + SplitterComponent::GetSplitterInput(*state); + SimAirServingZones::InitAirLoops(*state, firstHVACIteration); // set up zone load indicators DataZoneEnergyDemands::CurDeadBandOrSetback.allocate(2); @@ -680,7 +681,7 @@ TEST_F(EnergyPlusFixture, UnitaryBypassVAV_GetInputZoneEquipment) DataZoneEnergyDemands::ZoneSysEnergyDemand(2).SequencedOutputRequiredToCoolingSP(1) = -1000.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(2).SequencedOutputRequiredToHeatingSP(1) = -2000.0; - HVACUnitaryBypassVAV::GetCBVAV(state); // get UnitarySystem input from object above + HVACUnitaryBypassVAV::GetCBVAV(*state); // get UnitarySystem input from object above int CBVAVNum = 1; int zoneIndex = 1; @@ -705,10 +706,10 @@ TEST_F(EnergyPlusFixture, UnitaryBypassVAV_GetInputZoneEquipment) // If Init or GetZoneLoads is called again, with a different load (i.e., was cooling and now is heating) then changeOverTimer must be reset // if the loads do not change then there is no need to reset the timer, resetting here as an example. cbvav.changeOverTimer = -1.0; // reset timer so GetZoneLoads executes - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->HourOfDay = 1; // test zone indexing for loads - HVACUnitaryBypassVAV::GetZoneLoads(state, CBVAVNum); + HVACUnitaryBypassVAV::GetZoneLoads(*state, CBVAVNum); // only 1 conditioned zone EXPECT_EQ(1, cbvav.NumZonesCooled); EXPECT_EQ(HVACUnitaryBypassVAV::CoolingMode, cbvav.HeatCoolMode); @@ -737,9 +738,9 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_AutoSize) cbvav.OpMode = DataHVACGlobals::CycFanCycCoil; // must set one type of fan operating mode to initialize CalcSetPointTempTarget DataLoopNode::Node(cbvav.AirInNode).Temp = 24.0; // initialize inlet node temp used to initialize CalcSetPointTempTarget cbvav.AirLoopNumber = 1; - state.dataAirLoop->AirLoopFlow.allocate(cbvav.AirLoopNumber); + state->dataAirLoop->AirLoopFlow.allocate(cbvav.AirLoopNumber); - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); // expect CBVAV air flow to match FinalSysSizing info EXPECT_EQ(cbvav.MaxCoolAirVolFlow, finalSysSizing.DesMainVolFlow); @@ -784,12 +785,12 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_NoOASys) cbvav.OpMode = DataHVACGlobals::CycFanCycCoil; // set fan operating mode cbvav.AirLoopNumber = 1; - state.dataAirLoop->AirLoopFlow.allocate(cbvav.AirLoopNumber); + state->dataAirLoop->AirLoopFlow.allocate(cbvav.AirLoopNumber); // First time through GetZoneLoads CBVAV.HeatCoolMode gets set IF there is a load and won't exectute again until the simulation time increases // There is no load here and CBVAV.HeatCoolMode did not change so cbvav.changeOverTimer also did not get set (change) in previous call // so there is no need to reset cbvav.changeOverTimer here but it wouldn't hurt if it was reset to -1.0 - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); EXPECT_EQ(cbvav.HeatCoolMode, 0); EXPECT_EQ(cbvav.NumZonesCooled, 0); EXPECT_EQ(cbvav.NumZonesHeated, 0); @@ -805,7 +806,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_NoOASys) DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToCoolingSP(1) = -9000.0; // load to cooling set point DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToHeatingSP(1) = -15000.0; // more load to heating set point // No need to reset changeOverTimer since previous load was not cooling or heating and changeOverTimer DID NOT get set - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); // Now changeOverTimer = 0 and GetZoneLoads will not execute again unless changeOverTimer is reset, but only needs to occur when load changes EXPECT_EQ(cbvav.changeOverTimer, 0.0); // expect timer now set to current time (0.0) plus minModeChangeTime(0.0), so = 0.0 EXPECT_EQ(cbvav.HeatCoolMode, HVACUnitaryBypassVAV::CoolingMode); @@ -816,16 +817,16 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_NoOASys) EXPECT_NEAR(cbvav.OutletTempSetPoint, 9.56, 0.01); Real64 PartLoadFrac = 0.0; - HVACUnitaryBypassVAV::ControlCBVAVOutput(state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::ControlCBVAVOutput(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); EXPECT_EQ(PartLoadFrac, 1.0); // load = -9000 W, coil capacity = 10,000 W, SHR = 0.7 so max sensible is around 7,000 W // reduce load and check that outlet temp meets set point DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToCoolingSP(1) = -7000.0; // load to cooling set point DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToHeatingSP(1) = -15000.0; // more load to heating set point // No need to reset changeOverTimer since load did not change - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); Real64 FullOutput = 0.0; - HVACUnitaryBypassVAV::CalcCBVAV(state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::CalcCBVAV(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); EXPECT_NEAR(PartLoadFrac, 0.9387, 0.001); // load = -7000 W, coil capacity = 10,000 W, SHR = 0.7 so max sensible is just over 7,000 W EXPECT_NEAR(cbvav.OutletTempSetPoint, DataLoopNode::Node(cbvav.AirOutNode).Temp, 0.0001); EXPECT_NEAR(cbvav.OutletTempSetPoint, 12.771, 0.001); @@ -836,7 +837,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_NoOASys) cbvav.changeOverTimer = -1.0; // The load switched to heating so reset timer so GetZoneLoads executes // test timer function by setting minModeChangeTime to 2 hrs cbvav.minModeChangeTime = 2.0; - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); EXPECT_EQ(cbvav.changeOverTimer, 2.0); // expect timer now set to current time (0.0) plus minModeChangeTime(2.0), so = 2.0 EXPECT_EQ(cbvav.HeatCoolMode, HVACUnitaryBypassVAV::HeatingMode); EXPECT_EQ(cbvav.NumZonesCooled, 0); @@ -845,7 +846,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_NoOASys) EXPECT_LE(cbvav.OutletTempSetPoint, cbvav.MaxLATHeating); EXPECT_NEAR(cbvav.OutletTempSetPoint, 35.23, 0.01); FullOutput = 0.0; - HVACUnitaryBypassVAV::CalcCBVAV(state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::CalcCBVAV(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); EXPECT_LT(PartLoadFrac, 1.0); // load = 7000 W, coil capacity = 10,000 W EXPECT_NEAR(cbvav.OutletTempSetPoint, DataLoopNode::Node(cbvav.AirOutNode).Temp, 0.0001); EXPECT_NEAR(cbvav.OutletTempSetPoint, 35.228, 0.001); @@ -879,9 +880,9 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_InternalOAMixer) cbvav.OpMode = DataHVACGlobals::CycFanCycCoil; // set fan operating mode cbvav.AirLoopNumber = 1; - state.dataAirLoop->AirLoopFlow.allocate(cbvav.AirLoopNumber); + state->dataAirLoop->AirLoopFlow.allocate(cbvav.AirLoopNumber); - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); EXPECT_EQ(cbvav.HeatCoolMode, 0); EXPECT_EQ(cbvav.NumZonesCooled, 0); EXPECT_EQ(cbvav.NumZonesHeated, 0); @@ -896,7 +897,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_InternalOAMixer) // initialize cooling load DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToCoolingSP(1) = -9000.0; // load to cooling set point DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToHeatingSP(1) = -15000.0; // more load to heating set point - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); EXPECT_EQ(cbvav.HeatCoolMode, HVACUnitaryBypassVAV::CoolingMode); EXPECT_EQ(cbvav.NumZonesCooled, 1); EXPECT_EQ(cbvav.NumZonesHeated, 0); @@ -905,16 +906,16 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_InternalOAMixer) EXPECT_NEAR(cbvav.OutletTempSetPoint, 9.59, 0.01); Real64 PartLoadFrac = 0.0; - HVACUnitaryBypassVAV::ControlCBVAVOutput(state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::ControlCBVAVOutput(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); EXPECT_EQ(PartLoadFrac, 1.0); // load = -9000 W, coil capacity = 10,000 W, SHR = 0.7 so max sensible is around 7,000 W // reduce load and check that outlet temp meets set point DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToCoolingSP(1) = -6000.0; // load to cooling set point DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToHeatingSP(1) = -15000.0; // more load to heating set point cbvav.changeOverTimer = -1.0; // reset timer so GetZoneLoads executes - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); Real64 FullOutput = 0.0; - HVACUnitaryBypassVAV::CalcCBVAV(state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::CalcCBVAV(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); EXPECT_LT(PartLoadFrac, 1.0); // load = -6000 W, coil capacity = 10,000 W, SHR = 0.7 so max sensible is around 7,000 W EXPECT_NEAR(cbvav.OutletTempSetPoint, DataLoopNode::Node(cbvav.AirOutNode).Temp, 0.0001); EXPECT_NEAR(cbvav.OutletTempSetPoint, 14.392, 0.001); @@ -923,7 +924,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_InternalOAMixer) DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToCoolingSP(1) = 15000.0; // more capacity needed to get to cooling set point DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToHeatingSP(1) = 7000.0; // load to heating set point cbvav.changeOverTimer = -1.0; // reset timer so GetZoneLoads executes - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); EXPECT_EQ(cbvav.HeatCoolMode, HVACUnitaryBypassVAV::HeatingMode); EXPECT_EQ(cbvav.NumZonesCooled, 0); EXPECT_EQ(cbvav.NumZonesHeated, 1); @@ -931,7 +932,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_InternalOAMixer) EXPECT_LE(cbvav.OutletTempSetPoint, cbvav.MaxLATHeating); EXPECT_NEAR(cbvav.OutletTempSetPoint, 35.21, 0.01); FullOutput = 0.0; - HVACUnitaryBypassVAV::CalcCBVAV(state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::CalcCBVAV(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); EXPECT_LT(PartLoadFrac, 1.0); // load = 7000 W, coil capacity = 10,000 W EXPECT_NEAR(cbvav.OutletTempSetPoint, DataLoopNode::Node(cbvav.AirOutNode).Temp, 0.0001); EXPECT_NEAR(cbvav.OutletTempSetPoint, 35.208, 0.001); @@ -968,7 +969,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_Mixerconnected) cbvav.OpMode = DataHVACGlobals::CycFanCycCoil; // set fan operating mode - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); EXPECT_EQ(cbvav.HeatCoolMode, 0); EXPECT_EQ(cbvav.NumZonesCooled, 0); EXPECT_EQ(cbvav.NumZonesHeated, 0); @@ -983,7 +984,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_Mixerconnected) DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToCoolingSP(1) = -9000.0; // load to cooling set point DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToHeatingSP(1) = -15000.0; // more load to heating set point cbvav.changeOverTimer = -1.0; // reset timer so GetZoneLoads executes - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); EXPECT_EQ(cbvav.HeatCoolMode, HVACUnitaryBypassVAV::CoolingMode); EXPECT_EQ(cbvav.NumZonesCooled, 1); EXPECT_EQ(cbvav.NumZonesHeated, 0); @@ -992,27 +993,27 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_Mixerconnected) EXPECT_NEAR(cbvav.OutletTempSetPoint, 9.56, 0.01); Real64 PartLoadFrac = 0.0; - HVACUnitaryBypassVAV::ControlCBVAVOutput(state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::ControlCBVAVOutput(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); EXPECT_EQ(PartLoadFrac, 1.0); // load = -9000 W, coil capacity = 10,000 W, SHR = 0.7 so max sensible is around 7,000 W // set FirstHVACIteration = false and use box outlet mass flow rate to set bypass flow FirstHVACIteration = false; DataLoopNode::Node(cbvav.CBVAVBoxOutletNode(1)).MassFlowRate = 0.3; - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); - HVACUnitaryBypassVAV::ControlCBVAVOutput(state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::ControlCBVAVOutput(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); EXPECT_NEAR(DataLoopNode::Node(cbvav.AirOutNode).MassFlowRate, DataLoopNode::Node(cbvav.CBVAVBoxOutletNode(1)).MassFlowRate, 0.000001); EXPECT_NEAR(cbvav.OutletTempSetPoint, 9.56, 0.01); EXPECT_NEAR( - state.dataAirLoop->AirLoopFlow(cbvav.AirLoopNumber).BypassMassFlow, DataLoopNode::Node(cbvav.PlenumMixerInletAirNode).MassFlowRate, 0.00001); + state->dataAirLoop->AirLoopFlow(cbvav.AirLoopNumber).BypassMassFlow, DataLoopNode::Node(cbvav.PlenumMixerInletAirNode).MassFlowRate, 0.00001); EXPECT_NEAR(DataLoopNode::Node(cbvav.PlenumMixerInletAirNode).MassFlowRate, 0.302, 0.001); // reduce load and check that outlet temp meets set point FirstHVACIteration = true; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToCoolingSP(1) = -7000.0; // load to cooling set point DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToHeatingSP(1) = -15000.0; // more load to heating set point - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); Real64 FullOutput = 0.0; - HVACUnitaryBypassVAV::CalcCBVAV(state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::CalcCBVAV(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); EXPECT_LT(PartLoadFrac, 1.0); // load = -7000 W, coil capacity = 10,000 W, SHR = 0.7 so max sensible is around 7,000 W EXPECT_NEAR(cbvav.OutletTempSetPoint, DataLoopNode::Node(cbvav.AirOutNode).Temp, 0.0001); EXPECT_NEAR(cbvav.OutletTempSetPoint, 12.771, 0.001); @@ -1020,12 +1021,12 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_Mixerconnected) // set FirstHVACIteration = false and use box outlet mass flow rate to set bypass flow FirstHVACIteration = false; DataLoopNode::Node(cbvav.CBVAVBoxOutletNode(1)).MassFlowRate = 0.3; - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); - HVACUnitaryBypassVAV::ControlCBVAVOutput(state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::ControlCBVAVOutput(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); EXPECT_NEAR(DataLoopNode::Node(cbvav.AirOutNode).MassFlowRate, DataLoopNode::Node(cbvav.CBVAVBoxOutletNode(1)).MassFlowRate, 0.000001); EXPECT_NEAR(cbvav.OutletTempSetPoint, 12.771, 0.01); EXPECT_NEAR( - state.dataAirLoop->AirLoopFlow(cbvav.AirLoopNumber).BypassMassFlow, DataLoopNode::Node(cbvav.PlenumMixerInletAirNode).MassFlowRate, 0.00001); + state->dataAirLoop->AirLoopFlow(cbvav.AirLoopNumber).BypassMassFlow, DataLoopNode::Node(cbvav.PlenumMixerInletAirNode).MassFlowRate, 0.00001); EXPECT_NEAR(DataLoopNode::Node(cbvav.PlenumMixerInletAirNode).MassFlowRate, 0.302, 0.001); Real64 systemFlow = DataLoopNode::Node(cbvav.PlenumMixerInletAirNode).MassFlowRate + DataLoopNode::Node(cbvav.AirOutNode).MassFlowRate; EXPECT_NEAR(systemFlow, cbvav.MaxCoolAirMassFlow, 0.0001); @@ -1035,7 +1036,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_Mixerconnected) DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToCoolingSP(1) = 15000.0; // more capacity needed to get to cooling set point DataZoneEnergyDemands::ZoneSysEnergyDemand(1).SequencedOutputRequiredToHeatingSP(1) = 7000.0; // load to heating set point cbvav.changeOverTimer = -1.0; // reset timer so GetZoneLoads executes - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); EXPECT_EQ(cbvav.HeatCoolMode, HVACUnitaryBypassVAV::HeatingMode); EXPECT_EQ(cbvav.NumZonesCooled, 0); EXPECT_EQ(cbvav.NumZonesHeated, 1); @@ -1043,7 +1044,7 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_Mixerconnected) EXPECT_LE(cbvav.OutletTempSetPoint, cbvav.MaxLATHeating); EXPECT_NEAR(cbvav.OutletTempSetPoint, 35.23, 0.01); FullOutput = 0.0; - HVACUnitaryBypassVAV::CalcCBVAV(state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::CalcCBVAV(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, FullOutput, OnOffAirFlowRatio, HXUnitOn); EXPECT_LT(PartLoadFrac, 1.0); // load = 7000 W, coil capacity = 10,000 W EXPECT_NEAR(cbvav.OutletTempSetPoint, DataLoopNode::Node(cbvav.AirOutNode).Temp, 0.0001); EXPECT_NEAR(cbvav.OutletTempSetPoint, 35.228, 0.001); @@ -1051,12 +1052,12 @@ TEST_F(CBVAVSys, UnitaryBypassVAV_Mixerconnected) // set FirstHVACIteration = false and use box outlet mass flow rate to set bypass flow FirstHVACIteration = false; DataLoopNode::Node(cbvav.CBVAVBoxOutletNode(1)).MassFlowRate = 0.2; - HVACUnitaryBypassVAV::InitCBVAV(state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); - HVACUnitaryBypassVAV::ControlCBVAVOutput(state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::InitCBVAV(*state, cbvavNum, FirstHVACIteration, AirLoopNum, OnOffAirFlowRatio, HXUnitOn); + HVACUnitaryBypassVAV::ControlCBVAVOutput(*state, cbvavNum, FirstHVACIteration, PartLoadFrac, OnOffAirFlowRatio, HXUnitOn); EXPECT_NEAR(DataLoopNode::Node(cbvav.AirOutNode).MassFlowRate, DataLoopNode::Node(cbvav.CBVAVBoxOutletNode(1)).MassFlowRate, 0.000001); EXPECT_NEAR(cbvav.OutletTempSetPoint, 35.228, 0.01); EXPECT_NEAR( - state.dataAirLoop->AirLoopFlow(cbvav.AirLoopNumber).BypassMassFlow, DataLoopNode::Node(cbvav.PlenumMixerInletAirNode).MassFlowRate, 0.00001); + state->dataAirLoop->AirLoopFlow(cbvav.AirLoopNumber).BypassMassFlow, DataLoopNode::Node(cbvav.PlenumMixerInletAirNode).MassFlowRate, 0.00001); EXPECT_NEAR(DataLoopNode::Node(cbvav.PlenumMixerInletAirNode).MassFlowRate, 0.402, 0.001); systemFlow = DataLoopNode::Node(cbvav.PlenumMixerInletAirNode).MassFlowRate + DataLoopNode::Node(cbvav.AirOutNode).MassFlowRate; EXPECT_NEAR(systemFlow, cbvav.MaxHeatAirMassFlow, 0.0001); diff --git a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc index 7e48532a3e7..92b304fa4d7 100644 --- a/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc +++ b/tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc @@ -92,6 +92,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace DXCoils; @@ -138,20 +139,20 @@ class AirLoopFixture : public EnergyPlusFixture { EnergyPlusFixture::SetUp(); // Sets up the base fixture first. - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); // initialize StdRhoAir + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize StdRhoAir DataEnvironment::OutBaroPress = 101325.0; DataSizing::DesDayWeath.allocate(1); DataSizing::DesDayWeath(1).Temp.allocate(1); DataSizing::DesDayWeath(1).Temp(1) = 35.0; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::OutDryBulbTemp = 35.0; DataEnvironment::OutHumRat = 0.012; DataEnvironment::OutWetBulbTemp = - Psychrometrics::PsyTwbFnTdbWPb(state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat, DataEnvironment::StdPressureSeaLevel); + Psychrometrics::PsyTwbFnTdbWPb(*state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat, DataEnvironment::StdPressureSeaLevel); DataEnvironment::OutBaroPress = 101325; // sea level DataZoneEquipment::ZoneEquipInputsFilled = true; // denotes zone equipment has been read in - int numZones = state.dataGlobal->NumOfZones = 5; + int numZones = state->dataGlobal->NumOfZones = 5; int numAirloops = 5; DataLoopNode::Node.allocate(50); DataLoopNode::NodeID.allocate(50); @@ -193,22 +194,22 @@ class AirLoopFixture : public EnergyPlusFixture DataSizing::NumSysSizInput = 1; DataSizing::SysSizInput.allocate(1); DataSizing::SysSizInput(1).AirLoopNum = 1; - state.dataCurveManager->NumCurves = 10; - state.dataCurveManager->PerfCurve.allocate(10); - state.dataCurveManager->PerfCurve(1).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(1).CurveType = CurveTypeEnum::Linear; - state.dataCurveManager->PerfCurve(1).Coeff1 = 1.0; - state.dataCurveManager->PerfCurve(1).CurveMax = 1.0; - state.dataCurveManager->PerfCurve(2).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(2).CurveType = CurveTypeEnum::Linear; - state.dataCurveManager->PerfCurve(2).Coeff1 = 1.0; - state.dataCurveManager->PerfCurve(2).CurveMax = 1.0; + state->dataCurveManager->NumCurves = 10; + state->dataCurveManager->PerfCurve.allocate(10); + state->dataCurveManager->PerfCurve(1).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(1).CurveType = CurveTypeEnum::Linear; + state->dataCurveManager->PerfCurve(1).Coeff1 = 1.0; + state->dataCurveManager->PerfCurve(1).CurveMax = 1.0; + state->dataCurveManager->PerfCurve(2).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(2).CurveType = CurveTypeEnum::Linear; + state->dataCurveManager->PerfCurve(2).Coeff1 = 1.0; + state->dataCurveManager->PerfCurve(2).CurveMax = 1.0; int NumAirLoops = DataHVACGlobals::NumPrimaryAirSys = 1; // allocate to 1 air loop and adjust/resize as needed - state.dataAirSystemsData->PrimaryAirSystems.allocate(NumAirLoops); + state->dataAirSystemsData->PrimaryAirSystems.allocate(NumAirLoops); int thisAirLoop = 1; - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); ZoneSysEnergyDemand.allocate(numZones); @@ -305,18 +306,18 @@ class AirLoopFixture : public EnergyPlusFixture finalSysSizing.MixHumRatAtCoolPeak = 0.009; // set up air loop - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).NumInletBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).InletBranchNum.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).InletBranchNum(1) = 1; - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).NumOutletBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).OutletBranchNum.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).OutletBranchNum(1) = 1; - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch(1).Comp(1).Name = "VRFTU1"; - state.dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch(1).Comp(1).TypeOf = "ZONEHVAC:TERMINALUNIT:VARIABLEREFRIGERANTFLOW"; + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).NumInletBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).InletBranchNum.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).InletBranchNum(1) = 1; + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).NumOutletBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).OutletBranchNum.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).OutletBranchNum(1) = 1; + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch(1).Comp(1).Name = "VRFTU1"; + state->dataAirSystemsData->PrimaryAirSystems(thisAirLoop).Branch(1).Comp(1).TypeOf = "ZONEHVAC:TERMINALUNIT:VARIABLEREFRIGERANTFLOW"; // set up plant loop for water equipment DataPlant::TotNumLoops = 2; @@ -530,7 +531,7 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) { static std::string const RoutineName("VRF_SysModel_inAirloop"); - StdRhoAir = PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); int curSysNum = DataSizing::CurSysNum = 1; int curZoneNum = 1; int curTUNum = 1; @@ -539,7 +540,7 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) HVACVariableRefrigerantFlow::GetVRFInputFlag = false; DXCoils::GetCoilsInputFlag = false; // trigger a mining function (will bypass GetInput) - int ZoneInletAirNode = GetVRFTUZoneInletAirNode(state, 1); + int ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, 1); auto &thisTU(HVACVariableRefrigerantFlow::VRFTU(curTUNum)); // node number set up in fixture EXPECT_EQ(ZoneInletAirNode, thisTU.VRFTUOutletNodeNum); @@ -553,7 +554,7 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) ZoneSysEnergyDemand(curZoneNum).RemainingOutputReqToCoolSP = 0.0; ZoneSysEnergyDemand(curZoneNum).RemainingOutputReqToHeatSP = 0.0; - state.dataAirLoop->AirLoopInputsFilled = true; + state->dataAirLoop->AirLoopInputsFilled = true; Node(VRF(curSysNum).CondenserNodeNum).Temp = 35.0; @@ -582,25 +583,25 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) DataLoopNode::Node(thisTU.VRFTUOutletNodeNum).TempSetPoint = 20.0; // select 20 C as TU outlet set point temperature - InitVRF(state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters + InitVRF(*state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters ASSERT_EQ(1, NumVRFCond); EXPECT_TRUE(thisTU.isInAirLoop); // initialization found TU in main air loop EXPECT_TRUE(thisTU.isSetPointControlled); // initialization found TU is set point controlled EXPECT_EQ(20.0, thisTU.coilTempSetPoint); // set point is initialized - SimVRF(state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); + SimVRF(*state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); EXPECT_EQ(0.0, QZnReq); tuInletNode.MassFlowRate = thisTU.MaxCoolAirMassFlow; // set mass flow rate at TU inlet - InitVRF(state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); + InitVRF(*state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); EXPECT_LT(QZnReq, 0.0); // cooling load exists EXPECT_TRUE(thisTU.coolSPActive); // cooling set point control active EXPECT_NEAR(DataLoopNode::Node(thisTU.VRFTUOutletNodeNum).Temp, 24.0, 0.01); // verify outlet node is not at set point = 20 - SimVRF(state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); + SimVRF(*state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); EXPECT_LT(SysOutputProvided, 0.0); EXPECT_NEAR(DataLoopNode::Node(thisTU.VRFTUOutletNodeNum).Temp, thisTU.coilTempSetPoint, 0.01); EXPECT_NEAR(DataLoopNode::Node(thisTU.VRFTUOutletNodeNum).Temp, 20.0, 0.01); // TU outlet is at set point = 20 @@ -615,13 +616,13 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) Node(VRF(curSysNum).CondenserNodeNum).Temp = 10.0; Node(VRFTUOAMixerOANodeNum).Temp = 10.0; - InitVRF(state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); + InitVRF(*state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); EXPECT_GT(QZnReq, 0.0); // heating load exists EXPECT_FALSE(thisTU.coolSPActive); // verify cooling set point control is not active EXPECT_TRUE(thisTU.heatSPActive); // verify heating set point control is active EXPECT_NEAR(18.0, tuInletNode.Temp, 0.001); // verify TU inlet node = 18 EXPECT_NEAR(18.0, DataLoopNode::Node(thisTU.coolCoilAirInNode).Temp, 0.001); // verify cooling coil inlet node = 18 - SimVRF(state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); + SimVRF(*state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); EXPECT_GT(SysOutputProvided, 0.0); // TU provides heating EXPECT_NEAR(DataLoopNode::Node(thisTU.VRFTUOutletNodeNum).Temp, thisTU.coilTempSetPoint, 0.01); // TU outlet is at SP target EXPECT_NEAR(DataLoopNode::Node(thisTU.VRFTUOutletNodeNum).Temp, 20.0, 0.01); @@ -630,7 +631,7 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) thisTU.isSetPointControlled = false; thisTU.ZoneAirNode = 1; thisTU.ZoneNum = 1; - InitVRF(state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters + InitVRF(*state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters EXPECT_EQ(0.0, QZnReq); EXPECT_FALSE(CoolingLoad(curSysNum)); // verify no load on TU EXPECT_FALSE(HeatingLoad(curSysNum)); @@ -638,21 +639,21 @@ TEST_F(AirLoopFixture, VRF_SysModel_inAirloop) ZoneSysEnergyDemand(curZoneNum).RemainingOutputRequired = 1000.0; // set heating load ZoneSysEnergyDemand(curZoneNum).RemainingOutputReqToCoolSP = 2000.0; ZoneSysEnergyDemand(curZoneNum).RemainingOutputReqToHeatSP = 1000.0; - InitVRF(state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters + InitVRF(*state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters EXPECT_GT(QZnReq, 0.0); EXPECT_FALSE(CoolingLoad(curSysNum)); EXPECT_TRUE(HeatingLoad(curSysNum)); - SimVRF(state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); + SimVRF(*state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); EXPECT_NEAR(SysOutputProvided, QZnReq, 1.0); ZoneSysEnergyDemand(curZoneNum).RemainingOutputRequired = -1000.0; // set cooling load ZoneSysEnergyDemand(curZoneNum).RemainingOutputReqToCoolSP = -1000.0; ZoneSysEnergyDemand(curZoneNum).RemainingOutputReqToHeatSP = -2000.0; - InitVRF(state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters + InitVRF(*state, curTUNum, curZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters EXPECT_LT(QZnReq, 0.0); EXPECT_TRUE(CoolingLoad(curSysNum)); EXPECT_FALSE(HeatingLoad(curSysNum)); - SimVRF(state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); + SimVRF(*state, curTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); EXPECT_NEAR(SysOutputProvided, QZnReq, 1.0); } @@ -2244,19 +2245,19 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataSizing::CurZoneEqNum = 1; DataEnvironment::OutBaroPress = 101325; // sea level DataZoneEquipment::ZoneEquipInputsFilled = true; // denotes zone equipment has been read in - StdRhoAir = PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); // Read in IDF - ProcessScheduleInput(state); // read schedules - CurveManager::GetCurveInput(state); // read curves - FluidProperties::GetFluidPropertiesData(state); // read refrigerant properties + ProcessScheduleInput(*state); // read schedules + CurveManager::GetCurveInput(*state); // read curves + FluidProperties::GetFluidPropertiesData(*state); // read refrigerant properties // set up ZoneEquipConfig data - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataZoneEquipment::ZoneEquipConfig.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).IsControlled = true; DataZoneEquipment::ZoneEquipConfig(1).NumInletNodes = 1; @@ -2266,7 +2267,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) DataZoneEquipment::ZoneEquipConfig(1).InletNode(1) = 2; DataZoneEquipment::ZoneEquipConfig(1).ExhaustNode(1) = 1; - GetVRFInputData(state, ErrorsFound); // read VRF + GetVRFInputData(*state, ErrorsFound); // read VRF EXPECT_FALSE(ErrorsFound); // Check expected result from GetInput @@ -2294,7 +2295,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) DataEnvironment::OutDryBulbTemp = 10.35; // Run - Temperature = GetSupHeatTempRefrig(state, Refrigerant, Pressure, Enthalpy, TempLow, TempUp, RefrigIndex, CalledFrom); + Temperature = GetSupHeatTempRefrig(*state, Refrigerant, Pressure, Enthalpy, TempLow, TempUp, RefrigIndex, CalledFrom); // Test EXPECT_NEAR(Temperature, 44.5, 0.5); @@ -2328,7 +2329,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) DataEnvironment::OutDryBulbTemp = 10.35; // Run - VRF(VRFCond).VRFHR_OU_HR_Mode(state, + VRF(VRFCond).VRFHR_OU_HR_Mode(*state, h_IU_evap_in, h_comp_out, Q_c_TU_PL, @@ -2375,7 +2376,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) // Run C_cap_operation = - VRF(VRFCond).VRFOU_CapModFactor(state, h_comp_in_real, h_evap_in_real, P_evap_real, T_comp_in_real, T_comp_in_rate, T_cond_out_rate); + VRF(VRFCond).VRFOU_CapModFactor(*state, h_comp_in_real, h_evap_in_real, P_evap_real, T_comp_in_real, T_comp_in_rate, T_cond_out_rate); // Test EXPECT_NEAR(0.879, C_cap_operation, 0.005); @@ -2396,7 +2397,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) Real64 CompSpdActual; // Actual compressor running speed [rps] // Run - VRF(VRFCond).VRFOU_CompSpd(state, Q_req, FlagEvapMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); + VRF(VRFCond).VRFOU_CompSpd(*state, Q_req, FlagEvapMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); // Test EXPECT_NEAR(1295, CompSpdActual, 5); @@ -2414,7 +2415,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) Real64 CompSpdActual; // Actual compressor running speed [rps] // Run - VRF(VRFCond).VRFOU_CompSpd(state, Q_req, FlagCondMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); + VRF(VRFCond).VRFOU_CompSpd(*state, Q_req, FlagCondMode, T_suction, T_discharge, h_IU_evap_in, h_comp_in, CompSpdActual); // Test EXPECT_NEAR(950, CompSpdActual, 5); @@ -2436,7 +2437,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) Real64 Ncomp; // Compressor power [W] // Run - VRF(VRFCond).VRFOU_CompCap(state, CompSpdActual, T_suction, T_discharge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp); + VRF(VRFCond).VRFOU_CompCap(*state, CompSpdActual, T_suction, T_discharge, h_IU_evap_in, h_comp_in, Q_c_tot, Ncomp); // Test EXPECT_NEAR(6990, Q_c_tot, 10); @@ -2464,7 +2465,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor) Real64 CompSpdActual; // Actual compressor running speed [rps] // Run - VRF(VRFCond).VRFOU_CalcCompH(state, + VRF(VRFCond).VRFOU_CalcCompH(*state, TU_load, T_suction, T_discharge, Pipe_h_out_ave, IUMaxCondTemp, MinOutdoorUnitTe, Tfs, Pipe_Q, OUEvapHeatExtract, CompSpdActual, Ncomp); // Test @@ -2529,7 +2530,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) Tdischarge = 36; // Run - Q_h_OU = VRF(VRFCond).VRFOU_Cap(state, FlagCondMode, Tdischarge, SC, m_air, OutDryBulbTemp, OutHumRat); + Q_h_OU = VRF(VRFCond).VRFOU_Cap(*state, FlagCondMode, Tdischarge, SC, m_air, OutDryBulbTemp, OutHumRat); // Test EXPECT_NEAR(27551, Q_h_OU, 10); @@ -2546,7 +2547,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Coil) Tsuction = -3; // Run - Q_c_OU = VRF(VRFCond).VRFOU_Cap(state, FlagEvapMode, Tsuction, SH, m_air, OutDryBulbTemp, OutHumRat); + Q_c_OU = VRF(VRFCond).VRFOU_Cap(*state, FlagEvapMode, Tsuction, SH, m_air, OutDryBulbTemp, OutHumRat); // Test EXPECT_NEAR(24456, Q_c_OU, 10); @@ -2566,7 +2567,7 @@ SC = 1; Tdischarge = 36; // Run -m_air = VRF(VRFCond).VRFOU_FlowRate(state, FlagCondMode, Tdischarge, SC, Q_h_OU, OutDryBulbTemp, OutHumRat); +m_air = VRF(VRFCond).VRFOU_FlowRate(*state, FlagCondMode, Tdischarge, SC, Q_h_OU, OutDryBulbTemp, OutHumRat); // Test EXPECT_NEAR(3.6, m_air, 0.01); @@ -2583,7 +2584,7 @@ EXPECT_NEAR(3.6, m_air, 0.01); Tsuction = -3; // Run - m_air = VRF(VRFCond).VRFOU_FlowRate(state, FlagEvapMode, Tsuction, SH, Q_c_OU, OutDryBulbTemp, OutHumRat); + m_air = VRF(VRFCond).VRFOU_FlowRate(*state, FlagEvapMode, Tsuction, SH, Q_c_OU, OutDryBulbTemp, OutHumRat); // Test EXPECT_NEAR(3.6, m_air, 0.01); @@ -2604,7 +2605,7 @@ OutHumRat = 0.0146; SC = 1; // Run -VRF(VRFCond).VRFOU_TeTc(state, FlagCondMode, Q_h_OU, SC, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tdischarge); +VRF(VRFCond).VRFOU_TeTc(*state, FlagCondMode, Q_h_OU, SC, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tdischarge); // Test EXPECT_NEAR(36, Tdischarge, 0.05); @@ -2622,7 +2623,7 @@ EXPECT_NEAR(36, Tdischarge, 0.05); Tsuction = -3; // Run - VRF(VRFCond).VRFOU_TeTc(state, FlagEvapMode, Q_c_OU, SH, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tsuction); + VRF(VRFCond).VRFOU_TeTc(*state, FlagEvapMode, Q_c_OU, SH, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress, temp, Tsuction); // Test EXPECT_NEAR(-3, Tsuction, 0.05); @@ -2645,7 +2646,7 @@ EXPECT_NEAR(36, Tdischarge, 0.05); Tdischarge = 36; // Run - SC = VRF(VRFCond).VRFOU_SCSH(state, FlagCondMode, Q_h_OU, Tdischarge, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); + SC = VRF(VRFCond).VRFOU_SCSH(*state, FlagCondMode, Q_h_OU, Tdischarge, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); // Test EXPECT_NEAR(1, SC, 0.01); @@ -2662,7 +2663,7 @@ EXPECT_NEAR(36, Tdischarge, 0.05); Tsuction = -3; // Run - SH = VRF(VRFCond).VRFOU_SCSH(state, FlagEvapMode, Q_c_OU, Tsuction, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); + SH = VRF(VRFCond).VRFOU_SCSH(*state, FlagEvapMode, Q_c_OU, Tsuction, m_air, OutDryBulbTemp, OutHumRat, OutBaroPress); // Test EXPECT_NEAR(1, SH, 0.01); @@ -2703,7 +2704,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_GetCoilInput) ASSERT_TRUE(process_idf(idf_objects)); // Run the method - GetDXCoils(state); + GetDXCoils(*state); // Check the results ASSERT_EQ(1, NumDXCoils); @@ -2731,8 +2732,8 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CompResidual) Array1D Par; // Allocate - state.dataCurveManager->NumCurves = 1; // CurveManager::NumCurves - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->NumCurves = 1; // CurveManager::NumCurves + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); NumPar = 3; Par.allocate(NumPar); @@ -2743,26 +2744,26 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CompResidual) Par(3) = CurveNum; // Inputs: parameters - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 724.71125; // Coefficient1 Constant - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = -21.867868; // Coefficient2 x - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.52480042; // Coefficient3 x**2 - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = -17.043566; // Coefficient4 y - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = -.40346383; // Coefficient5 y**2 - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.29573589; // Coefficient6 x*y - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 15; // Minimum Value of x - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 65; // Maximum Value of x - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = -30; // Minimum Value of y - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 15; // Maximum Value of y + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Biquadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 724.71125; // Coefficient1 Constant + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = -21.867868; // Coefficient2 x + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.52480042; // Coefficient3 x**2 + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = -17.043566; // Coefficient4 y + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = -.40346383; // Coefficient5 y**2 + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = 0.29573589; // Coefficient6 x*y + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 15; // Minimum Value of x + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 65; // Maximum Value of x + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = -30; // Minimum Value of y + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 15; // Maximum Value of y // Run and Check - double CompResidual = HVACVariableRefrigerantFlow::CompResidual_FluidTCtrl(state, Te, Par); + double CompResidual = HVACVariableRefrigerantFlow::CompResidual_FluidTCtrl(*state, Te, Par); EXPECT_NEAR(1.652, CompResidual, 0.005); // Clean up - state.dataCurveManager->PerfCurve.deallocate(); + state->dataCurveManager->PerfCurve.deallocate(); Par.deallocate(); } @@ -2909,7 +2910,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CalcVRFIUAirFlow) DXCoil(CoolCoilIndex).InletAirHumRat = 8.4682e-3; DXCoil(CoolCoilIndex).InletAirEnthalpy = 47259.78; - ControlVRFIUCoil(state, + ControlVRFIUCoil(*state, CoolCoilIndex, ZoneSysEnergyDemand(ZoneIndex).OutputRequiredToCoolingSP, 25.5553, @@ -2939,7 +2940,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_CalcVRFIUAirFlow) DXCoil(HeatCoilIndex).InletAirHumRat = 4.1053e-3; DXCoil(HeatCoilIndex).InletAirEnthalpy = 30755.6253; - ControlVRFIUCoil(state, + ControlVRFIUCoil(*state, HeatCoilIndex, ZoneSysEnergyDemand(ZoneIndex).OutputRequiredToHeatingSP, 20.2362, @@ -3702,11 +3703,11 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataSizing::CurZoneEqNum = 1; DataEnvironment::OutBaroPress = 101325; // sea level DataZoneEquipment::ZoneEquipInputsFilled = true; // denotes zone equipment has been read in - StdRhoAir = PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); ZoneEqSizing.allocate(1); DataSizing::ZoneSizingRunDone = true; ZoneEqSizing(CurZoneEqNum).DesignSizeFromParent = false; @@ -3719,13 +3720,13 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) ZoneSysEnergyDemand.allocate(1); - ProcessScheduleInput(state); // read schedules - GetCurveInput(state); // read curves - GetZoneData(state, ErrorsFound); // read zone data + ProcessScheduleInput(*state); // read schedules + GetCurveInput(*state); // read curves + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - GetZoneEquipmentData(state); // read equipment list and connections - ZoneInletAirNode = GetVRFTUZoneInletAirNode(state, VRFTUNum); // trigger GetVRFInput by calling a mining function + GetZoneEquipmentData(*state); // read equipment list and connections + ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); // trigger GetVRFInput by calling a mining function Schedule(VRF(VRFCond).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // enable the terminal unit @@ -3737,7 +3738,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = 0.0; // set load = 0 ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = 0.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = 0.0; - state.dataAirLoop->AirLoopInputsFilled = true; + state->dataAirLoop->AirLoopInputsFilled = true; FinalZoneSizing(CurZoneEqNum).ZoneRetTempAtCoolPeak = 26.66667; FinalZoneSizing(CurZoneEqNum).ZoneHumRatAtCoolPeak = 0.01117049470250416; // AHRI condition at 80 F db / 67 F wb @@ -3758,9 +3759,9 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) int OAUnitNum = 0; Real64 OAUCoilOutTemp = 0.0; bool ZoneEquipment = true; - state.dataAirLoop->AirLoopInputsFilled = true; + state->dataAirLoop->AirLoopInputsFilled = true; - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -3794,7 +3795,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) VRF(VRFCond).HeatingCapacity + 1000.0; // simulates a dual Tstat with load to cooling SP > load to heating SP ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = VRF(VRFCond).HeatingCapacity; - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -3817,7 +3818,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) Real64 outHR = Node(VRF(VRFCond).CondenserNodeNum).HumRat; // adjust for defrost factors Real64 outT = 0.82 * Node(VRF(VRFCond).CondenserNodeNum).Temp - 8.589; - Real64 OutdoorCoildw = max(1.0e-6, (outHR - PsyWFnTdpPb(state, outT, DataEnvironment::OutBaroPress))); + Real64 OutdoorCoildw = max(1.0e-6, (outHR - PsyWFnTdpPb(*state, outT, DataEnvironment::OutBaroPress))); Real64 FractionalDefrostTime = VRF(VRFCond).DefrostFraction; Real64 LoadDueToDefrost = (0.01 * FractionalDefrostTime) * (7.222 - Node(VRF(VRFCond).CondenserNodeNum).Temp) * (VRF(VRFCond).HeatingCapacity / 1.01667); @@ -3825,13 +3826,13 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) Real64 InputPowerMultiplier = 0.90 - 36.45 * OutdoorCoildw; // setup curve results Real64 InletAirDryBulbC = DXCoils::DXCoilHeatInletAirDBTemp(DXHeatingCoilIndex); // load weighted average but only 1 coil here - Real64 OATatHeatCapBoundary = CurveValue(state, VRF(VRFCond).HeatBoundaryCurvePtr, InletAirDryBulbC); - Real64 OATatHeatEIRBoundary = CurveValue(state, VRF(VRFCond).EIRHeatBoundaryCurvePtr, InletAirDryBulbC); - Real64 TotHeatCapTempModFacLo = CurveValue(state, VRF(VRFCond).HeatCapFT, InletAirDryBulbC, outWB); - Real64 TotHeatEIRTempModFacLo = CurveValue(state, VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, outWB); - Real64 TotHeatCapTempModFacHi = CurveValue(state, VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, outWB); - Real64 TotHeatEIRTempModFacHi = CurveValue(state, VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, outWB); - Real64 EIRFPLRModFac = CurveValue(state, VRF(VRFCond).HeatEIRFPLR1, max(VRF(VRFCond).MinPLR, VRF(VRFCond).VRFCondPLR)); + Real64 OATatHeatCapBoundary = CurveValue(*state, VRF(VRFCond).HeatBoundaryCurvePtr, InletAirDryBulbC); + Real64 OATatHeatEIRBoundary = CurveValue(*state, VRF(VRFCond).EIRHeatBoundaryCurvePtr, InletAirDryBulbC); + Real64 TotHeatCapTempModFacLo = CurveValue(*state, VRF(VRFCond).HeatCapFT, InletAirDryBulbC, outWB); + Real64 TotHeatEIRTempModFacLo = CurveValue(*state, VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, outWB); + Real64 TotHeatCapTempModFacHi = CurveValue(*state, VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, outWB); + Real64 TotHeatEIRTempModFacHi = CurveValue(*state, VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, outWB); + Real64 EIRFPLRModFac = CurveValue(*state, VRF(VRFCond).HeatEIRFPLR1, max(VRF(VRFCond).MinPLR, VRF(VRFCond).VRFCondPLR)); Real64 TotalCondHeatingCapacityLo = VRF(VRFCond).HeatingCapacity * HeatCombinationRatio(VRFCond) * TotHeatCapTempModFacLo * HeatingCapacityMultiplier; Real64 ElecHeatingPowerLo = @@ -3881,7 +3882,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) Node(VRFTU(VRFCond).VRFTUInletNodeNum).Temp = 20; // 20 C at 13 C WB (44.5 % RH) for indoor heating condition Node(VRFTU(VRFCond).VRFTUInletNodeNum).HumRat = 0.0064516; // need to set these so OA mixer will get proper mixed air condition Node(VRFTU(VRFCond).VRFTUInletNodeNum).Enthalpy = 36485.3142; - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -3896,13 +3897,13 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) outWB = Node(VRF(VRFCond).CondenserNodeNum).OutAirWetBulb; // no defrost adjustment to OA WB InletAirDryBulbC = DXCoils::DXCoilHeatInletAirDBTemp(DXHeatingCoilIndex); // load weighted average but only 1 coil here - OATatHeatCapBoundary = CurveValue(state, VRF(VRFCond).HeatBoundaryCurvePtr, InletAirDryBulbC); - OATatHeatEIRBoundary = CurveValue(state, VRF(VRFCond).EIRHeatBoundaryCurvePtr, InletAirDryBulbC); - TotHeatCapTempModFacLo = CurveValue(state, VRF(VRFCond).HeatCapFT, InletAirDryBulbC, outWB); - TotHeatEIRTempModFacLo = CurveValue(state, VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, outWB); - TotHeatCapTempModFacHi = CurveValue(state, VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, outWB); - TotHeatEIRTempModFacHi = CurveValue(state, VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, outWB); - EIRFPLRModFac = CurveValue(state, VRF(VRFCond).HeatEIRFPLR1, max(VRF(VRFCond).MinPLR, VRF(VRFCond).VRFCondPLR)); // EIRFPLR1 is used when PLR <= 1 + OATatHeatCapBoundary = CurveValue(*state, VRF(VRFCond).HeatBoundaryCurvePtr, InletAirDryBulbC); + OATatHeatEIRBoundary = CurveValue(*state, VRF(VRFCond).EIRHeatBoundaryCurvePtr, InletAirDryBulbC); + TotHeatCapTempModFacLo = CurveValue(*state, VRF(VRFCond).HeatCapFT, InletAirDryBulbC, outWB); + TotHeatEIRTempModFacLo = CurveValue(*state, VRF(VRFCond).HeatEIRFT, InletAirDryBulbC, outWB); + TotHeatCapTempModFacHi = CurveValue(*state, VRF(VRFCond).HeatCapFTHi, InletAirDryBulbC, outWB); + TotHeatEIRTempModFacHi = CurveValue(*state, VRF(VRFCond).HeatEIRFTHi, InletAirDryBulbC, outWB); + EIRFPLRModFac = CurveValue(*state, VRF(VRFCond).HeatEIRFPLR1, max(VRF(VRFCond).MinPLR, VRF(VRFCond).VRFCondPLR)); // EIRFPLR1 is used when PLR <= 1 TotalCondHeatingCapacityLo = VRF(VRFCond).HeatingCapacity * HeatCombinationRatio(VRFCond) * TotHeatCapTempModFacLo * HeatingCapacityMultiplier; ElecHeatingPowerLo = VRF(VRFCond).RatedHeatingPower * TotHeatCapTempModFacLo * TotHeatEIRTempModFacLo * EIRFPLRModFac * InputPowerMultiplier; TotalCondHeatingCapacityHi = VRF(VRFCond).HeatingCapacity * HeatCombinationRatio(VRFCond) * TotHeatCapTempModFacHi * HeatingCapacityMultiplier; @@ -3967,7 +3968,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) VRF(VRFCond).MasterZoneTUIndex = 0; VRF(VRFCond).ThermostatPriority = ThermostatOffsetPriority; - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -3986,12 +3987,12 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) // test that correct performance curve is used (i.e., lo or hi performance curves based on OAT) int DXCoolingCoilIndex = 1; Real64 InletAirWetBulbC = DXCoils::DXCoilCoolInletAirWBTemp(DXCoolingCoilIndex); // load weighted average but only 1 coil here - Real64 OATatCoolCapBoundary = CurveValue(state, VRF(VRFCond).CoolBoundaryCurvePtr, InletAirWetBulbC); - Real64 OATatCoolEIRBoundary = CurveValue(state, VRF(VRFCond).EIRCoolBoundaryCurvePtr, InletAirWetBulbC); - Real64 TotCoolCapTempModFacLo = CurveValue(state, VRF(VRFCond).CoolCapFT, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); - Real64 TotCoolEIRTempModFacLo = CurveValue(state, VRF(VRFCond).CoolEIRFT, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); - Real64 TotCoolCapTempModFacHi = CurveValue(state, VRF(VRFCond).CoolCapFTHi, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); - Real64 TotCoolEIRTempModFacHi = CurveValue(state, VRF(VRFCond).CoolEIRFTHi, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); + Real64 OATatCoolCapBoundary = CurveValue(*state, VRF(VRFCond).CoolBoundaryCurvePtr, InletAirWetBulbC); + Real64 OATatCoolEIRBoundary = CurveValue(*state, VRF(VRFCond).EIRCoolBoundaryCurvePtr, InletAirWetBulbC); + Real64 TotCoolCapTempModFacLo = CurveValue(*state, VRF(VRFCond).CoolCapFT, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); + Real64 TotCoolEIRTempModFacLo = CurveValue(*state, VRF(VRFCond).CoolEIRFT, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); + Real64 TotCoolCapTempModFacHi = CurveValue(*state, VRF(VRFCond).CoolCapFTHi, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); + Real64 TotCoolEIRTempModFacHi = CurveValue(*state, VRF(VRFCond).CoolEIRFTHi, InletAirWetBulbC, Node(VRF(VRFCond).CondenserNodeNum).Temp); Real64 TotalCondCoolingCapacityLo = VRF(VRFCond).CoolingCapacity * CoolCombinationRatio(VRFCond) * TotCoolCapTempModFacLo; Real64 ElecCoolingPowerLo = VRF(VRFCond).RatedCoolingPower * TotCoolCapTempModFacLo * TotCoolEIRTempModFacLo; Real64 TotalCondCoolingCapacityHi = VRF(VRFCond).CoolingCapacity * CoolCombinationRatio(VRFCond) * TotCoolCapTempModFacHi; @@ -4039,7 +4040,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = 500.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = 400.0; Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set constant fan operating mode - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -4063,7 +4064,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = 900.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = 800.0; Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set constant fan operating mode - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -4080,7 +4081,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) Node(VRF(VRFCond).CondenserNodeNum).Temp = 21.0; // outside the heating temperature range (-20 to 20) of VRF outdoor unit Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 21.0; - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -4099,7 +4100,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve) 0.0); // flow should be = 0 at no load flow rate for constant fan mode in this example Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 0.0; // set cycling fan operating mode - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -4691,11 +4692,11 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_GetInputFailers) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataSizing::CurZoneEqNum = 1; DataEnvironment::OutBaroPress = 101325; // sea level DataZoneEquipment::ZoneEquipInputsFilled = true; // denotes zone equipment has been read in - StdRhoAir = PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); ZoneEqSizing.allocate(1); ZoneSizingRunDone = true; ZoneEqSizing(CurZoneEqNum).DesignSizeFromParent = false; @@ -4708,13 +4709,13 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_GetInputFailers) ZoneSysEnergyDemand.allocate(1); - ProcessScheduleInput(state); // read schedules - GetCurveInput(state); // read curves - GetZoneData(state, ErrorsFound); // read zone data + ProcessScheduleInput(*state); // read schedules + GetCurveInput(*state); // read curves + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - GetZoneEquipmentData(state); // read equipment list and connections - GetVRFInputData(state, ErrorsFound); + GetZoneEquipmentData(*state); // read equipment list and connections + GetVRFInputData(*state, ErrorsFound); EXPECT_TRUE(ErrorsFound); EXPECT_EQ(0, VRFTU(VRFTUNum).VRFSysNum); EXPECT_EQ(1, VRFTU(VRFTUNum).ZoneNum); @@ -5541,11 +5542,11 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataSizing::CurZoneEqNum = 1; DataEnvironment::OutBaroPress = 101325; // sea level DataZoneEquipment::ZoneEquipInputsFilled = true; // denotes zone equipment has been read in - DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); DataSizing::ZoneEqSizing.allocate(1); DataSizing::ZoneSizingRunDone = true; DataSizing::ZoneEqSizing(CurZoneEqNum).DesignSizeFromParent = false; @@ -5559,26 +5560,26 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); Array2D DummyArray; // Sky temperature - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 60 / state.dataGlobal->NumOfTimeStepInHour; - DummyArray.allocate(state.dataGlobal->NumOfTimeStepInHour, 24); + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + DummyArray.allocate(state->dataGlobal->NumOfTimeStepInHour, 24); DummyArray = 0.0; - ScheduleManager::GetScheduleValuesForDay(state, 1, DummyArray, 58, 3); + ScheduleManager::GetScheduleValuesForDay(*state, 1, DummyArray, 58, 3); - CurveManager::GetCurveInput(state); // read curves - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + CurveManager::GetCurveInput(*state); // read curves + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData(state); // read equipment list and connections + DataZoneEquipment::GetZoneEquipmentData(*state); // read equipment list and connections - BranchInputManager::ManageBranchInput(state); + BranchInputManager::ManageBranchInput(*state); // Get plant loop data - PlantManager::GetPlantLoopData(state); - PlantManager::GetPlantInput(state); + PlantManager::GetPlantLoopData(*state); + PlantManager::GetPlantInput(*state); HVACVariableRefrigerantFlow::MyEnvrnFlag = true; - ZoneInletAirNode = GetVRFTUZoneInletAirNode(state, VRFTUNum); // trigger GetVRFInput by calling a mining function - state.dataAirLoop->AirLoopInputsFilled = true; + ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); // trigger GetVRFInput by calling a mining function + state->dataAirLoop->AirLoopInputsFilled = true; Schedule(VRF(VRFCond).SchedPtr).CurrentValue = 1.0; // enable the VRF condenser Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; // enable the terminal unit @@ -5605,9 +5606,9 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) DataSizing::FinalZoneSizing(CurZoneEqNum).CoolDesTemp = 13.1; // 55.58 F DataSizing::FinalZoneSizing(CurZoneEqNum).CoolDesHumRat = 0.009297628698818194; // humrat at 12.77777 C db / 12.6 C wb - SizingManager::GetPlantSizingInput(state); + SizingManager::GetPlantSizingInput(*state); PlantManager::InitOneTimePlantSizingInfo(1); - PlantManager::SizePlantLoop(state, 1, true); + PlantManager::SizePlantLoop(*state, 1, true); PlantManager::InitLoopEquip = true; // call air-side VRF bool HeatingActive = false; @@ -5616,7 +5617,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) Real64 OAUCoilOutTemp = 0.0; bool ZoneEquipment = true; - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -5630,16 +5631,16 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) LatOutputProvided); // call plant-side VRF - auto vrfCondPtr = HVACVariableRefrigerantFlow::VRFCondenserEquipment::factory(state, VRF(VRFCond).Name); + auto vrfCondPtr = HVACVariableRefrigerantFlow::VRFCondenserEquipment::factory(*state, VRF(VRFCond).Name); PlantLocation dummyLoc; dummyLoc.loopNum = dynamic_cast(vrfCondPtr)->SourceLoopNum; - vrfCondPtr->onInitLoopEquip(state, dummyLoc); + vrfCondPtr->onInitLoopEquip(*state, dummyLoc); DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = -1000.0; // set cooling load DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = -1000.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = -2000.0; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataLoopNode::Node(VRFTU(VRFTUNum).ZoneAirNode).Temp = 24.0; DataLoopNode::Node(VRFTU(VRFTUNum).ZoneAirNode).HumRat = 0.0093; DataLoopNode::Node(VRFTU(VRFTUNum).ZoneAirNode).Enthalpy = 47794.1; @@ -5650,7 +5651,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) DataEnvironment::OutHumRat = 0.017767; // 50% RH DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::OutWetBulbTemp = 26.045; - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -5665,15 +5666,15 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) EXPECT_TRUE(VRF(VRFCond).VRFCondPLR > 0.0); EXPECT_NEAR(SysOutputProvided, ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP, 1.0); - rho = GetDensityGlycol(state, + rho = GetDensityGlycol(*state, PlantLoop(VRF(VRFCond).SourceLoopNum).FluidName, PlantSizData(1).ExitTemp, PlantLoop(VRF(VRFCond).SourceLoopNum).FluidIndex, RoutineName); - Cp = GetSpecificHeatGlycol(state, + Cp = GetSpecificHeatGlycol(*state, PlantLoop(VRF(VRFCond).SourceLoopNum).FluidName, PlantSizData(1).ExitTemp, PlantLoop(VRF(VRFCond).SourceLoopNum).FluidIndex, RoutineName); CondVolFlowRate = max(VRF(VRFCond).CoolingCapacity, VRF(VRFCond).HeatingCapacity) / (PlantSizData(1).DeltaT * Cp * rho); EXPECT_DOUBLE_EQ(CondVolFlowRate, VRF(VRFCond).WaterCondVolFlowRate); - rho = GetDensityGlycol(state, + rho = GetDensityGlycol(*state, PlantLoop(VRF(VRFCond).SourceLoopNum).FluidName, DataGlobalConstants::InitConvTemp(), PlantLoop(VRF(VRFCond).SourceLoopNum).FluidIndex, RoutineName); EXPECT_DOUBLE_EQ(VRF(VRFCond).WaterCondenserDesignMassFlow, (VRF(VRFCond).WaterCondVolFlowRate * rho)); @@ -5695,7 +5696,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) DataEnvironment::OutHumRat = 0.00269; // 50% RH DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::OutWetBulbTemp = 1.34678; - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -5717,7 +5718,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) Node(VRF(VRFCond).CondenserNodeNum).Temp = 21.0; // outside the heating temperature range (-20 to 20) of VRF outdoor unit Node(VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum).Temp = 21.0; - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -5737,7 +5738,7 @@ TEST_F(EnergyPlusFixture, VRFTest_SysCurve_WaterCooled) DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set constant fan operating mode - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -6427,24 +6428,24 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NoLoad_OAMassFlowRateTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataSizing::CurZoneEqNum = 1; DataEnvironment::OutBaroPress = 101325; // sea level DataZoneEquipment::ZoneEquipInputsFilled = true; // denotes zone equipment has been read in - DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); - state.dataGlobal->SysSizingCalc = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); + state->dataGlobal->SysSizingCalc = true; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataSizing::ZoneEqSizing.allocate(1); - CurveManager::GetCurveInput(state); // read curves - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + CurveManager::GetCurveInput(*state); // read curves + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData(state); // read equipment list and connections - state.dataAirLoop->AirLoopInputsFilled = true; + DataZoneEquipment::GetZoneEquipmentData(*state); // read equipment list and connections + state->dataAirLoop->AirLoopInputsFilled = true; HVACVariableRefrigerantFlow::MyEnvrnFlag = true; - ZoneInletAirNode = GetVRFTUZoneInletAirNode(state, VRFTUNum); // trigger GetVRFInput by calling a mining function + ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); // trigger GetVRFInput by calling a mining function OutsideAirNode = VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; // outside air air inlet node num DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = 0.0; // No load @@ -6453,10 +6454,10 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NoLoad_OAMassFlowRateTest) QZnReq = DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired; // No load // Initialize terminal unit Schedule(VRFTU(VRFTUNum).FanOpModeSchedPtr).CurrentValue = 1.0; // set continuous fan operating mode - InitVRF(state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters + InitVRF(*state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters ASSERT_EQ(VRFTU(VRFTUNum).OpMode, DataHVACGlobals::ContFanCycCoil); // continuous fan cycling coil operating mode // Set average OA flow rate when there in no load for cont. fan cyc. coil operating mode - SetAverageAirFlow(state, VRFTUNum, PartLoadRatio, OnOffAirFlowRatio); + SetAverageAirFlow(*state, VRFTUNum, PartLoadRatio, OnOffAirFlowRatio); AverageOAMassFlow = DataEnvironment::StdRhoAir * VRFTU(VRFTUNum).NoCoolHeatOutAirVolFlow; EXPECT_EQ(AverageOAMassFlow, Node(OutsideAirNode).MassFlowRate); } @@ -6500,7 +6501,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) }); ASSERT_TRUE(process_idf(idf_objects)); - CurveManager::GetCurveInput(state); + CurveManager::GetCurveInput(*state); int VRFCond = 1; VRF.allocate(1); @@ -6565,9 +6566,9 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) } // set up environment - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->CurrentTime = 0.25; - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->CurrentTime = 0.25; + state->dataGlobal->TimeStepZone = 0.25; DataHVACGlobals::SysTimeElapsed = 0.0; DataEnvironment::OutDryBulbTemp = 35.0; DataEnvironment::OutHumRat = 0.01; @@ -6586,7 +6587,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) TerminalUnitList(1).TotalHeatLoad(4) = 0.0; TerminalUnitList(1).TotalHeatLoad(5) = 0.0; - CalcVRFCondenser(state, VRFCond); + CalcVRFCondenser(*state, VRFCond); EXPECT_DOUBLE_EQ(VRF(VRFCond).ElecCoolingPower, 0.0); EXPECT_DOUBLE_EQ(VRF(VRFCond).ElecHeatingPower, 0.0); @@ -6620,7 +6621,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) TerminalUnitList(1).TotalCoolLoad(4) = 1000.0; TerminalUnitList(1).TotalCoolLoad(5) = 1000.0; - CalcVRFCondenser(state, VRFCond); + CalcVRFCondenser(*state, VRFCond); EXPECT_FALSE(VRF(VRFCond).HRHeatingActive); EXPECT_FALSE(VRF(VRFCond).HRCoolingActive); EXPECT_EQ(VRF(VRFCond).TotalCoolingCapacity, 5000.0); @@ -6651,7 +6652,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) TerminalUnitList(1).TotalHeatLoad(4) = 1000.0; TerminalUnitList(1).TotalHeatLoad(5) = 1000.0; - CalcVRFCondenser(state, VRFCond); + CalcVRFCondenser(*state, VRFCond); EXPECT_FALSE(VRF(VRFCond).HRHeatingActive); EXPECT_FALSE(VRF(VRFCond).HRCoolingActive); EXPECT_EQ(VRF(VRFCond).TotalCoolingCapacity, 0.0); @@ -6667,7 +6668,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR); // increment time step - state.dataGlobal->CurrentTime += state.dataGlobal->TimeStepZone; // 0.5 + state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 0.5 // set TU's to request both cooling and heating TerminalUnitList(1).TotalCoolLoad(1) = 0.0; TerminalUnitList(1).HRCoolRequest(1) = false; @@ -6694,7 +6695,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) // set heat recovery time constant to non-zero value (means mode change will degrade performance) VRF(VRFCond).HRHeatCapTC = 0.25; // 15 min exponential rise // last operating mode was heating - CalcVRFCondenser(state, VRFCond); + CalcVRFCondenser(*state, VRFCond); EXPECT_TRUE(VRF(VRFCond).HRHeatingActive); EXPECT_FALSE(VRF(VRFCond).HRCoolingActive); EXPECT_EQ(VRF(VRFCond).TotalCoolingCapacity, 0.0); @@ -6721,9 +6722,9 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) LastModeCooling(VRFCond) = true; LastModeHeating(VRFCond) = false; - state.dataGlobal->CurrentTime += state.dataGlobal->TimeStepZone; // 0.75 - CalcVRFCondenser saves last time stamp for use in exponential curve, increment by + state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 0.75 - CalcVRFCondenser saves last time stamp for use in exponential curve, increment by // 1 time step to get same answer - CalcVRFCondenser(state, VRFCond); + CalcVRFCondenser(*state, VRFCond); EXPECT_TRUE(VRF(VRFCond).HRHeatingActive); EXPECT_FALSE(VRF(VRFCond).HRCoolingActive); EXPECT_EQ(VRF(VRFCond).TotalCoolingCapacity, 0.0); @@ -6740,13 +6741,13 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) EXPECT_NEAR(HREIRAdjustment, 1.06321, 0.00001); // simulate again and see that power has exponential changed from previous time step - state.dataGlobal->CurrentTime += state.dataGlobal->TimeStepZone; // 1.0 + state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 1.0 CoolingLoad(VRFCond) = false; HeatingLoad(VRFCond) = true; LastModeCooling(VRFCond) = false; LastModeHeating(VRFCond) = true; - CalcVRFCondenser(state, VRFCond); + CalcVRFCondenser(*state, VRFCond); HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * VRF(VRFCond).SUMultiplier; @@ -6755,24 +6756,24 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest) EXPECT_NEAR(HREIRAdjustment, 1.08646, 0.00001); // will exponentially rise towards VRF( VRFCond ).HREIRFTHeatConst = 1.1 // simulate again and see that power has exponential changed from previous time step - state.dataGlobal->CurrentTime += state.dataGlobal->TimeStepZone; // 1.25 - CalcVRFCondenser(state, VRFCond); + state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 1.25 + CalcVRFCondenser(*state, VRFCond); HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * VRF(VRFCond).SUMultiplier; EXPECT_NEAR(VRF(VRFCond).SUMultiplier, 0.95021, 0.00001); // will exponentially rise towards 1.0 EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR * HREIRAdjustment); EXPECT_NEAR(HREIRAdjustment, 1.09502, 0.00001); // will exponentially rise towards VRF( VRFCond ).HREIRFTHeatConst = 1.1 // simulate again and see that power has exponential changed from previous time step - state.dataGlobal->CurrentTime += state.dataGlobal->TimeStepZone; // 1.5 - CalcVRFCondenser(state, VRFCond); + state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 1.5 + CalcVRFCondenser(*state, VRFCond); HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * VRF(VRFCond).SUMultiplier; EXPECT_NEAR(VRF(VRFCond).SUMultiplier, 0.98168, 0.00001); // will exponentially rise towards 1.0 EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR * HREIRAdjustment); EXPECT_NEAR(HREIRAdjustment, 1.09817, 0.00001); // will exponentially rise towards VRF( VRFCond ).HREIRFTHeatConst = 1.1 // simulate again and see that power has exponential changed from previous time step - state.dataGlobal->CurrentTime += state.dataGlobal->TimeStepZone; // 1.75 - CalcVRFCondenser(state, VRFCond); + state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 1.75 + CalcVRFCondenser(*state, VRFCond); HREIRAdjustment = HRInitialEIRFrac + (HREIRFTConst - HRInitialEIRFrac) * VRF(VRFCond).SUMultiplier; EXPECT_NEAR(VRF(VRFCond).SUMultiplier, 1.0, 0.00001); // will exponentially rise towards 1.0 EXPECT_EQ(VRF(VRFCond).ElecHeatingPower, VRF(VRFCond).RatedHeatingPower * VRF(VRFCond).VRFCondPLR * HREIRAdjustment); @@ -7853,13 +7854,13 @@ TEST_F(EnergyPlusFixture, VRFTU_SupplementalHeatingCoilGetInput) // get zone data bool ErrorsFound(false); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); // read equip list and connections - GetZoneEquipmentData(state); + GetZoneEquipmentData(*state); // get VRF terminal unit - GetVRFInput(state); + GetVRFInput(*state); auto &VRFTU_1(VRFTU(1)); // Check the results @@ -7931,7 +7932,7 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilElectric) HeatingCoils::CheckEquipName.dimension(HeatingCoils::NumHeatingCoils, true); HeatingCoils::ValidSourceType.dimension(HeatingCoils::NumHeatingCoils, true); - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; DataEnvironment::OutDryBulbTemp = 5.0; // init coil inlet condition DataLoopNode::Node(HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; @@ -7943,14 +7944,14 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilElectric) bool FirstHVACIteration(false); Real64 SuppHeatCoilLoad = 10000.0; // run supplemental heating coil - thisVRFTU.CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); + thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // check the coil load delivered EXPECT_EQ(10000.0, SuppHeatCoilLoad); EXPECT_EQ(10000.0, HeatingCoils::HeatingCoil(CoilNum).ElecUseRate); // test heating load larger than coil nominal capacity DataLoopNode::Node(HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; SuppHeatCoilLoad = 12000.0; - thisVRFTU.CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); + thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // delivered heat cannot exceed coil capacity EXPECT_EQ(10000.0, SuppHeatCoilLoad); EXPECT_EQ(10000.0, HeatingCoils::HeatingCoil(CoilNum).ElecUseRate); @@ -7995,7 +7996,7 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilFuel) HeatingCoils::CheckEquipName.dimension(HeatingCoils::NumHeatingCoils, true); HeatingCoils::ValidSourceType.dimension(HeatingCoils::NumHeatingCoils, true); - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; DataEnvironment::OutDryBulbTemp = 5.0; // init coil inlet condition DataLoopNode::Node(HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; @@ -8007,14 +8008,14 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilFuel) bool FirstHVACIteration(false); Real64 SuppHeatCoilLoad = 10000.0; // run supplemental heating coil - thisVRFTU.CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); + thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // check the coil load delivered EXPECT_EQ(10000.0, SuppHeatCoilLoad); EXPECT_EQ(10000.0, HeatingCoils::HeatingCoil(CoilNum).FuelUseRate); // test heating load larger than coil nominal capacity DataLoopNode::Node(HeatingCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; SuppHeatCoilLoad = 12000.0; - thisVRFTU.CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); + thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // delivered heat cannot exceed coil capacity EXPECT_EQ(10000.0, SuppHeatCoilLoad); EXPECT_EQ(10000.0, HeatingCoils::HeatingCoil(CoilNum).FuelUseRate); @@ -8046,31 +8047,31 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilWater) int CoilNum(1); DataLoopNode::Node.allocate(4); - state.dataWaterCoils->NumWaterCoils = 1; - state.dataWaterCoils->WaterCoil.allocate(state.dataWaterCoils->NumWaterCoils); - state.dataWaterCoils->WaterCoil(CoilNum).Name = thisVRFTU.SuppHeatCoilName; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilTypeA = "Heating"; - state.dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - - // state.dataWaterCoils->WaterCoil(CoilNum).FuelType_Num = DataGlobalConstants::ResourceType::Natural_Gas; - state.dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; - state.dataWaterCoils->WaterCoil(CoilNum).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = thisVRFTU.SuppHeatCoilFluidInletNode; - state.dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum = thisVRFTU.SuppHeatCoilFluidOutletNode; - - state.dataWaterCoils->WaterCoil(CoilNum).UACoil = 1000; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = 0.001; - - state.dataWaterCoils->GetWaterCoilsInputFlag = false; - - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopCompNum = 1; + state->dataWaterCoils->NumWaterCoils = 1; + state->dataWaterCoils->WaterCoil.allocate(state->dataWaterCoils->NumWaterCoils); + state->dataWaterCoils->WaterCoil(CoilNum).Name = thisVRFTU.SuppHeatCoilName; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilTypeA = "Heating"; + state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; + + // state->dataWaterCoils->WaterCoil(CoilNum).FuelType_Num = DataGlobalConstants::ResourceType::Natural_Gas; + state->dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; + state->dataWaterCoils->WaterCoil(CoilNum).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = thisVRFTU.SuppHeatCoilFluidInletNode; + state->dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum = thisVRFTU.SuppHeatCoilFluidOutletNode; + + state->dataWaterCoils->WaterCoil(CoilNum).UACoil = 1000; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = 0.001; + + state->dataWaterCoils->GetWaterCoilsInputFlag = false; + + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopCompNum = 1; NumPltSizInput = 1; PlantSizData.allocate(NumPltSizInput); @@ -8095,30 +8096,30 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilWater) PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "WATER"; PlantLoop(1).FluidIndex = 1; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(CoilNum).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - state.dataWaterCoils->CheckEquipName.dimension(state.dataWaterCoils->NumWaterCoils, true); - - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(CoilNum); - state.dataWaterCoils->MyUAAndFlowCalcFlag(CoilNum) = true; - state.dataWaterCoils->MySizeFlag.allocate(CoilNum); - state.dataWaterCoils->MySizeFlag(CoilNum) = true; - - state.dataGlobal->DoingSizing = true; - state.dataGlobal->SysSizingCalc = true; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(CoilNum).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + state->dataWaterCoils->CheckEquipName.dimension(state->dataWaterCoils->NumWaterCoils, true); + + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(CoilNum); + state->dataWaterCoils->MyUAAndFlowCalcFlag(CoilNum) = true; + state->dataWaterCoils->MySizeFlag.allocate(CoilNum); + state->dataWaterCoils->MySizeFlag(CoilNum) = true; + + state->dataGlobal->DoingSizing = true; + state->dataGlobal->SysSizingCalc = true; DataEnvironment::OutDryBulbTemp = 5.0; // init coil inlet condition - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).Temp = 15.0; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).HumRat = 0.0070; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).Enthalpy = - Psychrometrics::PsyHFnTdbW(DataLoopNode::Node(state.dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).Temp, - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).HumRat); + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).Temp = 15.0; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).HumRat = 0.0070; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).Enthalpy = + Psychrometrics::PsyHFnTdbW(DataLoopNode::Node(state->dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).Temp, + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum).HumRat); - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum).MassFlowRate = thisVRFTU.SuppHeatCoilFluidMaxFlow; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum).MassFlowRateMax = thisVRFTU.SuppHeatCoilFluidMaxFlow; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum).Temp = 60.0; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum).MassFlowRate = thisVRFTU.SuppHeatCoilFluidMaxFlow; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum).MassFlowRateMax = thisVRFTU.SuppHeatCoilFluidMaxFlow; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum).Temp = 60.0; bool FirstHVACIteration(false); Real64 SuppHeatCoilLoad = 10000.0; @@ -8127,16 +8128,16 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilWater) VRFTU(VRFTUNum) = thisVRFTU; // run supplemental heating coil - thisVRFTU.CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); + thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // check the coil load delivered EXPECT_NEAR(10000.0, SuppHeatCoilLoad, 5.0); - EXPECT_NEAR(10000.0, state.dataWaterCoils->WaterCoil(CoilNum).TotWaterHeatingCoilRate, 5.0); + EXPECT_NEAR(10000.0, state->dataWaterCoils->WaterCoil(CoilNum).TotWaterHeatingCoilRate, 5.0); // test larger heating load SuppHeatCoilLoad = 12000.0; - thisVRFTU.CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); + thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // delivered heating capacity EXPECT_NEAR(12000.0, SuppHeatCoilLoad, 5.0); - EXPECT_NEAR(12000.0, state.dataWaterCoils->WaterCoil(CoilNum).TotWaterHeatingCoilRate, 5.0); + EXPECT_NEAR(12000.0, state->dataWaterCoils->WaterCoil(CoilNum).TotWaterHeatingCoilRate, 5.0); } TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilSteam) @@ -8164,32 +8165,32 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilSteam) int CoilNum(1); DataLoopNode::Node.allocate(4); - state.dataSteamCoils->NumSteamCoils = 1; - state.dataSteamCoils->SteamCoil.allocate(state.dataSteamCoils->NumSteamCoils); - state.dataSteamCoils->SteamCoil(CoilNum).Name = thisVRFTU.SuppHeatCoilName; - state.dataSteamCoils->SteamCoil(CoilNum).SteamCoilType_Num = state.dataSteamCoils->SteamCoil_AirHeating; - state.dataSteamCoils->SteamCoil(CoilNum).LoopNum = 1; - state.dataSteamCoils->SteamCoil(CoilNum).SteamCoilTypeA = "Heating"; - state.dataSteamCoils->SteamCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); - state.dataSteamCoils->SteamCoil(CoilNum).InletSteamTemp = 100.0; - state.dataSteamCoils->SteamCoil(CoilNum).InletSteamPress = 101325.0; - state.dataSteamCoils->SteamCoil(CoilNum).DegOfSubcooling = 0.0; - - state.dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; - state.dataSteamCoils->SteamCoil(CoilNum).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; - state.dataSteamCoils->SteamCoil(CoilNum).SteamInletNodeNum = thisVRFTU.SuppHeatCoilFluidInletNode; - state.dataSteamCoils->SteamCoil(CoilNum).SteamOutletNodeNum = thisVRFTU.SuppHeatCoilFluidOutletNode; - state.dataSteamCoils->SteamCoil(CoilNum).MaxSteamVolFlowRate = 0.015; - state.dataSteamCoils->SteamCoil(CoilNum).LoopNum = 1; - state.dataSteamCoils->SteamCoil(CoilNum).LoopSide = 1; - state.dataSteamCoils->SteamCoil(CoilNum).BranchNum = 1; - state.dataSteamCoils->SteamCoil(CoilNum).CompNum = 1; - state.dataSteamCoils->SteamCoil(CoilNum).Coil_PlantTypeNum = DataPlant::TypeOf_CoilSteamAirHeating; - state.dataSteamCoils->SteamCoil(CoilNum).TypeOfCoil = state.dataSteamCoils->ZoneLoadControl; - state.dataSteamCoils->GetSteamCoilsInputFlag = false; - state.dataSteamCoils->CheckEquipName.dimension(state.dataSteamCoils->NumSteamCoils, true); - state.dataSteamCoils->MySizeFlag.allocate(CoilNum); - state.dataSteamCoils->MySizeFlag(CoilNum) = true; + state->dataSteamCoils->NumSteamCoils = 1; + state->dataSteamCoils->SteamCoil.allocate(state->dataSteamCoils->NumSteamCoils); + state->dataSteamCoils->SteamCoil(CoilNum).Name = thisVRFTU.SuppHeatCoilName; + state->dataSteamCoils->SteamCoil(CoilNum).SteamCoilType_Num = state->dataSteamCoils->SteamCoil_AirHeating; + state->dataSteamCoils->SteamCoil(CoilNum).LoopNum = 1; + state->dataSteamCoils->SteamCoil(CoilNum).SteamCoilTypeA = "Heating"; + state->dataSteamCoils->SteamCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); + state->dataSteamCoils->SteamCoil(CoilNum).InletSteamTemp = 100.0; + state->dataSteamCoils->SteamCoil(CoilNum).InletSteamPress = 101325.0; + state->dataSteamCoils->SteamCoil(CoilNum).DegOfSubcooling = 0.0; + + state->dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum = thisVRFTU.SuppHeatCoilAirInletNode; + state->dataSteamCoils->SteamCoil(CoilNum).AirOutletNodeNum = thisVRFTU.SuppHeatCoilAirOutletNode; + state->dataSteamCoils->SteamCoil(CoilNum).SteamInletNodeNum = thisVRFTU.SuppHeatCoilFluidInletNode; + state->dataSteamCoils->SteamCoil(CoilNum).SteamOutletNodeNum = thisVRFTU.SuppHeatCoilFluidOutletNode; + state->dataSteamCoils->SteamCoil(CoilNum).MaxSteamVolFlowRate = 0.015; + state->dataSteamCoils->SteamCoil(CoilNum).LoopNum = 1; + state->dataSteamCoils->SteamCoil(CoilNum).LoopSide = 1; + state->dataSteamCoils->SteamCoil(CoilNum).BranchNum = 1; + state->dataSteamCoils->SteamCoil(CoilNum).CompNum = 1; + state->dataSteamCoils->SteamCoil(CoilNum).Coil_PlantTypeNum = DataPlant::TypeOf_CoilSteamAirHeating; + state->dataSteamCoils->SteamCoil(CoilNum).TypeOfCoil = state->dataSteamCoils->ZoneLoadControl; + state->dataSteamCoils->GetSteamCoilsInputFlag = false; + state->dataSteamCoils->CheckEquipName.dimension(state->dataSteamCoils->NumSteamCoils, true); + state->dataSteamCoils->MySizeFlag.allocate(CoilNum); + state->dataSteamCoils->MySizeFlag(CoilNum) = true; NumPltSizInput = 1; PlantSizData.allocate(NumPltSizInput); @@ -8210,40 +8211,40 @@ TEST_F(EnergyPlusFixture, VRFTU_CalcVRFSupplementalHeatingCoilSteam) PlantLoop(1).Name = "SteamLoop"; PlantLoop(1).FluidName = "STEAM"; - PlantLoop(1).FluidIndex = state.dataSteamCoils->SteamIndex; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataSteamCoils->SteamCoil(CoilNum).Name; + PlantLoop(1).FluidIndex = state->dataSteamCoils->SteamIndex; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataSteamCoils->SteamCoil(CoilNum).Name; PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilSteamAirHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataSteamCoils->SteamCoil(CoilNum).SteamInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataSteamCoils->SteamCoil(CoilNum).SteamInletNodeNum; - state.dataGlobal->SysSizingCalc = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->SysSizingCalc = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::OutDryBulbTemp = 5.0; // init coil inlet condition - DataLoopNode::Node(state.dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; - DataLoopNode::Node(state.dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).Temp = 15.0; - DataLoopNode::Node(state.dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).HumRat = 0.0070; - DataLoopNode::Node(state.dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).Enthalpy = - Psychrometrics::PsyHFnTdbW(DataLoopNode::Node(state.dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).Temp, - DataLoopNode::Node(state.dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).HumRat); + DataLoopNode::Node(state->dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).MassFlowRate = 1.0; + DataLoopNode::Node(state->dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).Temp = 15.0; + DataLoopNode::Node(state->dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).HumRat = 0.0070; + DataLoopNode::Node(state->dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).Enthalpy = + Psychrometrics::PsyHFnTdbW(DataLoopNode::Node(state->dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).Temp, + DataLoopNode::Node(state->dataSteamCoils->SteamCoil(CoilNum).AirInletNodeNum).HumRat); - DataLoopNode::Node(state.dataSteamCoils->SteamCoil(CoilNum).SteamInletNodeNum).MassFlowRate = thisVRFTU.SuppHeatCoilFluidMaxFlow; - DataLoopNode::Node(state.dataSteamCoils->SteamCoil(CoilNum).SteamInletNodeNum).MassFlowRateMax = thisVRFTU.SuppHeatCoilFluidMaxFlow; + DataLoopNode::Node(state->dataSteamCoils->SteamCoil(CoilNum).SteamInletNodeNum).MassFlowRate = thisVRFTU.SuppHeatCoilFluidMaxFlow; + DataLoopNode::Node(state->dataSteamCoils->SteamCoil(CoilNum).SteamInletNodeNum).MassFlowRateMax = thisVRFTU.SuppHeatCoilFluidMaxFlow; bool FirstHVACIteration(true); Real64 SuppHeatCoilLoad = 20000.0; // run supplemental heating coil - thisVRFTU.CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); + thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // check heating load delivered EXPECT_DOUBLE_EQ(20000.0, SuppHeatCoilLoad); - EXPECT_DOUBLE_EQ(20000.0, state.dataSteamCoils->SteamCoil(CoilNum).TotSteamHeatingCoilRate); - EXPECT_DOUBLE_EQ(20311.199999999997, state.dataSteamCoils->SteamCoil(CoilNum).OperatingCapacity); + EXPECT_DOUBLE_EQ(20000.0, state->dataSteamCoils->SteamCoil(CoilNum).TotSteamHeatingCoilRate); + EXPECT_DOUBLE_EQ(20311.199999999997, state->dataSteamCoils->SteamCoil(CoilNum).OperatingCapacity); // testing heating load larger than available capacity SuppHeatCoilLoad = 24000.0; - thisVRFTU.CalcVRFSuppHeatingCoil(state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); + thisVRFTU.CalcVRFSuppHeatingCoil(*state, VRFTUNum, FirstHVACIteration, thisVRFTU.SuppHeatPartLoadRatio, SuppHeatCoilLoad); // delivered heating load can not exceed available operating capacity - EXPECT_DOUBLE_EQ(state.dataSteamCoils->SteamCoil(CoilNum).OperatingCapacity, SuppHeatCoilLoad); - EXPECT_DOUBLE_EQ(state.dataSteamCoils->SteamCoil(CoilNum).OperatingCapacity, state.dataSteamCoils->SteamCoil(CoilNum).TotSteamHeatingCoilRate); + EXPECT_DOUBLE_EQ(state->dataSteamCoils->SteamCoil(CoilNum).OperatingCapacity, SuppHeatCoilLoad); + EXPECT_DOUBLE_EQ(state->dataSteamCoils->SteamCoil(CoilNum).OperatingCapacity, state->dataSteamCoils->SteamCoil(CoilNum).TotSteamHeatingCoilRate); } TEST_F(EnergyPlusFixture, VRFTU_SupplementalHeatingCoilCapacityLimitTest) @@ -10540,7 +10541,7 @@ TEST_F(EnergyPlusFixture, VRFFluidControl_FanSysModel_OnOffModeTest) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::ManageSimulation(state); + SimulationManager::ManageSimulation(*state); int VRFCond(1); int ZoneNum(1); @@ -10564,10 +10565,10 @@ TEST_F(EnergyPlusFixture, VRFFluidControl_FanSysModel_OnOffModeTest) ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = -7000.0; ZoneSysEnergyDemand(1).OutputRequiredToHeatingSP = -7000.0; ZoneEqSizing.allocate(1); - state.dataAirLoop->AirLoopInputsFilled = true; - InitVRF(state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); + state->dataAirLoop->AirLoopInputsFilled = true; + InitVRF(*state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); EXPECT_EQ(QZnReq, -5000.0); - SimVRF(state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); + SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); // check fan operation for cooling mode Real64 Result_AirMassFlowRateDesign = HVACFan::fanObjs[0]->maxAirMassFlowRate(); EXPECT_NEAR(Result_AirMassFlowRateDesign, 0.347052, 0.000001); @@ -10583,9 +10584,9 @@ TEST_F(EnergyPlusFixture, VRFFluidControl_FanSysModel_OnOffModeTest) ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 0.0; ZoneSysEnergyDemand(1).OutputRequiredToHeatingSP = 0.0; QZnReq = ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP; - InitVRF(state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); + InitVRF(*state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); EXPECT_EQ(QZnReq, 0.0); - SimVRF(state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); + SimVRF(*state, VRFTUNum, FirstHVACIteration, OnOffAirFlowRatio, SysOutputProvided, LatOutputProvided, QZnReq); // check no load fan operation Result_AirMassFlowRateDesign = HVACFan::fanObjs[0]->maxAirMassFlowRate(); EXPECT_NEAR(Result_AirMassFlowRateDesign, 0.34706, 0.00001); @@ -11141,13 +11142,13 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataSizing::CurZoneEqNum = 1; DataEnvironment::OutBaroPress = 101325; // sea level DataZoneEquipment::ZoneEquipInputsFilled = true; // denotes zone equipment has been read in - StdRhoAir = PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); ZoneEqSizing.allocate(1); - state.dataAirLoop->AirLoopInputsFilled = true; + state->dataAirLoop->AirLoopInputsFilled = true; ZoneSizingRunDone = true; ZoneEqSizing(CurZoneEqNum).DesignSizeFromParent = false; ZoneEqSizing(CurZoneEqNum).SizingMethod.allocate(25); @@ -11157,13 +11158,13 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) FinalZoneSizing(CurZoneEqNum).DesHeatVolFlow = 0.566337; ZoneSysEnergyDemand.allocate(1); - ProcessScheduleInput(state); - GetCurveInput(state); - GetZoneData(state, ErrorsFound); + ProcessScheduleInput(*state); + GetCurveInput(*state); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // get zone input and connections - GetZoneEquipmentData(state); - ZoneInletAirNode = GetVRFTUZoneInletAirNode(state, VRFTUNum); + GetZoneEquipmentData(*state); + ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); Schedule(VRF(VRFCond).SchedPtr).CurrentValue = 1.0; Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; Schedule(VRFTU(VRFTUNum).FanAvailSchedPtr).CurrentValue = 1.0; @@ -11173,7 +11174,7 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = -5000.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = 0.0; - auto &thisZoneEquip(ZoneEquipConfig(state.dataGlobal->NumOfZones)); + auto &thisZoneEquip(ZoneEquipConfig(state->dataGlobal->NumOfZones)); // set zone air node properties Node(thisZoneEquip.ZoneNode).Temp = 24.0; Node(thisZoneEquip.ZoneNode).HumRat = 0.0075; @@ -11215,7 +11216,7 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) Real64 OAUCoilOutTemp = 0.0; bool ZoneEquipment = true; - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -11231,7 +11232,7 @@ TEST_F(EnergyPlusFixture, VRFTU_SysCurve_ReportOutputVerificationTest) // check model inputs ASSERT_EQ(1, NumVRFCond); ASSERT_EQ(1, NumVRFTU); - ASSERT_EQ(1, state.dataFans->NumFans); + ASSERT_EQ(1, state->dataFans->NumFans); ASSERT_EQ(2, NumDXCoils); ASSERT_EQ("TU1 VRF DX COOLING COIL", thisDXCoolingCoil.Name); ASSERT_EQ("TU1 VRF DX HEATING COIL", thisDXHeatingCoil.Name); @@ -12872,13 +12873,13 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataSizing::CurZoneEqNum = 1; DataEnvironment::OutBaroPress = 101325; // sea level DataZoneEquipment::ZoneEquipInputsFilled = true; // denotes zone equipment has been read in - StdRhoAir = PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); ZoneEqSizing.allocate(1); - state.dataAirLoop->AirLoopInputsFilled = true; + state->dataAirLoop->AirLoopInputsFilled = true; ZoneSizingRunDone = true; ZoneEqSizing(CurZoneEqNum).DesignSizeFromParent = false; ZoneEqSizing(CurZoneEqNum).SizingMethod.allocate(25); @@ -12888,13 +12889,13 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) FinalZoneSizing(CurZoneEqNum).DesHeatVolFlow = 0.566337; ZoneSysEnergyDemand.allocate(1); - ProcessScheduleInput(state); - GetCurveInput(state); - GetZoneData(state, ErrorsFound); + ProcessScheduleInput(*state); + GetCurveInput(*state); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // get zone input and connections - GetZoneEquipmentData(state); - GetVRFInput(state); + GetZoneEquipmentData(*state); + GetVRFInput(*state); GetVRFInputFlag = false; Schedule(VRF(VRFCond).SchedPtr).CurrentValue = 1.0; Schedule(VRFTU(VRFTUNum).SchedPtr).CurrentValue = 1.0; @@ -12905,7 +12906,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToCoolSP = -5000.0; ZoneSysEnergyDemand(CurZoneNum).RemainingOutputReqToHeatSP = 0.0; - auto &thisZoneEquip(ZoneEquipConfig(state.dataGlobal->NumOfZones)); + auto &thisZoneEquip(ZoneEquipConfig(state->dataGlobal->NumOfZones)); // set zone air node properties Node(thisZoneEquip.ZoneNode).Temp = 24.0; Node(thisZoneEquip.ZoneNode).HumRat = 0.0075; @@ -12948,7 +12949,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) Real64 OAUCoilOutTemp = 0.0; bool ZoneEquipment = true; - SimulateVRF(state, + SimulateVRF(*state, VRFTU(VRFTUNum).Name, FirstHVACIteration, CurZoneNum, @@ -12964,7 +12965,7 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_ReportOutputVerificationTest) // check model inputs ASSERT_EQ(1, NumVRFCond); ASSERT_EQ(1, NumVRFTU); - ASSERT_EQ(1, state.dataFans->NumFans); + ASSERT_EQ(1, state->dataFans->NumFans); ASSERT_EQ(2, NumDXCoils); ASSERT_EQ("TU1 VRF DX COOLING COIL", thisDXCoolingCoil.Name); ASSERT_EQ("TU1 VRF DX HEATING COIL", thisDXHeatingCoil.Name); @@ -13044,7 +13045,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest_HREIRFTHeat) }); ASSERT_TRUE(process_idf(idf_objects)); - CurveManager::GetCurveInput(state); + CurveManager::GetCurveInput(*state); int VRFCond = 1; VRF.allocate(1); @@ -13109,9 +13110,9 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest_HREIRFTHeat) } // set up environment - state.dataGlobal->DayOfSim = 2; // user a higher day than previous unit test to get around static timer variables problem - state.dataGlobal->CurrentTime = 0.25; - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->DayOfSim = 2; // user a higher day than previous unit test to get around static timer variables problem + state->dataGlobal->CurrentTime = 0.25; + state->dataGlobal->TimeStepZone = 0.25; DataHVACGlobals::TimeStepSys = 0.25; DataHVACGlobals::SysTimeElapsed = 0.0; DataEnvironment::OutDryBulbTemp = 35.0; @@ -13124,10 +13125,10 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest_HREIRFTHeat) TerminalUnitList(1).HRCoolRequest = false; TerminalUnitList(1).TotalHeatLoad = 0.0; TerminalUnitList(1).HRHeatRequest = false; - CalcVRFCondenser(state, VRFCond); + CalcVRFCondenser(*state, VRFCond); // increment time step - state.dataGlobal->CurrentTime += state.dataGlobal->TimeStepZone; // 0.5 + state->dataGlobal->CurrentTime += state->dataGlobal->TimeStepZone; // 0.5 // set TU's to request both cooling and heating CoolingLoad(VRFCond) = false; @@ -13161,7 +13162,7 @@ TEST_F(EnergyPlusFixture, VRFTest_CondenserCalcTest_HREIRFTHeat) VRF(VRFCond).HRHeatCapTC = 0.25; // 15 min exponential rise // VRF(VRFCond).HRHeatEIRTC = 0.0; // (default) // last operating mode was heating - CalcVRFCondenser(state, VRFCond); + CalcVRFCondenser(*state, VRFCond); EXPECT_TRUE(VRF(VRFCond).ModeChange); EXPECT_FALSE(VRF(VRFCond).HRModeChange); EXPECT_EQ(VRF(VRFCond).OperatingMode, 2); // ModeHeatingOnly @@ -13630,13 +13631,13 @@ TEST_F(EnergyPlusFixture, VRF_BlowthroughFanPlacement_InputTest) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - ProcessScheduleInput(state); - GetCurveInput(state); - GetZoneData(state, ErrorsFound); + ProcessScheduleInput(*state); + GetCurveInput(*state); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // get zone input and connections - GetZoneEquipmentData(state); - GetVRFInput(state); + GetZoneEquipmentData(*state); + GetVRFInput(*state); // set pointer to components auto &thisVRFTU(VRFTU(1)); auto &thisDXCoolingCoil(DXCoil(1)); @@ -14219,23 +14220,23 @@ TEST_F(EnergyPlusFixture, VRF_MinPLR_and_EIRfPLRCruveMinPLRInputsTest) Real64 minEIRfLowPLRXInput(0.0); Real64 maxEIRfLowPLRXInput(0.0); bool ErrorsFound(false); - ProcessScheduleInput(state); - GetCurveInput(state); - GetZoneData(state, ErrorsFound); + ProcessScheduleInput(*state); + GetCurveInput(*state); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // get zone input and connections - GetZoneEquipmentData(state); - GetVRFInputData(state, ErrorsFound); + GetZoneEquipmentData(*state); + GetVRFInputData(*state, ErrorsFound); // expect error due to min PLR value EXPECT_TRUE(ErrorsFound); // set pointer to components auto &thisVRF(VRF(1)); - auto &thisCoolEIRFPLR(state.dataCurveManager->PerfCurve(thisVRF.CoolEIRFPLR1)); - auto &thisHeatEIRFPLR(state.dataCurveManager->PerfCurve(thisVRF.HeatEIRFPLR1)); + auto &thisCoolEIRFPLR(state->dataCurveManager->PerfCurve(thisVRF.CoolEIRFPLR1)); + auto &thisHeatEIRFPLR(state->dataCurveManager->PerfCurve(thisVRF.HeatEIRFPLR1)); // check user input VRF Minimum PLR EXPECT_EQ(0.15, thisVRF.MinPLR); // EIRFPLR curve minimum PLR value specified - CurveManager::GetCurveMinMaxValues(state, thisVRF.CoolEIRFPLR1, minEIRfLowPLRXInput, maxEIRfLowPLRXInput); + CurveManager::GetCurveMinMaxValues(*state, thisVRF.CoolEIRFPLR1, minEIRfLowPLRXInput, maxEIRfLowPLRXInput); EXPECT_EQ(0.25, thisCoolEIRFPLR.Var1Min); EXPECT_EQ(0.25, minEIRfLowPLRXInput); // getinput checks this EXPECT_EQ(1.00, thisCoolEIRFPLR.Var1Max); @@ -14243,7 +14244,7 @@ TEST_F(EnergyPlusFixture, VRF_MinPLR_and_EIRfPLRCruveMinPLRInputsTest) EXPECT_GT(thisCoolEIRFPLR.Var1Min, thisVRF.MinPLR); // expect warning message minEIRfLowPLRXInput = 0.0; maxEIRfLowPLRXInput = 0.0; - CurveManager::GetCurveMinMaxValues(state, thisVRF.HeatEIRFPLR1, minEIRfLowPLRXInput, maxEIRfLowPLRXInput); + CurveManager::GetCurveMinMaxValues(*state, thisVRF.HeatEIRFPLR1, minEIRfLowPLRXInput, maxEIRfLowPLRXInput); EXPECT_EQ(0.25, thisHeatEIRFPLR.Var1Min); EXPECT_EQ(0.25, minEIRfLowPLRXInput); // getinput checks this EXPECT_EQ(1.00, thisHeatEIRFPLR.Var1Max); @@ -14925,24 +14926,24 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NotOnZoneHVACEquipmentList) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataSizing::CurZoneEqNum = 1; DataEnvironment::OutBaroPress = 101325; // sea level DataZoneEquipment::ZoneEquipInputsFilled = true; // denotes zone equipment has been read in - DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); - state.dataGlobal->SysSizingCalc = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); + state->dataGlobal->SysSizingCalc = true; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataSizing::ZoneEqSizing.allocate(1); - CurveManager::GetCurveInput(state); // read curves - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + CurveManager::GetCurveInput(*state); // read curves + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData(state); // read equipment list and connections - state.dataAirLoop->AirLoopInputsFilled = true; + DataZoneEquipment::GetZoneEquipmentData(*state); // read equipment list and connections + state->dataAirLoop->AirLoopInputsFilled = true; HVACVariableRefrigerantFlow::MyEnvrnFlag = true; - ZoneInletAirNode = GetVRFTUZoneInletAirNode(state, VRFTUNum); // trigger GetVRFInput by calling a mining function + ZoneInletAirNode = GetVRFTUZoneInletAirNode(*state, VRFTUNum); // trigger GetVRFInput by calling a mining function OutsideAirNode = VRFTU(VRFTUNum).VRFTUOAMixerOANodeNum; // outside air air inlet node num DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataZoneEnergyDemands::ZoneSysEnergyDemand(CurZoneNum).RemainingOutputRequired = 0.0; // No load @@ -14956,7 +14957,7 @@ TEST_F(EnergyPlusFixture, VRFTest_TU_NotOnZoneHVACEquipmentList) EXPECT_TRUE(has_err_output(true)); - InitVRF(state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters + InitVRF(*state, VRFTUNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // Initialize all VRFTU related parameters std::string const error_string = delimited_string({ " ** Severe ** InitVRF: VRF Terminal Unit = [ZoneHVAC:TerminalUnit:VariableRefrigerantFlow,LEVEL1:OFFICE1 VRF INDOOR UNIT] is not on any ZoneHVAC:EquipmentList, AirloopHVAC or AirLoopHVAC:OutdoorAirSystem:EquipmentList. It will not be simulated.", diff --git a/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc b/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc index c0bbc2d4ccf..820d5efce2d 100644 --- a/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc +++ b/tst/EnergyPlus/unit/HWBaseboardRadiator.unit.cc @@ -62,6 +62,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace DataZoneEnergyDemands; @@ -105,7 +106,7 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_CalcHWBaseboard) PlantLoop(1).FluidType = 2; QBBRadSource(1) = 0.0; - CalcHWBaseboard(state, BBNum, LoadMet); + CalcHWBaseboard(*state, BBNum, LoadMet); EXPECT_NEAR(14746.226690452937, HWBaseboard(1).TotPower, 0.000001); EXPECT_NEAR(50.349854486072232, HWBaseboard(1).AirOutletTemp, 0.000001); @@ -184,7 +185,7 @@ TEST_F(EnergyPlusFixture, HWBaseboardRadiator_HWBaseboardWaterFlowResetTest) PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = HWBaseboard(1).WaterOutletNode; // zero zone load case, so zero LoadMet must be returned - CalcHWBaseboard(state, BBNum, LoadMet); + CalcHWBaseboard(*state, BBNum, LoadMet); EXPECT_EQ(0.0, LoadMet); EXPECT_EQ(0.0, HWBaseboard(1).TotPower); diff --git a/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc b/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc index f179936ab2d..5cc6519cd87 100644 --- a/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalFiniteDiffManager.unit.cc @@ -56,6 +56,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -76,7 +77,7 @@ TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_CalcNodeHeatFluxTest) SurfaceFD(SurfNum).CpDelXRhoS1.allocate(numNodes + 1); SurfaceFD(SurfNum).CpDelXRhoS2.allocate(numNodes + 1); DataHeatBalSurface::SurfOpaqInsFaceConductionFlux.allocate(1); - state.dataGlobal->TimeStepZoneSec = 600.0; + state->dataGlobal->TimeStepZoneSec = 600.0; Real64 expectedResult1(0.0); Real64 expectedResult2(0.0); @@ -121,7 +122,7 @@ TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_CalcNodeHeatFluxTest) SurfaceFD(SurfNum).CpDelXRhoS2(nodeNum) = 2000.0; expectedResult5 = DataHeatBalSurface::SurfOpaqInsFaceConductionFlux(SurfNum); - CalcNodeHeatFlux(state, SurfNum, numNodes); + CalcNodeHeatFlux(*state, SurfNum, numNodes); EXPECT_NEAR(SurfaceFD(SurfNum).QDreport(1), expectedResult1, 0.0001); EXPECT_NEAR(SurfaceFD(SurfNum).QDreport(2), expectedResult2, 0.0001); EXPECT_NEAR(SurfaceFD(SurfNum).QDreport(3), expectedResult3, 0.0001); @@ -137,7 +138,7 @@ TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_CalcNodeHeatFluxTest) expectedResult5 = 0.0; // Unsteady-state case - state.dataGlobal->TimeStepZoneSec = 600.0; + state->dataGlobal->TimeStepZoneSec = 600.0; DataHeatBalSurface::SurfOpaqInsFaceConductionFlux(SurfNum) = -200.0; nodeNum = 5; @@ -167,7 +168,7 @@ TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_CalcNodeHeatFluxTest) SurfaceFD(SurfNum).CpDelXRhoS1(nodeNum) = 1000.0; SurfaceFD(SurfNum).CpDelXRhoS2(nodeNum) = 2000.0; expectedResult2 = expectedResult3 + (SurfaceFD(SurfNum).TDT(nodeNum) - SurfaceFD(SurfNum).TDpriortimestep(nodeNum)) * - SurfaceFD(SurfNum).CpDelXRhoS2(nodeNum) / state.dataGlobal->TimeStepZoneSec; + SurfaceFD(SurfNum).CpDelXRhoS2(nodeNum) / state->dataGlobal->TimeStepZoneSec; nodeNum = 1; SurfaceFD(SurfNum).TDpriortimestep(nodeNum) = 20.1; @@ -175,11 +176,11 @@ TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_CalcNodeHeatFluxTest) SurfaceFD(SurfNum).CpDelXRhoS1(nodeNum) = 1000.0; SurfaceFD(SurfNum).CpDelXRhoS2(nodeNum) = 2000.0; expectedResult1 = expectedResult2 + (SurfaceFD(SurfNum).TDT(nodeNum + 1) - SurfaceFD(SurfNum).TDpriortimestep(nodeNum + 1)) * - SurfaceFD(SurfNum).CpDelXRhoS1(nodeNum + 1) / state.dataGlobal->TimeStepZoneSec; + SurfaceFD(SurfNum).CpDelXRhoS1(nodeNum + 1) / state->dataGlobal->TimeStepZoneSec; expectedResult1 = expectedResult1 + (SurfaceFD(SurfNum).TDT(nodeNum) - SurfaceFD(SurfNum).TDpriortimestep(nodeNum)) * - SurfaceFD(SurfNum).CpDelXRhoS2(nodeNum) / state.dataGlobal->TimeStepZoneSec; + SurfaceFD(SurfNum).CpDelXRhoS2(nodeNum) / state->dataGlobal->TimeStepZoneSec; - CalcNodeHeatFlux(state, SurfNum, numNodes); + CalcNodeHeatFlux(*state, SurfNum, numNodes); EXPECT_NEAR(SurfaceFD(SurfNum).QDreport(1), expectedResult1, 0.0001); EXPECT_NEAR(SurfaceFD(SurfNum).QDreport(2), expectedResult2, 0.0001); EXPECT_NEAR(SurfaceFD(SurfNum).QDreport(3), expectedResult3, 0.0001); @@ -218,7 +219,7 @@ TEST_F(EnergyPlusFixture, HeatBalFiniteDiffManager_adjustPropertiesForPhaseChang // create a materials data object and assign the phase change variable based on above IDF processing Material::MaterialProperties material; - material.phaseChange = HysteresisPhaseChange::HysteresisPhaseChange::factory(state, "PCMNAME"); + material.phaseChange = HysteresisPhaseChange::HysteresisPhaseChange::factory(*state, "PCMNAME"); // create local variables to calculate and call the new worker function Real64 newSpecificHeat, newDensity, newThermalConductivity; diff --git a/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc index ce196c97bd0..88703639a12 100644 --- a/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceAirManager.unit.cc @@ -55,6 +55,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -80,7 +81,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceAirManager_RoomAirModelType_Test) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfZones = 2; + state->dataGlobal->NumOfZones = 2; DataHeatBalance::Zone.allocate(2); DataHeatBalance::Zone(1).Name = "SOUTH SKIN"; @@ -88,7 +89,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceAirManager_RoomAirModelType_Test) bool ErrorsFound(false); - HeatBalanceAirManager::GetRoomAirModelParameters(state, ErrorsFound); + HeatBalanceAirManager::GetRoomAirModelParameters(*state, ErrorsFound); EXPECT_TRUE(ErrorsFound); diff --git a/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc b/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc index 4ee573bc51c..7cb523c5311 100644 --- a/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceIntRadExchange.unit.cc @@ -60,6 +60,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -83,7 +84,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_CarrollMRT) { A(3) = 1.0; FMRT.allocate(N); - CalcFMRT(state, N, A, FMRT); + CalcFMRT(*state, N, A, FMRT); EMISS.allocate(N); EMISS(1) = 1.0; @@ -106,7 +107,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_CarrollMRT) { FMRT.redimension(N); - CalcFMRT(state, N, A, FMRT); + CalcFMRT(*state, N, A, FMRT); EXPECT_NEAR(FMRT(1), 2.0, 0.001); EXPECT_NEAR(FMRT(2), 2.0, 0.001); @@ -122,7 +123,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_CarrollMRT) { A(1) = 2.0; A(2) = 1.0; - CalcFMRT(state, N, A, FMRT); + CalcFMRT(*state, N, A, FMRT); std::string const error_string = delimited_string({" ** Severe ** Geometry not compatible with Carroll MRT Zone Radiant Exchange method."}); EXPECT_TRUE(compare_err_stream(error_string, true)); @@ -171,7 +172,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_FixViewFactorsTest) DataViewFactorInformation::ZoneRadiantInfo(ZoneNum).Name = DataHeatBalance::Zone(ZoneNum).Name; DataViewFactorInformation::ZoneRadiantInfo(ZoneNum).ZoneNums.push_back(ZoneNum); - FixViewFactors(state, N, + FixViewFactors(*state, N, A, F, DataViewFactorInformation::ZoneRadiantInfo(ZoneNum).Name, @@ -209,7 +210,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_FixViewFactorsTest) F(3, 2) = 0.9; F(3, 3) = 0.0; - FixViewFactors(state, N, + FixViewFactors(*state, N, A, F, DataViewFactorInformation::ZoneRadiantInfo(ZoneNum).Name, @@ -237,7 +238,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_FixViewFactorsTest) F(3, 2) = 0.5; F(3, 3) = 0.0; - FixViewFactors(state, N, + FixViewFactors(*state, N, A, F, DataViewFactorInformation::ZoneRadiantInfo(ZoneNum).Name, @@ -265,7 +266,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_FixViewFactorsTest) F(3, 2) = 0.6; F(3, 3) = 0.0; - FixViewFactors(state, N, + FixViewFactors(*state, N, A, F, DataViewFactorInformation::ZoneRadiantInfo(ZoneNum).Name, @@ -293,7 +294,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT bool DidMIChange; int SurfNum; - state.dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct.allocate(1); dataMaterial.Material.allocate(1); DataSurfaces::Surface.allocate(1); @@ -303,7 +304,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT DataSurfaces::Surface(1).MovInsulIntPresentPrevTS = false; DataSurfaces::Surface(1).Construction = 1; DataSurfaces::Surface(1).MaterialMovInsulInt = 1; - state.dataConstruction->Construct(1).InsideAbsorpThermal = 0.9; + state->dataConstruction->Construct(1).InsideAbsorpThermal = 0.9; dataMaterial.Material(1).AbsorpThermal = 0.5; dataMaterial.Material(1).Resistance = 1.25; DataSurfaces::Surface(1).SchedMovInsulInt = -1; @@ -311,19 +312,19 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_UpdateMovableInsulationFlagT // Test 1: Movable insulation present but wasn't in previous time step, also movable insulation emissivity different than base construction // This should result in a true value from the algorithm which will cause interior radiant exchange matrices to be recalculated - HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(state, DidMIChange, SurfNum); + HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(*state, DidMIChange, SurfNum); EXPECT_TRUE(DidMIChange); // Test 2: Movable insulation present and was also present in previous time step. This should result in a false value since nothing has changed. DataSurfaces::Surface(1).MovInsulIntPresentPrevTS = true; - HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(state, DidMIChange, SurfNum); + HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(*state, DidMIChange, SurfNum); EXPECT_TRUE(!DidMIChange); // Test 2: Movable insulation present but wasn't in previous time step. However, the emissivity of the movable insulation and that of the // construction are the same so nothing has actually changed. This should result in a false value. DataSurfaces::Surface(1).MovInsulIntPresentPrevTS = false; - dataMaterial.Material(1).AbsorpThermal = state.dataConstruction->Construct(1).InsideAbsorpThermal; - HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(state, DidMIChange, SurfNum); + dataMaterial.Material(1).AbsorpThermal = state->dataConstruction->Construct(1).InsideAbsorpThermal; + HeatBalanceIntRadExchange::UpdateMovableInsulationFlag(*state, DidMIChange, SurfNum); EXPECT_TRUE(!DidMIChange); } @@ -374,27 +375,27 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_AlignInputViewFactorsTest) }); ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); DataViewFactorInformation::NumOfRadiantEnclosures = 3; DataViewFactorInformation::ZoneRadiantInfo.allocate(3); DataViewFactorInformation::ZoneRadiantInfo(1).Name = "Enclosure 1"; DataViewFactorInformation::ZoneRadiantInfo(1).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 2"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 2"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneRadiantInfo(1).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 1"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 1"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneRadiantInfo(2).Name = "Enclosure 2"; DataViewFactorInformation::ZoneRadiantInfo(2).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 4"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 4"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneRadiantInfo(2).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneRadiantInfo(3).Name = "Zone 3"; DataViewFactorInformation::ZoneRadiantInfo(3).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 3"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 3"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); ErrorsFound = false; - HeatBalanceIntRadExchange::AlignInputViewFactors(state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); + HeatBalanceIntRadExchange::AlignInputViewFactors(*state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); EXPECT_TRUE(ErrorsFound); std::string const error_string = delimited_string({ " ** Severe ** AlignInputViewFactors: ZoneProperty:UserViewFactors:BySurfaceName=\"Perimeter Zones\" found a matching ZoneList, but did not find a matching radiant or solar enclosure with the same zones.", @@ -454,27 +455,27 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_AlignInputViewFactorsTest2) }); ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); DataViewFactorInformation::NumOfSolarEnclosures = 3; DataViewFactorInformation::ZoneSolarInfo.allocate(3); DataViewFactorInformation::ZoneSolarInfo(1).Name = "Enclosure 1"; DataViewFactorInformation::ZoneSolarInfo(1).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 2"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 2"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneSolarInfo(1).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneSolarInfo(2).Name = "Enclosure 2"; DataViewFactorInformation::ZoneSolarInfo(2).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 4"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 4"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneSolarInfo(2).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneSolarInfo(3).Name = "Zone 3"; DataViewFactorInformation::ZoneSolarInfo(3).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 3"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 3"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); ErrorsFound = false; - HeatBalanceIntRadExchange::AlignInputViewFactors(state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); + HeatBalanceIntRadExchange::AlignInputViewFactors(*state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); EXPECT_TRUE(ErrorsFound); std::string const error_string = delimited_string({ " ** Severe ** AlignInputViewFactors: ZoneProperty:UserViewFactors:BySurfaceName=\"Zone 6\" did not find a matching radiant or solar enclosure name." @@ -533,27 +534,27 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_AlignInputViewFactorsTest3) }); ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); DataViewFactorInformation::NumOfSolarEnclosures = 3; DataViewFactorInformation::ZoneSolarInfo.allocate(3); DataViewFactorInformation::ZoneSolarInfo(1).Name = "Enclosure 1"; DataViewFactorInformation::ZoneSolarInfo(1).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 2"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 2"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneSolarInfo(1).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 1"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 1"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneSolarInfo(2).Name = "Enclosure 2"; DataViewFactorInformation::ZoneSolarInfo(2).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 4"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 4"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneSolarInfo(2).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneSolarInfo(3).Name = "Zone 3"; DataViewFactorInformation::ZoneSolarInfo(3).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 3"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 3"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); ErrorsFound = false; - HeatBalanceIntRadExchange::AlignInputViewFactors(state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); + HeatBalanceIntRadExchange::AlignInputViewFactors(*state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); EXPECT_TRUE(ErrorsFound); std::string const error_string = delimited_string({ " ** Severe ** AlignInputViewFactors: ZoneProperty:UserViewFactors:BySurfaceName=\"Perimeter Zones\" found a matching ZoneList, but did not find a matching radiant or solar enclosure with the same zones.", @@ -613,27 +614,27 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_AlignInputViewFactorsTest4) }); ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); DataViewFactorInformation::NumOfRadiantEnclosures = 3; DataViewFactorInformation::ZoneRadiantInfo.allocate(3); DataViewFactorInformation::ZoneRadiantInfo(1).Name = "Enclosure 1"; DataViewFactorInformation::ZoneRadiantInfo(1).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 2"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 2"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneRadiantInfo(1).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneRadiantInfo(2).Name = "Enclosure 2"; DataViewFactorInformation::ZoneRadiantInfo(2).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 4"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 4"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneRadiantInfo(2).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 5"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); DataViewFactorInformation::ZoneRadiantInfo(3).Name = "Zone 3"; DataViewFactorInformation::ZoneRadiantInfo(3).ZoneNums.push_back(UtilityRoutines::FindItemInList( - UtilityRoutines::MakeUPPERCase("Zone 3"), DataHeatBalance::Zone, state.dataGlobal->NumOfZones)); + UtilityRoutines::MakeUPPERCase("Zone 3"), DataHeatBalance::Zone, state->dataGlobal->NumOfZones)); ErrorsFound = false; - HeatBalanceIntRadExchange::AlignInputViewFactors(state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); + HeatBalanceIntRadExchange::AlignInputViewFactors(*state, "ZoneProperty:UserViewFactors:BySurfaceName", ErrorsFound); EXPECT_TRUE(ErrorsFound); std::string const error_string = delimited_string({ " ** Severe ** AlignInputViewFactors: ZoneProperty:UserViewFactors:BySurfaceName=\"Zone 6\" did not find a matching radiant or solar enclosure name." diff --git a/tst/EnergyPlus/unit/HeatBalanceKivaManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceKivaManager.unit.cc index 3474c0ee2bb..0e0817a61f0 100644 --- a/tst/EnergyPlus/unit/HeatBalanceKivaManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceKivaManager.unit.cc @@ -65,6 +65,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -176,20 +177,20 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); // If errors detected in input - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); int DualZoneNum(1); DataEnvironment::DayOfYear_Schedule = 1; // must initialize this to get schedules initialized DataEnvironment::DayOfWeek = 1; // must initialize this to get schedules initialized - state.dataGlobal->HourOfDay = 1; // must initialize this to get schedules initialized - state.dataGlobal->TimeStep = 1; // must initialize this to get schedules initialized - 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 + state->dataGlobal->HourOfDay = 1; // must initialize this to get schedules initialized + state->dataGlobal->TimeStep = 1; // must initialize this to get schedules initialized + 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 - ZoneTempPredictorCorrector::GetZoneAirSetPoints(state); + ZoneTempPredictorCorrector::GetZoneAirSetPoints(*state); ScheduleManager::Schedule(DataZoneControls::TempControlledZone(DualZoneNum).CTSchedIndex).CurrentValue = DataHVACGlobals::DualSetPointWithDeadBand; @@ -201,7 +202,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs) kv1.zoneControlNum = 1; kv1.zoneControlType = 1; // Temperature - kv1.setInitialBoundaryConditions(state, kivaweather, 1, 1, 1); + kv1.setInitialBoundaryConditions(*state, kivaweather, 1, 1, 1); Real64 expectedResult1 = kv1.instance.bcs->slabConvectiveTemp; @@ -216,7 +217,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs) kv2.zoneControlNum = 1; kv2.zoneControlType = 1; // Temperature - kv2.setInitialBoundaryConditions(state, kivaweather, 1, 1, 1); + kv2.setInitialBoundaryConditions(*state, kivaweather, 1, 1, 1); Real64 expectedResult2 = kv2.instance.bcs->slabConvectiveTemp; @@ -224,8 +225,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs) // Test using default Initial Indoor Temperature with Cooling/Heating Setpoints of 100C/-100C - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).CoolTempSchedIndex = 4; - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).HeatTempSchedIndex = 5; + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).CoolTempSchedIndex = 4; + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).HeatTempSchedIndex = 5; Real64 coolingSetpoint3 = 100.0; Real64 zoneAssumedTemperature3 = -9999; @@ -234,7 +235,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs) kv3.zoneControlNum = 1; kv3.zoneControlType = 1; // Temperature - kv3.setInitialBoundaryConditions(state, kivaweather, 1, 1, 1); + kv3.setInitialBoundaryConditions(*state, kivaweather, 1, 1, 1); Real64 expectedResult3 = kv3.instance.bcs->slabConvectiveTemp; @@ -242,8 +243,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs) // Test Initial Indoor Temperature input of 15C with Cooling/Heating Setpoints of 100C/-100C - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).CoolTempSchedIndex = 4; - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).HeatTempSchedIndex = 5; + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).CoolTempSchedIndex = 4; + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).HeatTempSchedIndex = 5; Real64 zoneAssumedTemperature4 = 15.0; HeatBalanceKivaManager::KivaInstanceMap kv4(fnd, 0, {}, 0, zoneAssumedTemperature4, 1.0, 0, &km); @@ -251,7 +252,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceKiva_SetInitialBCs) kv4.zoneControlNum = 1; kv4.zoneControlType = 1; // Temperature - kv4.setInitialBoundaryConditions(state, kivaweather, 1, 1, 1); + kv4.setInitialBoundaryConditions(*state, kivaweather, 1, 1, 1); Real64 expectedResult4 = kv4.instance.bcs->slabConvectiveTemp; diff --git a/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc index 324a74199a2..2586ee16879 100644 --- a/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceManager.unit.cc @@ -80,6 +80,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -127,10 +128,10 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirBalance_OutdoorAir) }); ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - auto numZones = inputProcessor->getNumObjectsFound(state, "Zone"); + auto numZones = inputProcessor->getNumObjectsFound(*state, "Zone"); ZoneReOrder.allocate(numZones); - GetZoneData(state, ErrorsFound); - GetAirFlowFlag(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); + GetAirFlowFlag(*state, ErrorsFound); EXPECT_TRUE(ErrorsFound); } @@ -166,7 +167,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_WindowMaterial_Gap_Duplicate_Names) bool ErrorsFound(false); - GetMaterialData(state, ErrorsFound); + GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); } @@ -203,7 +204,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_WindowMaterial_Gap_Duplicate_Names_ bool ErrorsFound(false); - GetMaterialData(state, ErrorsFound); + GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); } @@ -228,8 +229,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ProcessZoneData) int NumNumbers(9); cCurrentModuleObject = "Zone"; - state.dataGlobal->NumOfZones = 2; - Zone.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 2; + Zone.allocate(state->dataGlobal->NumOfZones); // Set up a Zone object NumAlphas = 2; @@ -261,7 +262,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ProcessZoneData) cAlphaArgs(2) = "ADAPTIVECONVECTIONALGORITHM"; // Zone Inside Convection Algorithm - Must be UPPERCASE by this point ErrorsFound = false; - ProcessZoneData(state, cCurrentModuleObject, + ProcessZoneData(*state, cCurrentModuleObject, ZoneNum, cAlphaArgs, NumAlphas, @@ -278,7 +279,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ProcessZoneData) cAlphaArgs(1) = "Zone Two"; // Name cAlphaArgs(2) = "InvalidChoice"; // Zone Inside Convection Algorithm - Must be UPPERCASE by this point ErrorsFound = false; - ProcessZoneData(state, cCurrentModuleObject, + ProcessZoneData(*state, cCurrentModuleObject, ZoneNum, cAlphaArgs, NumAlphas, @@ -295,7 +296,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ProcessZoneData) cAlphaArgs(1) = "Zone Two"; // Name cAlphaArgs(2) = "TARP"; // Zone Inside Convection Algorithm - Must be UPPERCASE by this point ErrorsFound = false; - ProcessZoneData(state, cCurrentModuleObject, + ProcessZoneData(*state, cCurrentModuleObject, ZoneNum, cAlphaArgs, NumAlphas, @@ -356,11 +357,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetWindowConstructData) // call to get valid window material types ErrorsFound = false; - GetConstructData(state, ErrorsFound); // returns ErrorsFound as false since all layers are valid + GetConstructData(*state, ErrorsFound); // returns ErrorsFound as false since all layers are valid EXPECT_FALSE(ErrorsFound); // Clear shared arrays that were allocated in GetConstructData - state.dataConstruction->Construct.deallocate(); + state->dataConstruction->Construct.deallocate(); // call to get invalid window material type // Material( 2 ).Group = 16; // BlindEquivalentLayer, this layer is invalid in plain windows @@ -395,7 +396,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirMassFlowConservationData1) // call to process input ErrorsFound = false; - GetProjectControlData(state, ErrorsFound); // returns ErrorsFound false, ZoneAirMassFlowConservation never sets it + GetProjectControlData(*state, ErrorsFound); // returns ErrorsFound false, ZoneAirMassFlowConservation never sets it EXPECT_FALSE(ErrorsFound); EXPECT_TRUE(ZoneAirMassFlow.EnforceZoneMassBalance); EXPECT_TRUE(ZoneAirMassFlow.BalanceMixing); @@ -456,9 +457,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirMassFlowConservationData2) bool ErrorsFound(false); // If errors detected in input // call to process input - ProcessScheduleInput(state); + ProcessScheduleInput(*state); ErrorsFound = false; - GetProjectControlData(state, ErrorsFound); // returns ErrorsFound false, ZoneAirMassFlowConservation never sets it + GetProjectControlData(*state, ErrorsFound); // returns ErrorsFound false, ZoneAirMassFlowConservation never sets it EXPECT_FALSE(ErrorsFound); EXPECT_TRUE(ZoneAirMassFlow.EnforceZoneMassBalance); EXPECT_FALSE(ZoneAirMassFlow.BalanceMixing); @@ -466,18 +467,18 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirMassFlowConservationData2) EXPECT_EQ(ZoneAirMassFlow.InfiltrationZoneType, AllZones); // setup mixing and infiltration objects - state.dataGlobal->NumOfZones = 2; - ZoneReOrder.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 2; + ZoneReOrder.allocate(state->dataGlobal->NumOfZones); ErrorsFound = false; - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - AllocateHeatBalArrays(state); + AllocateHeatBalArrays(*state); ErrorsFound = false; - GetSimpleAirModelInputs(state, ErrorsFound); + GetSimpleAirModelInputs(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); SetZoneMassConservationFlag(); // setup zone equipment configuration - ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); + ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); ZoneEquipConfig(1).ZoneName = "Zone 1"; ZoneEquipConfig(1).ActualZoneNum = 1; @@ -535,9 +536,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirMassFlowConservationData2) ZoneEquipInputsFilled = true; NumPrimaryAirSys = 1; - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).OASysExists = true; + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).OASysExists = true; Node.allocate(8); // Avoid zero values in volume flow balance check @@ -559,13 +560,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirMassFlowConservationData2) Node(7).MassFlowRate = 0.0; // Zone 2 exhaust node Node(8).MassFlowRate = 8.0; // Zone 2 return node ZoneEquipConfig(2).ZoneExh = 0.0; - state.dataAirLoop->AirLoopFlow(1).OAFlow = Node(2).MassFlowRate + Node(6).MassFlowRate; - state.dataAirLoop->AirLoopFlow(1).MaxOutAir = state.dataAirLoop->AirLoopFlow(1).OAFlow; + state->dataAirLoop->AirLoopFlow(1).OAFlow = Node(2).MassFlowRate + Node(6).MassFlowRate; + state->dataAirLoop->AirLoopFlow(1).MaxOutAir = state->dataAirLoop->AirLoopFlow(1).OAFlow; Infiltration(1).MassFlowRate = 0.5; Mixing(1).MixingMassFlowRate = 0.1; // call zone air mass balance - CalcZoneMassBalance(state, false); + CalcZoneMassBalance(*state, false); EXPECT_EQ(Node(4).MassFlowRate, 0.0); // Zone 1 return node (max(0.0, 1-2) EXPECT_EQ(Infiltration(1).MassFlowRate, 1.0); // Zone 1 infiltration flow rate (2 - 1) EXPECT_EQ(Mixing(1).MixingMassFlowRate, 0.1); // Zone 1 to Zone 2 mixing flow rate (unchanged) @@ -575,8 +576,8 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirMassFlowConservationData2) ZoneReOrder.deallocate(); ZoneEquipConfig.deallocate(); Node.deallocate(); - state.dataAirSystemsData->PrimaryAirSystems.deallocate(); - state.dataAirLoop->AirLoopFlow.deallocate(); + state->dataAirSystemsData->PrimaryAirSystems.deallocate(); + state->dataAirLoop->AirLoopFlow.deallocate(); NumPrimaryAirSys = 0; } @@ -605,7 +606,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirMassFlowConservationData3) // call to process input ErrorsFound = false; - GetProjectControlData(state, ErrorsFound); // returns ErrorsFound false, ZoneAirMassFlowConservation never sets it + GetProjectControlData(*state, ErrorsFound); // returns ErrorsFound false, ZoneAirMassFlowConservation never sets it EXPECT_FALSE(ErrorsFound); EXPECT_FALSE(ZoneAirMassFlow.EnforceZoneMassBalance); EXPECT_FALSE(ZoneAirMassFlow.BalanceMixing); @@ -665,15 +666,15 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_ZoneAirMassFlowConservationReportVa // call to process input ErrorsFound = false; - GetProjectControlData(state, ErrorsFound); // returns ErrorsFound false, ZoneAirMassFlowConservation never sets it + GetProjectControlData(*state, ErrorsFound); // returns ErrorsFound false, ZoneAirMassFlowConservation never sets it EXPECT_FALSE(ErrorsFound); - state.dataGlobal->NumOfZones = 2; - ZoneReOrder.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 2; + ZoneReOrder.allocate(state->dataGlobal->NumOfZones); ErrorsFound = false; - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); ErrorsFound = false; - GetSimpleAirModelInputs(state, ErrorsFound); + GetSimpleAirModelInputs(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // first 2 have indexes swapped now since they are in lexicigraphical order now according to the new input processor @@ -711,7 +712,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetMaterialRoofVegetation) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - GetMaterialData(state, ErrorsFound); + GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // check the "Material:RoofVegetation" names @@ -725,26 +726,26 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetMaterialRoofVegetation) TEST_F(EnergyPlusFixture, HeatBalanceManager_WarmUpConvergenceSmallLoadTest) { - state.dataGlobal->WarmupFlag = false; - state.dataGlobal->DayOfSim = 7; + state->dataGlobal->WarmupFlag = false; + state->dataGlobal->DayOfSim = 7; MinNumberOfWarmupDays = 25; - state.dataGlobal->NumOfZones = 1; - WarmupConvergenceValues.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + WarmupConvergenceValues.allocate(state->dataGlobal->NumOfZones); TempConvergTol = 0.01; LoadsConvergTol = 0.01; - MaxTempPrevDay.allocate(state.dataGlobal->NumOfZones); + MaxTempPrevDay.allocate(state->dataGlobal->NumOfZones); MaxTempPrevDay(1) = 23.0; - MaxTempZone.allocate(state.dataGlobal->NumOfZones); + MaxTempZone.allocate(state->dataGlobal->NumOfZones); MaxTempZone(1) = 23.0; - MinTempPrevDay.allocate(state.dataGlobal->NumOfZones); + MinTempPrevDay.allocate(state->dataGlobal->NumOfZones); MinTempPrevDay(1) = 23.0; - MinTempZone.allocate(state.dataGlobal->NumOfZones); + MinTempZone.allocate(state->dataGlobal->NumOfZones); MinTempZone(1) = 23.0; - MaxHeatLoadZone.allocate(state.dataGlobal->NumOfZones); - MaxHeatLoadPrevDay.allocate(state.dataGlobal->NumOfZones); + MaxHeatLoadZone.allocate(state->dataGlobal->NumOfZones); + MaxHeatLoadPrevDay.allocate(state->dataGlobal->NumOfZones); WarmupConvergenceValues(1).TestMaxHeatLoadValue = 0.0; - MaxCoolLoadZone.allocate(state.dataGlobal->NumOfZones); - MaxCoolLoadPrevDay.allocate(state.dataGlobal->NumOfZones); + MaxCoolLoadZone.allocate(state->dataGlobal->NumOfZones); + MaxCoolLoadPrevDay.allocate(state->dataGlobal->NumOfZones); WarmupConvergenceValues(1).TestMaxCoolLoadValue = 0.0; // Test 1: All Maxs both less than MinLoad (100.0) @@ -752,7 +753,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_WarmUpConvergenceSmallLoadTest) MaxHeatLoadPrevDay(1) = 90.0; MaxCoolLoadZone(1) = 50.0; MaxCoolLoadPrevDay(1) = 90.0; - CheckWarmupConvergence(state); + CheckWarmupConvergence(*state); EXPECT_EQ(WarmupConvergenceValues(1).PassFlag(3), 2); EXPECT_EQ(WarmupConvergenceValues(1).PassFlag(4), 2); EXPECT_NEAR(WarmupConvergenceValues(1).TestMaxHeatLoadValue, 0.0, 0.0001); @@ -763,7 +764,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_WarmUpConvergenceSmallLoadTest) MaxHeatLoadPrevDay(1) = 90.0; MaxCoolLoadZone(1) = 100.5; MaxCoolLoadPrevDay(1) = 90.0; - CheckWarmupConvergence(state); + CheckWarmupConvergence(*state); EXPECT_EQ(WarmupConvergenceValues(1).PassFlag(3), 2); EXPECT_EQ(WarmupConvergenceValues(1).PassFlag(4), 2); EXPECT_NEAR(WarmupConvergenceValues(1).TestMaxHeatLoadValue, 0.005, 0.0001); @@ -774,7 +775,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_WarmUpConvergenceSmallLoadTest) MaxHeatLoadPrevDay(1) = 100.5; MaxCoolLoadZone(1) = 90.0; MaxCoolLoadPrevDay(1) = 100.5; - CheckWarmupConvergence(state); + CheckWarmupConvergence(*state); EXPECT_EQ(WarmupConvergenceValues(1).PassFlag(3), 2); EXPECT_EQ(WarmupConvergenceValues(1).PassFlag(4), 2); EXPECT_NEAR(WarmupConvergenceValues(1).TestMaxHeatLoadValue, 0.005, 0.0001); @@ -785,7 +786,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_WarmUpConvergenceSmallLoadTest) MaxHeatLoadPrevDay(1) = 200.0; MaxCoolLoadZone(1) = 201.0; MaxCoolLoadPrevDay(1) = 200.0; - CheckWarmupConvergence(state); + CheckWarmupConvergence(*state); EXPECT_EQ(WarmupConvergenceValues(1).PassFlag(3), 2); EXPECT_EQ(WarmupConvergenceValues(1).PassFlag(4), 2); EXPECT_NEAR(WarmupConvergenceValues(1).TestMaxHeatLoadValue, 0.005, 0.0001); @@ -796,7 +797,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_WarmUpConvergenceSmallLoadTest) MaxHeatLoadPrevDay(1) = 200.0; MaxCoolLoadZone(1) = 210.0; MaxCoolLoadPrevDay(1) = 200.0; - CheckWarmupConvergence(state); + CheckWarmupConvergence(*state); EXPECT_EQ(WarmupConvergenceValues(1).PassFlag(3), 1); EXPECT_EQ(WarmupConvergenceValues(1).PassFlag(4), 1); EXPECT_NEAR(WarmupConvergenceValues(1).TestMaxHeatLoadValue, 0.05, 0.005); @@ -1207,18 +1208,18 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_TestZonePropertyLocalEnv) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(state); + ScheduleManager::ProcessScheduleInput(*state); - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - EXPECT_TRUE(state.dataGlobal->AnyLocalEnvironmentsInModel); + EXPECT_TRUE(state->dataGlobal->AnyLocalEnvironmentsInModel); DataZoneEquipment::ZoneEquipConfig.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).ZoneName = "LIVING ZONE"; @@ -1249,22 +1250,22 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_TestZonePropertyLocalEnv) DataHeatBalance::HConvIn(5) = 0.5; DataHeatBalance::HConvIn(6) = 0.5; - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->KickOffSimulation = true; DataHeatBalFanSys::ZoneLatentGain.allocate(1); - state.dataGlobal->TimeStepZoneSec = 900; + state->dataGlobal->TimeStepZoneSec = 900; DataHeatBalance::ZoneWinHeatGain.allocate(1); DataHeatBalance::ZoneWinHeatGainRep.allocate(1); DataHeatBalance::ZoneWinHeatGainRepEnergy.allocate(1); // Set up - OutAirNodeManager::GetOutAirNodesInput(state); + OutAirNodeManager::GetOutAirNodesInput(*state); DataEnvironment::OutBaroPress = 101325; ScheduleManager::Schedule(1).CurrentValue = 25.0; ScheduleManager::Schedule(2).CurrentValue = 20.0; ScheduleManager::Schedule(3).CurrentValue = 1.5; ScheduleManager::Schedule(4).CurrentValue = 90.0; - OutAirNodeManager::InitOutAirNodes(state); + OutAirNodeManager::InitOutAirNodes(*state); // Test if local nodes data correctly overwritten EXPECT_EQ(25.0, DataLoopNode::Node(1).OutAirDryBulb); @@ -1274,7 +1275,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_TestZonePropertyLocalEnv) EXPECT_DOUBLE_EQ(0.012611481326656135, DataLoopNode::Node(1).HumRat); EXPECT_DOUBLE_EQ(57247.660939392081, DataLoopNode::Node(1).Enthalpy); - InitHeatBalance(state); + InitHeatBalance(*state); // Test if local value correctly overwritten EXPECT_EQ(25.0, Zone(1).OutDryBulbTemp); @@ -1292,7 +1293,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_TestZonePropertyLocalEnv) DataEnvironment::WindSpeed = 1.5; DataEnvironment::WindDir = 90.0; - InitHeatBalance(state); + InitHeatBalance(*state); // Test if local value correctly overwritten EXPECT_EQ(25.0, Zone(1).OutDryBulbTemp); @@ -1329,7 +1330,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_HVACSystemRootFindingAlgorithmInput bool ErrorsFound(false); // If errors detected in input ErrorsFound = false; - GetProjectControlData(state, ErrorsFound); // returns ErrorsFound false + GetProjectControlData(*state, ErrorsFound); // returns ErrorsFound false EXPECT_FALSE(ErrorsFound); EXPECT_EQ(DataHVACGlobals::HVACSystemRootFinding.Algorithm, "REGULAFALSITHENBISECTION"); } @@ -1359,7 +1360,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_HVACSystemRootFindingAlgorithmNoInp bool ErrorsFound(false); // If errors detected in input ErrorsFound = false; - GetProjectControlData(state, ErrorsFound); // returns ErrorsFound false + GetProjectControlData(*state, ErrorsFound); // returns ErrorsFound false EXPECT_FALSE(ErrorsFound); EXPECT_EQ(DataHVACGlobals::HVACSystemRootFinding.Algorithm, "RegulaFalsi"); } @@ -1566,21 +1567,21 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_EMSConstructionTest) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - SimulationManager::ManageSimulation(state); - state.dataGlobal->DayOfSim = 2; // avoid array bounds problem in RecKeepHeatBalance - state.dataWeatherManager->Envrn = 1; + SimulationManager::ManageSimulation(*state); + state->dataGlobal->DayOfSim = 2; // avoid array bounds problem in RecKeepHeatBalance + state->dataWeatherManager->Envrn = 1; // Test 1 - Set time of day to morning - should use high transmittance window - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 11; - state.dataGlobal->CurrentTime = 11.0; - WeatherManager::SetCurrentWeather(state); - HeatBalanceManager::ManageHeatBalance(state); + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 11; + state->dataGlobal->CurrentTime = 11.0; + WeatherManager::SetCurrentWeather(*state); + HeatBalanceManager::ManageHeatBalance(*state); // For now, must call this twice in order to hit the BeginTimeStepBeforePredictor EMS calling point - HeatBalanceManager::ManageHeatBalance(state); + HeatBalanceManager::ManageHeatBalance(*state); // Find the fenestration surface int winSurfNum = UtilityRoutines::FindItemInList("FENESTRATIONSURFACE", DataSurfaces::Surface); - int win1ConstNum = UtilityRoutines::FindItemInList("WINDOWCONSTRUCTION1", state.dataConstruction->Construct); + int win1ConstNum = UtilityRoutines::FindItemInList("WINDOWCONSTRUCTION1", state->dataConstruction->Construct); EXPECT_EQ(DataSurfaces::Surface(winSurfNum).Construction, win1ConstNum); Real64 transSol = DataSurfaces::SurfWinSysSolTransmittance(winSurfNum); EXPECT_GT(transSol, 0.8); @@ -1588,14 +1589,14 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_EMSConstructionTest) EXPECT_GT(refPtIllum, 3000.0); // Test 2 - Set time of day to afternoon - should use low transmittance window - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 14; - state.dataGlobal->CurrentTime = 14.0; - WeatherManager::SetCurrentWeather(state); - HeatBalanceManager::ManageHeatBalance(state); + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 14; + state->dataGlobal->CurrentTime = 14.0; + WeatherManager::SetCurrentWeather(*state); + HeatBalanceManager::ManageHeatBalance(*state); // For now, must call this twice in order to hit the BeginTimeStepBeforePredictor EMS calling point - HeatBalanceManager::ManageHeatBalance(state); - int win2ConstNum = UtilityRoutines::FindItemInList("WINDOWCONSTRUCTION2", state.dataConstruction->Construct); + HeatBalanceManager::ManageHeatBalance(*state); + int win2ConstNum = UtilityRoutines::FindItemInList("WINDOWCONSTRUCTION2", state->dataConstruction->Construct); EXPECT_EQ(DataSurfaces::Surface(winSurfNum).Construction, win2ConstNum); transSol = DataSurfaces::SurfWinSysSolTransmittance(winSurfNum); EXPECT_LT(transSol, 0.2); @@ -1617,7 +1618,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_HeatBalanceAlgorithm_Default) EXPECT_TRUE(process_idf(idf_objects)); - HeatBalanceManager::GetProjectControlData(state, errorsfound); + HeatBalanceManager::GetProjectControlData(*state, errorsfound); EXPECT_FALSE(errorsfound); EXPECT_TRUE(DataHeatBalance::AnyCTF); EXPECT_FALSE(DataHeatBalance::AnyEMPD); @@ -1644,7 +1645,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_HeatBalanceAlgorithm_CTF) EXPECT_TRUE(process_idf(idf_objects)); - HeatBalanceManager::GetProjectControlData(state, errorsfound); + HeatBalanceManager::GetProjectControlData(*state, errorsfound); EXPECT_FALSE(errorsfound); EXPECT_TRUE(DataHeatBalance::AnyCTF); EXPECT_FALSE(DataHeatBalance::AnyEMPD); @@ -1670,7 +1671,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_HeatBalanceAlgorithm_EMPD) EXPECT_TRUE(process_idf(idf_objects)); - HeatBalanceManager::GetProjectControlData(state, errorsfound); + HeatBalanceManager::GetProjectControlData(*state, errorsfound); EXPECT_FALSE(errorsfound); EXPECT_FALSE(DataHeatBalance::AnyCTF); EXPECT_TRUE(DataHeatBalance::AnyEMPD); @@ -1693,7 +1694,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_HeatBalanceAlgorithm_CondFD) EXPECT_TRUE(process_idf(idf_objects)); - HeatBalanceManager::GetProjectControlData(state, errorsfound); + HeatBalanceManager::GetProjectControlData(*state, errorsfound); EXPECT_FALSE(errorsfound); EXPECT_FALSE(DataHeatBalance::AnyCTF); EXPECT_FALSE(DataHeatBalance::AnyEMPD); @@ -1716,7 +1717,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_HeatBalanceAlgorithm_HAMT) EXPECT_TRUE(process_idf(idf_objects)); - HeatBalanceManager::GetProjectControlData(state, errorsfound); + HeatBalanceManager::GetProjectControlData(*state, errorsfound); EXPECT_FALSE(errorsfound); EXPECT_FALSE(DataHeatBalance::AnyCTF); EXPECT_FALSE(DataHeatBalance::AnyEMPD); @@ -1765,7 +1766,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GlazingEquivalentLayer_RValue) EXPECT_TRUE(process_idf(idf_objects)); - HeatBalanceManager::GetMaterialData(state, errorsfound); + HeatBalanceManager::GetMaterialData(*state, errorsfound); EXPECT_FALSE(errorsfound); EXPECT_NEAR(dataMaterial.Material(1).Resistance,0.158,0.0001); @@ -1806,11 +1807,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); // call get material data to auto-generate IRTSurface material ErrorsFound = false; - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ(DataHeatBalance::TotMaterials, 1); int MaterNum = 1; @@ -1828,53 +1829,53 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData) // get constructions ErrorsFound = false; - GetConstructData(state, ErrorsFound); + GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ(DataHeatBalance::TotConstructs, 3); - int constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Non-Grouped Air Boundary"), state.dataConstruction->Construct); - EXPECT_TRUE(UtilityRoutines::SameString(state.dataConstruction->Construct(constrNum).Name, "Non-Grouped Air Boundary")); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundary); - EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); - EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).IsUsedCTF); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); - EXPECT_EQ(state.dataConstruction->Construct(constrNum).TotLayers, 1); - EXPECT_TRUE(UtilityRoutines::SameString(dataMaterial.Material(state.dataConstruction->Construct(constrNum).LayerPoint(1)).Name, "~AirBoundary-IRTMaterial")); - EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryACH, 0.5); // Default value from IDD - EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryMixingSched, -1); + int constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Non-Grouped Air Boundary"), state->dataConstruction->Construct); + EXPECT_TRUE(UtilityRoutines::SameString(state->dataConstruction->Construct(constrNum).Name, "Non-Grouped Air Boundary")); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundary); + EXPECT_FALSE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); + EXPECT_FALSE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).IsUsedCTF); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).TotLayers, 1); + EXPECT_TRUE(UtilityRoutines::SameString(dataMaterial.Material(state->dataConstruction->Construct(constrNum).LayerPoint(1)).Name, "~AirBoundary-IRTMaterial")); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryACH, 0.5); // Default value from IDD + EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryMixingSched, -1); EXPECT_EQ(DataHeatBalance::NominalRforNominalUCalculation(constrNum), 0.01); - constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Grouped Air Boundary"), state.dataConstruction->Construct); - EXPECT_TRUE(UtilityRoutines::SameString(state.dataConstruction->Construct(constrNum).Name, "Grouped Air Boundary")); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundary); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); - EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); - EXPECT_FALSE(state.dataConstruction->Construct(constrNum).IsUsedCTF); - EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); - EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); - EXPECT_EQ(state.dataConstruction->Construct(constrNum).TotLayers, 0); - EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryACH, 0.0); // Not processed for GroupedZone mixing option - EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 0); + constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Grouped Air Boundary"), state->dataConstruction->Construct); + EXPECT_TRUE(UtilityRoutines::SameString(state->dataConstruction->Construct(constrNum).Name, "Grouped Air Boundary")); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundary); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); + EXPECT_FALSE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); + EXPECT_FALSE(state->dataConstruction->Construct(constrNum).IsUsedCTF); + EXPECT_FALSE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); + EXPECT_FALSE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).TotLayers, 0); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryACH, 0.0); // Not processed for GroupedZone mixing option + EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 0); EXPECT_EQ(DataHeatBalance::NominalRforNominalUCalculation(constrNum), 0.0); - constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Air Boundary with Good Mixing Schedule"), state.dataConstruction->Construct); - EXPECT_TRUE(UtilityRoutines::SameString(state.dataConstruction->Construct(constrNum).Name, "Air Boundary with Good Mixing Schedule")); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundary); - EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); - EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).IsUsedCTF); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); - EXPECT_EQ(state.dataConstruction->Construct(constrNum).TotLayers, 1); - EXPECT_TRUE(UtilityRoutines::SameString(dataMaterial.Material(state.dataConstruction->Construct(constrNum).LayerPoint(1)).Name, "~AirBoundary-IRTMaterial")); - EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryACH, 0.4); - EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 1); + constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Air Boundary with Good Mixing Schedule"), state->dataConstruction->Construct); + EXPECT_TRUE(UtilityRoutines::SameString(state->dataConstruction->Construct(constrNum).Name, "Air Boundary with Good Mixing Schedule")); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundary); + EXPECT_FALSE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); + EXPECT_FALSE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).IsUsedCTF); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).TotLayers, 1); + EXPECT_TRUE(UtilityRoutines::SameString(dataMaterial.Material(state->dataConstruction->Construct(constrNum).LayerPoint(1)).Name, "~AirBoundary-IRTMaterial")); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryACH, 0.4); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 1); EXPECT_EQ(DataHeatBalance::NominalRforNominalUCalculation(constrNum), 0.01); } @@ -1899,7 +1900,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData2) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); // skip call to get material data since this doesn't use IRT ErrorsFound = false; @@ -1907,7 +1908,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData2) // get constructions ErrorsFound = false; - GetConstructData(state, ErrorsFound); + GetConstructData(*state, ErrorsFound); EXPECT_TRUE(ErrorsFound); std::string const error_string = delimited_string({ @@ -1920,18 +1921,18 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetAirBoundaryConstructData2) EXPECT_EQ(DataHeatBalance::TotConstructs, 1); - int constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Air Boundary with Bad Mixing Schedule"), state.dataConstruction->Construct); - EXPECT_TRUE(UtilityRoutines::SameString(state.dataConstruction->Construct(constrNum).Name, "Air Boundary with Bad Mixing Schedule")); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundary); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); - EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); - EXPECT_FALSE(state.dataConstruction->Construct(constrNum).IsUsedCTF); - EXPECT_FALSE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); - EXPECT_TRUE(state.dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); - EXPECT_EQ(state.dataConstruction->Construct(constrNum).TotLayers, 0); - EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryACH, 0.1); - EXPECT_EQ(state.dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 0); + int constrNum = UtilityRoutines::FindItemInList(UtilityRoutines::MakeUPPERCase("Air Boundary with Bad Mixing Schedule"), state->dataConstruction->Construct); + EXPECT_TRUE(UtilityRoutines::SameString(state->dataConstruction->Construct(constrNum).Name, "Air Boundary with Bad Mixing Schedule")); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundary); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryGroupedRadiant); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundarySolar); + EXPECT_FALSE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryInteriorWindow); + EXPECT_FALSE(state->dataConstruction->Construct(constrNum).IsUsedCTF); + EXPECT_FALSE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryIRTSurface); + EXPECT_TRUE(state->dataConstruction->Construct(constrNum).TypeIsAirBoundaryMixing); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).TotLayers, 0); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryACH, 0.1); + EXPECT_EQ(state->dataConstruction->Construct(constrNum).AirBoundaryMixingSched, 0); EXPECT_EQ(DataHeatBalance::NominalRforNominalUCalculation(constrNum), 0.0); } @@ -1947,7 +1948,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_GetMaterialData_IRTSurfaces) bool ErrorsFound(false); // If errors detected in input - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); @@ -1970,7 +1971,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_UpdateWindowFaceTempsNonBSDFWin) DataSurfaces::TotSurfaces = 3; DataSurfaces::Surface.allocate(DataSurfaces::TotSurfaces); DataHeatBalance::TotConstructs = 3; - state.dataConstruction->Construct.allocate( DataHeatBalance::TotConstructs); + state->dataConstruction->Construct.allocate( DataHeatBalance::TotConstructs); DataSurfaces::Surface(1).Class = DataSurfaces::SurfaceClass::Wall; DataSurfaces::Surface(2).Class = DataSurfaces::SurfaceClass::Window; @@ -1978,13 +1979,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_UpdateWindowFaceTempsNonBSDFWin) DataSurfaces::Surface(1).Construction = 1; DataSurfaces::Surface(2).Construction = 2; DataSurfaces::Surface(3).Construction = 3; - state.dataConstruction->Construct(1).WindowTypeBSDF = false; - state.dataConstruction->Construct(2).WindowTypeBSDF = false; - state.dataConstruction->Construct(3).WindowTypeBSDF = true; + state->dataConstruction->Construct(1).WindowTypeBSDF = false; + state->dataConstruction->Construct(2).WindowTypeBSDF = false; + state->dataConstruction->Construct(3).WindowTypeBSDF = true; int SurfsForRegWindow = 3; - state.dataConstruction->Construct(1).TotLayers = 1; - state.dataConstruction->Construct(2).TotLayers = SurfsForRegWindow; - state.dataConstruction->Construct(3).TotLayers = 1; + state->dataConstruction->Construct(1).TotLayers = 1; + state->dataConstruction->Construct(2).TotLayers = SurfsForRegWindow; + state->dataConstruction->Construct(3).TotLayers = 1; SurfWinFenLaySurfTempFront.dimension(10, DataSurfaces::TotSurfaces, 0.0); SurfWinFenLaySurfTempBack.dimension(10, DataSurfaces::TotSurfaces, 0.0); @@ -1999,7 +2000,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_UpdateWindowFaceTempsNonBSDFWin) Real64 ZeroResult = 0.0; - HeatBalanceManager::UpdateWindowFaceTempsNonBSDFWin(state); + HeatBalanceManager::UpdateWindowFaceTempsNonBSDFWin(*state); // First surface is NOT a window so these should NOT be set EXPECT_NEAR(SurfWinFenLaySurfTempFront(1,1),ZeroResult,0.0001); @@ -2041,7 +2042,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_HVACSystemRootFindingAlgorithmBisec bool ErrorsFound(false); // If errors detected in input ErrorsFound = false; - GetProjectControlData(state, ErrorsFound); // returns ErrorsFound false + GetProjectControlData(*state, ErrorsFound); // returns ErrorsFound false EXPECT_FALSE(ErrorsFound); EXPECT_EQ(DataHVACGlobals::HVACSystemRootFinding.Algorithm, "BISECTION"); } @@ -2244,7 +2245,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceManager_EMSConstructionSwitchTest) ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::ManageSimulation(state); + SimulationManager::ManageSimulation(*state); int surfNum = UtilityRoutines::FindItemInList("FENESTRATIONSURFACE", DataSurfaces::Surface); EXPECT_EQ(DataSurfaces::Surface(surfNum).Construction, DataSurfaces::Surface(surfNum).EMSConstructionOverrideValue); diff --git a/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc b/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc index d9effe49f0b..7423a32a045 100644 --- a/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceMovableInsulation.unit.cc @@ -61,6 +61,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -90,17 +91,17 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalOutsideMovableInsulat dataMaterial.Material(1).ReflectSolBeamFront = 0.20; AbsExt = 0.0; - EvalOutsideMovableInsulation(state, SurfNum, HMovInsul, RoughIndexMovInsul, AbsExt); + EvalOutsideMovableInsulation(*state, SurfNum, HMovInsul, RoughIndexMovInsul, AbsExt); EXPECT_EQ(0.75, AbsExt); AbsExt = 0.0; dataMaterial.Material(1).Group = DataHeatBalance::WindowGlass; - EvalOutsideMovableInsulation(state, SurfNum, HMovInsul, RoughIndexMovInsul, AbsExt); + EvalOutsideMovableInsulation(*state, SurfNum, HMovInsul, RoughIndexMovInsul, AbsExt); EXPECT_EQ(0.55, AbsExt); AbsExt = 0.0; dataMaterial.Material(1).Group = DataHeatBalance::GlassEquivalentLayer; - EvalOutsideMovableInsulation(state, SurfNum, HMovInsul, RoughIndexMovInsul, AbsExt); + EvalOutsideMovableInsulation(*state, SurfNum, HMovInsul, RoughIndexMovInsul, AbsExt); EXPECT_EQ(0.55, AbsExt); } @@ -125,17 +126,17 @@ TEST_F(EnergyPlusFixture, HeatBalanceMovableInsulation_EvalInsideMovableInsulati dataMaterial.Material(1).ReflectSolBeamFront = 0.20; AbsExt = 0.0; - EvalInsideMovableInsulation(state, SurfNum, HMovInsul, AbsExt); + EvalInsideMovableInsulation(*state, SurfNum, HMovInsul, AbsExt); EXPECT_EQ(0.75, AbsExt); AbsExt = 0.0; dataMaterial.Material(1).Group = DataHeatBalance::WindowGlass; - EvalInsideMovableInsulation(state, SurfNum, HMovInsul, AbsExt); + EvalInsideMovableInsulation(*state, SurfNum, HMovInsul, AbsExt); EXPECT_EQ(0.55, AbsExt); AbsExt = 0.0; dataMaterial.Material(1).Group = DataHeatBalance::GlassEquivalentLayer; - EvalInsideMovableInsulation(state, SurfNum, HMovInsul, AbsExt); + EvalInsideMovableInsulation(*state, SurfNum, HMovInsul, AbsExt); EXPECT_EQ(0.55, AbsExt); } TEST_F(EnergyPlusFixture, SurfaceControlMovableInsulation_InvalidWindowSimpleGlazingTest) @@ -229,43 +230,43 @@ TEST_F(EnergyPlusFixture, SurfaceControlMovableInsulation_InvalidWindowSimpleGla // set error to false bool ErrorsFound(false); // set zone data - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataHeatBalance::Zone.allocate(1); DataHeatBalance::Zone(1).Name = "ZONE ONE"; // get schedule data - ScheduleManager::ProcessScheduleInput(state); + ScheduleManager::ProcessScheduleInput(*state); // get materials data - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ(4, DataHeatBalance::TotMaterials); EXPECT_EQ(dataMaterial.Material(4).Group, DataHeatBalance::WindowSimpleGlazing); // get construction data - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_EQ(1, DataHeatBalance::TotConstructs); EXPECT_FALSE(ErrorsFound); // set relative coordinate - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->CosZoneRelNorth = 1.0; - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinZoneRelNorth = 0.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->CosZoneRelNorth = 1.0; + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinZoneRelNorth = 0.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; // set surface data DataSurfaces::TotSurfaces = 1; - state.dataSurfaceGeometry->SurfaceTmp.allocate(1); + state->dataSurfaceGeometry->SurfaceTmp.allocate(1); int SurfNum = 0; int TotHTSurfs = DataSurfaces::TotSurfaces = 1; Array1D_string const BaseSurfCls(1, {"WALL"}); Array1D const BaseSurfIDs(1, {DataSurfaces::SurfaceClass::Wall}); int NeedToAddSurfaces; // get heat tranfer surface data - SurfaceGeometry::GetHTSurfaceData(state, ErrorsFound, SurfNum, TotHTSurfs, 0, 0, 0, BaseSurfCls, BaseSurfIDs, NeedToAddSurfaces); + SurfaceGeometry::GetHTSurfaceData(*state, ErrorsFound, SurfNum, TotHTSurfs, 0, 0, 0, BaseSurfCls, BaseSurfIDs, NeedToAddSurfaces); // get movable insulation object data - SurfaceGeometry::GetMovableInsulationData(state, ErrorsFound); + SurfaceGeometry::GetMovableInsulationData(*state, ErrorsFound); // check movable insulation material - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(1).BaseSurfName, "ZN001:WALL001"); // base surface name - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(1).MaterialMovInsulExt, 4); // index to movable insulation material + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(1).BaseSurfName, "ZN001:WALL001"); // base surface name + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(1).MaterialMovInsulExt, 4); // index to movable insulation material EXPECT_EQ(dataMaterial.Material(4).Name, "SIMPLEGLAZINGSYSTEM"); // name of movable insulation material EXPECT_EQ(dataMaterial.Material(4).Group, DataHeatBalance::WindowSimpleGlazing); // invalid material group type EXPECT_TRUE(ErrorsFound); // error found due to invalid material diff --git a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc index e454e1442d8..270bca3af60 100644 --- a/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc +++ b/tst/EnergyPlus/unit/HeatBalanceSurfaceManager.unit.cc @@ -77,6 +77,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" @@ -101,11 +102,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_CalcOutsideSurfTemp) TempExt = 23.0; ErrorFlag = false; - state.dataConstruction->Construct.allocate(ConstrNum); - state.dataConstruction->Construct(ConstrNum).Name = "TestConstruct"; - state.dataConstruction->Construct(ConstrNum).CTFCross(0) = 0.0; - state.dataConstruction->Construct(ConstrNum).CTFOutside(0) = 1.0; - state.dataConstruction->Construct(ConstrNum).SourceSinkPresent = true; + state->dataConstruction->Construct.allocate(ConstrNum); + state->dataConstruction->Construct(ConstrNum).Name = "TestConstruct"; + state->dataConstruction->Construct(ConstrNum).CTFCross(0) = 0.0; + state->dataConstruction->Construct(ConstrNum).CTFOutside(0) = 1.0; + state->dataConstruction->Construct(ConstrNum).SourceSinkPresent = true; dataMaterial.Material.allocate(1); dataMaterial.Material(1).Name = "TestMaterial"; @@ -145,9 +146,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_CalcOutsideSurfTemp) DataHeatBalSurface::QRadOutReport.allocate(SurfNum); DataHeatBalSurface::QAirExtReport.allocate(SurfNum); DataHeatBalSurface::QHeatEmiReport.allocate(SurfNum); - state.dataGlobal->TimeStepZoneSec = 900.0; + state->dataGlobal->TimeStepZoneSec = 900.0; - CalcOutsideSurfTemp(state, SurfNum, ZoneNum, ConstrNum, HMovInsul, TempExt, ErrorFlag); + CalcOutsideSurfTemp(*state, SurfNum, ZoneNum, ConstrNum, HMovInsul, TempExt, ErrorFlag); std::string const error_string = delimited_string({ " ** Severe ** Exterior movable insulation is not valid with embedded sources/sinks", @@ -177,24 +178,24 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI // no error surfTemp = 26; - state.dataGlobal->WarmupFlag = true; + state->dataGlobal->WarmupFlag = true; testSurface.LowTempErrCount = 0; testSurface.HighTempErrCount = 0; testZone.TempOutOfBoundsReported = true; testZone.FloorArea = 1000; testZone.IsControlled = true; - TestSurfTempCalcHeatBalanceInsideSurf(state, surfTemp, testSurface, testZone, cntWarmupSurfTemp); + TestSurfTempCalcHeatBalanceInsideSurf(*state, surfTemp, testSurface, testZone, cntWarmupSurfTemp); EXPECT_TRUE(compare_err_stream("", true)); // to hot - first time surfTemp = 201; - state.dataGlobal->WarmupFlag = false; + state->dataGlobal->WarmupFlag = false; testSurface.LowTempErrCount = 0; testSurface.HighTempErrCount = 0; testZone.TempOutOfBoundsReported = false; testZone.FloorArea = 1000; testZone.IsControlled = true; - TestSurfTempCalcHeatBalanceInsideSurf(state, surfTemp, testSurface, testZone, cntWarmupSurfTemp); + TestSurfTempCalcHeatBalanceInsideSurf(*state, surfTemp, testSurface, testZone, cntWarmupSurfTemp); std::string const error_string01 = delimited_string({" ** Severe ** Temperature (high) out of bounds (201.00] for zone=\"TestZone\", for surface=\"TestSurface\"", " ** ~~~ ** Environment=, at Simulation time= 00:00 - 00:00", @@ -208,13 +209,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI // to hot - subsequent times surfTemp = 201; - state.dataGlobal->WarmupFlag = false; + state->dataGlobal->WarmupFlag = false; testSurface.LowTempErrCount = 0; testSurface.HighTempErrCount = 0; testZone.TempOutOfBoundsReported = true; testZone.FloorArea = 1000; testZone.IsControlled = true; - TestSurfTempCalcHeatBalanceInsideSurf(state, surfTemp, testSurface, testZone, cntWarmupSurfTemp); + TestSurfTempCalcHeatBalanceInsideSurf(*state, surfTemp, testSurface, testZone, cntWarmupSurfTemp); std::string const error_string02 = delimited_string({ " ** Severe ** Temperature (high) out of bounds (201.00] for zone=\"TestZone\", for surface=\"TestSurface\"", " ** ~~~ ** Environment=, at Simulation time= 00:00 - 00:00", @@ -224,13 +225,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI // to cold - first time surfTemp = -101; - state.dataGlobal->WarmupFlag = false; + state->dataGlobal->WarmupFlag = false; testSurface.LowTempErrCount = 0; testSurface.HighTempErrCount = 0; testZone.TempOutOfBoundsReported = false; testZone.FloorArea = 1000; testZone.IsControlled = true; - TestSurfTempCalcHeatBalanceInsideSurf(state, surfTemp, testSurface, testZone, cntWarmupSurfTemp); + TestSurfTempCalcHeatBalanceInsideSurf(*state, surfTemp, testSurface, testZone, cntWarmupSurfTemp); std::string const error_string03 = delimited_string({" ** Severe ** Temperature (low) out of bounds [-101.00] for zone=\"TestZone\", for surface=\"TestSurface\"", " ** ~~~ ** Environment=, at Simulation time= 00:00 - 00:00", @@ -244,13 +245,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI // to cold - subsequent times surfTemp = -101; - state.dataGlobal->WarmupFlag = false; + state->dataGlobal->WarmupFlag = false; testSurface.LowTempErrCount = 0; testSurface.HighTempErrCount = 0; testZone.TempOutOfBoundsReported = true; testZone.FloorArea = 1000; testZone.IsControlled = true; - TestSurfTempCalcHeatBalanceInsideSurf(state, surfTemp, testSurface, testZone, cntWarmupSurfTemp); + TestSurfTempCalcHeatBalanceInsideSurf(*state, surfTemp, testSurface, testZone, cntWarmupSurfTemp); std::string const error_string04 = delimited_string({" ** Severe ** Temperature (low) out of bounds [-101.00] for zone=\"TestZone\", for surface=\"TestSurface\"", " ** ~~~ ** Environment=, at Simulation time= 00:00 - 00:00"}); @@ -262,11 +263,11 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_ComputeIntThermalAbsorpFacto { DataSurfaces::TotSurfaces = 1; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataHeatBalance::TotMaterials = 1; DataHeatBalance::TotConstructs = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataHeatBalance::Zone(1).SurfaceFirst = 1; DataHeatBalance::Zone(1).SurfaceLast = 1; DataHeatBalance::Zone(1).WindowSurfaceFirst = 1; @@ -274,14 +275,14 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_ComputeIntThermalAbsorpFacto DataSurfaces::Surface.allocate(DataSurfaces::TotSurfaces); DataSurfaces::SurfaceWindow.allocate(DataSurfaces::TotSurfaces); SurfaceGeometry::AllocateSurfaceWindows(DataSurfaces::TotSurfaces); - state.dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); + state->dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); dataMaterial.Material.allocate(DataHeatBalance::TotMaterials); DataSurfaces::Surface(1).HeatTransSurf = true; DataSurfaces::Surface(1).Construction = 1; DataSurfaces::SurfWinShadingFlag(1) = 0; - state.dataConstruction->Construct(1).InsideAbsorpThermal = 0.9; - state.dataConstruction->Construct(1).TransDiff = 0.0; + state->dataConstruction->Construct(1).InsideAbsorpThermal = 0.9; + state->dataConstruction->Construct(1).TransDiff = 0.0; DataSurfaces::Surface(1).MaterialMovInsulInt = 1; dataMaterial.Material(1).AbsorpThermal = 0.2; dataMaterial.Material(1).AbsorpSolar = 0.5; @@ -289,7 +290,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_ComputeIntThermalAbsorpFacto DataSurfaces::Surface(1).SchedMovInsulInt = -1; // According to schedule manager protocol, an index of -1 returns a 1.0 value for the schedule dataMaterial.Material(1).Resistance = 1.25; - ComputeIntThermalAbsorpFactors(state); + ComputeIntThermalAbsorpFactors(*state); EXPECT_EQ(0.2, DataHeatBalance::ITABSF(1)); } @@ -297,15 +298,15 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_ComputeIntThermalAbsorpFacto TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_UpdateFinalThermalHistories) { DataSurfaces::TotSurfaces = 1; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataHeatBalance::TotConstructs = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataSurfaces::Surface.allocate(DataSurfaces::TotSurfaces); DataSurfaces::SurfaceWindow.allocate(DataSurfaces::TotSurfaces); - state.dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); + state->dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); DataHeatBalance::AnyConstructInternalSourceInInput = true; - AllocateSurfaceHeatBalArrays(state); // allocates a host of variables related to CTF calculations + AllocateSurfaceHeatBalArrays(*state); // allocates a host of variables related to CTF calculations DataSurfaces::Surface(1).Class = DataSurfaces::SurfaceClass::Wall; DataSurfaces::Surface(1).HeatTransSurf = true; @@ -313,12 +314,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_UpdateFinalThermalHistories) DataSurfaces::Surface(1).ExtBoundCond = 1; DataSurfaces::Surface(1).Construction = 1; - state.dataConstruction->Construct(1).NumCTFTerms = 2; - state.dataConstruction->Construct(1).SourceSinkPresent = true; - state.dataConstruction->Construct(1).NumHistories = 1; - state.dataConstruction->Construct(1).CTFTUserOut(0) = 0.5; - state.dataConstruction->Construct(1).CTFTUserIn(0) = 0.25; - state.dataConstruction->Construct(1).CTFTUserSource(0) = 0.25; + state->dataConstruction->Construct(1).NumCTFTerms = 2; + state->dataConstruction->Construct(1).SourceSinkPresent = true; + state->dataConstruction->Construct(1).NumHistories = 1; + state->dataConstruction->Construct(1).CTFTUserOut(0) = 0.5; + state->dataConstruction->Construct(1).CTFTUserIn(0) = 0.25; + state->dataConstruction->Construct(1).CTFTUserSource(0) = 0.25; DataHeatBalSurface::SUMH(1) = 0; DataHeatBalSurface::TH(1, 1, 1) = 20.0; @@ -326,12 +327,12 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_UpdateFinalThermalHistories) DataHeatBalFanSys::CTFTuserConstPart(1) = 0.0; - UpdateThermalHistories(state); // First check to see if it is calculating the user location temperature properly + UpdateThermalHistories(*state); // First check to see if it is calculating the user location temperature properly EXPECT_EQ(12.5, DataHeatBalSurface::TempUserLoc(1)); EXPECT_EQ(0.0, DataHeatBalSurface::TuserHist(1, 3)); - UpdateThermalHistories(state); + UpdateThermalHistories(*state); EXPECT_EQ(12.5, DataHeatBalSurface::TuserHist(1, 3)); // Now check to see that it is shifting the temperature history properly } @@ -686,20 +687,20 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); DataZoneEquipment::ZoneEquipConfig.allocate(1); @@ -768,15 +769,15 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI DataMoistureBalance::RhoVaporAirIn.allocate(6); DataMoistureBalance::HMassConvInFD.allocate(6); - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->KickOffSimulation = true; DataHeatBalFanSys::ZoneLatentGain.allocate(1); - state.dataGlobal->TimeStepZoneSec = 900; - SolarShading::AllocateModuleArrays(state); + state->dataGlobal->TimeStepZoneSec = 900; + SolarShading::AllocateModuleArrays(*state); - AllocateSurfaceHeatBalArrays(state); + AllocateSurfaceHeatBalArrays(*state); createFacilityElectricPowerServiceObject(); // with supply air - CalcHeatBalanceInsideSurf(state); + CalcHeatBalanceInsideSurf(*state); EXPECT_EQ(24.0, DataHeatBalance::TempEffBulkAir(1)); EXPECT_EQ(23.0, DataHeatBalance::TempEffBulkAir(2)); EXPECT_EQ(20.0, DataHeatBalance::TempEffBulkAir(3)); @@ -786,7 +787,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI DataLoopNode::Node(2).MassFlowRate = 0.0; DataLoopNode::Node(3).MassFlowRate = 0.0; DataLoopNode::Node(4).MassFlowRate = 0.0; - CalcHeatBalanceInsideSurf(state); + CalcHeatBalanceInsideSurf(*state); EXPECT_EQ(24.0, DataHeatBalance::TempEffBulkAir(1)); EXPECT_EQ(23.0, DataHeatBalance::TempEffBulkAir(2)); EXPECT_EQ(24.0, DataHeatBalance::TempEffBulkAir(3)); @@ -796,7 +797,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceI DataHeatBalFanSys::MAT.deallocate(); // Zone temperature C DataHeatBalFanSys::ZoneAirHumRat.deallocate(); DataLoopNode::Node.deallocate(); - state.dataGlobal->KickOffSimulation = false; + state->dataGlobal->KickOffSimulation = false; DataHeatBalSurface::TempSurfInTmp.deallocate(); DataHeatBalance::TempEffBulkAir.deallocate(); DataHeatBalSurface::TH.deallocate(); @@ -1213,28 +1214,28 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertyLocalEnv) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(state); + ScheduleManager::ProcessScheduleInput(*state); - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::SetupZoneGeometry(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::SetupZoneGeometry(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceIntRadExchange::InitSolarViewFactors(state); + HeatBalanceIntRadExchange::InitSolarViewFactors(*state); EXPECT_FALSE(has_err_output(true)); - EXPECT_TRUE(state.dataGlobal->AnyLocalEnvironmentsInModel); + EXPECT_TRUE(state->dataGlobal->AnyLocalEnvironmentsInModel); DataZoneEquipment::ZoneEquipConfig.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).ZoneName = "LIVING ZONE"; @@ -1304,25 +1305,25 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertyLocalEnv) DataMoistureBalance::RhoVaporAirIn.allocate(6); DataMoistureBalance::HMassConvInFD.allocate(6); - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->KickOffSimulation = true; DataHeatBalFanSys::ZoneLatentGain.allocate(1); - state.dataGlobal->TimeStepZoneSec = 900; + state->dataGlobal->TimeStepZoneSec = 900; DataHeatBalance::ZoneWinHeatGain.allocate(1); DataHeatBalance::ZoneWinHeatGainRep.allocate(1); DataHeatBalance::ZoneWinHeatGainRepEnergy.allocate(1); // Set up - AllocateSurfaceHeatBalArrays(state); + AllocateSurfaceHeatBalArrays(*state); createFacilityElectricPowerServiceObject(); - SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(state); - OutAirNodeManager::GetOutAirNodesInput(state); + SolarShading::AllocateModuleArrays(*state); + SolarShading::DetermineShadowingCombinations(*state); + OutAirNodeManager::GetOutAirNodesInput(*state); ScheduleManager::Schedule(1).CurrentValue = 25.0; ScheduleManager::Schedule(2).CurrentValue = 20.0; ScheduleManager::Schedule(3).CurrentValue = 1.5; ScheduleManager::Schedule(4).CurrentValue = 90.0; - OutAirNodeManager::InitOutAirNodes(state); + OutAirNodeManager::InitOutAirNodes(*state); // Test if local nodes data correctly overwritten EXPECT_EQ(25.0, DataLoopNode::Node(1).OutAirDryBulb); @@ -1332,7 +1333,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertyLocalEnv) EXPECT_DOUBLE_EQ(0.012611481326656135, DataLoopNode::Node(1).HumRat); EXPECT_DOUBLE_EQ(57247.660939392081, DataLoopNode::Node(1).Enthalpy); - InitSurfaceHeatBalance(state); + InitSurfaceHeatBalance(*state); // Test if local value correctly overwritten EXPECT_EQ(25.0, DataSurfaces::Surface(1).OutDryBulbTemp); @@ -1345,7 +1346,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertyLocalEnv) for (int SurfNum = 1; SurfNum <= 6; SurfNum++) { DataSurfaces::Surface(SurfNum).ExtConvCoeff = -1; } - CalcHeatBalanceOutsideSurf(state); + CalcHeatBalanceOutsideSurf(*state); Real64 HExt_Expect_Surf1 = ConvectionCoefficients::CalcASHRAESimpExtConvectCoeff(5, 1.5); Real64 HExt_Expect_Surf2 = ConvectionCoefficients::CalcASHRAESimpExtConvectCoeff(5, 0.0); EXPECT_EQ(HExt_Expect_Surf1, DataHeatBalSurface::HcExtSurf(1)); @@ -1788,28 +1789,28 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertySrdSurfLWR) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(state); + ScheduleManager::ProcessScheduleInput(*state); - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::SetupZoneGeometry(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::SetupZoneGeometry(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceIntRadExchange::InitSolarViewFactors(state); + HeatBalanceIntRadExchange::InitSolarViewFactors(*state); EXPECT_FALSE(has_err_output(true)); - EXPECT_TRUE(state.dataGlobal->AnyLocalEnvironmentsInModel); + EXPECT_TRUE(state->dataGlobal->AnyLocalEnvironmentsInModel); DataZoneEquipment::ZoneEquipConfig.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).ZoneName = "LIVING ZONE"; @@ -1873,20 +1874,20 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertySrdSurfLWR) DataMoistureBalance::RhoVaporAirIn.allocate(6); DataMoistureBalance::HMassConvInFD.allocate(6); - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->KickOffSimulation = true; DataHeatBalFanSys::ZoneLatentGain.allocate(1); - state.dataGlobal->TimeStepZoneSec = 900; + state->dataGlobal->TimeStepZoneSec = 900; DataHeatBalance::ZoneWinHeatGain.allocate(1); DataHeatBalance::ZoneWinHeatGainRep.allocate(1); DataHeatBalance::ZoneWinHeatGainRepEnergy.allocate(1); // Set up - AllocateSurfaceHeatBalArrays(state); + AllocateSurfaceHeatBalArrays(*state); createFacilityElectricPowerServiceObject(); - SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(state); + SolarShading::AllocateModuleArrays(*state); + SolarShading::DetermineShadowingCombinations(*state); - InitSurfaceHeatBalance(state); + InitSurfaceHeatBalance(*state); DataSurfaces::AirSkyRadSplit.allocate(6); ScheduleManager::Schedule(1).CurrentValue = 25.0; // Srd Srfs Temp @@ -1900,7 +1901,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfPropertySrdSurfLWR) DataSurfaces::Surface(SurfNum).ExtConvCoeff = -6; DataSurfaces::AirSkyRadSplit(SurfNum) = 1.0; } - CalcHeatBalanceOutsideSurf(state); + CalcHeatBalanceOutsideSurf(*state); // Test if local value correctly overwritten // Surface(1-3) - local; Surface(4-6) - global; @@ -1936,15 +1937,15 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_SurfaceCOnstructionIndexTest ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->DisplayAdvancedReportVariables = true; + state->dataGlobal->DisplayAdvancedReportVariables = true; DataSurfaces::TotSurfaces = 1; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataHeatBalance::TotConstructs = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataSurfaces::Surface.allocate(DataSurfaces::TotSurfaces); DataSurfaces::SurfaceWindow.allocate(DataSurfaces::TotSurfaces); - state.dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); + state->dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); DataHeatBalance::AnyConstructInternalSourceInInput = true; DataSurfaces::Surface(1).Class = DataSurfaces::SurfaceClass::Wall; @@ -1953,15 +1954,15 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_SurfaceCOnstructionIndexTest DataSurfaces::Surface(1).ExtBoundCond = 1; DataSurfaces::Surface(1).Construction = 1; - state.dataConstruction->Construct(1).NumCTFTerms = 2; - state.dataConstruction->Construct(1).SourceSinkPresent = true; - state.dataConstruction->Construct(1).NumHistories = 1; - state.dataConstruction->Construct(1).CTFTUserOut(0) = 0.5; - state.dataConstruction->Construct(1).CTFTUserIn(0) = 0.25; - state.dataConstruction->Construct(1).CTFTUserSource(0) = 0.25; + state->dataConstruction->Construct(1).NumCTFTerms = 2; + state->dataConstruction->Construct(1).SourceSinkPresent = true; + state->dataConstruction->Construct(1).NumHistories = 1; + state->dataConstruction->Construct(1).CTFTUserOut(0) = 0.5; + state->dataConstruction->Construct(1).CTFTUserIn(0) = 0.25; + state->dataConstruction->Construct(1).CTFTUserSource(0) = 0.25; - AllocateSurfaceHeatBalArrays(state); // allocates a host of variables related to CTF calculations - OutputProcessor::GetReportVariableInput(state); + AllocateSurfaceHeatBalArrays(*state); // allocates a host of variables related to CTF calculations + OutputProcessor::GetReportVariableInput(*state); EXPECT_EQ(OutputProcessor::ReqRepVars(2).VarName, "SURFACE CONSTRUCTION INDEX"); } @@ -2347,26 +2348,26 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceA ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::SetupZoneGeometry(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::SetupZoneGeometry(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Clear schedule type warnings EXPECT_TRUE(has_err_output(true)); - HeatBalanceIntRadExchange::InitSolarViewFactors(state); + HeatBalanceIntRadExchange::InitSolarViewFactors(*state); EXPECT_TRUE(compare_err_stream("")); EXPECT_FALSE(has_err_output(true)); @@ -2438,9 +2439,9 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceA DataMoistureBalance::RhoVaporAirIn.allocate(6); DataMoistureBalance::HMassConvInFD.allocate(6); - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->KickOffSimulation = true; DataHeatBalFanSys::ZoneLatentGain.allocate(1); - state.dataGlobal->TimeStepZoneSec = 900; + state->dataGlobal->TimeStepZoneSec = 900; DataHeatBalance::ZoneWinHeatGain.allocate(1); DataHeatBalance::ZoneWinHeatGainRep.allocate(1); DataHeatBalance::ZoneWinHeatGainRepEnergy.allocate(1); @@ -2448,19 +2449,19 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceA ScheduleManager::Schedule(1).CurrentValue = -0.1; ScheduleManager::Schedule(2).CurrentValue = 0.1; - AllocateSurfaceHeatBalArrays(state); + AllocateSurfaceHeatBalArrays(*state); createFacilityElectricPowerServiceObject(); - SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(state); - InitSurfaceHeatBalance(state); + SolarShading::AllocateModuleArrays(*state); + SolarShading::DetermineShadowingCombinations(*state); + InitSurfaceHeatBalance(*state); for (int SurfNum = 1; SurfNum <= 6; SurfNum++) { DataSurfaces::Surface(SurfNum).ExtConvCoeff = -1; } // Test Additional Heat Source Calculation - CalcHeatBalanceOutsideSurf(state); + CalcHeatBalanceOutsideSurf(*state); EXPECT_EQ(-0.1, DataHeatBalSurface::SurfQAdditionalHeatSourceOutside(1)); - CalcHeatBalanceInsideSurf(state); + CalcHeatBalanceInsideSurf(*state); EXPECT_EQ(0.1, DataHeatBalSurface::SurfQAdditionalHeatSourceInside(6)); DataZoneEquipment::ZoneEquipConfig.deallocate(); @@ -2468,7 +2469,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestSurfTempCalcHeatBalanceA DataHeatBalFanSys::MAT.deallocate(); // Zone temperature C DataHeatBalFanSys::ZoneAirHumRat.deallocate(); DataLoopNode::Node.deallocate(); - state.dataGlobal->KickOffSimulation = false; + state->dataGlobal->KickOffSimulation = false; DataHeatBalSurface::TempSurfInTmp.deallocate(); DataHeatBalance::TempEffBulkAir.deallocate(); DataHeatBalSurface::TH.deallocate(); @@ -2523,7 +2524,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestReportIntMovInsInsideSur ExpectedResult3 = 1.23; // TempSurfInMovInsRep should be set to TempSurfInTmp // Now call the subroutine which will run all of the test cases at once and then make the comparisons - HeatBalanceSurfaceManager::ReportIntMovInsInsideSurfTemp(state); + HeatBalanceSurfaceManager::ReportIntMovInsInsideSurfTemp(*state); EXPECT_NEAR(DataHeatBalSurface::TempSurfInMovInsRep(1), ExpectedResult1, 0.00001); EXPECT_NEAR(DataHeatBalSurface::TempSurfInMovInsRep(2), ExpectedResult2, 0.00001); EXPECT_NEAR(DataHeatBalSurface::TempSurfInMovInsRep(3), ExpectedResult3, 0.00001); @@ -2559,15 +2560,15 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInterzoneRadFactorCalc) { DataSurfaces::TotSurfaces = 2; - state.dataGlobal->NumOfZones = 2; + state->dataGlobal->NumOfZones = 2; DataHeatBalance::TotMaterials = 1; DataHeatBalance::TotConstructs = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataSurfaces::Surface.allocate(DataSurfaces::TotSurfaces); - state.dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); - DataHeatBalSurface::EnclSolVMULT.allocate(state.dataGlobal->NumOfZones); - state.dataConstruction->Construct(1).TransDiff = 0.1; + state->dataConstruction->Construct.allocate(DataHeatBalance::TotConstructs); + DataHeatBalSurface::EnclSolVMULT.allocate(state->dataGlobal->NumOfZones); + state->dataConstruction->Construct(1).TransDiff = 0.1; DataHeatBalSurface::EnclSolVMULT(1) = 1.0; DataHeatBalSurface::EnclSolVMULT(2) = 1.0; @@ -2586,7 +2587,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInterzoneRadFactorCalc) DataSurfaces::Surface(1).SolarEnclIndex = 1; DataSurfaces::Surface(2).SolarEnclIndex = 2; - ComputeDifSolExcZonesWIZWindows(state, state.dataGlobal->NumOfZones); + ComputeDifSolExcZonesWIZWindows(*state, state->dataGlobal->NumOfZones); EXPECT_EQ(1, DataHeatBalSurface::FractDifShortZtoZ(1, 1)); EXPECT_EQ(1, DataHeatBalSurface::FractDifShortZtoZ(2, 2)); @@ -2596,13 +2597,13 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInterzoneRadFactorCalc) DataHeatBalance::Zone(1).HasInterZoneWindow = true; DataHeatBalance::Zone(2).HasInterZoneWindow = true; - ComputeDifSolExcZonesWIZWindows(state, state.dataGlobal->NumOfZones); + ComputeDifSolExcZonesWIZWindows(*state, state->dataGlobal->NumOfZones); EXPECT_TRUE(DataHeatBalSurface::RecDifShortFromZ(1)); EXPECT_TRUE(DataHeatBalSurface::RecDifShortFromZ(2)); - state.dataGlobal->KickOffSimulation = true; - ComputeDifSolExcZonesWIZWindows(state, state.dataGlobal->NumOfZones); + state->dataGlobal->KickOffSimulation = true; + ComputeDifSolExcZonesWIZWindows(*state, state->dataGlobal->NumOfZones); EXPECT_EQ(1, DataHeatBalSurface::FractDifShortZtoZ(1, 1)); EXPECT_EQ(1, DataHeatBalSurface::FractDifShortZtoZ(2, 2)); @@ -2613,28 +2614,28 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInterzoneRadFactorCalc) TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) { - state.dataGlobal->NumOfZones = 1; - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::RunPeriodWeather; + state->dataGlobal->NumOfZones = 1; + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::RunPeriodWeather; OutputReportTabular::displayThermalResilienceSummary = true; DataEnvironment::Month = 7; DataEnvironment::DayOfMonth = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1; DataEnvironment::OutBaroPress = 101325.0; - state.dataGlobal->NumOfZones = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZTAV.dimension(state.dataGlobal->NumOfZones, 0.0); - DataHeatBalFanSys::ZoneAirHumRatAvg.dimension(state.dataGlobal->NumOfZones, 0.0); + state->dataGlobal->NumOfZones = 1; + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZTAV.dimension(state->dataGlobal->NumOfZones, 0.0); + DataHeatBalFanSys::ZoneAirHumRatAvg.dimension(state->dataGlobal->NumOfZones, 0.0); - DataHeatBalFanSys::ZoneHeatIndex.dimension(state.dataGlobal->NumOfZones, 0.0); - DataHeatBalFanSys::ZoneHumidex.dimension(state.dataGlobal->NumOfZones, 0.0); - DataHeatBalFanSys::ZoneNumOcc.dimension(state.dataGlobal->NumOfZones, 0); - DataHeatBalFanSys::ZoneHeatIndexHourBins.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneHumidexHourBins.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneHeatIndexOccuHourBins.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneHumidexOccuHourBins.allocate(state.dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneHeatIndex.dimension(state->dataGlobal->NumOfZones, 0.0); + DataHeatBalFanSys::ZoneHumidex.dimension(state->dataGlobal->NumOfZones, 0.0); + DataHeatBalFanSys::ZoneNumOcc.dimension(state->dataGlobal->NumOfZones, 0); + DataHeatBalFanSys::ZoneHeatIndexHourBins.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneHumidexHourBins.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneHeatIndexOccuHourBins.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneHumidexOccuHourBins.allocate(state->dataGlobal->NumOfZones); DataHeatBalance::TotPeople = 1; DataHeatBalance::People.allocate(DataHeatBalance::TotPeople); @@ -2644,48 +2645,48 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) DataHeatBalance::People(1).NumberOfPeoplePtr = 1; ScheduleManager::Schedule.allocate(1); - state.dataThermalComforts->ThermalComfortData.allocate(DataHeatBalance::TotPeople); - DataHeatBalFanSys::ZoneOccPierceSET.dimension(state.dataGlobal->NumOfZones, 0); - DataHeatBalFanSys::ZoneOccPierceSETLastStep.dimension(state.dataGlobal->NumOfZones, 0); - DataHeatBalFanSys::ZoneLowSETHours.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneHighSETHours.allocate(state.dataGlobal->NumOfZones); + state->dataThermalComforts->ThermalComfortData.allocate(DataHeatBalance::TotPeople); + DataHeatBalFanSys::ZoneOccPierceSET.dimension(state->dataGlobal->NumOfZones, 0); + DataHeatBalFanSys::ZoneOccPierceSETLastStep.dimension(state->dataGlobal->NumOfZones, 0); + DataHeatBalFanSys::ZoneLowSETHours.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneHighSETHours.allocate(state->dataGlobal->NumOfZones); - state.dataThermalComforts->ThermalComfortData(1).PierceSET = 31; + state->dataThermalComforts->ThermalComfortData(1).PierceSET = 31; ScheduleManager::Schedule(1).CurrentValue = 0; // Heat Index Case 1: Zone T < 80 F; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataHeatBalFanSys::ZTAV(1) = 25; DataHeatBalFanSys::ZoneAirHumRatAvg(1) = 0.00988; // RH = 50% - CalcThermalResilience(state); - ReportThermalResilience(state); + CalcThermalResilience(*state); + ReportThermalResilience(*state); EXPECT_NEAR(25, DataHeatBalFanSys::ZoneHeatIndex(1), 0.5); EXPECT_NEAR(28, DataHeatBalFanSys::ZoneHumidex(1), 1); // Heat Index Case 2: Zone RH > 85, 80 < T < 87 F; - state.dataGlobal->HourOfDay = 2; + state->dataGlobal->HourOfDay = 2; DataHeatBalFanSys::ZTAV(1) = 27; DataHeatBalFanSys::ZoneAirHumRatAvg(1) = 0.02035; // RH = 90% - CalcThermalResilience(state); - ReportThermalResilience(state); + CalcThermalResilience(*state); + ReportThermalResilience(*state); EXPECT_NEAR(31, DataHeatBalFanSys::ZoneHeatIndex(1), 0.5); EXPECT_NEAR(39, DataHeatBalFanSys::ZoneHumidex(1), 1); // Heat Index Case 3: < Zone RH > 85, 80 < T < 87 F; - state.dataGlobal->HourOfDay = 3; + state->dataGlobal->HourOfDay = 3; DataHeatBalFanSys::ZTAV(1) = 27; DataHeatBalFanSys::ZoneAirHumRatAvg(1) = 0.0022; // RH = 10% - CalcThermalResilience(state); - ReportThermalResilience(state); + CalcThermalResilience(*state); + ReportThermalResilience(*state); EXPECT_NEAR(26, DataHeatBalFanSys::ZoneHeatIndex(1), 0.5); EXPECT_NEAR(23, DataHeatBalFanSys::ZoneHumidex(1), 1); // Heat Index Case 4: Rothfusz regression, other than the above conditions; - state.dataGlobal->HourOfDay = 4; + state->dataGlobal->HourOfDay = 4; DataHeatBalFanSys::ZTAV(1) = 30; DataHeatBalFanSys::ZoneAirHumRatAvg(1) = 0.01604; // RH = 60% - CalcThermalResilience(state); - ReportThermalResilience(state); + CalcThermalResilience(*state); + ReportThermalResilience(*state); EXPECT_NEAR(33, DataHeatBalFanSys::ZoneHeatIndex(1), 0.5); EXPECT_NEAR(38, DataHeatBalFanSys::ZoneHumidex(1), 1); @@ -2704,40 +2705,40 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) EXPECT_EQ(0, DataHeatBalFanSys::ZoneHighSETHours(1)[0]); // SET Hours EXPECT_EQ(0, DataHeatBalFanSys::ZoneHighSETHours(1)[1]); // SET OccupantHours - state.dataThermalComforts->ThermalComfortData(1).PierceSET = 11.2; + state->dataThermalComforts->ThermalComfortData(1).PierceSET = 11.2; ScheduleManager::Schedule(1).CurrentValue = 1; for (int hour = 5; hour <= 7; hour++) { - state.dataGlobal->HourOfDay = hour; -// CalcThermalResilience(state); - ReportThermalResilience(state); + state->dataGlobal->HourOfDay = hour; +// CalcThermalResilience(*state); + ReportThermalResilience(*state); } // Test SET-hours calculation - Heating unmet EXPECT_EQ(3, DataHeatBalFanSys::ZoneLowSETHours(1)[0]); // SET Hours = (12.2 - 11.2) * 3 Hours EXPECT_EQ(6, DataHeatBalFanSys::ZoneLowSETHours(1)[1]); // SET OccupantHours = (12.2 - 11.2) * 3 Hours * 2 OCC - state.dataThermalComforts->ThermalComfortData(1).PierceSET = 32; + state->dataThermalComforts->ThermalComfortData(1).PierceSET = 32; for (int hour = 8; hour <= 10; hour++) { - state.dataGlobal->HourOfDay = hour; - ReportThermalResilience(state); + state->dataGlobal->HourOfDay = hour; + ReportThermalResilience(*state); } // Test SET-hours calculation - Cooling unmet EXPECT_EQ(6, DataHeatBalFanSys::ZoneHighSETHours(1)[0]); // SET Hours = (32 - 30) * 3 Hours EXPECT_EQ(12, DataHeatBalFanSys::ZoneHighSETHours(1)[1]); // SET OccupantHours = (32 - 30) * 3 Hours * 2 OCC - state.dataThermalComforts->ThermalComfortData(1).PierceSET = 25; + state->dataThermalComforts->ThermalComfortData(1).PierceSET = 25; for (int hour = 11; hour <= 12; hour++) { - state.dataGlobal->HourOfDay = hour; - ReportThermalResilience(state); + state->dataGlobal->HourOfDay = hour; + ReportThermalResilience(*state); } - state.dataThermalComforts->ThermalComfortData(1).PierceSET = 11.2; + state->dataThermalComforts->ThermalComfortData(1).PierceSET = 11.2; for (int hour = 13; hour <= 18; hour++) { - state.dataGlobal->HourOfDay = hour; - ReportThermalResilience(state); + state->dataGlobal->HourOfDay = hour; + ReportThermalResilience(*state); } ScheduleManager::Schedule(1).CurrentValue = 0; for (int hour = 18; hour <= 20; hour++) { - state.dataGlobal->HourOfDay = hour; - ReportThermalResilience(state); + state->dataGlobal->HourOfDay = hour; + ReportThermalResilience(*state); } // Test SET longest duration calculation @@ -2748,20 +2749,20 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) EXPECT_EQ(6, DataHeatBalFanSys::ZoneLowSETHours(1)[2]); // Longest Heating SET Unmet Duration EXPECT_EQ(3, DataHeatBalFanSys::ZoneHighSETHours(1)[2]); // Longest Cooling SET Unmet Duration - DataHeatBalFanSys::ZoneCO2LevelHourBins.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneCO2LevelOccuHourBins.allocate(state.dataGlobal->NumOfZones); - DataContaminantBalance::ZoneAirCO2Avg.allocate(state.dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneCO2LevelHourBins.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneCO2LevelOccuHourBins.allocate(state->dataGlobal->NumOfZones); + DataContaminantBalance::ZoneAirCO2Avg.allocate(state->dataGlobal->NumOfZones); DataContaminantBalance::Contaminant.CO2Simulation = true; ScheduleManager::Schedule(1).CurrentValue = 1; OutputReportTabular::displayCO2ResilienceSummary = true; DataContaminantBalance::ZoneAirCO2Avg(1) = 1100; - ReportCO2Resilience(state); + ReportCO2Resilience(*state); EXPECT_EQ(1, DataHeatBalFanSys::ZoneCO2LevelHourBins(1)[1]); EXPECT_EQ(2, DataHeatBalFanSys::ZoneCO2LevelOccuHourBins(1)[1]); - DataHeatBalFanSys::ZoneLightingLevelHourBins.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneLightingLevelOccuHourBins.allocate(state.dataGlobal->NumOfZones); - DataDaylighting::ZoneDaylight.allocate(state.dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneLightingLevelHourBins.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneLightingLevelOccuHourBins.allocate(state->dataGlobal->NumOfZones); + DataDaylighting::ZoneDaylight.allocate(state->dataGlobal->NumOfZones); DataDaylighting::ZoneDaylight(1).DaylightMethod = DataDaylighting::SplitFluxDaylighting; DataDaylighting::ZoneDaylight(1).DaylIllumAtRefPt.allocate(1); DataDaylighting::ZoneDaylight(1).IllumSetPoint.allocate(1); @@ -2770,7 +2771,7 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestResilienceMetricReport) DataDaylighting::ZoneDaylight(1).IllumSetPoint(1) = 400; OutputReportTabular::displayVisualResilienceSummary = true; - ReportVisualResilience(state); + ReportVisualResilience(*state); EXPECT_EQ(1, DataHeatBalFanSys::ZoneLightingLevelHourBins(1)[2]); EXPECT_EQ(2, DataHeatBalFanSys::ZoneLightingLevelOccuHourBins(1)[2]); @@ -3047,23 +3048,23 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInitHBInterzoneWindow) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::SetupZoneGeometry(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::SetupZoneGeometry(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceIntRadExchange::InitSolarViewFactors(state); + HeatBalanceIntRadExchange::InitSolarViewFactors(*state); EXPECT_FALSE(has_err_output(true)); DataHeatBalFanSys::MAT.allocate(1); // Zone temperature C @@ -3078,25 +3079,25 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInitHBInterzoneWindow) DataMoistureBalance::RhoVaporAirIn.allocate(6); DataMoistureBalance::HMassConvInFD.allocate(6); - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->KickOffSimulation = true; DataHeatBalFanSys::ZoneLatentGain.allocate(1); - state.dataGlobal->TimeStepZoneSec = 900; + state->dataGlobal->TimeStepZoneSec = 900; DataHeatBalance::ZoneWinHeatGain.allocate(1); DataHeatBalance::ZoneWinHeatGainRep.allocate(1); DataHeatBalance::ZoneWinHeatGainRepEnergy.allocate(1); - AllocateSurfaceHeatBalArrays(state); + AllocateSurfaceHeatBalArrays(*state); createFacilityElectricPowerServiceObject(); - SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(state); + SolarShading::AllocateModuleArrays(*state); + SolarShading::DetermineShadowingCombinations(*state); - InitSurfaceHeatBalance(state); + InitSurfaceHeatBalance(*state); EXPECT_FALSE(DataHeatBalSurface::InterZoneWindow); EXPECT_FALSE(allocated(DataHeatBalSurface::FractDifShortZtoZ)); DataHeatBalSurface::InterZoneWindow = true; - InitSurfaceHeatBalance(state); + InitSurfaceHeatBalance(*state); EXPECT_TRUE(allocated(DataHeatBalSurface::FractDifShortZtoZ)); EXPECT_EQ(1, DataHeatBalSurface::FractDifShortZtoZ(1, 1)); @@ -3105,10 +3106,10 @@ TEST_F(EnergyPlusFixture, HeatBalanceSurfaceManager_TestInitHBInterzoneWindow) DataHeatBalSurface::InterZoneWindow = false; DataHeatBalance::ZoneBmSolFrIntWinsRep(1) = 10.0; DataEnvironment::SunIsUp = false; - InitIntSolarDistribution(state); + InitIntSolarDistribution(*state); EXPECT_EQ(0.0, DataHeatBalance::SurfIntBmIncInsSurfIntensRep(1)); DataEnvironment::SunIsUp = true; - InitIntSolarDistribution(state); + InitIntSolarDistribution(*state); EXPECT_NEAR(1.666667, DataHeatBalance::SurfIntBmIncInsSurfIntensRep(1), 0.00001); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc b/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc index 28400c8033f..26b5792a60e 100644 --- a/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc +++ b/tst/EnergyPlus/unit/HeatPumpWaterToWaterSimple.unit.cc @@ -64,6 +64,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -705,68 +706,68 @@ TEST_F(EnergyPlusFixture, PlantLoopSourceSideTest) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); - OutputReportPredefined::SetPredefinedTables(state); - HeatBalanceManager::SetPreConstructionInputParameters(state); // establish array bounds for constructions early + OutputReportPredefined::SetPredefinedTables(*state); + HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); createFacilityElectricPowerServiceObject(); - OutputProcessor::GetReportVariableInput(state); - PlantManager::CheckIfAnyPlant(state); + OutputProcessor::GetReportVariableInput(*state); + PlantManager::CheckIfAnyPlant(*state); - BranchInputManager::ManageBranchInput(state); // just gets input and + BranchInputManager::ManageBranchInput(*state); // just gets input and - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); - SimulationManager::SetupSimulation(state, ErrorsFound); - state.dataGlobal->KickOffSimulation = false; + WeatherManager::ResetEnvironmentCounter(*state); + SimulationManager::SetupSimulation(*state, ErrorsFound); + state->dataGlobal->KickOffSimulation = false; int EnvCount = 0; - state.dataGlobal->WarmupFlag = true; + state->dataGlobal->WarmupFlag = true; bool Available(true); while (Available) { - WeatherManager::GetNextEnvironment(state, Available, ErrorsFound); + WeatherManager::GetNextEnvironment(*state, Available, ErrorsFound); if (!Available) break; if (ErrorsFound) break; ++EnvCount; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->EndEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->EndEnvrnFlag = false; DataEnvironment::EndMonthFlag = false; - state.dataGlobal->WarmupFlag = true; - state.dataGlobal->DayOfSim = 0; - state.dataGlobal->DayOfSimChr = "0"; + state->dataGlobal->WarmupFlag = true; + state->dataGlobal->DayOfSim = 0; + state->dataGlobal->DayOfSimChr = "0"; - while ((state.dataGlobal->DayOfSim < state.dataGlobal->NumOfDayInEnvrn) || (state.dataGlobal->WarmupFlag)) { // Begin day loop ... + while ((state->dataGlobal->DayOfSim < state->dataGlobal->NumOfDayInEnvrn) || (state->dataGlobal->WarmupFlag)) { // Begin day loop ... - ++state.dataGlobal->DayOfSim; + ++state->dataGlobal->DayOfSim; - if (!state.dataGlobal->WarmupFlag) { + if (!state->dataGlobal->WarmupFlag) { ++DataEnvironment::CurrentOverallSimDay; } - state.dataGlobal->BeginDayFlag = true; - state.dataGlobal->EndDayFlag = false; + state->dataGlobal->BeginDayFlag = true; + state->dataGlobal->EndDayFlag = false; - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... - state.dataGlobal->BeginHourFlag = true; - state.dataGlobal->EndHourFlag = false; + state->dataGlobal->BeginHourFlag = true; + state->dataGlobal->EndHourFlag = false; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { - state.dataGlobal->BeginTimeStepFlag = true; + state->dataGlobal->BeginTimeStepFlag = true; // Set the End__Flag variables to true if necessary. Note that // each flag builds on the previous level. EndDayFlag cannot be @@ -775,31 +776,31 @@ TEST_F(EnergyPlusFixture, PlantLoopSourceSideTest) // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the // SubTimeStepFlags can/will be set/reset in the HVAC Manager. - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { - state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { - state.dataGlobal->EndDayFlag = true; - if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { - state.dataGlobal->EndEnvrnFlag = true; + if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + state->dataGlobal->EndHourFlag = true; + if (state->dataGlobal->HourOfDay == 24) { + state->dataGlobal->EndDayFlag = true; + if ((!state->dataGlobal->WarmupFlag) && (state->dataGlobal->DayOfSim == state->dataGlobal->NumOfDayInEnvrn)) { + state->dataGlobal->EndEnvrnFlag = true; } } } - WeatherManager::ManageWeather(state); + WeatherManager::ManageWeather(*state); - HeatBalanceManager::ManageHeatBalance(state); + HeatBalanceManager::ManageHeatBalance(*state); // After the first iteration of HeatBalance, all the 'input' has been gotten - state.dataGlobal->BeginHourFlag = false; - state.dataGlobal->BeginDayFlag = false; - state.dataGlobal->BeginEnvrnFlag = false; - state.dataGlobal->BeginSimFlag = false; - state.dataGlobal->BeginFullSimFlag = false; + state->dataGlobal->BeginHourFlag = false; + state->dataGlobal->BeginDayFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginSimFlag = false; + state->dataGlobal->BeginFullSimFlag = false; } // TimeStep loop - state.dataGlobal->PreviousHour = state.dataGlobal->HourOfDay; + state->dataGlobal->PreviousHour = state->dataGlobal->HourOfDay; } // ... End hour loop. @@ -1455,29 +1456,29 @@ TEST_F(EnergyPlusFixture, WWHP_AutosizeTest1) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); - OutputReportPredefined::SetPredefinedTables(state); - HeatBalanceManager::SetPreConstructionInputParameters(state); // establish array bounds for constructions early + OutputReportPredefined::SetPredefinedTables(*state); + HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); createFacilityElectricPowerServiceObject(); - OutputProcessor::GetReportVariableInput(state); - PlantManager::CheckIfAnyPlant(state); + OutputProcessor::GetReportVariableInput(*state); + PlantManager::CheckIfAnyPlant(*state); - BranchInputManager::ManageBranchInput(state); // just gets input and - SizingManager::ManageSizing(state); - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + BranchInputManager::ManageBranchInput(*state); // just gets input and + SizingManager::ManageSizing(*state); + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); - SimulationManager::SetupSimulation(state, ErrorsFound); - state.dataGlobal->KickOffSimulation = false; + WeatherManager::ResetEnvironmentCounter(*state); + SimulationManager::SetupSimulation(*state, ErrorsFound); + state->dataGlobal->KickOffSimulation = false; // should be sized now diff --git a/tst/EnergyPlus/unit/HeatRecovery.unit.cc b/tst/EnergyPlus/unit/HeatRecovery.unit.cc index a216c227f47..5ed3b68ac0e 100644 --- a/tst/EnergyPlus/unit/HeatRecovery.unit.cc +++ b/tst/EnergyPlus/unit/HeatRecovery.unit.cc @@ -70,6 +70,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace DataEnvironment; @@ -152,8 +153,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) BalDesDehumPerfNumericFields(BalDesDehumPerfDataIndex).NumericFieldNames.allocate(2); // HXUnitOn is false so expect outlet = inlet - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); Toutlet = ExchCond(ExchNum).SupInTemp; Tnode = ExchCond(ExchNum).SupOutTemp; @@ -165,8 +166,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) // HXUnitOn is true and ControlToTemperatureSetPoint is false so expect outlet = temperature based on effectiveness HXUnitOn = true; ExchCond(ExchNum).ExchConfigNum = Plate; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); Toutlet = (ExchCond(ExchNum).SupInTemp + (ExchCond(ExchNum).CoolEffectSensible75 * (ExchCond(ExchNum).SecInTemp - ExchCond(ExchNum).SupInTemp))); Tnode = ExchCond(ExchNum).SupOutTemp; @@ -174,8 +175,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) ExchCond(ExchNum).ExchConfigNum = Rotary; HXUnitOn = true; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); Toutlet = (ExchCond(ExchNum).SupInTemp + (ExchCond(ExchNum).CoolEffectSensible75 * (ExchCond(ExchNum).SecInTemp - ExchCond(ExchNum).SupInTemp))); Tnode = ExchCond(ExchNum).SupOutTemp; @@ -187,8 +188,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) // HXUnitOn is true and ControlToTemperatureSetPoint is true so expect outlet = set point temperature HXUnitOn = true; ExchCond(ExchNum).ExchConfigNum = Plate; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); Toutlet = SetPointTemp; Tnode = ExchCond(ExchNum).SupOutTemp; @@ -196,8 +197,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) ExchCond(ExchNum).ExchConfigNum = Rotary; HXUnitOn = true; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); Toutlet = Node(ExchCond(ExchNum).SupOutletNode).TempSetPoint; Tnode = Node(ExchCond(ExchNum).SupOutletNode).Temp; @@ -222,8 +223,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) // HXUnitOn is false so expect outlet = inlet HXUnitOn = false; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); EXPECT_DOUBLE_EQ(ExchCond(ExchNum).SupInTemp, Node(ExchCond(ExchNum).SupOutletNode).Temp); @@ -233,8 +234,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) // HXUnitOn is true and ControlToTemperatureSetPoint is false so expect outlet = temperature based on effectiveness HXUnitOn = true; ExchCond(ExchNum).ExchConfigNum = Plate; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); EXPECT_DOUBLE_EQ( (ExchCond(ExchNum).SupInTemp + (ExchCond(ExchNum).CoolEffectSensible75 * (ExchCond(ExchNum).SecInTemp - ExchCond(ExchNum).SupInTemp))), @@ -242,8 +243,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) ExchCond(ExchNum).ExchConfigNum = Rotary; HXUnitOn = true; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); EXPECT_DOUBLE_EQ( (ExchCond(ExchNum).SupInTemp + (ExchCond(ExchNum).CoolEffectSensible75 * (ExchCond(ExchNum).SecInTemp - ExchCond(ExchNum).SupInTemp))), @@ -255,15 +256,15 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) // HXUnitOn is true and ControlToTemperatureSetPoint is true so expect outlet = set point temperature HXUnitOn = true; ExchCond(ExchNum).ExchConfigNum = Plate; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); EXPECT_DOUBLE_EQ(Node(ExchCond(ExchNum).SupOutletNode).TempSetPoint, Node(ExchCond(ExchNum).SupOutletNode).Temp); ExchCond(ExchNum).ExchConfigNum = Rotary; HXUnitOn = true; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); EXPECT_DOUBLE_EQ(Node(ExchCond(ExchNum).SupOutletNode).TempSetPoint, Node(ExchCond(ExchNum).SupOutletNode).Temp); @@ -272,8 +273,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HRTest) Node(ExchCond(ExchNum).SupInletNode).MassFlowRate = ExchCond(ExchNum).SupInMassFlow / 4.0; Node(ExchCond(ExchNum).SecInletNode).MassFlowRate = ExchCond(ExchNum).SecInMassFlow / 4.0; ExchCond(ExchNum).ControlToTemperatureSetPoint = false; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag, PartLoadRatio); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag, PartLoadRatio); UpdateHeatRecovery(ExchNum); EXPECT_DOUBLE_EQ( (ExchCond(ExchNum).SupInTemp + (ExchCond(ExchNum).CoolEffectSensible75 * (ExchCond(ExchNum).SecInTemp - ExchCond(ExchNum).SupInTemp))), @@ -483,9 +484,9 @@ TEST_F(EnergyPlusFixture, HeatRecoveryHXOnManinBranch_GetInputTest) ASSERT_TRUE(process_idf(idf_objects)); - GetReturnAirPathInput(state); - GetAirPathData(state); - ASSERT_EQ(SimAirServingZones::HeatXchngr, state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(4).CompType_Num); + GetReturnAirPathInput(*state); + GetAirPathData(*state); + ASSERT_EQ(SimAirServingZones::HeatXchngr, state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(4).CompType_Num); } TEST_F(EnergyPlusFixture, HeatRecoveryHXOnMainBranch_SimHeatRecoveryTest) @@ -3815,10 +3816,10 @@ TEST_F(EnergyPlusFixture, HeatRecoveryHXOnMainBranch_SimHeatRecoveryTest) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); // - ManageSimulation(state); // run the design day + ManageSimulation(*state); // run the design day ASSERT_EQ("DOAS HEAT RECOVERY", ExchCond(1).Name); // Name of Heat Recovery Exchange On Main Air Loop - ASSERT_EQ(ExchCond(1).Name, state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).Name); // Heat Recovery Exchange On Main Air Loop + ASSERT_EQ(ExchCond(1).Name, state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).Name); // Heat Recovery Exchange On Main Air Loop ASSERT_NEAR(-17.300, ExchCond(1).SupInTemp, 0.001); // Heat Recovery Exchanger Primary Air Inlet Temp ASSERT_GT(ExchCond(1).SupOutTemp, ExchCond(1).SupInTemp); // Heat Recovery Exchanger is On in heating mode @@ -3876,7 +3877,7 @@ TEST_F(EnergyPlusFixture, SizeHeatRecovery) UnitarySysEqSizing(CurSysNum).HeatingCapacity = false; // calc heat recovery sizing - SizeHeatRecovery(state, ExchNum); + SizeHeatRecovery(*state, ExchNum); // test autosized nominal vol flow rate EXPECT_EQ(1.0, BalDesDehumPerfData(BalDesDehumPerfDataIndex).NomSupAirVolFlow); // m3/s @@ -3922,7 +3923,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_AirFlowSizing) ASSERT_TRUE(process_idf(idf_objects)); // get heat recovery heat exchanger generic - GetHeatRecoveryInput(state); + GetHeatRecoveryInput(*state); // initialize DataSizing::CurZoneEqNum = 1; @@ -3935,7 +3936,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_AirFlowSizing) ZoneEqSizing(CurZoneEqNum).AirVolFlow = 1.0; // size the HX nominal supply air volume flow rate - SizeHeatRecovery(state, ExchNum); + SizeHeatRecovery(*state, ExchNum); // verify the name and autosized supply air flow rate EXPECT_EQ(ExchCond(ExchNum).Name, "HEATRECOVERY HX IN ERV"); @@ -4044,22 +4045,22 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HeatExchangerGenericCalcTest) ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(state); + ScheduleManager::ProcessScheduleInput(*state); // get OA Controller - MixedAir::GetOAControllerInputs(state); + MixedAir::GetOAControllerInputs(*state); int OAContrllerNum = 1; auto &thisOAController(MixedAir::OAController(OAContrllerNum)); EXPECT_EQ(1, MixedAir::NumOAControllers); EXPECT_EQ("VAV WITH REHEAT_OA_CONTROLLER", thisOAController.Name); // get OA System - MixedAir::GetOutsideAirSysInputs(state); + MixedAir::GetOutsideAirSysInputs(*state); int OASysNum = 1; - auto &thisOASys = state.dataAirLoop->OutsideAirSys(OASysNum); + auto &thisOASys = state->dataAirLoop->OutsideAirSys(OASysNum); thisOASys.OAControllerIndex = MixedAir::GetOAController(thisOAController.Name); - EXPECT_EQ(1, state.dataAirLoop->NumOASystems); + EXPECT_EQ(1, state->dataAirLoop->NumOASystems); EXPECT_EQ("VAV WITH REHEAT_OA", thisOASys.Name); // get HR HX generic - GetHeatRecoveryInput(state); + GetHeatRecoveryInput(*state); int ExchNum = 1; auto &thisHX = HeatRecovery::ExchCond(ExchNum); EXPECT_EQ(1, HeatRecovery::NumAirToAirGenericExchs); @@ -4081,7 +4082,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HeatExchangerGenericCalcTest) int FanOpMode = 2; // 2 = constant fan DataEnvironment::OutBaroPress = 101325.0; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); thisHX.ExchTypeNum = HX_AIRTOAIR_GENERIC; thisHX.SupInTemp = 10.0; @@ -4102,8 +4103,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HeatExchangerGenericCalcTest) thisHX.NomSecAirVolFlow = thisHX.NomSupAirVolFlow; Node(thisHX.SecInletNode).MassFlowRate = thisHX.NomSecAirVolFlow * DataEnvironment::StdRhoAir; Node(thisHX.SupOutletNode).TempSetPoint = 19.0; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); EXPECT_DOUBLE_EQ(10.0, thisHX.SupInTemp); EXPECT_DOUBLE_EQ(20.0, thisHX.SecInTemp); @@ -4118,8 +4119,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_HeatExchangerGenericCalcTest) thisHX.NomSecAirVolFlow = 10.0 * thisHX.NomSupAirVolFlow; Node(thisHX.SecInletNode).MassFlowRate = thisHX.NomSecAirVolFlow * DataEnvironment::StdRhoAir; Node(thisHX.SupOutletNode).TempSetPoint = 19.0; - InitHeatRecovery(state, ExchNum, CompanionCoilNum, 0); - CalcAirToAirGenericHeatExch(state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); + InitHeatRecovery(*state, ExchNum, CompanionCoilNum, 0); + CalcAirToAirGenericHeatExch(*state, ExchNum, HXUnitOn, FirstHVACIteration, FanOpMode, EconomizerFlag, HighHumCtrlFlag); UpdateHeatRecovery(ExchNum); EXPECT_DOUBLE_EQ(10.0, thisHX.SupInTemp); EXPECT_DOUBLE_EQ(20.0, thisHX.SecInTemp); @@ -4165,7 +4166,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_NominalAirFlowAutosizeTest) ASSERT_TRUE(process_idf(idf_objects)); // get HR HX generic - GetHeatRecoveryInput(state); + GetHeatRecoveryInput(*state); int ExchNum = 1; auto &thisHX = HeatRecovery::ExchCond(ExchNum); // check inputs @@ -4184,8 +4185,8 @@ TEST_F(EnergyPlusFixture, HeatRecovery_NominalAirFlowAutosizeTest) thisOAController.ControllerType_Num = MixedAir::ControllerOutsideAir; int OASysNum = 1; - state.dataAirLoop->OutsideAirSys.allocate(OASysNum); - auto &thisOASys = state.dataAirLoop->OutsideAirSys(OASysNum); + state->dataAirLoop->OutsideAirSys.allocate(OASysNum); + auto &thisOASys = state->dataAirLoop->OutsideAirSys(OASysNum); thisOASys.OAControllerIndex = 1; DataSizing::CurSysNum = 1; @@ -4200,7 +4201,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_NominalAirFlowAutosizeTest) thisOAController.HeatRecoveryBypassControlType = DataHVACGlobals::BypassWhenOAFlowGreaterThanMinimum; thisOAController.EconBypass = false; // economizer control action type, no bypass // run HX sizing calculation - SizeHeatRecovery(state, ExchNum); + SizeHeatRecovery(*state, ExchNum); // check autosized nominal supply flow EXPECT_EQ(thisHX.NomSupAirVolFlow, 0.20); @@ -4208,7 +4209,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_NominalAirFlowAutosizeTest) thisOAController.Econo = MixedAir::DifferentialDryBulb; // with economizer thisHX.NomSupAirVolFlow = DataSizing::AutoSize; // run HX sizing calculation - SizeHeatRecovery(state, ExchNum); + SizeHeatRecovery(*state, ExchNum); // check autosized nominal supply flow EXPECT_EQ(thisHX.NomSupAirVolFlow, 0.20); // minimum flow ; @@ -4217,7 +4218,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_NominalAirFlowAutosizeTest) thisOAController.HeatRecoveryBypassControlType = DataHVACGlobals::BypassWhenWithinEconomizerLimits; thisHX.NomSupAirVolFlow = DataSizing::AutoSize; // run HX sizing calculation - SizeHeatRecovery(state, ExchNum); + SizeHeatRecovery(*state, ExchNum); // check autosized nominal supply flow EXPECT_EQ(thisHX.NomSupAirVolFlow, 0.2); // maximum flow @@ -4226,7 +4227,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_NominalAirFlowAutosizeTest) thisOAController.Lockout = MixedAir::LockoutWithHeatingPossible; // lockout thisHX.NomSupAirVolFlow = DataSizing::AutoSize; // run HX sizing calculation - SizeHeatRecovery(state, ExchNum); + SizeHeatRecovery(*state, ExchNum); // check autosized nominal supply flow EXPECT_EQ(thisHX.NomSupAirVolFlow, 0.20); @@ -4235,7 +4236,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_NominalAirFlowAutosizeTest) thisOAController.Lockout = MixedAir::LockoutWithCompressorPossible; // lockout thisHX.NomSupAirVolFlow = DataSizing::AutoSize; // run HX sizing calculation - SizeHeatRecovery(state, ExchNum); + SizeHeatRecovery(*state, ExchNum); // check autosized nominal supply flow EXPECT_EQ(thisHX.NomSupAirVolFlow, 0.20); @@ -4244,7 +4245,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_NominalAirFlowAutosizeTest) thisOAController.EconBypass = true; // with bypass thisHX.NomSupAirVolFlow = DataSizing::AutoSize; // run HX sizing calculation - SizeHeatRecovery(state, ExchNum); + SizeHeatRecovery(*state, ExchNum); // check autosized nominal supply flow EXPECT_EQ(thisHX.NomSupAirVolFlow, 0.20); @@ -4253,7 +4254,7 @@ TEST_F(EnergyPlusFixture, HeatRecovery_NominalAirFlowAutosizeTest) DataSizing::CurSysNum = 1; DataSizing::CurOASysNum = 0; // run HX sizing calculation - SizeHeatRecovery(state, ExchNum); + SizeHeatRecovery(*state, ExchNum); // check autosized nominal supply flow EXPECT_EQ(thisHX.NomSupAirVolFlow, 1.0); } diff --git a/tst/EnergyPlus/unit/HeatingCoils.unit.cc b/tst/EnergyPlus/unit/HeatingCoils.unit.cc index 4d2106366a0..fc4eccd907a 100644 --- a/tst/EnergyPlus/unit/HeatingCoils.unit.cc +++ b/tst/EnergyPlus/unit/HeatingCoils.unit.cc @@ -59,6 +59,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -71,7 +72,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypeInput) ASSERT_TRUE(process_idf(idf_objects)); - ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(state)); + ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(*state)); EXPECT_EQ(HeatingCoils::HeatingCoil(1).FuelType_Num, DataGlobalConstants::ResourceType::OtherFuel1); } @@ -88,7 +89,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypeInputError) " Air Loop Outlet Node; !- Air Outlet Node Name"}); EXPECT_FALSE(process_idf(idf_objects, false)); - ASSERT_THROW(HeatingCoils::GetHeatingCoilInput(state), std::runtime_error); + ASSERT_THROW(HeatingCoils::GetHeatingCoilInput(*state), std::runtime_error); std::string const error_string = delimited_string({ " ** Severe ** [Coil:Heating:Fuel][Furnace Coil][fuel_type] - \"Electricity\" - Failed to match against any enum values.", @@ -111,7 +112,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypeCoal) ASSERT_TRUE(process_idf(idf_objects)); - ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(state)); + ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(*state)); EXPECT_EQ(HeatingCoils::HeatingCoil(1).FuelType_Num, DataGlobalConstants::ResourceType::Coal); } @@ -125,7 +126,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_FuelTypePropaneGas) ASSERT_TRUE(process_idf(idf_objects)); - ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(state)); + ASSERT_NO_THROW(HeatingCoils::GetHeatingCoilInput(*state)); EXPECT_EQ(HeatingCoils::HeatingCoil(1).FuelType_Num, DataGlobalConstants::ResourceType::Propane); } @@ -157,7 +158,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_OutletAirPropertiesTest) HeatingCoils::HeatingCoil(CoilNum).MSParasiticElecLoad(1) = 0.0; HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate = OffMassFlowrate; - HeatingCoils::CalcMultiStageGasHeatingCoil(state, CoilNum, 0.0, 0.0, 1, 2); + HeatingCoils::CalcMultiStageGasHeatingCoil(*state, CoilNum, 0.0, 0.0, 1, 2); Real64 HeatLoad00 = HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate * (Psychrometrics::PsyHFnTdbW(HeatingCoils::HeatingCoil(CoilNum).OutletAirTemp, HeatingCoils::HeatingCoil(CoilNum).OutletAirHumRat) - @@ -165,7 +166,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_OutletAirPropertiesTest) EXPECT_NEAR(HeatLoad00, HeatingCoils::HeatingCoil(CoilNum).HeatingCoilLoad, 0.0001); HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate = 0.5 * OnMassFlowrate + (1.0 - 0.5) * OffMassFlowrate; - HeatingCoils::CalcMultiStageGasHeatingCoil(state, CoilNum, 0.0, 0.5, 1, 2); + HeatingCoils::CalcMultiStageGasHeatingCoil(*state, CoilNum, 0.0, 0.5, 1, 2); Real64 HeatLoad05 = HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate * (Psychrometrics::PsyHFnTdbW(HeatingCoils::HeatingCoil(CoilNum).OutletAirTemp, HeatingCoils::HeatingCoil(CoilNum).OutletAirHumRat) - @@ -173,7 +174,7 @@ TEST_F(EnergyPlusFixture, HeatingCoils_OutletAirPropertiesTest) EXPECT_NEAR(HeatLoad05, HeatingCoils::HeatingCoil(CoilNum).HeatingCoilLoad, 0.0001); HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate = OnMassFlowrate; - HeatingCoils::CalcMultiStageGasHeatingCoil(state, CoilNum, 0.0, 1.0, 1, 2); + HeatingCoils::CalcMultiStageGasHeatingCoil(*state, CoilNum, 0.0, 1.0, 1, 2); Real64 HeatLoad10 = HeatingCoils::HeatingCoil(CoilNum).InletAirMassFlowRate * (Psychrometrics::PsyHFnTdbW(HeatingCoils::HeatingCoil(CoilNum).OutletAirTemp, HeatingCoils::HeatingCoil(CoilNum).OutletAirHumRat) - diff --git a/tst/EnergyPlus/unit/HighTempRadiantSystem.unit.cc b/tst/EnergyPlus/unit/HighTempRadiantSystem.unit.cc index 3081f70782a..993908454bd 100644 --- a/tst/EnergyPlus/unit/HighTempRadiantSystem.unit.cc +++ b/tst/EnergyPlus/unit/HighTempRadiantSystem.unit.cc @@ -59,6 +59,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::HighTempRadiantSystem; @@ -107,7 +108,7 @@ TEST_F(EnergyPlusFixture, HighTempRadiantSystemTest_GetHighTempRadiantSystem) ErrorsFound = false; - GetHighTempRadiantSystem(state, ErrorsFound); + GetHighTempRadiantSystem(*state, ErrorsFound); std::string const error_string01 = delimited_string({" ** Severe ** Heating Setpoint Temperature Schedule Name not found: RADIANT HEATING SETPOINTS", @@ -151,7 +152,7 @@ TEST_F(EnergyPlusFixture, HighTempRadiantSystemTest_SizeHighTempRadiantSystemSca if (SizingTypesNum < 1) SizingTypesNum = 1; ZoneEqSizing(CurZoneEqNum).SizingMethod.allocate(DataHVACGlobals::NumOfSizingTypes); - SizeHighTempRadiantSystem(state, RadSysNum); + SizeHighTempRadiantSystem(*state, RadSysNum); EXPECT_FALSE(DataSizing::DataScalableSizingON); } diff --git a/tst/EnergyPlus/unit/Humidifiers.unit.cc b/tst/EnergyPlus/unit/Humidifiers.unit.cc index cb99c575568..1ce40b361fb 100644 --- a/tst/EnergyPlus/unit/Humidifiers.unit.cc +++ b/tst/EnergyPlus/unit/Humidifiers.unit.cc @@ -61,6 +61,7 @@ #include #include #include +#include using namespace EnergyPlus::Humidifiers; using namespace EnergyPlus::DataSizing; @@ -100,7 +101,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_Sizing) // autosize nominal gas use rate OutBaroPress = 101325.0; - thisHum.SizeHumidifier(state); + thisHum.SizeHumidifier(*state); EXPECT_DOUBLE_EQ(4.00E-5, thisHum.NomCapVol); EXPECT_DOUBLE_EQ(0.040000010708118504, thisHum.NomCap); EXPECT_DOUBLE_EQ(103710.42776358133, thisHum.NomPower); @@ -137,7 +138,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_AutoSizing) // volumetric capacity autosize unit test thisHum.NomCapVol = AutoSize; CurZoneEqNum = 0; // size it based on system - thisHum.SizeHumidifier(state); + thisHum.SizeHumidifier(*state); // test autosized nominal capacity EXPECT_NEAR(8.185E-05, thisHum.NomCapVol, 1.0E-06); // m3/s // test autosized nominal capacity @@ -179,7 +180,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_EnergyUse) thisHum.NomCapVol = 4.00E-5; thisHum.NomPower = 103710; OutBaroPress = 101325.0; - thisHum.SizeHumidifier(state); + thisHum.SizeHumidifier(*state); EXPECT_DOUBLE_EQ(0.040000010708118504, thisHum.NomCap); EXPECT_DOUBLE_EQ(103710.42776358133, thisHum.NomPower); @@ -191,7 +192,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_EnergyUse) thisHum.CurMakeupWaterTemp = 20.0; OutBaroPress = 101325.0; - thisHum.CalcGasSteamHumidifier(state, 0.040000010708118504); + thisHum.CalcGasSteamHumidifier(*state, 0.040000010708118504); EXPECT_DOUBLE_EQ(103710.42776358133, thisHum.GasUseRate); thisHum.ReportHumidifier(); @@ -229,7 +230,7 @@ TEST_F(EnergyPlusFixture, Humidifiers_GetHumidifierInput) ASSERT_TRUE(process_idf(idf_objects)); - GetHumidifierInput(state); + GetHumidifierInput(*state); ASSERT_EQ(1, NumHumidifiers); EXPECT_EQ(1, Humidifier(1).EfficiencyCurvePtr); } @@ -286,9 +287,9 @@ TEST_F(EnergyPlusFixture, Humidifiers_ThermalEfficiency) ASSERT_TRUE(process_idf(idf_objects)); - thisHum.EfficiencyCurvePtr = CurveManager::GetCurveIndex(state, "THERMALEFFICIENCYFPLR"); + thisHum.EfficiencyCurvePtr = CurveManager::GetCurveIndex(*state, "THERMALEFFICIENCYFPLR"); - thisHum.CalcGasSteamHumidifier(state, 0.030); + thisHum.CalcGasSteamHumidifier(*state, 0.030); EXPECT_NEAR(0.7875, thisHum.ThermalEff, 0.001); } diff --git a/tst/EnergyPlus/unit/HybridModel.unit.cc b/tst/EnergyPlus/unit/HybridModel.unit.cc index 5ea034098ad..b29b1425011 100644 --- a/tst/EnergyPlus/unit/HybridModel.unit.cc +++ b/tst/EnergyPlus/unit/HybridModel.unit.cc @@ -76,6 +76,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace ObjexxFCL; @@ -128,7 +129,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) NonAirSystemResponse(1) = 0.0; SysDepZoneLoadsLagged.allocate(1); SysDepZoneLoadsLagged(1) = 0.0; - state.dataAirflowNetworkBalanceManager->exchangeData.allocate(1); + state->dataAirflowNetworkBalanceManager->exchangeData.allocate(1); Node.allocate(1); TempTstatAir.allocate(1); LoadCorrectionFactor.allocate(1); @@ -172,7 +173,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) SNLoadCoolRate.allocate(1); SNLoadHeatEnergy.allocate(1); SNLoadCoolEnergy.allocate(1); - state.dataZoneTempPredictorCorrector->ZoneAirRelHum.allocate(1); + state->dataZoneTempPredictorCorrector->ZoneAirRelHum.allocate(1); IsZoneDV.dimension(1, false); IsZoneCV.dimension(1, false); IsZoneUI.dimension(1, false); @@ -239,10 +240,10 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) ZoneGCGain(1) = 0.0; // Parameter setup - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; CurZoneEqNum = 1; - state.dataZonePlenum->NumZoneReturnPlenums = 0; - state.dataZonePlenum->NumZoneSupplyPlenums = 0; + state->dataZonePlenum->NumZoneReturnPlenums = 0; + state->dataZonePlenum->NumZoneSupplyPlenums = 0; AirflowNetwork::SimulateAirflowNetwork = 0; Zone(1).IsControlled = true; Zone(1).ZoneEqNum = 1; @@ -251,14 +252,14 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) Zone(1).SurfaceFirst = 1; Zone(1).SurfaceLast = 2; Zone(1).Volume = 1061.88; - state.dataGlobal->TimeStepZone = 10.0 / 60.0; // Zone timestep in hours + state->dataGlobal->TimeStepZone = 10.0 / 60.0; // Zone timestep in hours TimeStepSys = 10.0 / 60.0; Real64 ZoneTempChange; // Hybrid modeling trigger FlagHybridModel_TM = true; - state.dataGlobal->WarmupFlag = false; - state.dataGlobal->DoingSizing = false; + state->dataGlobal->WarmupFlag = false; + state->dataGlobal->DoingSizing = false; DayOfYear = 1; // Case 1: Hybrid model internal thermal mass (free-floating) @@ -282,7 +283,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) MCPTV(1) = -3335.10; // Assign TempIndCoef OutBaroPress = 99166.67; - CorrectZoneAirTemp(state, ZoneTempChange, false, true, 10 / 60); + CorrectZoneAirTemp(*state, ZoneTempChange, false, true, 10 / 60); EXPECT_NEAR(15.13, Zone(1).ZoneVolCapMultpSensHM, 0.01); // Case 2: Hybrid model infiltration with measured temperature (free-floating) @@ -307,7 +308,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) MCPTV(1) = 270.10; // Assign TempIndCoef OutBaroPress = 99250; - CorrectZoneAirTemp(state, ZoneTempChange, false, true, 10 / 60); + CorrectZoneAirTemp(*state, ZoneTempChange, false, true, 10 / 60); EXPECT_NEAR(0.2444, Zone(1).InfilOAAirChangeRateHM, 0.01); // Case 3: Hybrid model infiltration with measured humidity ratio (free-floating) @@ -336,7 +337,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) MCPTV(1) = 270.10; OutBaroPress = 99500; - CorrectZoneHumRat(state, 1); + CorrectZoneHumRat(*state, 1); EXPECT_NEAR(0.5, Zone(1).InfilOAAirChangeRateHM, 0.01); // Case 4: Hybrid model people count with measured temperature (free-floating) @@ -364,7 +365,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) HybridModelZone(1).ZoneMeasuredTemperatureSchedulePtr = 1; Schedule(HybridModelZone(1).ZoneMeasuredTemperatureSchedulePtr).CurrentValue = -2.923892218; - CorrectZoneAirTemp(state, ZoneTempChange, false, true, 10 / 60); + CorrectZoneAirTemp(*state, ZoneTempChange, false, true, 10 / 60); EXPECT_NEAR(0, Zone(1).NumOccHM, 0.1); // Need to initialize SumIntGain // Case 5: Hybrid model people count with measured humidity ratio (free-floating) @@ -394,7 +395,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) HybridModelZone(1).ZoneMeasuredHumidityRatioSchedulePtr = 1; Schedule(HybridModelZone(1).ZoneMeasuredHumidityRatioSchedulePtr).CurrentValue = 0.002506251487737; - CorrectZoneHumRat(state, 1); + CorrectZoneHumRat(*state, 1); EXPECT_NEAR(4, Zone(1).NumOccHM, 0.1); // Case 6: Hybrid model infiltration with measured temperature (with HVAC) @@ -427,7 +428,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) Schedule(HybridModelZone(1).ZoneSupplyAirTemperatureSchedulePtr).CurrentValue = 50; Schedule(HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr).CurrentValue = 0.7974274; - CorrectZoneAirTemp(state, ZoneTempChange, false, true, 10 / 60); + CorrectZoneAirTemp(*state, ZoneTempChange, false, true, 10 / 60); EXPECT_NEAR(0.49, Zone(1).InfilOAAirChangeRateHM, 0.01); // Case 7: Hybrid model infiltration with measured humidity ratio (with HVAC) @@ -459,7 +460,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) Schedule(HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr).CurrentValue = 0.8345; OutBaroPress = 99500; - CorrectZoneHumRat(state, 1); + CorrectZoneHumRat(*state, 1); EXPECT_NEAR(0.5, Zone(1).InfilOAAirChangeRateHM, 0.01); // Case 8: Hybrid model people count with measured temperature (with HVAC) @@ -497,7 +498,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) Schedule(HybridModelZone(1).ZonePeopleSensibleFractionSchedulePtr).CurrentValue = 0.6; Schedule(HybridModelZone(1).ZonePeopleRadiationFractionSchedulePtr).CurrentValue = 0.3; - CorrectZoneAirTemp(state, ZoneTempChange, false, true, 10 / 60); + CorrectZoneAirTemp(*state, ZoneTempChange, false, true, 10 / 60); EXPECT_NEAR(0, Zone(1).NumOccHM, 0.1); // Need to initialize SumIntGain // Case 9: Hybrid model people count with measured humidity ratio (with HVAC) @@ -534,7 +535,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) Schedule(HybridModelZone(1).ZonePeopleRadiationFractionSchedulePtr).CurrentValue = 0.3; OutBaroPress = 99500; - CorrectZoneHumRat(state, 1); + CorrectZoneHumRat(*state, 1); EXPECT_NEAR(4, Zone(1).NumOccHM, 0.1); // Deallocate everything @@ -563,7 +564,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) ZoneAirHumRat.deallocate(); NonAirSystemResponse.deallocate(); SysDepZoneLoadsLagged.deallocate(); - state.dataAirflowNetworkBalanceManager->exchangeData.deallocate(); + state->dataAirflowNetworkBalanceManager->exchangeData.deallocate(); Node.deallocate(); TempTstatAir.deallocate(); LoadCorrectionFactor.deallocate(); @@ -591,7 +592,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneAirTempTest) SNLoadCoolRate.deallocate(); SNLoadHeatEnergy.deallocate(); SNLoadCoolEnergy.deallocate(); - state.dataZoneTempPredictorCorrector->ZoneAirRelHum.deallocate(); + state->dataZoneTempPredictorCorrector->ZoneAirRelHum.deallocate(); IsZoneDV.deallocate(); IsZoneCV.deallocate(); IsZoneUI.deallocate(); @@ -635,7 +636,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) NonAirSystemResponse(1) = 0.0; SysDepZoneLoadsLagged.allocate(1); SysDepZoneLoadsLagged(1) = 0.0; - state.dataAirflowNetworkBalanceManager->exchangeData.allocate(1); + state->dataAirflowNetworkBalanceManager->exchangeData.allocate(1); Node.allocate(1); TempTstatAir.allocate(1); LoadCorrectionFactor.allocate(1); @@ -678,7 +679,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) SurfaceWindow.allocate(1); Surface.allocate(2); HConvIn.allocate(1); - state.dataZoneTempPredictorCorrector->ZoneAirRelHum.allocate(1); + state->dataZoneTempPredictorCorrector->ZoneAirRelHum.allocate(1); IsZoneDV.dimension(1, false); IsZoneCV.dimension(1, false); IsZoneUI.dimension(1, false); @@ -733,10 +734,10 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) MixingMassFlowCO2(1) = 0.0; // Parameter setup - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; CurZoneEqNum = 1; - state.dataZonePlenum->NumZoneReturnPlenums = 0; - state.dataZonePlenum->NumZoneSupplyPlenums = 0; + state->dataZonePlenum->NumZoneReturnPlenums = 0; + state->dataZonePlenum->NumZoneSupplyPlenums = 0; AirflowNetwork::SimulateAirflowNetwork = 0; Zone(1).IsControlled = true; Zone(1).ZoneEqNum = 1; @@ -745,13 +746,13 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) Zone(1).SurfaceFirst = 1; Zone(1).SurfaceLast = 2; Zone(1).Volume = 4000; - state.dataGlobal->TimeStepZone = 10.0 / 60.0; // Zone timestep in hours + state->dataGlobal->TimeStepZone = 10.0 / 60.0; // Zone timestep in hours TimeStepSys = 10.0 / 60.0; // Hybrid modeling trigger FlagHybridModel_TM = false; - state.dataGlobal->WarmupFlag = false; - state.dataGlobal->DoingSizing = false; + state->dataGlobal->WarmupFlag = false; + state->dataGlobal->DoingSizing = false; DayOfYear = 1; // Case 1: Hybrid model infiltration with measured CO2 concentration (free-floating) @@ -777,7 +778,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr = 1; Schedule(HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr).CurrentValue = 388.238646; - CorrectZoneContaminants(state, false, true, 10 / 60); + CorrectZoneContaminants(*state, false, true, 10 / 60); EXPECT_NEAR(0.5, Zone(1).InfilOAAirChangeRateHM, 0.01); // Case 2: Hybrid model people count with measured CO2 concentration (free-floating) @@ -806,7 +807,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) CO2ZoneTimeMinus3(1) = 387.2385685; HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr = 1; Schedule(HybridModelZone(1).ZoneMeasuredCO2ConcentrationSchedulePtr).CurrentValue = 389.8511796; - CorrectZoneContaminants(state, false, true, 10 / 60); + CorrectZoneContaminants(*state, false, true, 10 / 60); EXPECT_NEAR(4, Zone(1).NumOccHM, 0.1); // Case 3: Hybrid model infiltration with measured CO2 concentration (with HVAC) @@ -837,7 +838,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) Schedule(HybridModelZone(1).ZoneSupplyAirCO2ConcentrationSchedulePtr).CurrentValue = 388.54049; Schedule(HybridModelZone(1).ZoneSupplyAirMassFlowRateSchedulePtr).CurrentValue = 0.898375186; - CorrectZoneContaminants(state, false, true, 10 / 60); + CorrectZoneContaminants(*state, false, true, 10 / 60); EXPECT_NEAR(0.5, Zone(1).InfilOAAirChangeRateHM, 0.01); // Case 4: Hybrid model people count with measured CO2 concentration (with HVAC) @@ -877,7 +878,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) Schedule(HybridModelZone(1).ZonePeopleRadiationFractionSchedulePtr).CurrentValue = 0.3; Schedule(HybridModelZone(1).ZonePeopleCO2GenRateSchedulePtr).CurrentValue = 0.0000000382; - CorrectZoneContaminants(state, false, true, 10 / 60); + CorrectZoneContaminants(*state, false, true, 10 / 60); EXPECT_NEAR(7.27, Zone(1).NumOccHM, 0.1); // Deallocate everything @@ -895,7 +896,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) ZoneAirHumRat.deallocate(); NonAirSystemResponse.deallocate(); SysDepZoneLoadsLagged.deallocate(); - state.dataAirflowNetworkBalanceManager->exchangeData.deallocate(); + state->dataAirflowNetworkBalanceManager->exchangeData.deallocate(); Node.deallocate(); TempTstatAir.deallocate(); LoadCorrectionFactor.deallocate(); @@ -919,7 +920,7 @@ TEST_F(EnergyPlusFixture, HybridModel_CorrectZoneContaminantsTest) SurfaceWindow.deallocate(); Surface.deallocate(); HConvIn.deallocate(); - state.dataZoneTempPredictorCorrector->ZoneAirRelHum.deallocate(); + state->dataZoneTempPredictorCorrector->ZoneAirRelHum.deallocate(); IsZoneDV.deallocate(); IsZoneCV.deallocate(); IsZoneUI.deallocate(); diff --git a/tst/EnergyPlus/unit/ICEngineElectricGenerator.unit.cc b/tst/EnergyPlus/unit/ICEngineElectricGenerator.unit.cc index 101928c5bb6..fe2b31bfca3 100644 --- a/tst/EnergyPlus/unit/ICEngineElectricGenerator.unit.cc +++ b/tst/EnergyPlus/unit/ICEngineElectricGenerator.unit.cc @@ -54,6 +54,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus::ICEngineElectricGenerator; @@ -127,7 +128,7 @@ TEST_F(EnergyPlusFixture, ICEngineElectricGenerator_Fueltype) ASSERT_TRUE(process_idf(idf_objects)); - GetICEngineGeneratorInput(state); + GetICEngineGeneratorInput(*state); EXPECT_EQ(ICEngineGenerator(1).FuelType, "Diesel"); } diff --git a/tst/EnergyPlus/unit/ICSCollector.unit.cc b/tst/EnergyPlus/unit/ICSCollector.unit.cc index 62a786541b1..26c7822273f 100644 --- a/tst/EnergyPlus/unit/ICSCollector.unit.cc +++ b/tst/EnergyPlus/unit/ICSCollector.unit.cc @@ -62,6 +62,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace ObjexxFCL; using namespace EnergyPlus; @@ -87,7 +88,7 @@ TEST_F(EnergyPlusFixture, ICSSolarCollectorTest_CalcPassiveExteriorBaffleGapTest InitializePsychRoutines(); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; OutBaroPress = 101325.0; SkyTemp = 24.0; IsRain = false; @@ -108,9 +109,9 @@ TEST_F(EnergyPlusFixture, ICSSolarCollectorTest_CalcPassiveExteriorBaffleGapTest Surface(SurfNum).ExtConvCoeff = 0; Surface(SurfNum).ExtWind = false; // allocate construction variable data - state.dataConstruction->Construct.allocate(ConstrNum); - state.dataConstruction->Construct(ConstrNum).LayerPoint.allocate(MatNum); - state.dataConstruction->Construct(ConstrNum).LayerPoint(MatNum) = 1; + state->dataConstruction->Construct.allocate(ConstrNum); + state->dataConstruction->Construct(ConstrNum).LayerPoint.allocate(MatNum); + state->dataConstruction->Construct(ConstrNum).LayerPoint(MatNum) = 1; dataMaterial.Material.allocate(MatNum); dataMaterial.Material(MatNum).AbsorpThermal = 0.8; // allocate exterior vented cavaity variable data @@ -127,7 +128,7 @@ TEST_F(EnergyPlusFixture, ICSSolarCollectorTest_CalcPassiveExteriorBaffleGapTest SurfQRadSWOutIncident.allocate(1); SurfQRadSWOutIncident(1) = 0.0; // set user defined conv. coeff. calculation to false - state.dataConvectionCoefficient->GetUserSuppliedConvectionCoeffs = false; + state->dataConvectionCoefficient->GetUserSuppliedConvectionCoeffs = false; // SurfPtr( 1 ); // Array of indexes pointing to Surface structure in DataSurfaces Real64 const VentArea(0.1); // Area available for venting the gap [m2] @@ -151,7 +152,7 @@ TEST_F(EnergyPlusFixture, ICSSolarCollectorTest_CalcPassiveExteriorBaffleGapTest Real64 VdotBouyRpt; // gap buoyancy driven volume flow rate [m3/s] // call to test fix to resolve crash - CalcPassiveExteriorBaffleGap(state, ExtVentedCavity(1).SurfPtrs, VentArea, Cv, Cd, HdeltaNPL, SolAbs, + CalcPassiveExteriorBaffleGap(*state, ExtVentedCavity(1).SurfPtrs, VentArea, Cv, Cd, HdeltaNPL, SolAbs, AbsExt, Tilt, AspRat, GapThick, Roughness, QdotSource, TsBaffle, TaGap, HcGapRpt, HrGapRpt, IscRpt, MdotVentRpt, VdotWindRpt, VdotBouyRpt); @@ -162,8 +163,8 @@ TEST_F(EnergyPlusFixture, ICSSolarCollectorTest_CalcPassiveExteriorBaffleGapTest // deallocated variables Surface.deallocate(); - state.dataConstruction->Construct(ConstrNum).LayerPoint.deallocate(); - state.dataConstruction->Construct.deallocate(); + state->dataConstruction->Construct(ConstrNum).LayerPoint.deallocate(); + state->dataConstruction->Construct.deallocate(); dataMaterial.Material.deallocate(); ExtVentedCavity(NumOfSurf).SurfPtrs.deallocate(); ExtVentedCavity.deallocate(); diff --git a/tst/EnergyPlus/unit/IceThermalStorage.unit.cc b/tst/EnergyPlus/unit/IceThermalStorage.unit.cc index 4d3d3f32290..e970b62f504 100644 --- a/tst/EnergyPlus/unit/IceThermalStorage.unit.cc +++ b/tst/EnergyPlus/unit/IceThermalStorage.unit.cc @@ -57,6 +57,7 @@ #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::IceThermalStorage; @@ -68,7 +69,7 @@ TEST_F(EnergyPlusFixture, IceThermalStorage_CalcQstarTest) { IceThermalStorage::clear_state(); - state.dataCurveManager->clear_state(); + state->dataCurveManager->clear_state(); int TotDetailedIce = 4; int TotCurves = 4; @@ -79,83 +80,83 @@ TEST_F(EnergyPlusFixture, IceThermalStorage_CalcQstarTest) Real64 Tolerance = 0.001; IceThermalStorage::DetailedIceStorage.allocate(TotDetailedIce); - state.dataCurveManager->PerfCurve.allocate(TotCurves); - state.dataCurveManager->NumCurves = TotCurves; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataCurveManager->PerfCurve.allocate(TotCurves); + state->dataCurveManager->NumCurves = TotCurves; + state->dataGlobal->BeginEnvrnFlag = false; // Test 1: CurveVarsFracChargedLMTD Curve is QuadraticLinear TestNum = 1; IceStorageCurveType = IceThermalStorage::CurveVars::FracChargedLMTD; - state.dataCurveManager->PerfCurve(TestNum).CurveType = CurveTypeEnum::QuadraticLinear; - state.dataCurveManager->PerfCurve(TestNum).InterpolationType = CurveManager::InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(TestNum).Var1Max = 1.0; - state.dataCurveManager->PerfCurve(TestNum).Var1Min = 0.0; - state.dataCurveManager->PerfCurve(TestNum).Var2Max = 10.0; - state.dataCurveManager->PerfCurve(TestNum).Var2Min = 0.0; - state.dataCurveManager->PerfCurve(TestNum).Coeff1 = 0.1; - state.dataCurveManager->PerfCurve(TestNum).Coeff2 = 0.2; - state.dataCurveManager->PerfCurve(TestNum).Coeff3 = 0.3; - state.dataCurveManager->PerfCurve(TestNum).Coeff4 = 0.4; - state.dataCurveManager->PerfCurve(TestNum).Coeff5 = 0.5; - state.dataCurveManager->PerfCurve(TestNum).Coeff6 = 0.6; - CurveAnswer = IceThermalStorage::CalcQstar(state, TestNum, IceStorageCurveType, 0.5, 1.5, 0.25); + state->dataCurveManager->PerfCurve(TestNum).CurveType = CurveTypeEnum::QuadraticLinear; + state->dataCurveManager->PerfCurve(TestNum).InterpolationType = CurveManager::InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(TestNum).Var1Max = 1.0; + state->dataCurveManager->PerfCurve(TestNum).Var1Min = 0.0; + state->dataCurveManager->PerfCurve(TestNum).Var2Max = 10.0; + state->dataCurveManager->PerfCurve(TestNum).Var2Min = 0.0; + state->dataCurveManager->PerfCurve(TestNum).Coeff1 = 0.1; + state->dataCurveManager->PerfCurve(TestNum).Coeff2 = 0.2; + state->dataCurveManager->PerfCurve(TestNum).Coeff3 = 0.3; + state->dataCurveManager->PerfCurve(TestNum).Coeff4 = 0.4; + state->dataCurveManager->PerfCurve(TestNum).Coeff5 = 0.5; + state->dataCurveManager->PerfCurve(TestNum).Coeff6 = 0.6; + CurveAnswer = IceThermalStorage::CalcQstar(*state, TestNum, IceStorageCurveType, 0.5, 1.5, 0.25); ExpectedValue = 1.475; EXPECT_NEAR(ExpectedValue, CurveAnswer, Tolerance); // Test 2: CurveVarsFracDischargedLMTD Curve is BiQuadratic TestNum = 2; IceStorageCurveType = IceThermalStorage::CurveVars::FracDischargedLMTD; - state.dataCurveManager->PerfCurve(TestNum).CurveType = CurveTypeEnum::BiQuadratic; - state.dataCurveManager->PerfCurve(TestNum).InterpolationType = CurveManager::InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(TestNum).Var1Max = 1.0; - state.dataCurveManager->PerfCurve(TestNum).Var1Min = 0.0; - state.dataCurveManager->PerfCurve(TestNum).Var2Max = 10.0; - state.dataCurveManager->PerfCurve(TestNum).Var2Min = 0.0; - state.dataCurveManager->PerfCurve(TestNum).Coeff1 = 0.1; - state.dataCurveManager->PerfCurve(TestNum).Coeff2 = 0.2; - state.dataCurveManager->PerfCurve(TestNum).Coeff3 = 0.3; - state.dataCurveManager->PerfCurve(TestNum).Coeff4 = 0.4; - state.dataCurveManager->PerfCurve(TestNum).Coeff5 = 0.5; - state.dataCurveManager->PerfCurve(TestNum).Coeff6 = 0.6; - CurveAnswer = IceThermalStorage::CalcQstar(state, TestNum, IceStorageCurveType, 0.4, 1.2, 0.25); + state->dataCurveManager->PerfCurve(TestNum).CurveType = CurveTypeEnum::BiQuadratic; + state->dataCurveManager->PerfCurve(TestNum).InterpolationType = CurveManager::InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(TestNum).Var1Max = 1.0; + state->dataCurveManager->PerfCurve(TestNum).Var1Min = 0.0; + state->dataCurveManager->PerfCurve(TestNum).Var2Max = 10.0; + state->dataCurveManager->PerfCurve(TestNum).Var2Min = 0.0; + state->dataCurveManager->PerfCurve(TestNum).Coeff1 = 0.1; + state->dataCurveManager->PerfCurve(TestNum).Coeff2 = 0.2; + state->dataCurveManager->PerfCurve(TestNum).Coeff3 = 0.3; + state->dataCurveManager->PerfCurve(TestNum).Coeff4 = 0.4; + state->dataCurveManager->PerfCurve(TestNum).Coeff5 = 0.5; + state->dataCurveManager->PerfCurve(TestNum).Coeff6 = 0.6; + CurveAnswer = IceThermalStorage::CalcQstar(*state, TestNum, IceStorageCurveType, 0.4, 1.2, 0.25); ExpectedValue = 1.960; EXPECT_NEAR(ExpectedValue, CurveAnswer, Tolerance); // Test 3: CurveVarsLMTDMassFlow Curve is CubicLinear TestNum = 3; IceStorageCurveType = IceThermalStorage::CurveVars::LMTDMassFlow; - state.dataCurveManager->PerfCurve(TestNum).CurveType = CurveTypeEnum::CubicLinear; - state.dataCurveManager->PerfCurve(TestNum).InterpolationType = CurveManager::InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(TestNum).Var1Max = 10.0; - state.dataCurveManager->PerfCurve(TestNum).Var1Min = 0.0; - state.dataCurveManager->PerfCurve(TestNum).Var2Max = 1.0; - state.dataCurveManager->PerfCurve(TestNum).Var2Min = 0.0; - state.dataCurveManager->PerfCurve(TestNum).Coeff1 = 0.1; - state.dataCurveManager->PerfCurve(TestNum).Coeff2 = 0.2; - state.dataCurveManager->PerfCurve(TestNum).Coeff3 = 0.3; - state.dataCurveManager->PerfCurve(TestNum).Coeff4 = 0.4; - state.dataCurveManager->PerfCurve(TestNum).Coeff5 = 0.5; - state.dataCurveManager->PerfCurve(TestNum).Coeff6 = 0.6; - CurveAnswer = IceThermalStorage::CalcQstar(state, TestNum, IceStorageCurveType, 0.4, 1.2, 0.25); + state->dataCurveManager->PerfCurve(TestNum).CurveType = CurveTypeEnum::CubicLinear; + state->dataCurveManager->PerfCurve(TestNum).InterpolationType = CurveManager::InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(TestNum).Var1Max = 10.0; + state->dataCurveManager->PerfCurve(TestNum).Var1Min = 0.0; + state->dataCurveManager->PerfCurve(TestNum).Var2Max = 1.0; + state->dataCurveManager->PerfCurve(TestNum).Var2Min = 0.0; + state->dataCurveManager->PerfCurve(TestNum).Coeff1 = 0.1; + state->dataCurveManager->PerfCurve(TestNum).Coeff2 = 0.2; + state->dataCurveManager->PerfCurve(TestNum).Coeff3 = 0.3; + state->dataCurveManager->PerfCurve(TestNum).Coeff4 = 0.4; + state->dataCurveManager->PerfCurve(TestNum).Coeff5 = 0.5; + state->dataCurveManager->PerfCurve(TestNum).Coeff6 = 0.6; + CurveAnswer = IceThermalStorage::CalcQstar(*state, TestNum, IceStorageCurveType, 0.4, 1.2, 0.25); ExpectedValue = 1.768; EXPECT_NEAR(ExpectedValue, CurveAnswer, Tolerance); // Test 4: CurveVarsFracLMTDFracCharged Curve is CubicLinear TestNum = 4; IceStorageCurveType = IceThermalStorage::CurveVars::LMTDFracCharged; - state.dataCurveManager->PerfCurve(TestNum).CurveType = CurveTypeEnum::CubicLinear; - state.dataCurveManager->PerfCurve(TestNum).InterpolationType = CurveManager::InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(TestNum).Var1Max = 10.0; - state.dataCurveManager->PerfCurve(TestNum).Var1Min = 0.0; - state.dataCurveManager->PerfCurve(TestNum).Var2Max = 1.0; - state.dataCurveManager->PerfCurve(TestNum).Var2Min = 0.0; - state.dataCurveManager->PerfCurve(TestNum).Coeff1 = 0.1; - state.dataCurveManager->PerfCurve(TestNum).Coeff2 = 0.2; - state.dataCurveManager->PerfCurve(TestNum).Coeff3 = 0.3; - state.dataCurveManager->PerfCurve(TestNum).Coeff4 = 0.4; - state.dataCurveManager->PerfCurve(TestNum).Coeff5 = 0.5; - state.dataCurveManager->PerfCurve(TestNum).Coeff6 = 0.6; - CurveAnswer = IceThermalStorage::CalcQstar(state, TestNum, IceStorageCurveType, 0.4, 1.2, 0.25); + state->dataCurveManager->PerfCurve(TestNum).CurveType = CurveTypeEnum::CubicLinear; + state->dataCurveManager->PerfCurve(TestNum).InterpolationType = CurveManager::InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(TestNum).Var1Max = 10.0; + state->dataCurveManager->PerfCurve(TestNum).Var1Min = 0.0; + state->dataCurveManager->PerfCurve(TestNum).Var2Max = 1.0; + state->dataCurveManager->PerfCurve(TestNum).Var2Min = 0.0; + state->dataCurveManager->PerfCurve(TestNum).Coeff1 = 0.1; + state->dataCurveManager->PerfCurve(TestNum).Coeff2 = 0.2; + state->dataCurveManager->PerfCurve(TestNum).Coeff3 = 0.3; + state->dataCurveManager->PerfCurve(TestNum).Coeff4 = 0.4; + state->dataCurveManager->PerfCurve(TestNum).Coeff5 = 0.5; + state->dataCurveManager->PerfCurve(TestNum).Coeff6 = 0.6; + CurveAnswer = IceThermalStorage::CalcQstar(*state, TestNum, IceStorageCurveType, 0.4, 1.2, 0.25); ExpectedValue = 1.951; EXPECT_NEAR(ExpectedValue, CurveAnswer, Tolerance); } diff --git a/tst/EnergyPlus/unit/InputProcessor.unit.cc b/tst/EnergyPlus/unit/InputProcessor.unit.cc index 69d73fb10d4..c407a597035 100644 --- a/tst/EnergyPlus/unit/InputProcessor.unit.cc +++ b/tst/EnergyPlus/unit/InputProcessor.unit.cc @@ -93,12 +93,12 @@ namespace EnergyPlus { // for (int i = 0; i < 10000000; ++i) // { -// total += inputProcessor->getNumObjectsFound(state, "Refrigeration:Compressor" ); -// total += inputProcessor->getNumObjectsFound(state, "Curve:Bicubic" ); -// total += inputProcessor->getNumObjectsFound(state, "Refrigeration:Case" ); -// total += inputProcessor->getNumObjectsFound(state, "Chiller:Electric:EIR" ); -// total += inputProcessor->getNumObjectsFound(state, "Curve:Biquadratic" ); -// total += inputProcessor->getNumObjectsFound(state, "Curve:Quadratic" ); +// total += inputProcessor->getNumObjectsFound(*state, "Refrigeration:Compressor" ); +// total += inputProcessor->getNumObjectsFound(*state, "Curve:Bicubic" ); +// total += inputProcessor->getNumObjectsFound(*state, "Refrigeration:Case" ); +// total += inputProcessor->getNumObjectsFound(*state, "Chiller:Electric:EIR" ); +// total += inputProcessor->getNumObjectsFound(*state, "Curve:Biquadratic" ); +// total += inputProcessor->getNumObjectsFound(*state, "Curve:Quadratic" ); // } // EXPECT_EQ( 4038000ul * 10000, total ); @@ -118,12 +118,12 @@ namespace EnergyPlus { // for (int i = 0; i < 10000000; ++i) // { -// total += inputProcessor->getNumObjectsFound(state, "Refrigeration:CompressoR" ); -// total += inputProcessor->getNumObjectsFound(state, "Curve:BicubiC" ); -// total += inputProcessor->getNumObjectsFound(state, "Refrigeration:CasE" ); -// total += inputProcessor->getNumObjectsFound(state, "Chiller:Electric:EIr" ); -// total += inputProcessor->getNumObjectsFound(state, "Curve:BiquadratiC" ); -// total += inputProcessor->getNumObjectsFound(state, "Curve:QuadratiC" ); +// total += inputProcessor->getNumObjectsFound(*state, "Refrigeration:CompressoR" ); +// total += inputProcessor->getNumObjectsFound(*state, "Curve:BicubiC" ); +// total += inputProcessor->getNumObjectsFound(*state, "Refrigeration:CasE" ); +// total += inputProcessor->getNumObjectsFound(*state, "Chiller:Electric:EIr" ); +// total += inputProcessor->getNumObjectsFound(*state, "Curve:BiquadratiC" ); +// total += inputProcessor->getNumObjectsFound(*state, "Curve:QuadratiC" ); // } // EXPECT_EQ( 4038000ul * 10000, total ); @@ -143,12 +143,12 @@ namespace EnergyPlus { // for (int i = 0; i < 10000000; ++i) // { -// total += inputProcessor->getNumObjectsFound(state, "SurfaceConvectionAlgorithm:Inside" ); -// total += inputProcessor->getNumObjectsFound(state, "RoomAir:Node:AirflowNetwork:InternalGains" ); -// total += inputProcessor->getNumObjectsFound(state, "AirflowNetwork:MultiZone:Component:DetailedOpening" ); -// total += inputProcessor->getNumObjectsFound(state, "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit" ); -// total += inputProcessor->getNumObjectsFound(state, "HeatPump:WaterToWater:ParameterEstimation:Cooling" ); -// total += inputProcessor->getNumObjectsFound(state, "WaterHeater:Stratified" ); +// total += inputProcessor->getNumObjectsFound(*state, "SurfaceConvectionAlgorithm:Inside" ); +// total += inputProcessor->getNumObjectsFound(*state, "RoomAir:Node:AirflowNetwork:InternalGains" ); +// total += inputProcessor->getNumObjectsFound(*state, "AirflowNetwork:MultiZone:Component:DetailedOpening" ); +// total += inputProcessor->getNumObjectsFound(*state, "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFit" ); +// total += inputProcessor->getNumObjectsFound(*state, "HeatPump:WaterToWater:ParameterEstimation:Cooling" ); +// total += inputProcessor->getNumObjectsFound(*state, "WaterHeater:Stratified" ); // } // EXPECT_EQ( 0ul, total ); @@ -168,12 +168,12 @@ namespace EnergyPlus { // for (int i = 0; i < 10000000; ++i) // { -// total += inputProcessor->getNumObjectsFound(state, "SurfaceConvectionAlgorithm:Insides" ); -// total += inputProcessor->getNumObjectsFound(state, "RoomAir:Node:AirflowNetwork:InternalGainss" ); -// total += inputProcessor->getNumObjectsFound(state, "AirflowNetwork:MultiZone:Component:DetailedOpenings" ); -// total += inputProcessor->getNumObjectsFound(state, "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFits" ); -// total += inputProcessor->getNumObjectsFound(state, "HeatPump:WaterToWater:ParameterEstimation:Coolings" ); -// total += inputProcessor->getNumObjectsFound(state, "WaterHeater:Stratifieds" ); +// total += inputProcessor->getNumObjectsFound(*state, "SurfaceConvectionAlgorithm:Insides" ); +// total += inputProcessor->getNumObjectsFound(*state, "RoomAir:Node:AirflowNetwork:InternalGainss" ); +// total += inputProcessor->getNumObjectsFound(*state, "AirflowNetwork:MultiZone:Component:DetailedOpenings" ); +// total += inputProcessor->getNumObjectsFound(*state, "Coil:Cooling:WaterToAirHeatPump:VariableSpeedEquationFits" ); +// total += inputProcessor->getNumObjectsFound(*state, "HeatPump:WaterToWater:ParameterEstimation:Coolings" ); +// total += inputProcessor->getNumObjectsFound(*state, "WaterHeater:Stratifieds" ); // } // EXPECT_EQ( 0ul, total ); @@ -2043,14 +2043,14 @@ TEST_F(InputProcessorFixture, getObjectItem_json1) ASSERT_TRUE(process_idf(idf_objects)); std::string const CurrentModuleObject = "Output:SQLite"; - int NumSQLite = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumSQLite = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, NumSQLite); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -2060,7 +2060,7 @@ TEST_F(InputProcessorFixture, getObjectItem_json1) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, NumSQLite, Alphas, NumAlphas, Numbers, NumNumbers, IOStatus, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields); EXPECT_TRUE(compare_containers(std::vector({"SIMPLEANDTABULAR"}), Alphas)); @@ -2094,14 +2094,14 @@ TEST_F(InputProcessorFixture, getObjectItem_json2) ASSERT_TRUE(process_idf(idf_objects)); std::string const CurrentModuleObject = "Humidifier:Steam:Gas"; - int NumGasSteamHums = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumGasSteamHums = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, NumGasSteamHums); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); Array1D Numbers(NumNumbers, 0.0); @@ -2109,7 +2109,7 @@ TEST_F(InputProcessorFixture, getObjectItem_json2) Array1D_bool lAlphaBlanks(NumAlphas, true); Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, NumGasSteamHums, Alphas, NumAlphas, @@ -2168,14 +2168,14 @@ TEST_F(InputProcessorFixture, getObjectItem_json3) ASSERT_TRUE(process_idf(idf_objects)); std::string const CurrentModuleObject = "BuildingSurface:Detailed"; - int numBuildingSurfaceDetailed = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int numBuildingSurfaceDetailed = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, numBuildingSurfaceDetailed); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); Array1D Numbers(NumNumbers, 0.0); @@ -2183,7 +2183,7 @@ TEST_F(InputProcessorFixture, getObjectItem_json3) Array1D_bool lAlphaBlanks(NumAlphas, true); Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, numBuildingSurfaceDetailed, Alphas, NumAlphas, @@ -2228,14 +2228,14 @@ TEST_F(InputProcessorFixture, getObjectItem_parsing_numbers_as_alpha_fields) std::string const CurrentModuleObject = "FenestrationSurface:Detailed"; - int num_curve_biquadratic_objects = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_curve_biquadratic_objects = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_curve_biquadratic_objects); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -2245,7 +2245,7 @@ TEST_F(InputProcessorFixture, getObjectItem_parsing_numbers_as_alpha_fields) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_curve_biquadratic_objects, Alphas, NumAlphas, @@ -2292,14 +2292,14 @@ TEST_F(InputProcessorFixture, getObjectItem_parsing_numbers_as_alpha_fields2) std::string const CurrentModuleObject = "FenestrationSurface:Detailed"; - int num_curve_biquadratic_objects = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_curve_biquadratic_objects = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_curve_biquadratic_objects); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -2309,7 +2309,7 @@ TEST_F(InputProcessorFixture, getObjectItem_parsing_numbers_as_alpha_fields2) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_curve_biquadratic_objects, Alphas, NumAlphas, @@ -2364,14 +2364,14 @@ TEST_F(InputProcessorFixture, getObjectItem_empty_fields_with_no_defaults) std::string const CurrentModuleObject = "Curve:Biquadratic"; - int num_curve_biquadratic_objects = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_curve_biquadratic_objects = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_curve_biquadratic_objects); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -2381,7 +2381,7 @@ TEST_F(InputProcessorFixture, getObjectItem_empty_fields_with_no_defaults) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_curve_biquadratic_objects, Alphas, NumAlphas, @@ -2470,14 +2470,14 @@ TEST_F(InputProcessorFixture, getObjectItem_truncated_obj_pulled_up_semicolon) std::string const CurrentModuleObject = "Curve:Biquadratic"; - int num_curve_biquadratic_objects = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_curve_biquadratic_objects = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_curve_biquadratic_objects); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -2487,7 +2487,7 @@ TEST_F(InputProcessorFixture, getObjectItem_truncated_obj_pulled_up_semicolon) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_curve_biquadratic_objects, Alphas, NumAlphas, @@ -2572,14 +2572,14 @@ TEST_F(InputProcessorFixture, getObjectItem_truncated_sizing_system_min_fields) std::string const CurrentModuleObject = "Sizing:System"; - int NumSizingSystem = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumSizingSystem = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, NumSizingSystem); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -2589,7 +2589,7 @@ TEST_F(InputProcessorFixture, getObjectItem_truncated_sizing_system_min_fields) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, NumSizingSystem, Alphas, NumAlphas, @@ -2657,14 +2657,14 @@ TEST_F(InputProcessorFixture, getObjectItem_missing_numerics_with_defaults_and_a std::string const CurrentModuleObject = "Humidifier:Steam:Gas"; - int NumGasSteamHums = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumGasSteamHums = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, NumGasSteamHums); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -2674,7 +2674,7 @@ TEST_F(InputProcessorFixture, getObjectItem_missing_numerics_with_defaults_and_a Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, NumGasSteamHums, Alphas, NumAlphas, @@ -2731,14 +2731,14 @@ TEST_F(InputProcessorFixture, getObjectItem_truncated_autosize_fields) std::string const CurrentModuleObject = "Humidifier:Steam:Gas"; - int NumGasSteamHums = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int NumGasSteamHums = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, NumGasSteamHums); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -2748,7 +2748,7 @@ TEST_F(InputProcessorFixture, getObjectItem_truncated_autosize_fields) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, NumGasSteamHums, Alphas, NumAlphas, @@ -2830,14 +2830,14 @@ TEST_F(InputProcessorFixture, getObjectItem_unitary_system_input) std::string const CurrentModuleObject = "AirLoopHVAC:UnitarySystem"; - int num_unitary_systems = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_unitary_systems = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_unitary_systems); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -2847,7 +2847,7 @@ TEST_F(InputProcessorFixture, getObjectItem_unitary_system_input) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_unitary_systems, Alphas, NumAlphas, @@ -2918,14 +2918,14 @@ TEST_F(InputProcessorFixture, getObjectItem_test_numbers_as_strings) std::string const CurrentModuleObject = "ZoneHVAC:EquipmentConnections"; - int num_eq_connections = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_eq_connections = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_eq_connections); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -2935,7 +2935,7 @@ TEST_F(InputProcessorFixture, getObjectItem_test_numbers_as_strings) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_eq_connections, Alphas, NumAlphas, @@ -2977,14 +2977,14 @@ TEST_F(InputProcessorFixture, getObjectItem_test_zone_input) std::string const CurrentModuleObject = "Zone"; - int num_zones = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_zones = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_zones); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -2994,7 +2994,7 @@ TEST_F(InputProcessorFixture, getObjectItem_test_zone_input) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_zones, Alphas, NumAlphas, Numbers, NumNumbers, IOStatus, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields); EXPECT_EQ(1, NumAlphas); @@ -3034,14 +3034,14 @@ TEST_F(InputProcessorFixture, getObjectItem_zone_HVAC_input) std::string CurrentModuleObject = "ZoneHVAC:EquipmentConnections"; - int num_equipment_connections = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_equipment_connections = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_equipment_connections); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -3051,7 +3051,7 @@ TEST_F(InputProcessorFixture, getObjectItem_zone_HVAC_input) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_equipment_connections, Alphas, NumAlphas, @@ -3076,14 +3076,14 @@ TEST_F(InputProcessorFixture, getObjectItem_zone_HVAC_input) CurrentModuleObject = "ZoneHVAC:EquipmentList"; - int num_equipment_lists = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_equipment_lists = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_equipment_lists); int TotalArgs2 = 0; int NumAlphas2 = 0; int NumNumbers2 = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs2, NumAlphas2, NumNumbers2); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs2, NumAlphas2, NumNumbers2); Array1D_string Alphas2(NumAlphas2); Array1D Numbers2(NumNumbers2, 0.0); @@ -3092,7 +3092,7 @@ TEST_F(InputProcessorFixture, getObjectItem_zone_HVAC_input) Array1D_string cAlphaFields2(NumAlphas2); Array1D_string cNumericFields2(NumNumbers2); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_equipment_lists, Alphas2, NumAlphas2, @@ -3149,14 +3149,14 @@ TEST_F(InputProcessorFixture, getObjectItem_coil_heating_fuel) std::string const CurrentModuleObject = "Coil:Heating:Fuel"; - int num_coil_heating_gas = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_coil_heating_gas = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(2, num_coil_heating_gas); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -3166,7 +3166,7 @@ TEST_F(InputProcessorFixture, getObjectItem_coil_heating_fuel) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, 1, Alphas, NumAlphas, Numbers, NumNumbers, IOStatus, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields); EXPECT_EQ(7, NumAlphas); @@ -3184,7 +3184,7 @@ TEST_F(InputProcessorFixture, getObjectItem_coil_heating_fuel) int NumAlphas2 = 0; int NumNumbers2 = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs2, NumAlphas2, NumNumbers2); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs2, NumAlphas2, NumNumbers2); Array1D_string Alphas2(NumAlphas2); Array1D Numbers2(NumNumbers2, 0.0); @@ -3193,7 +3193,7 @@ TEST_F(InputProcessorFixture, getObjectItem_coil_heating_fuel) Array1D_string cAlphaFields2(NumAlphas2); Array1D_string cNumericFields2(NumNumbers2); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, 2, Alphas2, NumAlphas2, Numbers2, NumNumbers2, IOStatus, lNumericBlanks2, lAlphaBlanks2, cAlphaFields2, cNumericFields2); EXPECT_EQ(7, NumAlphas); @@ -3235,14 +3235,14 @@ TEST_F(InputProcessorFixture, getObjectItem_schedule_objects) std::string CurrentModuleObject = "ScheduleTypeLimits"; - int num_schedule_type_limits = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_schedule_type_limits = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_schedule_type_limits); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -3252,7 +3252,7 @@ TEST_F(InputProcessorFixture, getObjectItem_schedule_objects) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_schedule_type_limits, Alphas, NumAlphas, @@ -3274,14 +3274,14 @@ TEST_F(InputProcessorFixture, getObjectItem_schedule_objects) CurrentModuleObject = "Schedule:Compact"; - int num_schedule_compact = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_schedule_compact = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(2, num_schedule_compact); TotalArgs = 0; NumAlphas = 0; NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); Array1D_string Alphas2(NumAlphas); Array1D Numbers2(NumNumbers, 0.0); @@ -3290,7 +3290,7 @@ TEST_F(InputProcessorFixture, getObjectItem_schedule_objects) Array1D_string cAlphaFields2(NumAlphas); Array1D_string cNumericFields2(NumNumbers); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, 2, Alphas2, NumAlphas, Numbers2, NumNumbers, IOStatus, lNumericBlanks2, lAlphaBlanks2, cAlphaFields2, cNumericFields2); // Container size is 4500 here! @@ -3326,14 +3326,14 @@ TEST_F(InputProcessorFixture, getObjectItem_fan_on_off) std::string const CurrentModuleObject = "Fan:OnOff"; - int num_fans = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_fans = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_fans); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -3343,7 +3343,7 @@ TEST_F(InputProcessorFixture, getObjectItem_fan_on_off) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_fans, Alphas, NumAlphas, Numbers, NumNumbers, IOStatus, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields); EXPECT_EQ(4, NumAlphas); @@ -3390,14 +3390,14 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_quadratic) std::string const CurrentModuleObject = "Curve:Quadratic"; - int num_curve_quad = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_curve_quad = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(3, num_curve_quad); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -3407,7 +3407,7 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_quadratic) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, 1, Alphas, NumAlphas, Numbers, NumNumbers, IOStatus, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields); EXPECT_EQ(1, NumAlphas); @@ -3422,7 +3422,7 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_quadratic) int NumAlphas2 = 0; int NumNumbers2 = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs2, NumAlphas2, NumNumbers2); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs2, NumAlphas2, NumNumbers2); Array1D_string Alphas2(NumAlphas2); Array1D Numbers2(NumNumbers2, 0.0); @@ -3431,7 +3431,7 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_quadratic) Array1D_string cAlphaFields2(NumAlphas2); Array1D_string cNumericFields2(NumNumbers2); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, 2, Alphas2, NumAlphas2, Numbers2, NumNumbers2, IOStatus, lNumericBlanks2, lAlphaBlanks2, cAlphaFields2, cNumericFields2); EXPECT_EQ(1, NumAlphas2); @@ -3446,7 +3446,7 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_quadratic) int NumAlphas3 = 0; int NumNumbers3 = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs3, NumAlphas3, NumNumbers3); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs3, NumAlphas3, NumNumbers3); Array1D_string Alphas3(NumAlphas3); Array1D Numbers3(NumNumbers3, 0.0); @@ -3455,7 +3455,7 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_quadratic) Array1D_string cAlphaFields3(NumAlphas3); Array1D_string cNumericFields3(NumNumbers3); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, 3, Alphas3, NumAlphas3, Numbers3, NumNumbers3, IOStatus, lNumericBlanks3, lAlphaBlanks3, cAlphaFields3, cNumericFields3); EXPECT_EQ(1, NumAlphas3); @@ -3599,14 +3599,14 @@ TEST_F(InputProcessorFixture, getObjectItem_coil_cooling_dx_variable_speed) std::string const CurrentModuleObject = "Coil:Cooling:DX:VariableSpeed"; - int num_coils = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_coils = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_coils); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -3616,7 +3616,7 @@ TEST_F(InputProcessorFixture, getObjectItem_coil_cooling_dx_variable_speed) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_coils, Alphas, NumAlphas, Numbers, NumNumbers, IOStatus, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields); EXPECT_EQ(49, NumAlphas); @@ -3694,30 +3694,30 @@ TEST_F(InputProcessorFixture, getObjectItem_coil_cooling_dx_variable_speed) EXPECT_EQ(1, IOStatus); // test logical return for ValidateComponent bool IsNotOK = false; - ValidateComponent(state, CurrentModuleObject, "Furnace ACDXCoil 1", IsNotOK, CurrentModuleObject); + ValidateComponent(*state, CurrentModuleObject, "Furnace ACDXCoil 1", IsNotOK, CurrentModuleObject); EXPECT_FALSE(IsNotOK); - ValidateComponent(state, CurrentModuleObject, "Furnace ACDXCoil 2", IsNotOK, CurrentModuleObject); + ValidateComponent(*state, CurrentModuleObject, "Furnace ACDXCoil 2", IsNotOK, CurrentModuleObject); EXPECT_TRUE(IsNotOK); IsNotOK = false; - ValidateComponent(state, CurrentModuleObject + "x", "Furnace ACDXCoil 1", IsNotOK, CurrentModuleObject); + ValidateComponent(*state, CurrentModuleObject + "x", "Furnace ACDXCoil 1", IsNotOK, CurrentModuleObject); EXPECT_TRUE(IsNotOK); // test int return for getObjectItemNum - int ItemNum = inputProcessor->getObjectItemNum(state, CurrentModuleObject, "Furnace ACDXCoil 1"); + int ItemNum = inputProcessor->getObjectItemNum(*state, CurrentModuleObject, "Furnace ACDXCoil 1"); EXPECT_GT(ItemNum, 0); // object type and name are correct, ItemNum is > 0 // corrupt object type - ItemNum = inputProcessor->getObjectItemNum(state, CurrentModuleObject + "x", "Furnace ACDXCoil 1"); + ItemNum = inputProcessor->getObjectItemNum(*state, CurrentModuleObject + "x", "Furnace ACDXCoil 1"); EXPECT_EQ(ItemNum, -1); // object type is invalid, ItemNum = -1 // corrupt object name - ItemNum = inputProcessor->getObjectItemNum(state, CurrentModuleObject, "Furnace ACDXCoil 2"); + ItemNum = inputProcessor->getObjectItemNum(*state, CurrentModuleObject, "Furnace ACDXCoil 2"); EXPECT_EQ(ItemNum, 0); // object name is invalid, ItemNum = 0 std::string CompValType = "x"; - ItemNum = inputProcessor->getObjectItemNum(state, CurrentModuleObject, CompValType, "Furnace ACDXCoil 1"); + ItemNum = inputProcessor->getObjectItemNum(*state, CurrentModuleObject, CompValType, "Furnace ACDXCoil 1"); EXPECT_EQ(ItemNum, 0); // developer error, CompValType is invalid, ItemNum = 0 CompValType = "indoor_air_inlet_node_name"; - ItemNum = inputProcessor->getObjectItemNum(state, CurrentModuleObject, CompValType, "DX Cooling Coil Air Inlet Node"); + ItemNum = inputProcessor->getObjectItemNum(*state, CurrentModuleObject, CompValType, "DX Cooling Coil Air Inlet Node"); EXPECT_GT(ItemNum, 0); // Object type is valid, CompValType is valid, CompValType name is valid, ItemNum > 0 } @@ -3765,14 +3765,14 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_biquadratic) std::string const CurrentModuleObject = "Curve:Biquadratic"; - int num_curve_biquad = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_curve_biquad = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(2, num_curve_biquad); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -3782,7 +3782,7 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_biquadratic) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, 1, Alphas, NumAlphas, Numbers, NumNumbers, IOStatus, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields); EXPECT_EQ(4, NumAlphas); @@ -3801,7 +3801,7 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_biquadratic) int NumAlphas2 = 0; int NumNumbers2 = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs2, NumAlphas2, NumNumbers2); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs2, NumAlphas2, NumNumbers2); Array1D_string Alphas2(NumAlphas2); Array1D Numbers2(NumNumbers2, 0.0); @@ -3810,7 +3810,7 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_biquadratic) Array1D_string cAlphaFields2(NumAlphas2); Array1D_string cNumericFields2(NumNumbers2); - inputProcessor->getObjectItem(state, + inputProcessor->getObjectItem(*state, CurrentModuleObject, 2, Alphas2, NumAlphas2, Numbers2, NumNumbers2, IOStatus, lNumericBlanks2, lAlphaBlanks2, cAlphaFields2, cNumericFields2); EXPECT_EQ(4, NumAlphas2); @@ -3854,14 +3854,14 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_biquadratic2) std::string const CurrentModuleObject = "Curve:Biquadratic"; - int num_curve_biquad = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + int num_curve_biquad = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); ASSERT_EQ(1, num_curve_biquad); int TotalArgs = 0; int NumAlphas = 0; int NumNumbers = 0; - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObject, TotalArgs, NumAlphas, NumNumbers); int IOStatus = 0; Array1D_string Alphas(NumAlphas); @@ -3871,7 +3871,7 @@ TEST_F(InputProcessorFixture, getObjectItem_curve_biquadratic2) Array1D_string cAlphaFields(NumAlphas); Array1D_string cNumericFields(NumNumbers); - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, num_curve_biquad, Alphas, NumAlphas, @@ -4105,7 +4105,7 @@ TEST_F(InputProcessorFixture, reportIDFRecordsStats_basic) ASSERT_TRUE(process_idf(idf_objects)); - inputProcessor->reportIDFRecordsStats(state); + inputProcessor->reportIDFRecordsStats(*state); // TOTAL: // 34 fields with defaults, 6 Autosizable, 3 Autocalculatable @@ -4180,7 +4180,7 @@ TEST_F(InputProcessorFixture, reportIDFRecordsStats_extensible_fields) bool use_assertions = false; process_idf(idf_objects, use_assertions); - inputProcessor->reportIDFRecordsStats(state); + inputProcessor->reportIDFRecordsStats(*state); // TOTAL: // 15 fields with defaults, 0 Autosizable, 0 Autocalculatable @@ -4216,14 +4216,14 @@ TEST_F(InputProcessorFixture, reportIDFRecordsStats_extensible_fields) json::parser_callback_t cb = [&state](int depth, json::parse_event_t event, json &parsed, unsigned line_num, unsigned line_index) -> bool { - state.traverse(event, parsed, line_num, line_index); + state->traverse(event, parsed, line_num, line_index); return true; }; IP.epJSON = idf_parser.decode(idf, schema); json::parse(IP.epJSON.dump(2), cb); - EXPECT_EQ(2, state.errors + state.warnings); + EXPECT_EQ(2, state->errors + state->warnings); // auto index = FindItemInSortedList( version_name, ListOfObjects, NumObjectDefs ); // if ( index != 0 ) index = iListOfObjects( index ); diff --git a/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc b/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc index 1f3dd8fa840..3cbbbd22b8a 100644 --- a/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/IntegratedHeatPump.unit.cc @@ -52,6 +52,7 @@ #include "Fixtures/EnergyPlusFixture.hh" #include #include +#include using namespace EnergyPlus; @@ -71,9 +72,9 @@ TEST_F(EnergyPlusFixture, ASIHP_GetCurWorkMode) IntegratedHeatPumps.push_back(IHP); - EXPECT_ANY_THROW(GetCurWorkMode(state, 0);); + EXPECT_ANY_THROW(GetCurWorkMode(*state, 0);); - EXPECT_EQ(IHPOperationMode::DWHMode, GetCurWorkMode(state, 1)); + EXPECT_EQ(IHPOperationMode::DWHMode, GetCurWorkMode(*state, 1)); } TEST_F(EnergyPlusFixture, ASIHP_GetCoilIndexIHP) @@ -90,11 +91,11 @@ TEST_F(EnergyPlusFixture, ASIHP_GetCoilIndexIHP) IntegratedHeatPumps.push_back(IHP); - EXPECT_EQ(0, GetCoilIndexIHP(state, "", "", ErrorsFound)); + EXPECT_EQ(0, GetCoilIndexIHP(*state, "", "", ErrorsFound)); EXPECT_TRUE(ErrorsFound); ErrorsFound = false; - EXPECT_EQ(1, GetCoilIndexIHP(state, "", "ASIHP", ErrorsFound)); + EXPECT_EQ(1, GetCoilIndexIHP(*state, "", "ASIHP", ErrorsFound)); EXPECT_FALSE(ErrorsFound); } @@ -113,11 +114,11 @@ TEST_F(EnergyPlusFixture, ASIHP_GetCoilInletNodeIHP) IntegratedHeatPumps.push_back(IHP); - EXPECT_EQ(0, GetCoilInletNodeIHP(state, "", "", ErrorsFound)); + EXPECT_EQ(0, GetCoilInletNodeIHP(*state, "", "", ErrorsFound)); EXPECT_TRUE(ErrorsFound); ErrorsFound = false; - EXPECT_EQ(999, GetCoilInletNodeIHP(state, "", "ASIHP", ErrorsFound)); + EXPECT_EQ(999, GetCoilInletNodeIHP(*state, "", "ASIHP", ErrorsFound)); EXPECT_FALSE(ErrorsFound); } @@ -137,36 +138,36 @@ TEST_F(EnergyPlusFixture, ASIHP_GetLowSpeedNumIHP) IntegratedHeatPumps.push_back(IHP); - EXPECT_ANY_THROW(GetLowSpeedNumIHP(state, 0);); + EXPECT_ANY_THROW(GetLowSpeedNumIHP(*state, 0);); auto &instance(IntegratedHeatPumps(1)); instance.CurMode = IHPOperationMode::IdleMode; - EXPECT_EQ(1, GetLowSpeedNumIHP(state, 1)); + EXPECT_EQ(1, GetLowSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SCMode; - EXPECT_EQ(1, GetLowSpeedNumIHP(state, 1)); + EXPECT_EQ(1, GetLowSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SHMode; - EXPECT_EQ(1, GetLowSpeedNumIHP(state, 1)); + EXPECT_EQ(1, GetLowSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::DWHMode; - EXPECT_EQ(1, GetLowSpeedNumIHP(state, 1)); + EXPECT_EQ(1, GetLowSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SCWHMatchSCMode; - EXPECT_EQ(IHP.MinSpedSCWH, GetLowSpeedNumIHP(state, 1)); + EXPECT_EQ(IHP.MinSpedSCWH, GetLowSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SCWHMatchWHMode; - EXPECT_EQ(IHP.MinSpedSCWH, GetLowSpeedNumIHP(state, 1)); + EXPECT_EQ(IHP.MinSpedSCWH, GetLowSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SCDWHMode; - EXPECT_EQ(IHP.MinSpedSCDWH, GetLowSpeedNumIHP(state, 1)); + EXPECT_EQ(IHP.MinSpedSCDWH, GetLowSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SHDWHElecHeatOffMode; - EXPECT_EQ(IHP.MinSpedSHDWH, GetLowSpeedNumIHP(state, 1)); + EXPECT_EQ(IHP.MinSpedSHDWH, GetLowSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SHDWHElecHeatOnMode; - EXPECT_EQ(IHP.MinSpedSHDWH, GetLowSpeedNumIHP(state, 1)); + EXPECT_EQ(IHP.MinSpedSHDWH, GetLowSpeedNumIHP(*state, 1)); } TEST_F(EnergyPlusFixture, ASIHP_GetMaxSpeedNumIHP) @@ -177,7 +178,7 @@ TEST_F(EnergyPlusFixture, ASIHP_GetMaxSpeedNumIHP) VariableSpeedCoils::VariableSpeedCoilData vsCoil; vsCoil.NumOfSpeeds = 999; - state.dataVariableSpeedCoils->VarSpeedCoil.push_back(vsCoil); + state->dataVariableSpeedCoils->VarSpeedCoil.push_back(vsCoil); IntegratedHeatPumpData IHP; IHP.Name = "ASIHP"; @@ -195,36 +196,36 @@ TEST_F(EnergyPlusFixture, ASIHP_GetMaxSpeedNumIHP) IntegratedHeatPumps.push_back(IHP); - EXPECT_ANY_THROW(GetMaxSpeedNumIHP(state, 0);); + EXPECT_ANY_THROW(GetMaxSpeedNumIHP(*state, 0);); auto &instance(IntegratedHeatPumps(1)); instance.CurMode = IHPOperationMode::IdleMode; - EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(state, 1)); + EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SCMode; - EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(state, 1)); + EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SHMode; - EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(state, 1)); + EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::DWHMode; - EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(state, 1)); + EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SCWHMatchSCMode; - EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(state, 1)); + EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SCWHMatchWHMode; - EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(state, 1)); + EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SCDWHMode; - EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(state, 1)); + EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SHDWHElecHeatOffMode; - EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(state, 1)); + EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(*state, 1)); instance.CurMode = IHPOperationMode::SHDWHElecHeatOnMode; - EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(state, 1)); + EXPECT_EQ(vsCoil.NumOfSpeeds, GetMaxSpeedNumIHP(*state, 1)); } TEST_F(EnergyPlusFixture, ASIHP_GetIHPInput) @@ -1567,6 +1568,6 @@ TEST_F(EnergyPlusFixture, ASIHP_GetIHPInput) ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_NO_THROW(GetIHPInput(state)); + EXPECT_NO_THROW(GetIHPInput(*state)); compare_err_stream(""); } diff --git a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc index 1e55b3b1584..1ce367b5813 100644 --- a/tst/EnergyPlus/unit/InternalHeatGains.unit.cc +++ b/tst/EnergyPlus/unit/InternalHeatGains.unit.cc @@ -72,6 +72,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace ObjexxFCL; @@ -115,14 +116,14 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_OtherEquipment_CheckFuelType) bool ErrorsFound(false); - 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 + 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 - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - InternalHeatGains::GetInternalHeatGainsInput(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); ASSERT_EQ(DataHeatBalance::ZoneOtherEq.size(), 2u); @@ -164,14 +165,14 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_OtherEquipment_NegativeDesignLevel) bool ErrorsFound(false); - 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 + 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 - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - ASSERT_THROW(InternalHeatGains::GetInternalHeatGainsInput(state), std::runtime_error); + ASSERT_THROW(InternalHeatGains::GetInternalHeatGainsInput(*state), std::runtime_error); std::string const error_string = delimited_string( {" ** Warning ** ProcessScheduleInput: Schedule:Constant=\"SCHEDULE1\", Blank Schedule Type Limits Name input -- will not be validated.", @@ -216,14 +217,14 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_OtherEquipment_BadFuelType) bool ErrorsFound(false); - 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 + 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 - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - ASSERT_THROW(InternalHeatGains::GetInternalHeatGainsInput(state), std::runtime_error); + ASSERT_THROW(InternalHeatGains::GetInternalHeatGainsInput(*state), std::runtime_error); error_string = delimited_string( {" ** Warning ** ProcessScheduleInput: Schedule:Constant=\"SCHEDULE1\", Blank Schedule Type Limits Name input -- will not be validated.", @@ -286,8 +287,8 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_AllowBlankFieldsForAdaptiveComfortMo bool ErrorsFound1(false); - ScheduleManager::ProcessScheduleInput(state); // read schedules - HeatBalanceManager::GetZoneData(state, ErrorsFound1); + ScheduleManager::ProcessScheduleInput(*state); // read schedules + HeatBalanceManager::GetZoneData(*state, ErrorsFound1); ASSERT_FALSE(ErrorsFound1); ScheduleManager::ScheduleInputProcessed = true; @@ -303,7 +304,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_AllowBlankFieldsForAdaptiveComfortMo ScheduleManager::Schedule(2).MinValue = 131.8; ScheduleManager::Schedule(2).MaxValue = 131.8; ScheduleManager::Schedule(2).MaxMinSet = true; - InternalHeatGains::GetInternalHeatGainsInput(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); EXPECT_FALSE(InternalHeatGains::ErrorsFound); } @@ -467,10 +468,10 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_BeginEnvironmentRes EXPECT_FALSE(has_err_output()); bool ErrorsFound(false); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataHeatBalFanSys::MAT.allocate(1); DataHeatBalFanSys::ZoneAirHumRat.allocate(1); @@ -478,17 +479,17 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_BeginEnvironmentRes DataHeatBalFanSys::MAT(1) = 24.0; DataHeatBalFanSys::ZoneAirHumRat(1) = 0.008; - InternalHeatGains::GetInternalHeatGainsInput(state); - InternalHeatGains::CalcZoneITEq(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); + InternalHeatGains::CalcZoneITEq(*state); Real64 InitialPower = DataHeatBalance::ZoneITEq(1).CPUPower + DataHeatBalance::ZoneITEq(1).FanPower + DataHeatBalance::ZoneITEq(1).UPSPower; DataLoopNode::Node(1).Temp = 45.0; - InternalHeatGains::CalcZoneITEq(state); + InternalHeatGains::CalcZoneITEq(*state); Real64 NewPower = DataHeatBalance::ZoneITEq(1).CPUPower + DataHeatBalance::ZoneITEq(1).FanPower + DataHeatBalance::ZoneITEq(1).UPSPower; ASSERT_NE(InitialPower, NewPower); HVACManager::ResetNodeData(); - InternalHeatGains::CalcZoneITEq(state); + InternalHeatGains::CalcZoneITEq(*state); NewPower = DataHeatBalance::ZoneITEq(1).CPUPower + DataHeatBalance::ZoneITEq(1).FanPower + DataHeatBalance::ZoneITEq(1).UPSPower; ASSERT_EQ(InitialPower, NewPower); } @@ -652,9 +653,9 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_CheckZoneComponentLoadSubtotals) EXPECT_FALSE(has_err_output()); bool ErrorsFound(false); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - InternalHeatGains::GetInternalHeatGainsInput(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); // Set up a simple convective gain for each gain type int zoneNum = 1; @@ -668,10 +669,10 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_CheckZoneComponentLoadSubtotals) for (int gainType = 1; gainType <= numGainTypes; ++gainType) { convGains(gainType) = 100 * gainType; expectedTotConvGains += convGains(gainType); - SetupZoneInternalGain(state, zoneNum, DataHeatBalance::ccZoneIntGainDeviceTypes(gainType), "Gain", gainType, &convGains(gainType)); + SetupZoneInternalGain(*state, zoneNum, DataHeatBalance::ccZoneIntGainDeviceTypes(gainType), "Gain", gainType, &convGains(gainType)); } - InternalHeatGains::UpdateInternalGainValues(state); + InternalHeatGains::UpdateInternalGainValues(*state); // Check total of all convective gains InternalHeatGains::SumAllInternalConvectionGains(zoneNum, totConvGains); @@ -681,15 +682,15 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_CheckZoneComponentLoadSubtotals) DataEnvironment::TotDesDays = 1; DataEnvironment::TotRunDesPersDays = 0; DataSizing::CurOverallSimDay = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->NumOfTimeStepInHour = 10; - state.dataGlobal->TimeStep = 1; - OutputReportTabular::AllocateLoadComponentArrays(state); - int timeStepInDay = (state.dataGlobal->HourOfDay - 1) * state.dataGlobal->NumOfTimeStepInHour + state.dataGlobal->TimeStep; - - state.dataGlobal->CompLoadReportIsReq = true; - state.dataGlobal->isPulseZoneSizing = false; - InternalHeatGains::GatherComponentLoadsIntGain(state); + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->NumOfTimeStepInHour = 10; + state->dataGlobal->TimeStep = 1; + OutputReportTabular::AllocateLoadComponentArrays(*state); + int timeStepInDay = (state->dataGlobal->HourOfDay - 1) * state->dataGlobal->NumOfTimeStepInHour + state->dataGlobal->TimeStep; + + state->dataGlobal->CompLoadReportIsReq = true; + state->dataGlobal->isPulseZoneSizing = false; + InternalHeatGains::GatherComponentLoadsIntGain(*state); totConvGains = OutputReportTabular::peopleInstantSeq(DataSizing::CurOverallSimDay, timeStepInDay, zoneNum) + OutputReportTabular::lightInstantSeq(DataSizing::CurOverallSimDay, timeStepInDay, zoneNum) + OutputReportTabular::equipInstantSeq(DataSizing::CurOverallSimDay, timeStepInDay, zoneNum) + @@ -879,10 +880,10 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_ApproachTemperature EXPECT_FALSE(has_err_output()); bool ErrorsFound(false); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataHeatBalFanSys::MAT.allocate(1); DataHeatBalFanSys::ZoneAirHumRat.allocate(1); @@ -892,10 +893,10 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_ApproachTemperature DataHeatBalFanSys::MAT(1) = 24.0; DataHeatBalFanSys::ZoneAirHumRat(1) = 0.008; - InternalHeatGains::GetInternalHeatGainsInput(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); DataLoopNode::Node(1).Temp = 45.0; - InternalHeatGains::CalcZoneITEq(state); + InternalHeatGains::CalcZoneITEq(*state); ASSERT_DOUBLE_EQ(DataHeatBalance::ZoneITEq(1).AirOutletDryBulbT + DataHeatBalance::ZoneITEq(1).ReturnApproachTemp, DataHeatBalance::Zone(1).AdjustedReturnTempByITE); ASSERT_DOUBLE_EQ(DataLoopNode::Node(1).Temp + DataHeatBalance::ZoneITEq(1).SupplyApproachTemp, DataHeatBalance::ZoneITEq(1).AirInletDryBulbT); @@ -1037,7 +1038,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_DefaultCurves) bool ErrorsFound(false); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataHeatBalFanSys::MAT.allocate(1); DataHeatBalFanSys::ZoneAirHumRat.allocate(1); @@ -1045,8 +1046,8 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ElectricEquipITE_DefaultCurves) DataHeatBalFanSys::MAT(1) = 24.0; DataHeatBalFanSys::ZoneAirHumRat(1) = 0.008; - InternalHeatGains::GetInternalHeatGainsInput(state); - InternalHeatGains::CalcZoneITEq(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); + InternalHeatGains::CalcZoneITEq(*state); // If Electric Power Supply Efficiency Function of Part Load Ratio Curve Name is blank => always 1, so UPSPower is calculated as such Real64 DefaultUPSPower = (DataHeatBalance::ZoneITEq(1).CPUPower + DataHeatBalance::ZoneITEq(1).FanPower) * @@ -1296,21 +1297,21 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ZnRpt_Outputs) bool ErrorsFound(false); - 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 + 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 DataEnvironment::DayOfYear_Schedule = 1; DataEnvironment::DayOfMonth = 1; DataEnvironment::DayOfWeek = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; - ScheduleManager::UpdateScheduleValues(state); + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + ScheduleManager::UpdateScheduleValues(*state); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - HeatBalanceManager::AllocateHeatBalArrays(state); + HeatBalanceManager::AllocateHeatBalArrays(*state); - InternalHeatGains::GetInternalHeatGainsInput(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); EXPECT_EQ(DataHeatBalance::TotPeople, 1); EXPECT_EQ(DataHeatBalance::TotLights, 1); @@ -1324,7 +1325,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ZnRpt_Outputs) EnergyPlus::createFacilityElectricPowerServiceObject(); // Needs to happen before InitInternalHeatGains // First time should be all good, because ZnRpt values intialize to zero - InternalHeatGains::InitInternalHeatGains(state); + InternalHeatGains::InitInternalHeatGains(*state); EXPECT_EQ(DataHeatBalance::ZnRpt(1).LtsPower, 100.0); EXPECT_EQ(DataHeatBalance::ZnRpt(1).ElecPower, 150.0); @@ -1336,7 +1337,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_ZnRpt_Outputs) EXPECT_EQ(DataHeatBalance::ZnRpt(1).ITEqSHI, 0); // Second time should should give the same answers, because everything should reset before accumulating - InternalHeatGains::InitInternalHeatGains(state); + InternalHeatGains::InitInternalHeatGains(*state); EXPECT_EQ(DataHeatBalance::ZnRpt(1).LtsPower, 100.0); EXPECT_EQ(DataHeatBalance::ZnRpt(1).ElecPower, 150.0); @@ -1556,10 +1557,10 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_AdjustedSupplyGoodInletNode) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataHeatBalFanSys::MAT.allocate(1); DataHeatBalFanSys::ZoneAirHumRat.allocate(1); @@ -1567,7 +1568,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_AdjustedSupplyGoodInletNode) DataHeatBalFanSys::MAT(1) = 24.0; DataHeatBalFanSys::ZoneAirHumRat(1) = 0.008; - InternalHeatGains::GetInternalHeatGainsInput(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); ASSERT_FALSE(ErrorsFound); } @@ -1779,10 +1780,10 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_AdjustedSupplyBadInletNode) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataHeatBalFanSys::MAT.allocate(1); DataHeatBalFanSys::ZoneAirHumRat.allocate(1); @@ -1790,7 +1791,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_AdjustedSupplyBadInletNode) DataHeatBalFanSys::MAT(1) = 24.0; DataHeatBalFanSys::ZoneAirHumRat(1) = 0.008; - EXPECT_ANY_THROW(InternalHeatGains::GetInternalHeatGainsInput(state)); + EXPECT_ANY_THROW(InternalHeatGains::GetInternalHeatGainsInput(*state)); } TEST_F(EnergyPlusFixture, InternalHeatGains_FlowControlWithApproachTemperaturesGoodInletNode) @@ -2005,10 +2006,10 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_FlowControlWithApproachTemperaturesG ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataHeatBalFanSys::MAT.allocate(1); DataHeatBalFanSys::ZoneAirHumRat.allocate(1); @@ -2016,7 +2017,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_FlowControlWithApproachTemperaturesG DataHeatBalFanSys::MAT(1) = 24.0; DataHeatBalFanSys::ZoneAirHumRat(1) = 0.008; - InternalHeatGains::GetInternalHeatGainsInput(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); ASSERT_FALSE(ErrorsFound); } @@ -2232,10 +2233,10 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_FlowControlWithApproachTemperaturesB ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataHeatBalFanSys::MAT.allocate(1); DataHeatBalFanSys::ZoneAirHumRat.allocate(1); @@ -2243,7 +2244,7 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_FlowControlWithApproachTemperaturesB DataHeatBalFanSys::MAT(1) = 24.0; DataHeatBalFanSys::ZoneAirHumRat(1) = 0.008; - ASSERT_ANY_THROW(InternalHeatGains::GetInternalHeatGainsInput(state)); + ASSERT_ANY_THROW(InternalHeatGains::GetInternalHeatGainsInput(*state)); } TEST_F(EnergyPlusFixture, InternalHeatGains_WarnMissingInletNode) @@ -2458,10 +2459,10 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_WarnMissingInletNode) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataHeatBalFanSys::MAT.allocate(1); DataHeatBalFanSys::ZoneAirHumRat.allocate(1); @@ -2469,6 +2470,6 @@ TEST_F(EnergyPlusFixture, InternalHeatGains_WarnMissingInletNode) DataHeatBalFanSys::MAT(1) = 24.0; DataHeatBalFanSys::ZoneAirHumRat(1) = 0.008; - InternalHeatGains::GetInternalHeatGainsInput(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); ASSERT_FALSE(ErrorsFound); } diff --git a/tst/EnergyPlus/unit/KusudaAchenbachGroundTemperatureModel.unit.cc b/tst/EnergyPlus/unit/KusudaAchenbachGroundTemperatureModel.unit.cc index ff0f740e3e6..46f862afbd7 100644 --- a/tst/EnergyPlus/unit/KusudaAchenbachGroundTemperatureModel.unit.cc +++ b/tst/EnergyPlus/unit/KusudaAchenbachGroundTemperatureModel.unit.cc @@ -55,6 +55,7 @@ #include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" #include "EnergyPlus/GroundTemperatureModeling/KusudaAchenbachGroundTemperatureModel.hh" #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::GroundTemperatureManager; @@ -76,15 +77,15 @@ TEST_F(EnergyPlusFixture, KusudaAchenbachGroundTempModelTest1) std::string const CurrentModuleObject = CurrentModuleObjects(objectType_KusudaGroundTemp); - auto thisModel = GetGroundTempModelAndInit(state, CurrentModuleObject, "TEST"); + auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); - EXPECT_NEAR(10.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 0.0), 0.01); // Jan 1 - EXPECT_NEAR(20.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 15768000), 0.01); // June 1 - EXPECT_NEAR(10.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 31449600), 0.01); // Dec 30 - EXPECT_NEAR(15.0, thisModel->getGroundTempAtTimeInSeconds(state, 100.0, 0.0), 0.01); // Very deep + EXPECT_NEAR(10.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 0.0), 0.01); // Jan 1 + EXPECT_NEAR(20.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 15768000), 0.01); // June 1 + EXPECT_NEAR(10.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 31449600), 0.01); // Dec 30 + EXPECT_NEAR(15.0, thisModel->getGroundTempAtTimeInSeconds(*state, 100.0, 0.0), 0.01); // Very deep - EXPECT_NEAR(10.15, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 1), 0.01); // January - EXPECT_NEAR(19.75, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 6), 0.01); // June + EXPECT_NEAR(10.15, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.01); // January + EXPECT_NEAR(19.75, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 6), 0.01); // June } TEST_F(EnergyPlusFixture, KusudaAchenbachGroundTempModelTest2) // lNumericFieldBlanks not working correctly for this test @@ -118,12 +119,12 @@ TEST_F(EnergyPlusFixture, KusudaAchenbachGroundTempModelTest2) // lNumericFieldB std::string const CurrentModuleObject = CurrentModuleObjects(objectType_KusudaGroundTemp); - auto thisModel = GetGroundTempModelAndInit(state, CurrentModuleObject, "TEST"); + auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); - EXPECT_NEAR(16.46, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 0.0), 0.01); // Jan 1 - EXPECT_NEAR(17.17, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 11664000), 0.01); // May 15 - EXPECT_NEAR(20.12, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 24883200), 0.01); // Oct 15 - EXPECT_NEAR(16.46, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 31536000), 0.01); // Dec 31 + EXPECT_NEAR(16.46, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 0.0), 0.01); // Jan 1 + EXPECT_NEAR(17.17, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 11664000), 0.01); // May 15 + EXPECT_NEAR(20.12, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 24883200), 0.01); // Oct 15 + EXPECT_NEAR(16.46, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 31536000), 0.01); // Dec 31 - EXPECT_NEAR(18.0, thisModel->getGroundTempAtTimeInSeconds(state, 100.0, 24883200), 0.01); // Oct 15--deep + EXPECT_NEAR(18.0, thisModel->getGroundTempAtTimeInSeconds(*state, 100.0, 24883200), 0.01); // Oct 15--deep } diff --git a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc index c3f8e6355df..1916419c76d 100644 --- a/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc +++ b/tst/EnergyPlus/unit/LowTempRadiantSystem.unit.cc @@ -75,6 +75,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::LowTempRadiantSystem; @@ -186,7 +187,7 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantElectric) ElecRadSys(RadSysNum).HeatingCapMethod = HeatingDesignCapacity; ElecRadSys(RadSysNum).ScaledHeatingCapacity = AutoSize; FinalZoneSizing(CurZoneEqNum).NonAirSysDesHeatLoad = 1200.0; - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(1200.0, ElecRadSys(RadSysNum).MaxElecPower, 0.1); // Electric - CapacityPerFloorArea method - hold until scalable sizing issue is resolved @@ -194,7 +195,7 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantElectric) ElecRadSys(RadSysNum).HeatingCapMethod = CapacityPerFloorArea; ElecRadSys(RadSysNum).ScaledHeatingCapacity = 1.5; Zone(1).FloorArea = 500.0; - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(750.0, ElecRadSys(RadSysNum).MaxElecPower, 0.1); // Electric - FractionOfAutosizedHeatingCapacity method - hold until scalable sizing issue is resolved @@ -202,7 +203,7 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantElectric) ElecRadSys(RadSysNum).HeatingCapMethod = FractionOfAutosizedHeatingCapacity; ElecRadSys(RadSysNum).ScaledHeatingCapacity = 10.0; FinalZoneSizing(CurZoneEqNum).NonAirSysDesHeatLoad = 880.0; - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(8800.0, ElecRadSys(RadSysNum).MaxElecPower, 0.1); } @@ -249,10 +250,10 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantVariableFlow) Surface.allocate(1); Surface(1).Construction = 1; Surface(1).Area = 1500.0; - state.dataConstruction->Construct.allocate(1); - state.dataConstruction->Construct(1).ThicknessPerpend = 0.075; + state->dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct(1).ThicknessPerpend = 0.075; - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(ExpectedResult1, HydrRadSys(RadSysNum).WaterVolFlowMaxHeat, 0.1); EXPECT_NEAR(ExpectedResult2, HydrRadSys(RadSysNum).WaterVolFlowMaxCool, 0.1); EXPECT_NEAR(ExpectedResult3, HydrRadSys(RadSysNum).TubeLength, 0.1); @@ -271,7 +272,7 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantVariableFlow) ExpectedResult2 = HydrRadSys(RadSysNum).ScaledCoolingCapacity * Zone(1).FloorArea; ExpectedResult2 = ExpectedResult2 / (PlantSizData(2).DeltaT * RhoWater * CpWater); - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(ExpectedResult1, HydrRadSys(RadSysNum).WaterVolFlowMaxHeat, 0.1); EXPECT_NEAR(ExpectedResult2, HydrRadSys(RadSysNum).WaterVolFlowMaxCool, 0.1); @@ -290,7 +291,7 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantVariableFlow) ExpectedResult2 = HydrRadSys(RadSysNum).ScaledCoolingCapacity * FinalZoneSizing(CurZoneEqNum).NonAirSysDesCoolLoad; ExpectedResult2 = ExpectedResult2 / (PlantSizData(2).DeltaT * RhoWater * CpWater); - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(ExpectedResult1, HydrRadSys(RadSysNum).WaterVolFlowMaxHeat, 0.1); EXPECT_NEAR(ExpectedResult2, HydrRadSys(RadSysNum).WaterVolFlowMaxCool, 0.1); } @@ -330,10 +331,10 @@ TEST_F(LowTempRadiantSystemTest, SizeCapacityLowTempRadiantVariableFlow) Surface.allocate(1); Surface(1).Construction = 1; Surface(1).Area = 1500.0; - state.dataConstruction->Construct.allocate(1); - state.dataConstruction->Construct(1).ThicknessPerpend = 0.075; + state->dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct(1).ThicknessPerpend = 0.075; - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(ExpectedResult1, HydrRadSys(RadSysNum).ScaledHeatingCapacity, 0.1); EXPECT_NEAR(ExpectedResult2, HydrRadSys(RadSysNum).ScaledCoolingCapacity, 0.1); @@ -347,7 +348,7 @@ TEST_F(LowTempRadiantSystemTest, SizeCapacityLowTempRadiantVariableFlow) HydrRadSys(RadSysNum).ScaledCoolingCapacity = 250.0; ExpectedResult2 = HydrRadSys(RadSysNum).ScaledCoolingCapacity * Zone(1).FloorArea; - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(ExpectedResult1, HydrRadSys(RadSysNum).ScaledHeatingCapacity, 0.1); EXPECT_NEAR(ExpectedResult2, HydrRadSys(RadSysNum).ScaledCoolingCapacity, 0.1); @@ -362,7 +363,7 @@ TEST_F(LowTempRadiantSystemTest, SizeCapacityLowTempRadiantVariableFlow) FinalZoneSizing(CurZoneEqNum).NonAirSysDesCoolLoad = 1200.0; ExpectedResult2 = HydrRadSys(RadSysNum).ScaledCoolingCapacity * FinalZoneSizing(CurZoneEqNum).NonAirSysDesCoolLoad; - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(ExpectedResult1, HydrRadSys(RadSysNum).ScaledHeatingCapacity, 0.1); EXPECT_NEAR(ExpectedResult2, HydrRadSys(RadSysNum).ScaledCoolingCapacity, 0.1); } @@ -398,10 +399,10 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantConstantFlow) Surface.allocate(1); Surface(1).Construction = 1; Surface(1).Area = 150.0; - state.dataConstruction->Construct.allocate(1); - state.dataConstruction->Construct(1).ThicknessPerpend = 0.075; + state->dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct(1).ThicknessPerpend = 0.075; - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(ExpectedResult1, CFloRadSys(RadSysNum).WaterVolFlowMax, 0.001); // Hydronic - cold water volume flow rate autosize @@ -414,7 +415,7 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantConstantFlow) ExpectedResult2 = FinalZoneSizing(CurZoneEqNum).NonAirSysDesCoolLoad; ExpectedResult2 = ExpectedResult2 / (PlantSizData(2).DeltaT * RhoWater * CpWater); - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(ExpectedResult2, CFloRadSys(RadSysNum).WaterVolFlowMax, 0.001); // Hydronic - maximum water volume flow rate autosize @@ -431,7 +432,7 @@ TEST_F(LowTempRadiantSystemTest, SizeLowTempRadiantConstantFlow) CFloRadSys(RadSysNum).TotalSurfaceArea = 150.0; ExpectedResult3 = CFloRadSys(RadSysNum).TotalSurfaceArea / 0.15; - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); EXPECT_NEAR(std::max(ExpectedResult1, ExpectedResult2), CFloRadSys(RadSysNum).WaterVolFlowMax, 0.001); EXPECT_NEAR(ExpectedResult3, CFloRadSys(RadSysNum).TubeLength, 0.1); } @@ -1105,43 +1106,43 @@ TEST_F(LowTempRadiantSystemTest, AutosizeLowTempRadiantVariableFlowTest) }); ASSERT_TRUE(process_idf(idf_objects)); - GetProjectControlData(state, ErrorsFound); + GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ("WEST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - HeatBalanceManager::SetPreConstructionInputParameters(state); - GetMaterialData(state, ErrorsFound); + HeatBalanceManager::SetPreConstructionInputParameters(*state); + GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - GetConstructData(state, ErrorsFound); + GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - GetPlantSizingInput(state); - GetPlantLoopData(state); - GetPlantInput(state); + GetPlantSizingInput(*state); + GetPlantLoopData(*state); + GetPlantInput(*state); SetupInitialPlantCallingOrder(); - SetupBranchControlTypes(state); + SetupBranchControlTypes(*state); DataSurfaces::WorldCoordSystem = true; - GetSurfaceListsInputs(state); + GetSurfaceListsInputs(*state); ErrorsFound = false; - SetupZoneGeometry(state, ErrorsFound); + SetupZoneGeometry(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - GetLowTempRadiantSystem(state); + GetLowTempRadiantSystem(*state); EXPECT_EQ(1, LowTempRadiantSystem::NumOfHydrLowTempRadSys); EXPECT_EQ("WEST ZONE RADIANT FLOOR", RadSysTypes(RadSysNum).Name); EXPECT_EQ(LowTempRadiantSystem::HydronicSystem, RadSysTypes(RadSysNum).SystemType); ErrorsFound = false; - PlantUtilities::ScanPlantLoopsForObject(state, + PlantUtilities::ScanPlantLoopsForObject(*state, HydrRadSys(RadSysNum).Name, TypeOf_LowTempRadiant_VarFlow, HydrRadSys(RadSysNum).HWLoopNum, @@ -1157,7 +1158,7 @@ TEST_F(LowTempRadiantSystemTest, AutosizeLowTempRadiantVariableFlowTest) EXPECT_FALSE(ErrorsFound); ErrorsFound = false; - PlantUtilities::ScanPlantLoopsForObject(state, + PlantUtilities::ScanPlantLoopsForObject(*state, HydrRadSys(RadSysNum).Name, TypeOf_LowTempRadiant_VarFlow, HydrRadSys(RadSysNum).CWLoopNum, @@ -1187,21 +1188,21 @@ TEST_F(LowTempRadiantSystemTest, AutosizeLowTempRadiantVariableFlowTest) FinalZoneSizing(DataSizing::CurZoneEqNum).NonAirSysDesCoolLoad = 10000.0; CoolingCapacity = FinalZoneSizing(DataSizing::CurZoneEqNum).NonAirSysDesCoolLoad * HydrRadSys(RadSysNum).ScaledCoolingCapacity; // hot water flow rate sizing calculation - Density = GetDensityGlycol(state, PlantLoop(HydrRadSys(RadSysNum).HWLoopNum).FluidName, + Density = GetDensityGlycol(*state, PlantLoop(HydrRadSys(RadSysNum).HWLoopNum).FluidName, 60.0, PlantLoop(HydrRadSys(RadSysNum).HWLoopNum).FluidIndex, "AutosizeLowTempRadiantVariableFlowTest"); - Cp = GetSpecificHeatGlycol(state, PlantLoop(HydrRadSys(RadSysNum).HWLoopNum).FluidName, + Cp = GetSpecificHeatGlycol(*state, PlantLoop(HydrRadSys(RadSysNum).HWLoopNum).FluidName, 60.0, PlantLoop(HydrRadSys(RadSysNum).HWLoopNum).FluidIndex, "AutosizeLowTempRadiantVariableFlowTest"); HotWaterFlowRate = HeatingCapacity / (PlantSizData(1).DeltaT * Cp * Density); // chilled water flow rate sizing calculation - Density = GetDensityGlycol(state, PlantLoop(HydrRadSys(RadSysNum).CWLoopNum).FluidName, + Density = GetDensityGlycol(*state, PlantLoop(HydrRadSys(RadSysNum).CWLoopNum).FluidName, 5.05, PlantLoop(HydrRadSys(RadSysNum).CWLoopNum).FluidIndex, "AutosizeLowTempRadiantVariableFlowTest"); - Cp = GetSpecificHeatGlycol(state, PlantLoop(HydrRadSys(RadSysNum).CWLoopNum).FluidName, + Cp = GetSpecificHeatGlycol(*state, PlantLoop(HydrRadSys(RadSysNum).CWLoopNum).FluidName, 5.05, PlantLoop(HydrRadSys(RadSysNum).CWLoopNum).FluidIndex, "AutosizeLowTempRadiantVariableFlowTest"); @@ -1211,7 +1212,7 @@ TEST_F(LowTempRadiantSystemTest, AutosizeLowTempRadiantVariableFlowTest) TubeLengthDes = HydrRadSys(RadSysNum).TotalSurfaceArea / 0.1524; // tube length uses the construction perpendicular spacing // do autosize calculations - SizeLowTempRadiantSystem(state, RadSysNum, RadSysTypes(1).SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, RadSysTypes(1).SystemType); // Test autosized heat/cool capacity EXPECT_EQ(HeatingCapacity, HydrRadSys(RadSysNum).ScaledHeatingCapacity); EXPECT_EQ(CoolingCapacity, HydrRadSys(RadSysNum).ScaledCoolingCapacity); @@ -1232,10 +1233,10 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystem) NumOfCFloLowTempRadSys = 1; CFloRadSys(RadSysNum).NumOfSurfaces = 0; TotalNumOfRadSystems = 0; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; CFloRadSys(RadSysNum).HotWaterInNode = 0; CFloRadSys(RadSysNum).ColdWaterInNode = 0; - state.dataGlobal->BeginTimeStepFlag = false; + state->dataGlobal->BeginTimeStepFlag = false; CFloRadSys(RadSysNum).VolFlowSchedPtr = 0; CFloRadSys(RadSysNum).EMSOverrideOnWaterMdot = false; CFloRadSys(RadSysNum).WaterMassFlowRate = 1.0; @@ -1250,13 +1251,13 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystem) CFloRadSys(RadSysNum).CoolingSystem = true; CFloRadSys(RadSysNum).HeatingSystem = false; - InitLowTempRadiantSystem(state, false, RadSysNum, SystemType, InitErrorFound); + InitLowTempRadiantSystem(*state, false, RadSysNum, SystemType, InitErrorFound); EXPECT_EQ(3.0, CFloRadSys(RadSysNum).ChWaterMassFlowRate); EXPECT_EQ(0.0, CFloRadSys(RadSysNum).WaterMassFlowRate); CFloRadSys(RadSysNum).CoolingSystem = false; CFloRadSys(RadSysNum).HeatingSystem = true; - InitLowTempRadiantSystem(state, false, RadSysNum, SystemType, InitErrorFound); + InitLowTempRadiantSystem(*state, false, RadSysNum, SystemType, InitErrorFound); EXPECT_EQ(2.0, CFloRadSys(RadSysNum).HotWaterMassFlowRate); EXPECT_EQ(0.0, CFloRadSys(RadSysNum).WaterMassFlowRate); } @@ -1276,11 +1277,11 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) CFloRadSys(RadSysNum).NumOfSurfaces = 0; CFloRadSys(RadSysNum).Name = "NoNameRadSys"; TotalNumOfRadSystems = 0; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; DataZoneEquipment::ZoneEquipInputsFilled = false; CFloRadSys(RadSysNum).HotWaterInNode = 0; CFloRadSys(RadSysNum).ColdWaterInNode = 0; - state.dataGlobal->BeginTimeStepFlag = false; + state->dataGlobal->BeginTimeStepFlag = false; CFloRadSys(RadSysNum).VolFlowSchedPtr = 0; CFloRadSys(RadSysNum).EMSOverrideOnWaterMdot = false; CFloRadSys(RadSysNum).WaterMassFlowRate = 1.0; @@ -1296,7 +1297,7 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) CFloRadSys(RadSysNum).HeatingSystem = false; CFloRadSys(RadSysNum).WaterVolFlowMax = AutoSize; - InitLowTempRadiantSystem(state, false, RadSysNum, SystemType, InitErrorFound); + InitLowTempRadiantSystem(*state, false, RadSysNum, SystemType, InitErrorFound); EXPECT_EQ(CFloRadSys(RadSysNum).PumpEffic, 0.0); EXPECT_EQ(InitErrorFound, false); @@ -1309,11 +1310,11 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) CFloRadSys(RadSysNum).NumOfSurfaces = 0; CFloRadSys(RadSysNum).Name = "NoNameRadSys"; TotalNumOfRadSystems = 0; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; DataZoneEquipment::ZoneEquipInputsFilled = false; CFloRadSys(RadSysNum).HotWaterInNode = 0; CFloRadSys(RadSysNum).ColdWaterInNode = 0; - state.dataGlobal->BeginTimeStepFlag = false; + state->dataGlobal->BeginTimeStepFlag = false; CFloRadSys(RadSysNum).VolFlowSchedPtr = 0; CFloRadSys(RadSysNum).EMSOverrideOnWaterMdot = false; CFloRadSys(RadSysNum).WaterMassFlowRate = 1.0; @@ -1329,7 +1330,7 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) CFloRadSys(RadSysNum).HeatingSystem = false; CFloRadSys(RadSysNum).WaterVolFlowMax = 0.4; // because of how other parameters are set, this value is equal to the pump efficiency - InitLowTempRadiantSystem(state, false, RadSysNum, SystemType, InitErrorFound); + InitLowTempRadiantSystem(*state, false, RadSysNum, SystemType, InitErrorFound); actualEfficiencyPercentage = CFloRadSys(RadSysNum).PumpEffic * 100.0; std::string const error_string02 = delimited_string({" ** Warning ** Check input. Calc Pump Efficiency=" + General::RoundSigDigits(actualEfficiencyPercentage, 5) + @@ -1347,11 +1348,11 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) CFloRadSys(RadSysNum).NumOfSurfaces = 0; CFloRadSys(RadSysNum).Name = "NoNameRadSys"; TotalNumOfRadSystems = 0; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; DataZoneEquipment::ZoneEquipInputsFilled = false; CFloRadSys(RadSysNum).HotWaterInNode = 0; CFloRadSys(RadSysNum).ColdWaterInNode = 0; - state.dataGlobal->BeginTimeStepFlag = false; + state->dataGlobal->BeginTimeStepFlag = false; CFloRadSys(RadSysNum).VolFlowSchedPtr = 0; CFloRadSys(RadSysNum).EMSOverrideOnWaterMdot = false; CFloRadSys(RadSysNum).WaterMassFlowRate = 1.0; @@ -1367,7 +1368,7 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) CFloRadSys(RadSysNum).HeatingSystem = false; CFloRadSys(RadSysNum).WaterVolFlowMax = 0.98; // because of how other parameters are set, this value is equal to the pump efficiency - InitLowTempRadiantSystem(state, false, RadSysNum, SystemType, InitErrorFound); + InitLowTempRadiantSystem(*state, false, RadSysNum, SystemType, InitErrorFound); actualEfficiencyPercentage = CFloRadSys(RadSysNum).PumpEffic * 100.0; std::string const error_string03 = delimited_string({" ** Warning ** Check input. Calc Pump Efficiency=" + General::RoundSigDigits(actualEfficiencyPercentage, 5) + @@ -1385,11 +1386,11 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) CFloRadSys(RadSysNum).NumOfSurfaces = 0; CFloRadSys(RadSysNum).Name = "NoNameRadSys"; TotalNumOfRadSystems = 0; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; DataZoneEquipment::ZoneEquipInputsFilled = false; CFloRadSys(RadSysNum).HotWaterInNode = 0; CFloRadSys(RadSysNum).ColdWaterInNode = 0; - state.dataGlobal->BeginTimeStepFlag = false; + state->dataGlobal->BeginTimeStepFlag = false; CFloRadSys(RadSysNum).VolFlowSchedPtr = 0; CFloRadSys(RadSysNum).EMSOverrideOnWaterMdot = false; CFloRadSys(RadSysNum).WaterMassFlowRate = 1.0; @@ -1405,7 +1406,7 @@ TEST_F(LowTempRadiantSystemTest, InitLowTempRadiantSystemCFloPump) CFloRadSys(RadSysNum).HeatingSystem = false; CFloRadSys(RadSysNum).WaterVolFlowMax = 1.23; // because of how other parameters are set, this value is equal to the pump efficiency - InitLowTempRadiantSystem(state, false, RadSysNum, SystemType, InitErrorFound); + InitLowTempRadiantSystem(*state, false, RadSysNum, SystemType, InitErrorFound); actualEfficiencyPercentage = CFloRadSys(RadSysNum).PumpEffic * 100.0; std::string const error_string04 = delimited_string({" ** Severe ** Check input. Calc Pump Efficiency=" + General::RoundSigDigits(actualEfficiencyPercentage, 5) + @@ -1503,10 +1504,10 @@ TEST_F(LowTempRadiantSystemTest, LowTempElecRadSurfaceGroupTest) Surface(4).ZoneName = "EAST ZONE"; Surface(4).Zone = 2; Surface(4).Construction = 1; - state.dataConstruction->Construct.allocate(1); - state.dataConstruction->Construct(1).SourceSinkPresent = true; + state->dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct(1).SourceSinkPresent = true; - GetLowTempRadiantSystem(state); + GetLowTempRadiantSystem(*state); EXPECT_EQ(2, LowTempRadiantSystem::NumOfElecLowTempRadSys); EXPECT_EQ("WEST ZONE RADIANT FLOOR", RadSysTypes(RadSysNum).Name); EXPECT_EQ("EAST ZONE RADIANT FLOOR", RadSysTypes(RadSysNum + 1).Name); @@ -1567,14 +1568,14 @@ TEST_F(LowTempRadiantSystemTest, CalcLowTempCFloRadiantSystem_OperationMode) CFloRadSys(RadSysNum).CoolingSystem = true; CFloRadSys(RadSysNum).HeatingSystem = false; Load = 1000.0; - CFloRadSys(RadSysNum).calculateLowTemperatureRadiantSystem(state, Load); + CFloRadSys(RadSysNum).calculateLowTemperatureRadiantSystem(*state, Load); EXPECT_EQ(NotOperating, CFloRadSys(RadSysNum).OperatingMode); // Cooling CFloRadSys(RadSysNum).CoolingSystem = false; CFloRadSys(RadSysNum).HeatingSystem = true; DataHeatBalFanSys::MAT(1) = 26.0; - CFloRadSys(RadSysNum).calculateLowTemperatureRadiantSystem(state, Load); + CFloRadSys(RadSysNum).calculateLowTemperatureRadiantSystem(*state, Load); EXPECT_EQ(NotOperating, CFloRadSys(RadSysNum).OperatingMode); CFloRadSys.deallocate(); @@ -1622,14 +1623,14 @@ TEST_F(LowTempRadiantSystemTest, CalcLowTempHydrRadiantSystem_OperationMode) HydrRadSys(RadSysNum).CoolingSystem = true; HydrRadSys(RadSysNum).HeatingSystem = false; Load = 1000.0; - HydrRadSys(RadSysNum).calculateLowTemperatureRadiantSystem(state, Load); + HydrRadSys(RadSysNum).calculateLowTemperatureRadiantSystem(*state, Load); EXPECT_EQ(0, HydrRadSys(RadSysNum).OperatingMode); // Cooling HydrRadSys(RadSysNum).CoolingSystem = false; HydrRadSys(RadSysNum).HeatingSystem = true; DataHeatBalFanSys::MAT(1) = 26.0; - HydrRadSys(RadSysNum).calculateLowTemperatureRadiantSystem(state, Load); + HydrRadSys(RadSysNum).calculateLowTemperatureRadiantSystem(*state, Load); EXPECT_EQ(NotOperating, HydrRadSys(RadSysNum).OperatingMode); HydrRadSys.deallocate(); @@ -1679,60 +1680,60 @@ TEST_F(LowTempRadiantSystemTest, SizeRadSysTubeLengthTest) Surface(3).Construction = 3; Surface(3).Area = 300.0; - state.dataConstruction->Construct.allocate(3); - state.dataConstruction->Construct(1).ThicknessPerpend = 0.05; - state.dataConstruction->Construct(2).ThicknessPerpend = 0.125; + state->dataConstruction->Construct.allocate(3); + state->dataConstruction->Construct(1).ThicknessPerpend = 0.05; + state->dataConstruction->Construct(2).ThicknessPerpend = 0.125; // Test 1: Hydronic radiant system 1 (one surface) RadSysType = HydronicSystem; RadSysNum = 1; - FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); + FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(*state); EXPECT_NEAR(FuncCalc, 1000.0, 0.1); // Test 2: Hydronic radiant system 2 (two surfaces) RadSysType = HydronicSystem; RadSysNum = 2; - FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); + FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(*state); EXPECT_NEAR(FuncCalc, 1800.0, 0.1); // Test 3: Constant flow radiant system 1 (one surface) RadSysType = ConstantFlowSystem; RadSysNum = 1; - FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); + FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(*state); EXPECT_NEAR(FuncCalc, 1000.0, 0.1); // Test 4: Constant flow radiant system 2 (two surfaces) RadSysType = ConstantFlowSystem; RadSysNum = 2; - FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); + FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(*state); EXPECT_NEAR(FuncCalc, 1800.0, 0.1); // Test 5: Hydronic radiant system 3 (thickness out of range, low side) RadSysType = HydronicSystem; RadSysNum = 3; - state.dataConstruction->Construct(3).ThicknessPerpend = 0.004; - FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); + state->dataConstruction->Construct(3).ThicknessPerpend = 0.004; + FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(*state); EXPECT_NEAR(FuncCalc, 2000.0, 0.1); // Test 6: Hydronic radiant system 3 (thickness out of range, high side) RadSysType = HydronicSystem; RadSysNum = 3; - state.dataConstruction->Construct(3).ThicknessPerpend = 0.6; - FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); + state->dataConstruction->Construct(3).ThicknessPerpend = 0.6; + FuncCalc = HydrRadSys(RadSysNum).sizeRadiantSystemTubeLength(*state); EXPECT_NEAR(FuncCalc, 2000.0, 0.1); // Test 7: Constant flow radiant system 3 (thickness out of range, low side) RadSysType = ConstantFlowSystem; RadSysNum = 3; - state.dataConstruction->Construct(3).ThicknessPerpend = 0.004; - FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); + state->dataConstruction->Construct(3).ThicknessPerpend = 0.004; + FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(*state); EXPECT_NEAR(FuncCalc, 2000.0, 0.1); // Test 8: Constant flow radiant system 3 (thickness out of range, high side) RadSysType = ConstantFlowSystem; RadSysNum = 3; - state.dataConstruction->Construct(3).ThicknessPerpend = 0.6; - FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(state); + state->dataConstruction->Construct(3).ThicknessPerpend = 0.6; + FuncCalc = CFloRadSys(RadSysNum).sizeRadiantSystemTubeLength(*state); EXPECT_NEAR(FuncCalc, 2000.0, 0.1); } @@ -1763,8 +1764,8 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadConFlowSystemAutoSizeTempTest) Surface.allocate(1); Surface(1).Construction = 1; Surface(1).Area = 150.0; - state.dataConstruction->Construct.allocate(1); - state.dataConstruction->Construct(1).ThicknessPerpend = 0.075; + state->dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct(1).ThicknessPerpend = 0.075; // Hydronic - Hot water volume flow rate autosize CFloRadSys(RadSysNum).ColdWaterInNode = 0; @@ -1774,18 +1775,18 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadConFlowSystemAutoSizeTempTest) FinalZoneSizing(CurZoneEqNum).NonAirSysDesCoolLoad = 1000.0; // hot water volume flow rate sizing calculation - Density = GetDensityGlycol(state, PlantLoop(CFloRadSys(RadSysNum).HWLoopNum).FluidName, + Density = GetDensityGlycol(*state, PlantLoop(CFloRadSys(RadSysNum).HWLoopNum).FluidName, 60.0, PlantLoop(CFloRadSys(RadSysNum).HWLoopNum).FluidIndex, "LowTempRadConFlowSystemAutoSizeTempTest"); - Cp = GetSpecificHeatGlycol(state, PlantLoop(CFloRadSys(RadSysNum).HWLoopNum).FluidName, + Cp = GetSpecificHeatGlycol(*state, PlantLoop(CFloRadSys(RadSysNum).HWLoopNum).FluidName, 60.0, PlantLoop(CFloRadSys(RadSysNum).HWLoopNum).FluidIndex, "LowTempRadConFlowSystemAutoSizeTempTest"); Real64 HeatingLoad = FinalZoneSizing(1).NonAirSysDesHeatLoad; Real64 DesHotWaterVolFlowRate = HeatingLoad / (PlantSizData(1).DeltaT * Density * Cp); - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); // check hot water design flow rate calculated here and autosized flow are identical EXPECT_DOUBLE_EQ(DesHotWaterVolFlowRate, CFloRadSys(RadSysNum).WaterVolFlowMax); @@ -1797,18 +1798,18 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadConFlowSystemAutoSizeTempTest) CFloRadSys(RadSysNum).WaterVolFlowMax = AutoSize; // chilled water volume flow rate sizing calculation - Density = GetDensityGlycol(state, PlantLoop(CFloRadSys(RadSysNum).CWLoopNum).FluidName, + Density = GetDensityGlycol(*state, PlantLoop(CFloRadSys(RadSysNum).CWLoopNum).FluidName, 5.05, PlantLoop(CFloRadSys(RadSysNum).CWLoopNum).FluidIndex, "LowTempRadConFlowSystemAutoSizeTempTest"); - Cp = GetSpecificHeatGlycol(state, PlantLoop(CFloRadSys(RadSysNum).CWLoopNum).FluidName, + Cp = GetSpecificHeatGlycol(*state, PlantLoop(CFloRadSys(RadSysNum).CWLoopNum).FluidName, 5.05, PlantLoop(CFloRadSys(RadSysNum).CWLoopNum).FluidIndex, "LowTempRadConFlowSystemAutoSizeTempTest"); Real64 CoolingLoad = FinalZoneSizing(CurZoneEqNum).NonAirSysDesCoolLoad; Real64 DesChilledWaterVolFlowRate = CoolingLoad / (PlantSizData(2).DeltaT * Density * Cp); - SizeLowTempRadiantSystem(state, RadSysNum, SystemType); + SizeLowTempRadiantSystem(*state, RadSysNum, SystemType); // check chilled water design flow rate calculated here and autosized flow are identical EXPECT_DOUBLE_EQ(DesChilledWaterVolFlowRate, CFloRadSys(RadSysNum).WaterVolFlowMax); } @@ -1848,7 +1849,7 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadCalcRadSysHXEffectTermTest) RadSysType = HydronicSystem; Temperature = 10.0; HydrRadSys(RadSysNum).HWLoopNum = 1; - HXEffectFuncResult = HydrRadSys(RadSysNum).calculateHXEffectivenessTerm(state, SurfNum, Temperature, WaterMassFlow, FlowFraction, NumCircs); + HXEffectFuncResult = HydrRadSys(RadSysNum).calculateHXEffectivenessTerm(*state, SurfNum, Temperature, WaterMassFlow, FlowFraction, NumCircs); EXPECT_NEAR( HXEffectFuncResult, 62.344, 0.001); // Test 2: Cooling for Hydronic System @@ -1857,7 +1858,7 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadCalcRadSysHXEffectTermTest) RadSysType = HydronicSystem; Temperature = 10.0; HydrRadSys(RadSysNum).CWLoopNum = 1; - HXEffectFuncResult = HydrRadSys(RadSysNum).calculateHXEffectivenessTerm(state, SurfNum, Temperature, WaterMassFlow, FlowFraction, NumCircs); + HXEffectFuncResult = HydrRadSys(RadSysNum).calculateHXEffectivenessTerm(*state, SurfNum, Temperature, WaterMassFlow, FlowFraction, NumCircs); EXPECT_NEAR( HXEffectFuncResult, 62.344, 0.001); // Test 3: Heating for Constant Flow System @@ -1866,7 +1867,7 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadCalcRadSysHXEffectTermTest) RadSysType = ConstantFlowSystem; Temperature = 10.0; CFloRadSys(RadSysNum).HWLoopNum = 1; - HXEffectFuncResult = CFloRadSys(RadSysNum).calculateHXEffectivenessTerm(state, SurfNum, Temperature, WaterMassFlow, FlowFraction, NumCircs); + HXEffectFuncResult = CFloRadSys(RadSysNum).calculateHXEffectivenessTerm(*state, SurfNum, Temperature, WaterMassFlow, FlowFraction, NumCircs); EXPECT_NEAR( HXEffectFuncResult, 62.344, 0.001); // Test 4: Cooling for Constant Flow System @@ -1875,7 +1876,7 @@ TEST_F(LowTempRadiantSystemTest, LowTempRadCalcRadSysHXEffectTermTest) RadSysType = ConstantFlowSystem; Temperature = 10.0; CFloRadSys(RadSysNum).CWLoopNum = 1; - HXEffectFuncResult = CFloRadSys(RadSysNum).calculateHXEffectivenessTerm(state, SurfNum, Temperature, WaterMassFlow, FlowFraction, NumCircs); + HXEffectFuncResult = CFloRadSys(RadSysNum).calculateHXEffectivenessTerm(*state, SurfNum, Temperature, WaterMassFlow, FlowFraction, NumCircs); EXPECT_NEAR( HXEffectFuncResult, 62.344, 0.001); } @@ -1906,91 +1907,91 @@ TEST_F(LowTempRadiantSystemTest, processRadiantSystemControlInputTest) inputFunction = meanAirTemperature; expectedResult = LowTempRadiantControlTypes::MATControl; actualFunctionAnswer = LowTempRadiantControlTypes::MRTControl; // reset - actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, HydronicSystem); + actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, HydronicSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MRTControl; // reset - actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ConstantFlowSystem); + actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ConstantFlowSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MRTControl; // reset - actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ElectricSystem); + actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ElectricSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); // Test 2: MRT test (done for all three types of systems) inputFunction = meanRadiantTemperature; expectedResult = LowTempRadiantControlTypes::MRTControl; actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, HydronicSystem); + actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, HydronicSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ConstantFlowSystem); + actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ConstantFlowSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ElectricSystem); + actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ElectricSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); // Test 3: Operative Temperature test (done for all three types of systems) inputFunction = operativeTemperature; expectedResult = LowTempRadiantControlTypes::OperativeControl; actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, HydronicSystem); + actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, HydronicSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ConstantFlowSystem); + actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ConstantFlowSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ElectricSystem); + actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ElectricSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); // Test 4: Outside Dry-Bulb Temperature test (done for all three types of systems) inputFunction = outsideAirDryBulbTemperature; expectedResult = LowTempRadiantControlTypes::ODBControl; actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, HydronicSystem); + actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, HydronicSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ConstantFlowSystem); + actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ConstantFlowSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ElectricSystem); + actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ElectricSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); // Test 5: Outside Wet-Bulb Temperature test (done for all three types of systems) inputFunction = outsideAirWetBulbTemperature; expectedResult = LowTempRadiantControlTypes::OWBControl; actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, HydronicSystem); + actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, HydronicSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ConstantFlowSystem); + actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ConstantFlowSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ElectricSystem); + actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ElectricSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); // Test 6: Inside Face Surface Temperature test (done for all three types of systems) inputFunction = surfaceFaceTemperature; expectedResult = LowTempRadiantControlTypes::SurfFaceTempControl; actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, HydronicSystem); + actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, HydronicSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ConstantFlowSystem); + actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ConstantFlowSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ElectricSystem); + actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ElectricSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); // Test 7: Inside Face Surface Temperature test (done for all three types of systems) inputFunction = surfaceInteriorTemperature; expectedResult = LowTempRadiantControlTypes::SurfIntTempControl; actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, HydronicSystem); + actualFunctionAnswer = HydrRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, HydronicSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ConstantFlowSystem); + actualFunctionAnswer = CFloRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ConstantFlowSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); actualFunctionAnswer = LowTempRadiantControlTypes::MATControl; // reset - actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(state, inputFunction, textField2Pass, ElectricSystem); + actualFunctionAnswer = ElecRadSys(1).processRadiantSystemControlInput(*state, inputFunction, textField2Pass, ElectricSystem); EXPECT_EQ(expectedResult,actualFunctionAnswer); } @@ -2032,119 +2033,119 @@ TEST_F(LowTempRadiantSystemTest, setRadiantSystemControlTemperatureTest) HydrRadSys(1).ControlType = LowTempRadiantControlTypes::MATControl; expectedResult = DataHeatBalFanSys::MAT(1); actualResult = 0.0; // reset - actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); CFloRadSys(1).ControlType = LowTempRadiantControlTypes::MATControl; expectedResult = DataHeatBalFanSys::MAT(1); actualResult = 0.0; // reset - actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); ElecRadSys(1).ControlType = LowTempRadiantControlTypes::MATControl; expectedResult = DataHeatBalFanSys::MAT(1); actualResult = 0.0; // reset - actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 2: MRT Control HydrRadSys(1).ControlType = LowTempRadiantControlTypes::MRTControl; expectedResult = MRT(1); actualResult = 0.0; // reset - actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); CFloRadSys(1).ControlType = LowTempRadiantControlTypes::MRTControl; expectedResult = MRT(1); actualResult = 0.0; // reset - actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); ElecRadSys(1).ControlType = LowTempRadiantControlTypes::MRTControl; expectedResult = MRT(1); actualResult = 0.0; // reset - actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 3: Operative Temperature Control HydrRadSys(1).ControlType = LowTempRadiantControlTypes::OperativeControl; expectedResult = (DataHeatBalFanSys::MAT(1) + MRT(1))/2.0; actualResult = 0.0; // reset - actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); CFloRadSys(1).ControlType = LowTempRadiantControlTypes::OperativeControl; expectedResult = (DataHeatBalFanSys::MAT(1) + MRT(1))/2.0; actualResult = 0.0; // reset - actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); ElecRadSys(1).ControlType = LowTempRadiantControlTypes::OperativeControl; expectedResult = (DataHeatBalFanSys::MAT(1) + MRT(1))/2.0; actualResult = 0.0; // reset - actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 4: ODB Temperature Control HydrRadSys(1).ControlType = LowTempRadiantControlTypes::ODBControl; expectedResult = Zone(1).OutDryBulbTemp; actualResult = 0.0; // reset - actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); CFloRadSys(1).ControlType = LowTempRadiantControlTypes::ODBControl; expectedResult = Zone(1).OutDryBulbTemp; actualResult = 0.0; // reset - actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); ElecRadSys(1).ControlType = LowTempRadiantControlTypes::ODBControl; expectedResult = Zone(1).OutDryBulbTemp; actualResult = 0.0; // reset - actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 5: OWB Temperature Control HydrRadSys(1).ControlType = LowTempRadiantControlTypes::OWBControl; expectedResult = Zone(1).OutWetBulbTemp; actualResult = 0.0; // reset - actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); CFloRadSys(1).ControlType = LowTempRadiantControlTypes::OWBControl; expectedResult = Zone(1).OutWetBulbTemp; actualResult = 0.0; // reset - actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); ElecRadSys(1).ControlType = LowTempRadiantControlTypes::OWBControl; expectedResult = Zone(1).OutWetBulbTemp; actualResult = 0.0; // reset - actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 6: Surface Inside Face Temperature Control HydrRadSys(1).ControlType = LowTempRadiantControlTypes::SurfFaceTempControl; expectedResult = DataHeatBalSurface::TempSurfIn(1); actualResult = 0.0; // reset - actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); CFloRadSys(1).ControlType = LowTempRadiantControlTypes::SurfFaceTempControl; expectedResult = DataHeatBalSurface::TempSurfIn(1); actualResult = 0.0; // reset - actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); ElecRadSys(1).ControlType = LowTempRadiantControlTypes::SurfFaceTempControl; expectedResult = DataHeatBalSurface::TempSurfIn(1); actualResult = 0.0; // reset - actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 7: Surface Inside (within the slab) Temperature Control HydrRadSys(1).ControlType = LowTempRadiantControlTypes::SurfIntTempControl; expectedResult = DataHeatBalSurface::TempUserLoc(1); actualResult = 0.0; // reset - actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = HydrRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); CFloRadSys(1).ControlType = LowTempRadiantControlTypes::SurfIntTempControl; expectedResult = DataHeatBalSurface::TempUserLoc(1); actualResult = 0.0; // reset - actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); ElecRadSys(1).ControlType = LowTempRadiantControlTypes::SurfIntTempControl; expectedResult = DataHeatBalSurface::TempUserLoc(1); actualResult = 0.0; // reset - actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = ElecRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 8: Running Mean Outdoor Air Temperature Control (Constant Flow System Only) @@ -2152,7 +2153,7 @@ TEST_F(LowTempRadiantSystemTest, setRadiantSystemControlTemperatureTest) CFloRadSys(1).todayRunningMeanOutdoorDryBulbTemperature = 12.345; expectedResult = CFloRadSys(1).todayRunningMeanOutdoorDryBulbTemperature; actualResult = 0.0; // reset - actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(state); + actualResult = CFloRadSys(1).setRadiantSystemControlTemperature(*state); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); } @@ -2268,7 +2269,7 @@ TEST_F(LowTempRadiantSystemTest, setOffTemperatureLowTemperatureRadiantSystemTes throttlingRange = 0.0; HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::zeroFlowPower; expectedResult = 1.0; - actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(state, scheduleIndex,throttlingRange); + actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(*state, scheduleIndex,throttlingRange); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 2: zeroFlow and positive throttling range @@ -2276,7 +2277,7 @@ TEST_F(LowTempRadiantSystemTest, setOffTemperatureLowTemperatureRadiantSystemTes throttlingRange = 0.5; HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::zeroFlowPower; expectedResult = 1.0; - actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(state, scheduleIndex,throttlingRange); + actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(*state, scheduleIndex,throttlingRange); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 3: zeroFlow and negative throttling range (cooling situation) @@ -2284,7 +2285,7 @@ TEST_F(LowTempRadiantSystemTest, setOffTemperatureLowTemperatureRadiantSystemTes throttlingRange = -0.5; HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::zeroFlowPower; expectedResult = 1.0; - actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(state, scheduleIndex,throttlingRange); + actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(*state, scheduleIndex,throttlingRange); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 4: halfFlow and no throttling range @@ -2292,7 +2293,7 @@ TEST_F(LowTempRadiantSystemTest, setOffTemperatureLowTemperatureRadiantSystemTes throttlingRange = 0.0; HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::halfFlowPower; expectedResult = 1.0; - actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(state, scheduleIndex,throttlingRange); + actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(*state, scheduleIndex,throttlingRange); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 5: halfFlow and positive throttling range @@ -2300,7 +2301,7 @@ TEST_F(LowTempRadiantSystemTest, setOffTemperatureLowTemperatureRadiantSystemTes throttlingRange = 0.5; HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::halfFlowPower; expectedResult = 1.25; - actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(state, scheduleIndex,throttlingRange); + actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(*state, scheduleIndex,throttlingRange); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); // Test 5: halfFlow and negative throttling range (cooling situation) @@ -2308,7 +2309,7 @@ TEST_F(LowTempRadiantSystemTest, setOffTemperatureLowTemperatureRadiantSystemTes throttlingRange = -0.5; HydrRadSys(1).SetpointType = LowTempRadiantSetpointTypes::halfFlowPower; expectedResult = 0.75; - actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(state, scheduleIndex,throttlingRange); + actualResult = HydrRadSys(1).setOffTemperatureLowTemperatureRadiantSystem(*state, scheduleIndex,throttlingRange); EXPECT_NEAR(expectedResult, actualResult, acceptibleError); } @@ -2331,9 +2332,9 @@ TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) thisRadSys.ZonePtr = 1; Surface.allocate(3); Zone.allocate(3); - state.dataConstruction->Construct.allocate(2); - state.dataConstruction->Construct(1).SourceSinkPresent = true; - state.dataConstruction->Construct(2).SourceSinkPresent = false; + state->dataConstruction->Construct.allocate(2); + state->dataConstruction->Construct(1).SourceSinkPresent = true; + state->dataConstruction->Construct(2).SourceSinkPresent = false; // Test 1a: Surfaces are in the same zones, zone multipliers are all the same, and the construct has a source/sink. // Everything is "ok" so the result should be the error flag is FALSE. @@ -2350,7 +2351,7 @@ TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) Surface(1).Construction = 1; Surface(2).Construction = 1; Surface(3).Construction = 1; - thisRadSys.errorCheckZonesAndConstructions(state, actualErrorsFound); + thisRadSys.errorCheckZonesAndConstructions(*state, actualErrorsFound); EXPECT_FALSE(actualErrorsFound); // Test 1b: Surfaces are in different zones, zone multipliers are all the same, and the construct has a source/sink. @@ -2368,7 +2369,7 @@ TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) Surface(1).Construction = 1; Surface(2).Construction = 1; Surface(3).Construction = 1; - thisRadSys.errorCheckZonesAndConstructions(state, actualErrorsFound); + thisRadSys.errorCheckZonesAndConstructions(*state, actualErrorsFound); EXPECT_FALSE(actualErrorsFound); // Test 2: Surfaces are in different zones, zone multipliers are NOT all the same (one is 7 instead of 2), and the construct has a source/sink. @@ -2386,7 +2387,7 @@ TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) Surface(1).Construction = 1; Surface(2).Construction = 1; Surface(3).Construction = 1; - thisRadSys.errorCheckZonesAndConstructions(state, actualErrorsFound); + thisRadSys.errorCheckZonesAndConstructions(*state, actualErrorsFound); EXPECT_TRUE(actualErrorsFound); // Test 3: Surfaces are in the same zones, zone multipliers are all the same, and one construct does NOT have a source/sink. @@ -2404,7 +2405,7 @@ TEST_F(LowTempRadiantSystemTest, errorCheckZonesAndConstructionsTest) Surface(1).Construction = 1; Surface(2).Construction = 1; Surface(3).Construction = 2; - thisRadSys.errorCheckZonesAndConstructions(state, actualErrorsFound); + thisRadSys.errorCheckZonesAndConstructions(*state, actualErrorsFound); EXPECT_TRUE(actualErrorsFound); } @@ -2418,71 +2419,71 @@ TEST_F(LowTempRadiantSystemTest, calculateRunningMeanAverageTemperatureTest) CFloRadSys.allocate(1); auto &thisCFloSys (CFloRadSys(1)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataWeatherManager->TodayOutDryBulbTemp.allocate(state.dataGlobal->NumOfTimeStepInHour, DataGlobalConstants::HoursInDay()); - state.dataWeatherManager->TodayOutDryBulbTemp = 0.0; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataWeatherManager->TodayOutDryBulbTemp.allocate(state->dataGlobal->NumOfTimeStepInHour, DataGlobalConstants::HoursInDay()); + state->dataWeatherManager->TodayOutDryBulbTemp = 0.0; for (int hourNumber = 1; hourNumber <= DataGlobalConstants::HoursInDay(); ++hourNumber) { - state.dataWeatherManager->TodayOutDryBulbTemp(state.dataGlobal->NumOfTimeStepInHour,hourNumber) = double(hourNumber); + state->dataWeatherManager->TodayOutDryBulbTemp(state->dataGlobal->NumOfTimeStepInHour,hourNumber) = double(hourNumber); } // Test 1: First day of the simulation and it's in warmup-->everything set to the same temperature - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->WarmupFlag = true; - state.dataGlobal->NumOfDayInEnvrn = 366; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->WarmupFlag = true; + state->dataGlobal->NumOfDayInEnvrn = 366; thisCFloSys.todayAverageOutdoorDryBulbTemperature = -9999.9; thisCFloSys.yesterdayAverageOutdoorDryBulbTemperature = -9999.9; thisCFloSys.todayRunningMeanOutdoorDryBulbTemperature = -9999.9; thisCFloSys.yesterdayRunningMeanOutdoorDryBulbTemperature = -9999.9; thisCFloSys.runningMeanOutdoorAirTemperatureWeightingFactor = 0.5; expectedResult = 12.5; - thisCFloSys.calculateRunningMeanAverageTemperature(state); + thisCFloSys.calculateRunningMeanAverageTemperature(*state); EXPECT_NEAR(expectedResult, thisCFloSys.todayAverageOutdoorDryBulbTemperature, acceptibleError); EXPECT_NEAR(expectedResult, thisCFloSys.yesterdayAverageOutdoorDryBulbTemperature, acceptibleError); EXPECT_NEAR(expectedResult, thisCFloSys.todayRunningMeanOutdoorDryBulbTemperature, acceptibleError); EXPECT_NEAR(expectedResult, thisCFloSys.yesterdayRunningMeanOutdoorDryBulbTemperature, acceptibleError); // Test 2: Not first dsy of simulation but still in warmup-->should not do anything because in warmup same day repeated over and over - state.dataGlobal->DayOfSim = 2; - state.dataGlobal->WarmupFlag = true; - state.dataGlobal->NumOfDayInEnvrn = 366; + state->dataGlobal->DayOfSim = 2; + state->dataGlobal->WarmupFlag = true; + state->dataGlobal->NumOfDayInEnvrn = 366; thisCFloSys.todayAverageOutdoorDryBulbTemperature = -9999.9; thisCFloSys.yesterdayAverageOutdoorDryBulbTemperature = -9999.9; thisCFloSys.todayRunningMeanOutdoorDryBulbTemperature = -9999.9; thisCFloSys.yesterdayRunningMeanOutdoorDryBulbTemperature = -9999.9; thisCFloSys.runningMeanOutdoorAirTemperatureWeightingFactor = 0.5; expectedResult = -9999.9; - thisCFloSys.calculateRunningMeanAverageTemperature(state); + thisCFloSys.calculateRunningMeanAverageTemperature(*state); EXPECT_NEAR(expectedResult, thisCFloSys.todayAverageOutdoorDryBulbTemperature, acceptibleError); EXPECT_NEAR(expectedResult, thisCFloSys.yesterdayAverageOutdoorDryBulbTemperature, acceptibleError); EXPECT_NEAR(expectedResult, thisCFloSys.todayRunningMeanOutdoorDryBulbTemperature, acceptibleError); EXPECT_NEAR(expectedResult, thisCFloSys.yesterdayRunningMeanOutdoorDryBulbTemperature, acceptibleError); // Test 3: Not in warmup but number of days of simulation only 1-->should not do anything because it's a single day which means no real history - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->WarmupFlag = false; - state.dataGlobal->NumOfDayInEnvrn = 1; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->WarmupFlag = false; + state->dataGlobal->NumOfDayInEnvrn = 1; thisCFloSys.todayAverageOutdoorDryBulbTemperature = 12.345; thisCFloSys.yesterdayAverageOutdoorDryBulbTemperature = 12.345; thisCFloSys.todayRunningMeanOutdoorDryBulbTemperature = 12.345; thisCFloSys.yesterdayRunningMeanOutdoorDryBulbTemperature = 12.345; thisCFloSys.runningMeanOutdoorAirTemperatureWeightingFactor = 0.5; expectedResult = 12.345; - thisCFloSys.calculateRunningMeanAverageTemperature(state); + thisCFloSys.calculateRunningMeanAverageTemperature(*state); EXPECT_NEAR(expectedResult, thisCFloSys.todayAverageOutdoorDryBulbTemperature, acceptibleError); EXPECT_NEAR(expectedResult, thisCFloSys.yesterdayAverageOutdoorDryBulbTemperature, acceptibleError); EXPECT_NEAR(expectedResult, thisCFloSys.todayRunningMeanOutdoorDryBulbTemperature, acceptibleError); EXPECT_NEAR(expectedResult, thisCFloSys.yesterdayRunningMeanOutdoorDryBulbTemperature, acceptibleError); // Test 4: Not in warmup and number of days of simulation greater than 1-->apply the formula for running mean temperature and shift data - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->WarmupFlag = false; - state.dataGlobal->NumOfDayInEnvrn = 366; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->WarmupFlag = false; + state->dataGlobal->NumOfDayInEnvrn = 366; thisCFloSys.todayAverageOutdoorDryBulbTemperature = 15.0; thisCFloSys.yesterdayAverageOutdoorDryBulbTemperature = 10.0; thisCFloSys.todayRunningMeanOutdoorDryBulbTemperature = 14.5; thisCFloSys.yesterdayRunningMeanOutdoorDryBulbTemperature = 5.0; thisCFloSys.runningMeanOutdoorAirTemperatureWeightingFactor = 0.5; - thisCFloSys.calculateRunningMeanAverageTemperature(state); + thisCFloSys.calculateRunningMeanAverageTemperature(*state); expectedResult = 12.5; // Average of TodayOutDryBulbTemp(firstTimeStepIndex,hourNumber) EXPECT_NEAR(expectedResult, thisCFloSys.todayAverageOutdoorDryBulbTemperature, acceptibleError); expectedResult = 15.0; // Should transfer what was todayAverageOutdoorDryBulbTemperature (see above) @@ -2499,10 +2500,10 @@ TEST_F(LowTempRadiantSystemTest, updateOperatingModeHistoryTest) int expectedResult; int resetResult = -9999; HydrRadSys.allocate(1); - state.dataGlobal->NumOfTimeStepInHour = 6; - state.dataGlobal->DayOfSim = 2; - state.dataGlobal->HourOfDay = 4; - state.dataGlobal->TimeStep = 5; + state->dataGlobal->NumOfTimeStepInHour = 6; + state->dataGlobal->DayOfSim = 2; + state->dataGlobal->HourOfDay = 4; + state->dataGlobal->TimeStep = 5; auto &thisRadSys (HydrRadSys(1)); // Test 1: Operating Mode different, beginning of day-->lastOperatingMode should switch, last parameters should get set appropriately @@ -2511,15 +2512,15 @@ TEST_F(LowTempRadiantSystemTest, updateOperatingModeHistoryTest) thisRadSys.lastDayOfSim = resetResult; thisRadSys.lastHourOfDay = resetResult; thisRadSys.lastTimeStep = resetResult; - state.dataGlobal->BeginDayFlag = true; - state.dataGlobal->BeginHourFlag = false; - state.dataGlobal->BeginTimeStepFlag = false; - thisRadSys.updateOperatingModeHistory(state); + state->dataGlobal->BeginDayFlag = true; + state->dataGlobal->BeginHourFlag = false; + state->dataGlobal->BeginTimeStepFlag = false; + thisRadSys.updateOperatingModeHistory(*state); expectedResult = 1; EXPECT_EQ(thisRadSys.lastDayOfSim, expectedResult); expectedResult = DataGlobalConstants::HoursInDay(); EXPECT_EQ(thisRadSys.lastHourOfDay, expectedResult); - expectedResult = state.dataGlobal->NumOfTimeStepInHour; + expectedResult = state->dataGlobal->NumOfTimeStepInHour; EXPECT_EQ(thisRadSys.lastTimeStep, expectedResult); EXPECT_EQ(thisRadSys.lastOperatingMode, LowTempRadiantSystem::CoolingMode); EXPECT_EQ(thisRadSys.OperatingMode, LowTempRadiantSystem::NotOperating); @@ -2530,15 +2531,15 @@ TEST_F(LowTempRadiantSystemTest, updateOperatingModeHistoryTest) thisRadSys.lastDayOfSim = resetResult; thisRadSys.lastHourOfDay = resetResult; thisRadSys.lastTimeStep = resetResult; - state.dataGlobal->BeginDayFlag = false; - state.dataGlobal->BeginHourFlag = true; - state.dataGlobal->BeginTimeStepFlag = false; - thisRadSys.updateOperatingModeHistory(state); + state->dataGlobal->BeginDayFlag = false; + state->dataGlobal->BeginHourFlag = true; + state->dataGlobal->BeginTimeStepFlag = false; + thisRadSys.updateOperatingModeHistory(*state); expectedResult = 2; EXPECT_EQ(thisRadSys.lastDayOfSim, expectedResult); expectedResult = 3; EXPECT_EQ(thisRadSys.lastHourOfDay, expectedResult); - expectedResult = state.dataGlobal->NumOfTimeStepInHour; + expectedResult = state->dataGlobal->NumOfTimeStepInHour; EXPECT_EQ(thisRadSys.lastTimeStep, expectedResult); EXPECT_EQ(thisRadSys.lastOperatingMode, LowTempRadiantSystem::CoolingMode); EXPECT_EQ(thisRadSys.OperatingMode, LowTempRadiantSystem::NotOperating); @@ -2549,10 +2550,10 @@ TEST_F(LowTempRadiantSystemTest, updateOperatingModeHistoryTest) thisRadSys.lastDayOfSim = resetResult; thisRadSys.lastHourOfDay = resetResult; thisRadSys.lastTimeStep = resetResult; - state.dataGlobal->BeginDayFlag = false; - state.dataGlobal->BeginHourFlag = false; - state.dataGlobal->BeginTimeStepFlag = true; - thisRadSys.updateOperatingModeHistory(state); + state->dataGlobal->BeginDayFlag = false; + state->dataGlobal->BeginHourFlag = false; + state->dataGlobal->BeginTimeStepFlag = true; + thisRadSys.updateOperatingModeHistory(*state); expectedResult = 2; EXPECT_EQ(thisRadSys.lastDayOfSim, expectedResult); expectedResult = 4; @@ -2568,10 +2569,10 @@ TEST_F(LowTempRadiantSystemTest, updateOperatingModeHistoryTest) thisRadSys.lastDayOfSim = resetResult; thisRadSys.lastHourOfDay = resetResult; thisRadSys.lastTimeStep = resetResult; - state.dataGlobal->BeginDayFlag = false; - state.dataGlobal->BeginHourFlag = false; - state.dataGlobal->BeginTimeStepFlag = false; - thisRadSys.updateOperatingModeHistory(state); + state->dataGlobal->BeginDayFlag = false; + state->dataGlobal->BeginHourFlag = false; + state->dataGlobal->BeginTimeStepFlag = false; + thisRadSys.updateOperatingModeHistory(*state); expectedResult = 2; EXPECT_EQ(thisRadSys.lastDayOfSim, expectedResult); expectedResult = 4; @@ -2588,27 +2589,27 @@ TEST_F(LowTempRadiantSystemTest, setOperatingModeBasedOnChangeoverDelayTest) int expectedResult; HydrRadSys.allocate(1); auto &thisRadSys (HydrRadSys(1)); - state.dataGlobal->NumOfTimeStepInHour = 6; - state.dataGlobal->MinutesPerTimeStep = 10.0; + state->dataGlobal->NumOfTimeStepInHour = 6; + state->dataGlobal->MinutesPerTimeStep = 10.0; // Test 1: lastOperatingMode is NotOperating-->don't do anything to OperatingMode thisRadSys.lastOperatingMode = LowTempRadiantSystem::NotOperating; thisRadSys.OperatingMode = LowTempRadiantSystem::HeatingMode; - thisRadSys.setOperatingModeBasedOnChangeoverDelay(state); + thisRadSys.setOperatingModeBasedOnChangeoverDelay(*state); expectedResult = LowTempRadiantSystem::HeatingMode; EXPECT_EQ(thisRadSys.OperatingMode, expectedResult); // Test 2: lastOperatingMode is not NotOperating, OperatingMode is NotOperating-->don't do anything to OperatingMode thisRadSys.lastOperatingMode = LowTempRadiantSystem::HeatingMode; thisRadSys.OperatingMode = LowTempRadiantSystem::NotOperating; - thisRadSys.setOperatingModeBasedOnChangeoverDelay(state); + thisRadSys.setOperatingModeBasedOnChangeoverDelay(*state); expectedResult = LowTempRadiantSystem::NotOperating; EXPECT_EQ(thisRadSys.OperatingMode, expectedResult); // Test 3: lastOperatingMode and OperatingMode are both the same (and not NotOperating)-->don't do anything to OperatingMode thisRadSys.lastOperatingMode = LowTempRadiantSystem::HeatingMode; thisRadSys.OperatingMode = LowTempRadiantSystem::HeatingMode; - thisRadSys.setOperatingModeBasedOnChangeoverDelay(state); + thisRadSys.setOperatingModeBasedOnChangeoverDelay(*state); expectedResult = LowTempRadiantSystem::HeatingMode; EXPECT_EQ(thisRadSys.OperatingMode, expectedResult); @@ -2616,7 +2617,7 @@ TEST_F(LowTempRadiantSystemTest, setOperatingModeBasedOnChangeoverDelayTest) thisRadSys.lastOperatingMode = LowTempRadiantSystem::HeatingMode; thisRadSys.OperatingMode = LowTempRadiantSystem::CoolingMode; thisRadSys.schedPtrChangeoverDelay = 0; - thisRadSys.setOperatingModeBasedOnChangeoverDelay(state); + thisRadSys.setOperatingModeBasedOnChangeoverDelay(*state); expectedResult = LowTempRadiantSystem::CoolingMode; EXPECT_EQ(thisRadSys.OperatingMode, expectedResult); @@ -2626,13 +2627,13 @@ TEST_F(LowTempRadiantSystemTest, setOperatingModeBasedOnChangeoverDelayTest) thisRadSys.lastOperatingMode = LowTempRadiantSystem::HeatingMode; thisRadSys.OperatingMode = LowTempRadiantSystem::CoolingMode; thisRadSys.schedPtrChangeoverDelay = -1; - state.dataGlobal->DayOfSim = 2; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->DayOfSim = 2; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; thisRadSys.lastDayOfSim = 1; thisRadSys.lastHourOfDay = 24; thisRadSys.lastTimeStep = 2; - thisRadSys.setOperatingModeBasedOnChangeoverDelay(state); + thisRadSys.setOperatingModeBasedOnChangeoverDelay(*state); expectedResult = LowTempRadiantSystem::NotOperating; EXPECT_EQ(thisRadSys.OperatingMode, expectedResult); @@ -2641,13 +2642,13 @@ TEST_F(LowTempRadiantSystemTest, setOperatingModeBasedOnChangeoverDelayTest) // to switch over yet-->don't do anything to OperatingMode thisRadSys.lastOperatingMode = LowTempRadiantSystem::HeatingMode; thisRadSys.OperatingMode = LowTempRadiantSystem::CoolingMode; - state.dataGlobal->DayOfSim = 2; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 4; + state->dataGlobal->DayOfSim = 2; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 4; thisRadSys.lastDayOfSim = 1; thisRadSys.lastHourOfDay = 22; thisRadSys.lastTimeStep = 3; - thisRadSys.setOperatingModeBasedOnChangeoverDelay(state); + thisRadSys.setOperatingModeBasedOnChangeoverDelay(*state); expectedResult = LowTempRadiantSystem::CoolingMode; EXPECT_EQ(thisRadSys.OperatingMode, expectedResult); } @@ -2661,19 +2662,19 @@ TEST_F(LowTempRadiantSystemTest, getFluidToSlabHeatTransferInputTest) //Test 1: Input is ConvectionOnly--so this field needs to get reset to ConvectionOnly userInput = "ConvectionOnly"; thisCFloSys.FluidToSlabHeatTransfer = FluidToSlabHeatTransferTypes::ISOStandard; - thisCFloSys.FluidToSlabHeatTransfer = thisCFloSys.getFluidToSlabHeatTransferInput(state, userInput); + thisCFloSys.FluidToSlabHeatTransfer = thisCFloSys.getFluidToSlabHeatTransferInput(*state, userInput); EXPECT_EQ(FluidToSlabHeatTransferTypes::ConvectionOnly, thisCFloSys.FluidToSlabHeatTransfer); //Test 2: Input is ISOStandard--so this field needs to get reset to ISOStandard userInput = "ISOStandard"; thisCFloSys.FluidToSlabHeatTransfer = FluidToSlabHeatTransferTypes::ConvectionOnly; - thisCFloSys.FluidToSlabHeatTransfer = thisCFloSys.getFluidToSlabHeatTransferInput(state, userInput); + thisCFloSys.FluidToSlabHeatTransfer = thisCFloSys.getFluidToSlabHeatTransferInput(*state, userInput); EXPECT_EQ(FluidToSlabHeatTransferTypes::ISOStandard, thisCFloSys.FluidToSlabHeatTransfer); //Test 3: Input is ISOStandard--so this field needs to get reset to ConvectionOnly (the default) userInput = "WeWantSomethingElse!"; thisCFloSys.FluidToSlabHeatTransfer = FluidToSlabHeatTransferTypes::ISOStandard; - thisCFloSys.FluidToSlabHeatTransfer = thisCFloSys.getFluidToSlabHeatTransferInput(state, userInput); + thisCFloSys.FluidToSlabHeatTransfer = thisCFloSys.getFluidToSlabHeatTransferInput(*state, userInput); EXPECT_EQ(FluidToSlabHeatTransferTypes::ConvectionOnly, thisCFloSys.FluidToSlabHeatTransfer); } @@ -2687,8 +2688,8 @@ TEST_F(LowTempRadiantSystemTest, calculateUFromISOStandardTest) int SurfNum = 1; DataSurfaces::Surface.allocate(1); Surface(1).Construction = 1; - state.dataConstruction->Construct.allocate(1); - state.dataConstruction->Construct(1).ThicknessPerpend = 0.5; + state->dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct(1).ThicknessPerpend = 0.5; CFloRadSys.allocate(1); auto &thisCFloSys (CFloRadSys(1)); thisCFloSys.TubeDiameterInner = 0.01; @@ -2699,7 +2700,7 @@ TEST_F(LowTempRadiantSystemTest, calculateUFromISOStandardTest) Real64 expectedResult = 28.00687; Real64 allowedDifference = 0.00001; - Real64 actualResult = thisCFloSys.calculateUFromISOStandard(state, SurfNum, WaterMassFlow); + Real64 actualResult = thisCFloSys.calculateUFromISOStandard(*state, SurfNum, WaterMassFlow); EXPECT_NEAR(expectedResult, actualResult, allowedDifference); } diff --git a/tst/EnergyPlus/unit/MicroCHPElectricGenerator.unit.cc b/tst/EnergyPlus/unit/MicroCHPElectricGenerator.unit.cc index 57fbfd39691..ef759c06936 100644 --- a/tst/EnergyPlus/unit/MicroCHPElectricGenerator.unit.cc +++ b/tst/EnergyPlus/unit/MicroCHPElectricGenerator.unit.cc @@ -59,6 +59,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace ObjexxFCL; @@ -294,17 +295,17 @@ TEST_F(EnergyPlusFixture, MicroCHPTest_InitGeneratorDynamics) MicroCHP2.TypeOf = "GENERATOR:MICROCHP"; MicroCHP2.TypeOf_Num = DataPlant::TypeOf_Generator_MicroCHP; MicroCHP2.Name = "MICROCOGEN2"; - MicroCHP1.compPtr = MicroCHPElectricGenerator::MicroCHPDataStruct::factory(state, "MICROCOGEN1"); - MicroCHP2.compPtr = MicroCHPElectricGenerator::MicroCHPDataStruct::factory(state, "MICROCOGEN2"); + MicroCHP1.compPtr = MicroCHPElectricGenerator::MicroCHPDataStruct::factory(*state, "MICROCOGEN1"); + MicroCHP2.compPtr = MicroCHPElectricGenerator::MicroCHPDataStruct::factory(*state, "MICROCOGEN2"); EXPECT_EQ(MicroCHPElectricGenerator::NumMicroCHPs, 2); bool FirstHVACIteration = true; bool InitLoopEquip = true; bool GetCompSizFac = false; - dynamic_cast (MicroCHP1.compPtr)->InitMicroCHPNoNormalizeGenerators(state); - dynamic_cast (MicroCHP2.compPtr)->InitMicroCHPNoNormalizeGenerators(state); - MicroCHP1.simulate(state, FirstHVACIteration, InitLoopEquip, GetCompSizFac); - MicroCHP2.simulate(state, FirstHVACIteration, InitLoopEquip, GetCompSizFac); + dynamic_cast (MicroCHP1.compPtr)->InitMicroCHPNoNormalizeGenerators(*state); + dynamic_cast (MicroCHP2.compPtr)->InitMicroCHPNoNormalizeGenerators(*state); + MicroCHP1.simulate(*state, FirstHVACIteration, InitLoopEquip, GetCompSizFac); + MicroCHP2.simulate(*state, FirstHVACIteration, InitLoopEquip, GetCompSizFac); EXPECT_EQ(DataGenerators::GeneratorDynamics(1).Name, MicroCHP1.Name); EXPECT_EQ(DataGenerators::GeneratorDynamics(2).Name, MicroCHP2.Name); } diff --git a/tst/EnergyPlus/unit/MicroturbineElectricGenerator.unit.cc b/tst/EnergyPlus/unit/MicroturbineElectricGenerator.unit.cc index ac19db22dd7..5af64bb2e05 100644 --- a/tst/EnergyPlus/unit/MicroturbineElectricGenerator.unit.cc +++ b/tst/EnergyPlus/unit/MicroturbineElectricGenerator.unit.cc @@ -55,6 +55,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus::MicroturbineElectricGenerator; @@ -125,7 +126,7 @@ TEST_F(EnergyPlusFixture, MicroturbineElectricGenerator_Fueltype) ASSERT_TRUE(process_idf(idf_objects)); DataIPShortCuts::cAlphaArgs(1) = "Capstone C65"; DataIPShortCuts::cCurrentModuleObject = "Generator:MicroTurbine"; - GetMTGeneratorInput(state); + GetMTGeneratorInput(*state); EXPECT_EQ(MTGenerator(1).FuelType, "NaturalGas"); } diff --git a/tst/EnergyPlus/unit/MixedAir.unit.cc b/tst/EnergyPlus/unit/MixedAir.unit.cc index 63de9c73297..4faabc171d4 100644 --- a/tst/EnergyPlus/unit/MixedAir.unit.cc +++ b/tst/EnergyPlus/unit/MixedAir.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -72,6 +73,7 @@ #include "Fixtures/EnergyPlusFixture.hh" #include +#include using namespace EnergyPlus::MixedAir; using namespace EnergyPlus::DataContaminantBalance; @@ -142,7 +144,7 @@ TEST_F(EnergyPlusFixture, MixedAir_ProcessOAControllerTest) int IOStat(0); std::string const CurrentModuleObject = CurrentModuleObjects(CMO_OAController); - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObjects(CMO_OAController), NumArg, NumAlphas, NumNums); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObjects(CMO_OAController), NumArg, NumAlphas, NumNums); Array1D NumArray(NumNums, 0.0); Array1D_string AlphArray(NumAlphas); @@ -151,12 +153,12 @@ TEST_F(EnergyPlusFixture, MixedAir_ProcessOAControllerTest) Array1D_bool lAlphaBlanks(NumAlphas, true); Array1D_bool lNumericBlanks(NumNums, true); - NumOAControllers = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + NumOAControllers = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); OAController.allocate(NumOAControllers); ControllerNum = 1; - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, ControllerNum, AlphArray, NumAlphas, @@ -168,7 +170,7 @@ TEST_F(EnergyPlusFixture, MixedAir_ProcessOAControllerTest) cAlphaFields, cNumericFields); - ProcessOAControllerInputs(state, + ProcessOAControllerInputs(*state, CurrentModuleObject, ControllerNum, AlphArray, @@ -183,10 +185,10 @@ TEST_F(EnergyPlusFixture, MixedAir_ProcessOAControllerTest) EXPECT_FALSE(ErrorsFound); EXPECT_EQ(2, OAController(1).OANode); - EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(state, OAController(1).OANode)); + EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(*state, OAController(1).OANode)); ControllerNum = 2; - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, ControllerNum, AlphArray, NumAlphas, @@ -199,7 +201,7 @@ TEST_F(EnergyPlusFixture, MixedAir_ProcessOAControllerTest) cNumericFields); ErrorsFound = false; - ProcessOAControllerInputs(state, + ProcessOAControllerInputs(*state, CurrentModuleObject, ControllerNum, AlphArray, @@ -213,7 +215,7 @@ TEST_F(EnergyPlusFixture, MixedAir_ProcessOAControllerTest) ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ(6, OAController(2).OANode); - EXPECT_FALSE(OutAirNodeManager::CheckOutAirNodeNumber(state, OAController(2).OANode)); + EXPECT_FALSE(OutAirNodeManager::CheckOutAirNodeNumber(*state, OAController(2).OANode)); } TEST_F(EnergyPlusFixture, MixedAir_HXBypassOptionTest) @@ -487,51 +489,51 @@ TEST_F(EnergyPlusFixture, MixedAir_HXBypassOptionTest) }); ASSERT_TRUE(process_idf(idf_objects)); - GetOAControllerInputs(state); + GetOAControllerInputs(*state); EXPECT_EQ(2, OAController(1).OANode); - EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(state, OAController(1).OANode)); + EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(*state, OAController(1).OANode)); EXPECT_EQ(6, OAController(2).OANode); - EXPECT_FALSE(OutAirNodeManager::CheckOutAirNodeNumber(state, OAController(2).OANode)); + EXPECT_FALSE(OutAirNodeManager::CheckOutAirNodeNumber(*state, OAController(2).OANode)); int OAControllerNum; int AirLoopNum; DataHVACGlobals::NumPrimaryAirSys = 5; // will be reset in DataHVACGlobals::clear_state(); in EnergyPlusFixture - state.dataAirLoop->AirLoopControlInfo.allocate(5); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture - state.dataAirLoop->AirLoopFlow.allocate(5); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture - state.dataAirSystemsData->PrimaryAirSystems.allocate(5); // will be deallocated by DataAirSystems::clear_state(); in EnergyPlusFixture + state->dataAirLoop->AirLoopControlInfo.allocate(5); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture + state->dataAirLoop->AirLoopFlow.allocate(5); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture + state->dataAirSystemsData->PrimaryAirSystems.allocate(5); // will be deallocated by DataAirSystems::clear_state(); in EnergyPlusFixture Node.allocate(21); // will be deallocated by DataLoopNode::clear_state(); in EnergyPlusFixture StdBaroPress = StdPressureSeaLevel; - StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, StdBaroPress, 20.0, 0.0); + StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, StdBaroPress, 20.0, 0.0); // Initialize common AirLoop data for (AirLoopNum = 1; AirLoopNum <= 5; ++AirLoopNum) { - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).OASysNum = AirLoopNum; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoLockout = false; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).NightVent = false; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).FanOpMode = DataHVACGlobals::ContFanCycCoil; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).LoopFlowRateSet = false; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CheckHeatRecoveryBypassStatus = true; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).OASysComponentsSimulated = true; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconomizerFlowLocked = false; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass = false; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryResimFlag = false; // Need this to avoid resetting hxbypass, saying this has already been simulated - state.dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply = 1.0 * StdRhoAir; - state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(1).Comp.allocate(1); + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).OASysNum = AirLoopNum; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoLockout = false; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).NightVent = false; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).FanOpMode = DataHVACGlobals::ContFanCycCoil; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).LoopFlowRateSet = false; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).CheckHeatRecoveryBypassStatus = true; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).OASysComponentsSimulated = true; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).EconomizerFlowLocked = false; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass = false; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryResimFlag = false; // Need this to avoid resetting hxbypass, saying this has already been simulated + state->dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply = 1.0 * StdRhoAir; + state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(1).Comp.allocate(1); } - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "OA Sys 1"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; - state.dataAirSystemsData->PrimaryAirSystems(2).Branch(1).Comp(1).Name = "OA Sys 2"; - state.dataAirSystemsData->PrimaryAirSystems(2).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; - state.dataAirSystemsData->PrimaryAirSystems(3).Branch(1).Comp(1).Name = "OA Sys 3"; - state.dataAirSystemsData->PrimaryAirSystems(3).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; - state.dataAirSystemsData->PrimaryAirSystems(4).Branch(1).Comp(1).Name = "OA Sys 4"; - state.dataAirSystemsData->PrimaryAirSystems(4).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "OA Sys 1"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; + state->dataAirSystemsData->PrimaryAirSystems(2).Branch(1).Comp(1).Name = "OA Sys 2"; + state->dataAirSystemsData->PrimaryAirSystems(2).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; + state->dataAirSystemsData->PrimaryAirSystems(3).Branch(1).Comp(1).Name = "OA Sys 3"; + state->dataAirSystemsData->PrimaryAirSystems(3).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; + state->dataAirSystemsData->PrimaryAirSystems(4).Branch(1).Comp(1).Name = "OA Sys 4"; + state->dataAirSystemsData->PrimaryAirSystems(4).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; // Initialize common OA controller and node data for (OAControllerNum = 1; OAControllerNum <= 5; ++OAControllerNum) { @@ -569,41 +571,41 @@ TEST_F(EnergyPlusFixture, MixedAir_HXBypassOptionTest) // OAFlow = MixFlow*(MixTemp - RetTemp)/(InletTemp - RetTemp) AirLoopNum = 1; OAControllerNum = 1; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatingActiveFlag = true; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatingActiveFlag = true; // setup OA system and initialize nodes // ManageOutsideAirSystem( "OA Sys 1", true, AirLoopNum, OAControllerNum ); - OAController(OAControllerNum).CalcOAController(state, AirLoopNum, true); + OAController(OAControllerNum).CalcOAController(*state, AirLoopNum, true); expectedMinOAflow = - 0.2 * StdRhoAir * OAController(OAControllerNum).MixMassFlow / state.dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply; // For Proportional minimum input + 0.2 * StdRhoAir * OAController(OAControllerNum).MixMassFlow / state->dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply; // For Proportional minimum input expectedOAflow = OAController(OAControllerNum).MixMassFlow * (OAController(OAControllerNum).MixSetTemp - OAController(OAControllerNum).RetTemp) / (OAController(OAControllerNum).InletTemp - OAController(OAControllerNum).RetTemp); EXPECT_NEAR(expectedOAflow, OAController(OAControllerNum).OAMassFlow, 0.00001); - EXPECT_NEAR(OAController(OAControllerNum).OAMassFlow / OAController(OAControllerNum).MixMassFlow, state.dataAirLoop->AirLoopFlow(AirLoopNum).OAFrac, 0.00001); - EXPECT_EQ(expectedMinOAflow, state.dataAirLoop->AirLoopFlow(AirLoopNum).MinOutAir); - EXPECT_EQ(expectedMinOAflow / OAController(OAControllerNum).MixMassFlow, state.dataAirLoop->AirLoopFlow(AirLoopNum).OAMinFrac); - EXPECT_TRUE(state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); + EXPECT_NEAR(OAController(OAControllerNum).OAMassFlow / OAController(OAControllerNum).MixMassFlow, state->dataAirLoop->AirLoopFlow(AirLoopNum).OAFrac, 0.00001); + EXPECT_EQ(expectedMinOAflow, state->dataAirLoop->AirLoopFlow(AirLoopNum).MinOutAir); + EXPECT_EQ(expectedMinOAflow / OAController(OAControllerNum).MixMassFlow, state->dataAirLoop->AirLoopFlow(AirLoopNum).OAMinFrac); + EXPECT_TRUE(state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); EXPECT_EQ(1, OAController(OAControllerNum).HeatRecoveryBypassStatus); // Case 2 - economizer active, LockoutWithHeating, BypassWhenWithinEconomizerLimits // economizer should not be locked out, OA flow at minimum, HXbypass true AirLoopNum = 2; OAControllerNum = 2; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatingActiveFlag = true; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatingActiveFlag = true; OAController(OAControllerNum).InletTemp = 0.0; // This is the same as the outdoor air dry bulb for these tests OAController(OAControllerNum).OATemp = 0.0; Node(OAControllerNum * 4 - 2).Temp = OAController(OAControllerNum).OATemp; // OA inlet (actuated) air nodes, dry air - OAController(OAControllerNum).CalcOAController(state, AirLoopNum, true); + OAController(OAControllerNum).CalcOAController(*state, AirLoopNum, true); expectedMinOAflow = - 0.2 * StdRhoAir * OAController(OAControllerNum).MixMassFlow / state.dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply; // For Proportional minimum input + 0.2 * StdRhoAir * OAController(OAControllerNum).MixMassFlow / state->dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply; // For Proportional minimum input expectedOAflow = expectedMinOAflow; EXPECT_NEAR(expectedOAflow, OAController(OAControllerNum).OAMassFlow, 0.00001); - EXPECT_NEAR(OAController(OAControllerNum).OAMassFlow / OAController(OAControllerNum).MixMassFlow, state.dataAirLoop->AirLoopFlow(AirLoopNum).OAFrac, 0.00001); - EXPECT_EQ(expectedMinOAflow, state.dataAirLoop->AirLoopFlow(AirLoopNum).MinOutAir); - EXPECT_EQ(expectedMinOAflow / OAController(OAControllerNum).MixMassFlow, state.dataAirLoop->AirLoopFlow(AirLoopNum).OAMinFrac); - EXPECT_FALSE(state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); + EXPECT_NEAR(OAController(OAControllerNum).OAMassFlow / OAController(OAControllerNum).MixMassFlow, state->dataAirLoop->AirLoopFlow(AirLoopNum).OAFrac, 0.00001); + EXPECT_EQ(expectedMinOAflow, state->dataAirLoop->AirLoopFlow(AirLoopNum).MinOutAir); + EXPECT_EQ(expectedMinOAflow / OAController(OAControllerNum).MixMassFlow, state->dataAirLoop->AirLoopFlow(AirLoopNum).OAMinFrac); + EXPECT_FALSE(state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); EXPECT_EQ(0, OAController(OAControllerNum).HeatRecoveryBypassStatus); // Case 3 - economizer active, NoLockout, BypassWhenOAFlowGreaterThanMinimum (should be same result as Case 1) @@ -611,42 +613,42 @@ TEST_F(EnergyPlusFixture, MixedAir_HXBypassOptionTest) // OAFlow = MixFlow*(MixTemp - RetTemp)/(InletTemp - RetTemp) AirLoopNum = 3; OAControllerNum = 3; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatingActiveFlag = true; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatingActiveFlag = true; OAController(OAControllerNum).InletTemp = 20.0; // This is the same as the outdoor air dry bulb for these tests OAController(OAControllerNum).OATemp = 20.0; Node(OAControllerNum * 4 - 2).Temp = OAController(OAControllerNum).OATemp; // OA inlet (actuated) air nodes, dry air - OAController(OAControllerNum).CalcOAController(state, AirLoopNum, true); + OAController(OAControllerNum).CalcOAController(*state, AirLoopNum, true); expectedMinOAflow = - 0.2 * StdRhoAir * OAController(OAControllerNum).MixMassFlow / state.dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply; // For Proportional minimum input + 0.2 * StdRhoAir * OAController(OAControllerNum).MixMassFlow / state->dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply; // For Proportional minimum input expectedOAflow = OAController(OAControllerNum).MixMassFlow * (OAController(OAControllerNum).MixSetTemp - OAController(OAControllerNum).RetTemp) / (OAController(OAControllerNum).InletTemp - OAController(OAControllerNum).RetTemp); EXPECT_NEAR(expectedOAflow, OAController(OAControllerNum).OAMassFlow, 0.00001); - EXPECT_NEAR(OAController(OAControllerNum).OAMassFlow / OAController(OAControllerNum).MixMassFlow, state.dataAirLoop->AirLoopFlow(AirLoopNum).OAFrac, 0.00001); - EXPECT_EQ(expectedMinOAflow, state.dataAirLoop->AirLoopFlow(AirLoopNum).MinOutAir); - EXPECT_EQ(expectedMinOAflow / OAController(OAControllerNum).MixMassFlow, state.dataAirLoop->AirLoopFlow(AirLoopNum).OAMinFrac); - EXPECT_TRUE(state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); + EXPECT_NEAR(OAController(OAControllerNum).OAMassFlow / OAController(OAControllerNum).MixMassFlow, state->dataAirLoop->AirLoopFlow(AirLoopNum).OAFrac, 0.00001); + EXPECT_EQ(expectedMinOAflow, state->dataAirLoop->AirLoopFlow(AirLoopNum).MinOutAir); + EXPECT_EQ(expectedMinOAflow / OAController(OAControllerNum).MixMassFlow, state->dataAirLoop->AirLoopFlow(AirLoopNum).OAMinFrac); + EXPECT_TRUE(state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); EXPECT_EQ(1, OAController(OAControllerNum).HeatRecoveryBypassStatus); // Case 4 - economizer active, NoLockout, BypassWhenOAFlowGreaterThanMinimum // economizer should be at minimum due to cold outdoor temp, OA flow at minimum, HXbypass false AirLoopNum = 4; OAControllerNum = 4; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatingActiveFlag = true; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatingActiveFlag = true; OAController(OAControllerNum).InletTemp = 0.0; // This is the same as the outdoor air dry bulb for these tests OAController(OAControllerNum).OATemp = 0.0; Node(OAControllerNum * 4 - 2).Temp = OAController(OAControllerNum).OATemp; // OA inlet (actuated) air nodes, dry air - OAController(OAControllerNum).CalcOAController(state, AirLoopNum, true); + OAController(OAControllerNum).CalcOAController(*state, AirLoopNum, true); expectedMinOAflow = - 0.2 * StdRhoAir * OAController(OAControllerNum).MixMassFlow / state.dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply; // For Proportional minimum input + 0.2 * StdRhoAir * OAController(OAControllerNum).MixMassFlow / state->dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply; // For Proportional minimum input expectedOAflow = expectedMinOAflow; EXPECT_NEAR(expectedOAflow, OAController(OAControllerNum).OAMassFlow, 0.00001); - EXPECT_NEAR(OAController(OAControllerNum).OAMassFlow / OAController(OAControllerNum).MixMassFlow, state.dataAirLoop->AirLoopFlow(AirLoopNum).OAFrac, 0.00001); - EXPECT_EQ(expectedMinOAflow, state.dataAirLoop->AirLoopFlow(AirLoopNum).MinOutAir); - EXPECT_EQ(expectedMinOAflow / OAController(OAControllerNum).MixMassFlow, state.dataAirLoop->AirLoopFlow(AirLoopNum).OAMinFrac); - EXPECT_FALSE(state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); + EXPECT_NEAR(OAController(OAControllerNum).OAMassFlow / OAController(OAControllerNum).MixMassFlow, state->dataAirLoop->AirLoopFlow(AirLoopNum).OAFrac, 0.00001); + EXPECT_EQ(expectedMinOAflow, state->dataAirLoop->AirLoopFlow(AirLoopNum).MinOutAir); + EXPECT_EQ(expectedMinOAflow / OAController(OAControllerNum).MixMassFlow, state->dataAirLoop->AirLoopFlow(AirLoopNum).OAMinFrac); + EXPECT_FALSE(state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); EXPECT_EQ(0, OAController(OAControllerNum).HeatRecoveryBypassStatus); // Case 5 - heating coil in outside air stream upstream of mixer #5697 @@ -654,23 +656,23 @@ TEST_F(EnergyPlusFixture, MixedAir_HXBypassOptionTest) // economizer should open to meet mixed air set point temperature, HXbypass true AirLoopNum = 5; OAControllerNum = 5; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatingActiveFlag = false; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatingActiveFlag = false; OAController(OAControllerNum).InletTemp = 20.0; // This is the same as the outdoor air dry bulb for these tests OAController(OAControllerNum).OATemp = 20.0; Node(OAControllerNum * 4 - 3).MassFlowRate = OAController(OAControllerNum).MixMassFlow; // set the mixed air node mass flow rate Node(OAControllerNum * 4 - 2).Temp = OAController(OAControllerNum).OATemp; // OA inlet (actuated) air nodes, dry air - OAController(OAControllerNum).CalcOAController(state, AirLoopNum, true); + OAController(OAControllerNum).CalcOAController(*state, AirLoopNum, true); expectedMinOAflow = - 0.2 * StdRhoAir * OAController(OAControllerNum).MixMassFlow / state.dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply; // For Proportional minimum input + 0.2 * StdRhoAir * OAController(OAControllerNum).MixMassFlow / state->dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply; // For Proportional minimum input expectedOAflow = expectedMinOAflow; EXPECT_GT(OAController(OAControllerNum).OAMassFlow, expectedOAflow); - EXPECT_NEAR(OAController(OAControllerNum).OAMassFlow / OAController(OAControllerNum).MixMassFlow, state.dataAirLoop->AirLoopFlow(AirLoopNum).OAFrac, 0.00001); + EXPECT_NEAR(OAController(OAControllerNum).OAMassFlow / OAController(OAControllerNum).MixMassFlow, state->dataAirLoop->AirLoopFlow(AirLoopNum).OAFrac, 0.00001); EXPECT_NEAR(OAController(OAControllerNum).OAMassFlow, 0.145329, 0.000001); - EXPECT_EQ(expectedMinOAflow, state.dataAirLoop->AirLoopFlow(AirLoopNum).MinOutAir); - EXPECT_EQ(expectedMinOAflow / OAController(OAControllerNum).MixMassFlow, state.dataAirLoop->AirLoopFlow(AirLoopNum).OAMinFrac); - EXPECT_FALSE(state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); + EXPECT_EQ(expectedMinOAflow, state->dataAirLoop->AirLoopFlow(AirLoopNum).MinOutAir); + EXPECT_EQ(expectedMinOAflow / OAController(OAControllerNum).MixMassFlow, state->dataAirLoop->AirLoopFlow(AirLoopNum).OAMinFrac); + EXPECT_FALSE(state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); EXPECT_EQ(0, OAController(OAControllerNum).HeatRecoveryBypassStatus); } @@ -732,8 +734,8 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataAirLoop->AirLoopControlInfo.allocate(1); - state.dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; + state->dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; OARequirements.allocate(1); OARequirements(1).Name = "CM DSOA WEST ZONE"; OARequirements(1).OAFlowMethod = OAFlowSum; @@ -749,21 +751,21 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest) Zone(1).FloorArea = 10.0; Zone(1).ZoneContamControllerSchedIndex = 4; - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirLoop->AirLoopFlow(1).OAFrac = 0.01; // DataAirLoop variable (AirloopHVAC) - state.dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.01; // DataAirLoop variable (AirloopHVAC) + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow(1).OAFrac = 0.01; // DataAirLoop variable (AirloopHVAC) + state->dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.01; // DataAirLoop variable (AirloopHVAC) - GetOAControllerInputs(state); + GetOAControllerInputs(*state); EXPECT_EQ(7, VentilationMechanical(1).SystemOAMethod); - EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(state, OAController(1).OANode)); + EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(*state, OAController(1).OANode)); EXPECT_NEAR(0.00314899, VentilationMechanical(1).ZoneOAPeopleRate(1), 0.00001); EXPECT_NEAR(0.000407, VentilationMechanical(1).ZoneOAAreaRate(1), 0.00001); StdRhoAir = 1.2; OAController(1).MixMassFlow = 1.7 * StdRhoAir; OAController(1).MaxOAMassFlowRate = 1.7 * StdRhoAir; - state.dataAirLoop->AirLoopFlow(1).DesSupply = 1.7; + state->dataAirLoop->AirLoopFlow(1).DesSupply = 1.7; VentilationMechanical(1).SchPtr = 1; Schedule(1).CurrentValue = 1.0; @@ -794,50 +796,50 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOccupancyTest) OutBaroPress = 101325; ZoneSysEnergyDemand.allocate(1); - OAController(1).CalcOAController(state, 1, true); + OAController(1).CalcOAController(*state, 1, true); EXPECT_NEAR(0.0194359, OAController(1).OAMassFlow, 0.00001); EXPECT_NEAR(0.009527, OAController(1).MinOAFracLimit, 0.00001); OARequirements(1).OAFlowMethod = 9; VentilationMechanical(1).ZoneOAFlowMethod(1) = OARequirements(1).OAFlowMethod; - state.dataAirLoop->NumOASystems = 1; - - state.dataAirLoop->OutsideAirSys.allocate(1); - state.dataAirLoop->OutsideAirSys(1).Name = "AIRLOOP OASYSTEM"; - state.dataAirLoop->OutsideAirSys(1).NumControllers = 1; - state.dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA CONTROLLER 1"; - state.dataAirLoop->OutsideAirSys(1).ComponentType.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ComponentType(1) = "OutdoorAir:Mixer"; - state.dataAirLoop->OutsideAirSys(1).ComponentName.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ComponentName(1) = "OAMixer"; + state->dataAirLoop->NumOASystems = 1; + + state->dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys(1).Name = "AIRLOOP OASYSTEM"; + state->dataAirLoop->OutsideAirSys(1).NumControllers = 1; + state->dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA CONTROLLER 1"; + state->dataAirLoop->OutsideAirSys(1).ComponentType.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ComponentType(1) = "OutdoorAir:Mixer"; + state->dataAirLoop->OutsideAirSys(1).ComponentName.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ComponentName(1) = "OAMixer"; OAMixer.allocate(1); OAMixer(1).Name = "OAMixer"; OAMixer(1).InletNode = 2; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Name = "PrimaryAirLoop"; - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = state.dataAirLoop->OutsideAirSys(1).Name; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; - - state.dataAirLoop->AirLoopZoneInfo.allocate(1); - state.dataAirLoop->AirLoopZoneInfo(1).NumZones = 1; - state.dataAirLoop->AirLoopZoneInfo(1).ActualZoneNumber.allocate(1); - state.dataAirLoop->AirLoopZoneInfo(1).ActualZoneNumber(1) = 1; - - InitOAController(state, 1, true, 1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Name = "PrimaryAirLoop"; + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = state->dataAirLoop->OutsideAirSys(1).Name; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; + + state->dataAirLoop->AirLoopZoneInfo.allocate(1); + state->dataAirLoop->AirLoopZoneInfo(1).NumZones = 1; + state->dataAirLoop->AirLoopZoneInfo(1).ActualZoneNumber.allocate(1); + state->dataAirLoop->AirLoopZoneInfo(1).ActualZoneNumber(1) = 1; + + InitOAController(*state, 1, true, 1); EXPECT_EQ("ProportionalControlBasedOnDesignOccupancy", DataSizing::cOAFlowMethodTypes(VentilationMechanical(1).ZoneOAFlowMethod(1))); - state.dataAirLoop->OutsideAirSys.deallocate(); + state->dataAirLoop->OutsideAirSys.deallocate(); OAMixer.deallocate(); - state.dataAirLoop->AirLoopZoneInfo.deallocate(); - state.dataAirSystemsData->PrimaryAirSystems.deallocate(); + state->dataAirLoop->AirLoopZoneInfo.deallocate(); + state->dataAirSystemsData->PrimaryAirSystems.deallocate(); ZoneAirCO2.deallocate(); ZoneCO2GainFromPeople.deallocate(); } @@ -943,23 +945,23 @@ TEST_F(EnergyPlusFixture, MissingDesignOccupancyTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataAirLoop->AirLoopControlInfo.allocate(1); - state.dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; + state->dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; OARequirements.allocate(1); ZoneAirDistribution.allocate(1); ZoneAirDistribution(1).Name = "CM DSZAD WEST ZONE"; ZoneAirDistribution(1).ZoneADEffSchPtr = 4; - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirLoop->AirLoopFlow(1).OAFrac = 0.01; // DataAirLoop variable (AirloopHVAC) - state.dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.01; // DataAirLoop variable (AirloopHVAC) + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow(1).OAFrac = 0.01; // DataAirLoop variable (AirloopHVAC) + state->dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.01; // DataAirLoop variable (AirloopHVAC) - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - GetZoneAirDistribution(state); - GetZoneSizingInput(state); - state.dataGlobal->DoZoneSizing = true; - GetOAControllerInputs(state); + GetZoneAirDistribution(*state); + GetZoneSizingInput(*state); + state->dataGlobal->DoZoneSizing = true; + GetOAControllerInputs(*state); EXPECT_EQ(0.00944, VentilationMechanical(1).ZoneOAPeopleRate(1)); EXPECT_EQ(0.00, VentilationMechanical(1).ZoneOAAreaRate(1)); @@ -1064,40 +1066,40 @@ TEST_F(EnergyPlusFixture, MixedAir_TestHXinOASystem) ASSERT_TRUE(process_idf(idf_objects)); GetOASysInputFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; int AirloopNum = 1; int OASysNum = 1; int OAControllerNum = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(AirloopNum); - state.dataAirSystemsData->PrimaryAirSystems(AirloopNum).Name = "Airloop 1"; - state.dataAirLoop->AirLoopControlInfo.allocate(AirloopNum); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture - state.dataAirLoop->AirLoopFlow.allocate(AirloopNum); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture + state->dataAirSystemsData->PrimaryAirSystems.allocate(AirloopNum); + state->dataAirSystemsData->PrimaryAirSystems(AirloopNum).Name = "Airloop 1"; + state->dataAirLoop->AirLoopControlInfo.allocate(AirloopNum); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture + state->dataAirLoop->AirLoopFlow.allocate(AirloopNum); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture DataEnvironment::StdRhoAir = 1.2; DataEnvironment::OutBaroPress = 101250.0; - state.dataAirLoop->AirLoopFlow(AirloopNum).DesSupply = 1.0 * DataEnvironment::StdRhoAir; + state->dataAirLoop->AirLoopFlow(AirloopNum).DesSupply = 1.0 * DataEnvironment::StdRhoAir; // setup OA system and initialize nodes - ManageOutsideAirSystem(state, "OA Sys 1", true, AirloopNum, OASysNum); + ManageOutsideAirSystem(*state, "OA Sys 1", true, AirloopNum, OASysNum); // reset nodes to common property for (int i = 1; i <= DataLoopNode::NumOfNodes; ++i) { Node(i).Temp = 20.0; Node(i).HumRat = 0.01; Node(i).Enthalpy = 45478.0; - Node(i).MassFlowRate = state.dataAirLoop->AirLoopFlow(AirloopNum).DesSupply; - Node(i).MassFlowRateMaxAvail = state.dataAirLoop->AirLoopFlow(AirloopNum).DesSupply; + Node(i).MassFlowRate = state->dataAirLoop->AirLoopFlow(AirloopNum).DesSupply; + Node(i).MassFlowRateMaxAvail = state->dataAirLoop->AirLoopFlow(AirloopNum).DesSupply; Node(i).Press = 101250.0; } // simulate OA system, common node property is propogated - ManageOutsideAirSystem(state, "OA Sys 1", true, AirloopNum, OASysNum); + ManageOutsideAirSystem(*state, "OA Sys 1", true, AirloopNum, OASysNum); // change node property at OA inlet and mixer inlet Node(2).Temp = 18.0; // reset temps at HX Node(5).Temp = 24.0; // simulate OA system - ManageOutsideAirSystem(state, "OA Sys 1", true, AirloopNum, OASysNum); + ManageOutsideAirSystem(*state, "OA Sys 1", true, AirloopNum, OASysNum); int mixedAirNode = OAController(OAControllerNum).MixNode; int mixerIntletNode = OAController(OAControllerNum).InletNode; @@ -1207,16 +1209,16 @@ TEST_F(EnergyPlusFixture, MixedAir_HumidifierOnOASystemTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60 / state.dataGlobal->NumOfTimeStepInHour; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DayOfWeek = 1; DataEnvironment::DayOfYear_Schedule = 1; - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); GetOASysInputFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; int AirloopNum = 1; int OASysNum = 1; int HumNum(1); @@ -1225,33 +1227,33 @@ TEST_F(EnergyPlusFixture, MixedAir_HumidifierOnOASystemTest) Real64 WaterConsumptionRate(0.0); // water use rate of the humidifier Real64 ElecPowerInput(0.0); // electric use rate of the humidifier - state.dataAirSystemsData->PrimaryAirSystems.allocate(AirloopNum); - state.dataAirSystemsData->PrimaryAirSystems(AirloopNum).Name = "Airloop 1"; - state.dataAirLoop->AirLoopControlInfo.allocate(AirloopNum); - state.dataAirLoop->AirLoopFlow.allocate(AirloopNum); - state.dataAirLoop->AirLoopFlow(AirloopNum).DesSupply = 1.0 * DataEnvironment::StdRhoAir; + state->dataAirSystemsData->PrimaryAirSystems.allocate(AirloopNum); + state->dataAirSystemsData->PrimaryAirSystems(AirloopNum).Name = "Airloop 1"; + state->dataAirLoop->AirLoopControlInfo.allocate(AirloopNum); + state->dataAirLoop->AirLoopFlow.allocate(AirloopNum); + state->dataAirLoop->AirLoopFlow(AirloopNum).DesSupply = 1.0 * DataEnvironment::StdRhoAir; DataEnvironment::StdRhoAir = 1.2; DataEnvironment::OutBaroPress = 101250.0; DataSizing::SysSizingRunDone = false; DataSizing::CurSysNum = 1; - GetOutsideAirSysInputs(state); - EXPECT_EQ(1, state.dataAirLoop->NumOASystems); - EXPECT_EQ("DOAS OA SYSTEM", state.dataAirLoop->OutsideAirSys(OASysNum).Name); + GetOutsideAirSysInputs(*state); + EXPECT_EQ(1, state->dataAirLoop->NumOASystems); + EXPECT_EQ("DOAS OA SYSTEM", state->dataAirLoop->OutsideAirSys(OASysNum).Name); // setup OA system and initialize nodes - ManageOutsideAirSystem(state, state.dataAirLoop->OutsideAirSys(OASysNum).Name, true, AirloopNum, OASysNum); + ManageOutsideAirSystem(*state, state->dataAirLoop->OutsideAirSys(OASysNum).Name, true, AirloopNum, OASysNum); // reset nodes to common property for (int i = 1; i <= DataLoopNode::NumOfNodes; ++i) { Node(i).Temp = 20.0; Node(i).HumRat = 0.0005; Node(i).Enthalpy = Psychrometrics::PsyHFnTdbW(DataLoopNode::Node(i).Temp, DataLoopNode::Node(i).HumRat); - Node(i).MassFlowRate = state.dataAirLoop->AirLoopFlow(AirloopNum).DesSupply; - Node(i).MassFlowRateMaxAvail = state.dataAirLoop->AirLoopFlow(AirloopNum).DesSupply; + Node(i).MassFlowRate = state->dataAirLoop->AirLoopFlow(AirloopNum).DesSupply; + Node(i).MassFlowRateMaxAvail = state->dataAirLoop->AirLoopFlow(AirloopNum).DesSupply; Node(i).Press = 101250.0; } // simulate OA system, common node properties are propagated - ManageOutsideAirSystem(state, state.dataAirLoop->OutsideAirSys(OASysNum).Name, true, AirloopNum, OASysNum); + ManageOutsideAirSystem(*state, state->dataAirLoop->OutsideAirSys(OASysNum).Name, true, AirloopNum, OASysNum); // humidifier water and electric use rate are zero (no Hum Rat setpoint applied) EXPECT_EQ(0.0, Humidifiers::Humidifier(HumNum).WaterAdd); EXPECT_EQ(0.0, Humidifiers::Humidifier(HumNum).ElecUseRate); @@ -1259,12 +1261,12 @@ TEST_F(EnergyPlusFixture, MixedAir_HumidifierOnOASystemTest) // Add humidity ratio setpoint to the humidifier air outlet node Node(2).HumRatMin = 0.005; // humidity ratio setpoint value // simulate OA system - ManageOutsideAirSystem(state, state.dataAirLoop->OutsideAirSys(OASysNum).Name, true, AirloopNum, OASysNum); + ManageOutsideAirSystem(*state, state->dataAirLoop->OutsideAirSys(OASysNum).Name, true, AirloopNum, OASysNum); // get humidifier's air inlet and outlet node number AirInNode = Humidifiers::Humidifier(HumNum).AirInNode; AirOutNode = Humidifiers::Humidifier(HumNum).AirOutNode; // Calculate expected humidifier water consumption rate - WaterConsumptionRate = state.dataAirLoop->AirLoopFlow(AirloopNum).DesSupply * (0.005 - 0.0005); + WaterConsumptionRate = state->dataAirLoop->AirLoopFlow(AirloopNum).DesSupply * (0.005 - 0.0005); // Calculate humidifier electric use rate (fan electric power and standby electric power are zero) ElecPowerInput = (WaterConsumptionRate / Humidifiers::Humidifier(HumNum).NomCap) * Humidifiers::Humidifier(HumNum).NomPower; // Confirm humidifier water consumption calculation @@ -1304,28 +1306,28 @@ TEST_F(EnergyPlusFixture, FreezingCheckTest) ASSERT_TRUE(process_idf(idf_objects)); - GetOAControllerInputs(state); + GetOAControllerInputs(*state); - state.dataAirLoop->AirLoopControlInfo.allocate(1); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture - state.dataAirLoop->AirLoopFlow.allocate(1); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture + state->dataAirLoop->AirLoopControlInfo.allocate(1); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture + state->dataAirLoop->AirLoopFlow.allocate(1); // will be deallocated by MixedAir::clear_state(); in EnergyPlusFixture Node.allocate(5); // will be deallocated by DataLoopNode::clear_state(); in EnergyPlusFixture int OAControllerNum = 1; int AirLoopNum = 1; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoLockout = false; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).NightVent = false; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).FanOpMode = DataHVACGlobals::CycFanCycCoil; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).LoopFlowRateSet = false; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).CheckHeatRecoveryBypassStatus = true; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).OASysComponentsSimulated = true; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).EconomizerFlowLocked = false; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass = false; - state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryResimFlag = false; // Need this to avoid resetting hxbypass, saying this has already been simulated - state.dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply = 1.0; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).EconoLockout = false; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).NightVent = false; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).FanOpMode = DataHVACGlobals::CycFanCycCoil; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).LoopFlowRateSet = false; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).CheckHeatRecoveryBypassStatus = true; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).OASysComponentsSimulated = true; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).EconomizerFlowLocked = false; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass = false; + state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryResimFlag = false; // Need this to avoid resetting hxbypass, saying this has already been simulated + state->dataAirLoop->AirLoopFlow(AirLoopNum).DesSupply = 1.0; StdBaroPress = StdPressureSeaLevel; - StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, StdBaroPress, 20.0, 0.0); + StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, StdBaroPress, 20.0, 0.0); // Initialize common OA controller and node data OAController(OAControllerNum).MinOAMassFlowRate = OAController(OAControllerNum).MinOA * StdRhoAir; @@ -1349,7 +1351,7 @@ TEST_F(EnergyPlusFixture, FreezingCheckTest) OAController(1).CoolCoilFreezeCheck = true; Schedule(1).CurrentValue = 1.0; - OAController(OAControllerNum).CalcOAController(state, AirLoopNum, true); + OAController(OAControllerNum).CalcOAController(*state, AirLoopNum, true); EXPECT_NEAR(0.2408617, OAController(1).OAFractionRpt, 0.00001); } @@ -1383,7 +1385,7 @@ TEST_F(EnergyPlusFixture, MixedAir_ControllerTypeTest) Contaminant.CO2Simulation = true; Contaminant.GenericContamSimulation = true; - OAController(OAControllerNum).UpdateOAController(state); + OAController(OAControllerNum).UpdateOAController(*state); // Expect no value changes of relief node due to no actions. EXPECT_NEAR(500.0, Node(OAController(OAControllerNum).RelNode).CO2, 0.00001); EXPECT_NEAR(0.3, Node(OAController(OAControllerNum).RelNode).GenContam, 0.00001); @@ -1447,7 +1449,7 @@ TEST_F(EnergyPlusFixture, MixedAir_MissingHIghRHControlInputTest) int IOStat(0); std::string const CurrentModuleObject = CurrentModuleObjects(CMO_OAController); - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObjects(CMO_OAController), NumArg, NumAlphas, NumNums); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObjects(CMO_OAController), NumArg, NumAlphas, NumNums); Array1D NumArray(NumNums, 0.0); Array1D_string AlphArray(NumAlphas); @@ -1456,39 +1458,39 @@ TEST_F(EnergyPlusFixture, MixedAir_MissingHIghRHControlInputTest) Array1D_bool lAlphaBlanks(NumAlphas, true); Array1D_bool lNumericBlanks(NumNums, true); - NumOAControllers = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + NumOAControllers = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); OAController.allocate(NumOAControllers); ControllerNum = 1; Zone.allocate(1); Zone(1).Name = "ZONE1"; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; ZoneEquipConfig.allocate(1); ZoneEquipConfig(1).ActualZoneNum = 1; ZoneEquipConfig(1).ZoneNode = 2; ZoneEquipConfig(1).NumInletNodes = 1; ZoneEquipConfig(1).InletNodeAirLoopNum.allocate(1); ZoneEquipConfig(1).InletNodeAirLoopNum(1) = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "OASysName"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; - state.dataAirLoop->OutsideAirSys.allocate(1); - state.dataAirLoop->OutsideAirSys(1).Name = "OASysName"; - state.dataAirLoop->OutsideAirSys(1).NumControllers = 1; - state.dataAirLoop->OutsideAirSys(1).ControllerType.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ControllerType(1) = "Controller:OutdoorAir"; - state.dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA Controller 1"; - state.dataAirLoop->NumOASystems = 1; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "OASysName"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; + state->dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys(1).Name = "OASysName"; + state->dataAirLoop->OutsideAirSys(1).NumControllers = 1; + state->dataAirLoop->OutsideAirSys(1).ControllerType.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ControllerType(1) = "Controller:OutdoorAir"; + state->dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA Controller 1"; + state->dataAirLoop->NumOASystems = 1; HumidityControlZone.allocate(1); HumidityControlZone(1).ActualZoneNum = 1; NumHumidityControlZones = 1; - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, ControllerNum, AlphArray, NumAlphas, @@ -1500,7 +1502,7 @@ TEST_F(EnergyPlusFixture, MixedAir_MissingHIghRHControlInputTest) cAlphaFields, cNumericFields); - ProcessOAControllerInputs(state, + ProcessOAControllerInputs(*state, CurrentModuleObject, ControllerNum, AlphArray, @@ -1579,7 +1581,7 @@ TEST_F(EnergyPlusFixture, MixedAir_HIghRHControlTest) int IOStat(0); std::string const CurrentModuleObject = CurrentModuleObjects(CMO_OAController); - inputProcessor->getObjectDefMaxArgs(state, CurrentModuleObjects(CMO_OAController), NumArg, NumAlphas, NumNums); + inputProcessor->getObjectDefMaxArgs(*state, CurrentModuleObjects(CMO_OAController), NumArg, NumAlphas, NumNums); Array1D NumArray(NumNums, 0.0); Array1D_string AlphArray(NumAlphas); @@ -1588,40 +1590,40 @@ TEST_F(EnergyPlusFixture, MixedAir_HIghRHControlTest) Array1D_bool lAlphaBlanks(NumAlphas, true); Array1D_bool lNumericBlanks(NumNums, true); - NumOAControllers = inputProcessor->getNumObjectsFound(state, CurrentModuleObject); + NumOAControllers = inputProcessor->getNumObjectsFound(*state, CurrentModuleObject); OAController.allocate(NumOAControllers); ControllerNum = 1; Zone.allocate(1); Zone(1).Name = "ZONE1"; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; ZoneEquipConfig.allocate(1); ZoneEquipConfig(1).ActualZoneNum = 1; ZoneEquipConfig(1).ZoneNode = 2; ZoneEquipConfig(1).NumInletNodes = 1; ZoneEquipConfig(1).InletNodeAirLoopNum.allocate(1); ZoneEquipConfig(1).InletNodeAirLoopNum(1) = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "OASysName"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; - state.dataAirLoop->OutsideAirSys.allocate(1); - state.dataAirLoop->OutsideAirSys(1).Name = "OASysName"; - state.dataAirLoop->OutsideAirSys(1).NumControllers = 1; - state.dataAirLoop->OutsideAirSys(1).ControllerType.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ControllerType(1) = "Controller:OutdoorAir"; - state.dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA Controller 1"; - state.dataAirLoop->NumOASystems = 1; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "OASysName"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; + state->dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys(1).Name = "OASysName"; + state->dataAirLoop->OutsideAirSys(1).NumControllers = 1; + state->dataAirLoop->OutsideAirSys(1).ControllerType.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ControllerType(1) = "Controller:OutdoorAir"; + state->dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA Controller 1"; + state->dataAirLoop->NumOASystems = 1; HumidityControlZone.allocate(1); HumidityControlZone(1).ActualZoneNum = 1; NumHumidityControlZones = 1; - inputProcessor->getObjectItem(state, CurrentModuleObject, + inputProcessor->getObjectItem(*state, CurrentModuleObject, ControllerNum, AlphArray, NumAlphas, @@ -1633,7 +1635,7 @@ TEST_F(EnergyPlusFixture, MixedAir_HIghRHControlTest) cAlphaFields, cNumericFields); - ProcessOAControllerInputs(state, + ProcessOAControllerInputs(*state, CurrentModuleObject, ControllerNum, AlphArray, @@ -1671,28 +1673,28 @@ TEST_F(EnergyPlusFixture, MixedAir_HIghRHControlTest) // Case 1 - OA humrat = zone humrat - no high humidity operation Node(ZoneEquipConfig(1).ZoneNode).HumRat = 0.006; OAController(ControllerNum).OAHumRat = 0.006; - OAController(ControllerNum).CalcOAEconomizer(state, airLoopNum, outAirMinFrac, OASignal, HighHumidityOperationFlag, firstHVACIteration); + OAController(ControllerNum).CalcOAEconomizer(*state, airLoopNum, outAirMinFrac, OASignal, HighHumidityOperationFlag, firstHVACIteration); EXPECT_FALSE(OAController(ControllerNum).HighHumCtrlActive); EXPECT_NEAR(OASignal, 0.0, 0.00001); // Case 2 - OA humrat < zone humrat - high humidity operation Node(ZoneEquipConfig(1).ZoneNode).HumRat = 0.006; OAController(ControllerNum).OAHumRat = 0.006 - DataHVACGlobals::SmallHumRatDiff; - OAController(ControllerNum).CalcOAEconomizer(state, airLoopNum, outAirMinFrac, OASignal, HighHumidityOperationFlag, firstHVACIteration); + OAController(ControllerNum).CalcOAEconomizer(*state, airLoopNum, outAirMinFrac, OASignal, HighHumidityOperationFlag, firstHVACIteration); EXPECT_TRUE(OAController(ControllerNum).HighHumCtrlActive); EXPECT_NEAR(OASignal, 0.8, 0.00001); // Case 3 - OA humrat within tolerance of zone humrat - no high humidity operation Node(ZoneEquipConfig(1).ZoneNode).HumRat = 0.006; OAController(ControllerNum).OAHumRat = 0.006 - DataHVACGlobals::SmallHumRatDiff / 2.0; - OAController(ControllerNum).CalcOAEconomizer(state, airLoopNum, outAirMinFrac, OASignal, HighHumidityOperationFlag, firstHVACIteration); + OAController(ControllerNum).CalcOAEconomizer(*state, airLoopNum, outAirMinFrac, OASignal, HighHumidityOperationFlag, firstHVACIteration); EXPECT_FALSE(OAController(ControllerNum).HighHumCtrlActive); EXPECT_NEAR(OASignal, 0.0, 0.00001); // Case 4 - OA humrat slightly above zone humrat - no high humidity operation Node(ZoneEquipConfig(1).ZoneNode).HumRat = 0.006; OAController(ControllerNum).OAHumRat = 0.006 + DataHVACGlobals::SmallHumRatDiff / 2.0; - OAController(ControllerNum).CalcOAEconomizer(state, airLoopNum, outAirMinFrac, OASignal, HighHumidityOperationFlag, firstHVACIteration); + OAController(ControllerNum).CalcOAEconomizer(*state, airLoopNum, outAirMinFrac, OASignal, HighHumidityOperationFlag, firstHVACIteration); EXPECT_FALSE(OAController(ControllerNum).HighHumCtrlActive); EXPECT_NEAR(OASignal, 0.0, 0.00001); } @@ -1735,56 +1737,56 @@ TEST_F(EnergyPlusFixture, OAControllerMixedAirSPTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); - state.dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; - GetOAControllerInputs(state); + GetOAControllerInputs(*state); StdRhoAir = 1.2; OAController(1).MixMassFlow = 1.7 * StdRhoAir; OAController(1).MaxOAMassFlowRate = 1.7 * StdRhoAir; - state.dataAirLoop->AirLoopFlow(1).DesSupply = 1.7 * StdRhoAir; - state.dataAirLoop->AirLoopFlow(1).ReqSupplyFrac = 1.0; - Node(OAController(1).MixNode).MassFlowRateMaxAvail = state.dataAirLoop->AirLoopFlow(1).DesSupply; // set max avail or controller will shut down + state->dataAirLoop->AirLoopFlow(1).DesSupply = 1.7 * StdRhoAir; + state->dataAirLoop->AirLoopFlow(1).ReqSupplyFrac = 1.0; + Node(OAController(1).MixNode).MassFlowRateMaxAvail = state->dataAirLoop->AirLoopFlow(1).DesSupply; // set max avail or controller will shut down Node(OAController(1).RetNode).MassFlowRate = - state.dataAirLoop->AirLoopFlow(1).DesSupply; // set return flow for mixing calculation (i.e., mix flow = return flow + exhaust flow [0]) - state.dataAirLoop->NumOASystems = 1; - state.dataAirLoop->OutsideAirSys.allocate(1); - state.dataAirLoop->OutsideAirSys(1).Name = "AIRLOOP OASYSTEM"; - state.dataAirLoop->OutsideAirSys(1).NumControllers = 1; - state.dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA CONTROLLER 1"; - state.dataAirLoop->OutsideAirSys(1).ComponentType.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ComponentType(1) = "OutdoorAir:Mixer"; - state.dataAirLoop->OutsideAirSys(1).ComponentName.allocate(1); - state.dataAirLoop->OutsideAirSys(1).ComponentName(1) = "OAMixer"; + state->dataAirLoop->AirLoopFlow(1).DesSupply; // set return flow for mixing calculation (i.e., mix flow = return flow + exhaust flow [0]) + state->dataAirLoop->NumOASystems = 1; + state->dataAirLoop->OutsideAirSys.allocate(1); + state->dataAirLoop->OutsideAirSys(1).Name = "AIRLOOP OASYSTEM"; + state->dataAirLoop->OutsideAirSys(1).NumControllers = 1; + state->dataAirLoop->OutsideAirSys(1).ControllerName.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ControllerName(1) = "OA CONTROLLER 1"; + state->dataAirLoop->OutsideAirSys(1).ComponentType.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ComponentType(1) = "OutdoorAir:Mixer"; + state->dataAirLoop->OutsideAirSys(1).ComponentName.allocate(1); + state->dataAirLoop->OutsideAirSys(1).ComponentName(1) = "OAMixer"; OAMixer.allocate(1); OAMixer(1).Name = "OAMixer"; OAMixer(1).InletNode = 2; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Name = "PrimaryAirLoop"; - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = state.dataAirLoop->OutsideAirSys(1).Name; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Name = "PrimaryAirLoop"; + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = state->dataAirLoop->OutsideAirSys(1).Name; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:OutdoorAirSystem"; // mixed node temperature set point has not yet been set, expect OA controller mixed temp SP to be equal to low temp limit - InitOAController(state, 1, true, 1); + InitOAController(*state, 1, true, 1); EXPECT_EQ(OAController(1).MixSetTemp, OAController(1).TempLowLim); // expect OA controller mixed node temp SP to be equal to 0.5 C. Node(1).TempSetPoint = 0.5; - InitOAController(state, 1, true, 1); + InitOAController(*state, 1, true, 1); EXPECT_EQ(OAController(1).MixSetTemp, 0.5); // expect OA controller mixed node temp SP to be less than 0 and equal to -5.0 C. Node(1).TempSetPoint = -5.0; - InitOAController(state, 1, true, 1); + InitOAController(*state, 1, true, 1); EXPECT_EQ(OAController(1).MixSetTemp, -5.0); } @@ -1883,12 +1885,12 @@ TEST_F(EnergyPlusFixture, MixedAir_MiscGetsPart1) }); ASSERT_TRUE(process_idf(idf_objects)); - GetOAControllerInputs(state); + GetOAControllerInputs(*state); - EXPECT_EQ(1, GetNumOAMixers(state)); - EXPECT_EQ(1, GetNumOAControllers(state)); - EXPECT_EQ(3, GetOAMixerReliefNodeNumber(state, 1)); - EXPECT_EQ(1, GetOAMixerIndex(state, "OA Mixer")); + EXPECT_EQ(1, GetNumOAMixers(*state)); + EXPECT_EQ(1, GetNumOAControllers(*state)); + EXPECT_EQ(3, GetOAMixerReliefNodeNumber(*state, 1)); + EXPECT_EQ(1, GetOAMixerIndex(*state, "OA Mixer")); } TEST_F(EnergyPlusFixture, MixedAir_MiscGetsPart2) @@ -5211,19 +5213,19 @@ TEST_F(EnergyPlusFixture, MixedAir_MiscGetsPart2) }); ASSERT_TRUE(process_idf(idf_objects)); - GetOAControllerInputs(state); + GetOAControllerInputs(*state); - EXPECT_EQ(6, GetNumOAMixers(state)); - EXPECT_EQ(1, GetNumOAControllers(state)); - EXPECT_EQ(18, GetOAMixerReliefNodeNumber(state, 1)); + EXPECT_EQ(6, GetNumOAMixers(*state)); + EXPECT_EQ(1, GetNumOAControllers(*state)); + EXPECT_EQ(18, GetOAMixerReliefNodeNumber(*state, 1)); // indexes can be found in OAMixer array for these feild names - EXPECT_EQ(1, GetOAMixerIndex(state, "SPACE1-1 OA Mixing Box")); - EXPECT_EQ(2, GetOAMixerIndex(state, "SPACE2-1 OA Mixing Box")); - EXPECT_EQ(3, GetOAMixerIndex(state, "SPACE3-1 OA Mixing Box")); - EXPECT_EQ(4, GetOAMixerIndex(state, "SPACE4-1 OA Mixing Box")); - EXPECT_EQ(5, GetOAMixerIndex(state, "SPACE5-1 OA Mixing Box")); - EXPECT_EQ(6, GetOAMixerIndex(state, "DOAS OA Mixing Box")); + EXPECT_EQ(1, GetOAMixerIndex(*state, "SPACE1-1 OA Mixing Box")); + EXPECT_EQ(2, GetOAMixerIndex(*state, "SPACE2-1 OA Mixing Box")); + EXPECT_EQ(3, GetOAMixerIndex(*state, "SPACE3-1 OA Mixing Box")); + EXPECT_EQ(4, GetOAMixerIndex(*state, "SPACE4-1 OA Mixing Box")); + EXPECT_EQ(5, GetOAMixerIndex(*state, "SPACE5-1 OA Mixing Box")); + EXPECT_EQ(6, GetOAMixerIndex(*state, "DOAS OA Mixing Box")); } TEST_F(EnergyPlusFixture, MechVentController_IAQPTests) @@ -5249,7 +5251,7 @@ TEST_F(EnergyPlusFixture, MechVentController_IAQPTests) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); int NumZones(2); @@ -5261,25 +5263,25 @@ TEST_F(EnergyPlusFixture, MechVentController_IAQPTests) DataContaminantBalance::ZoneSysContDemand(1).OutputRequiredToGCSP = 1.0; DataContaminantBalance::ZoneSysContDemand(2).OutputRequiredToGCSP = 0.5; - GetOAControllerInputs(state); + GetOAControllerInputs(*state); // Case 1 - System OA method = IndoorAirQualityProcedure, SOAM_IAQP, controls to OutputRequiredToCO2SP OAMassFlow = 0.0; EXPECT_EQ(SOAM_IAQP, VentilationMechanical(1).SystemOAMethod); - VentilationMechanical(1).CalcMechVentController(state, SysMassFlow, OAMassFlow); + VentilationMechanical(1).CalcMechVentController(*state, SysMassFlow, OAMassFlow); EXPECT_EQ(0.5, OAMassFlow); // Case 2 - System OA method = IndoorAirQualityProcedureGenericContaminant, SOAM_IAQPGC, controls to OutputRequiredToGCSP OAMassFlow = 0.0; VentilationMechanical(1).SystemOAMethod = SOAM_IAQPGC; - VentilationMechanical(1).CalcMechVentController(state, SysMassFlow, OAMassFlow); + VentilationMechanical(1).CalcMechVentController(*state, SysMassFlow, OAMassFlow); EXPECT_EQ(1.5, OAMassFlow); // Case 3 - System OA method = IndoorAirQualityProcedureCombined, SOAM_IAQPCOM, controls to greater of total OutputRequiredToCO2SP and // OutputRequiredToGCSP OAMassFlow = 0.0; VentilationMechanical(1).SystemOAMethod = SOAM_IAQPCOM; - VentilationMechanical(1).CalcMechVentController(state, SysMassFlow, OAMassFlow); + VentilationMechanical(1).CalcMechVentController(*state, SysMassFlow, OAMassFlow); EXPECT_EQ(1.5, OAMassFlow); // Case 4 - System OA method = IndoorAirQualityProcedureCombined, SOAM_IAQPCOM, set zone OA schedules to alwaysoff @@ -5290,7 +5292,7 @@ TEST_F(EnergyPlusFixture, MechVentController_IAQPTests) OAMassFlow = 0.0; VentilationMechanical(1).SystemOAMethod = SOAM_IAQPCOM; - VentilationMechanical(1).CalcMechVentController(state, SysMassFlow, OAMassFlow); + VentilationMechanical(1).CalcMechVentController(*state, SysMassFlow, OAMassFlow); EXPECT_EQ(0.0, OAMassFlow); DataContaminantBalance::ZoneSysContDemand.deallocate(); @@ -5438,17 +5440,17 @@ TEST_F(EnergyPlusFixture, MechVentController_ZoneSumTests) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Initialize schedule values - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60 / state.dataGlobal->NumOfTimeStepInHour; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DayOfWeek = 1; DataEnvironment::DayOfYear_Schedule = 100; - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); // Initialize zone areas and volumes - too many other things need to be set up to do these in the normal routines int NumZones(6); @@ -5468,8 +5470,8 @@ TEST_F(EnergyPlusFixture, MechVentController_ZoneSumTests) DataHeatBalance::ZoneIntGain(5).NOFOCC = 20; DataHeatBalance::ZoneIntGain(6).NOFOCC = 6; - SizingManager::GetOARequirements(state); - GetOAControllerInputs(state); + SizingManager::GetOARequirements(*state); + GetOAControllerInputs(*state); EXPECT_EQ(SOAM_ZoneSum, VentilationMechanical(1).SystemOAMethod); // Summary of inputs and expected OA flow rate for each zone, StdRho = 1, so mass flow = volume flow for these tests @@ -5492,7 +5494,7 @@ TEST_F(EnergyPlusFixture, MechVentController_ZoneSumTests) // Case 1 - All zones as initially set up OAMassFlow = 0.0; - VentilationMechanical(1).CalcMechVentController(state, SysMassFlow, OAMassFlow); + VentilationMechanical(1).CalcMechVentController(*state, SysMassFlow, OAMassFlow); EXPECT_NEAR(1951.5, OAMassFlow, 0.00001); // Case 2 - Turn off Zone 4-6 @@ -5500,7 +5502,7 @@ TEST_F(EnergyPlusFixture, MechVentController_ZoneSumTests) ScheduleManager::Schedule(4).CurrentValue = 0.0; ScheduleManager::Schedule(5).CurrentValue = 0.0; ScheduleManager::Schedule(6).CurrentValue = 0.0; - VentilationMechanical(1).CalcMechVentController(state, SysMassFlow, OAMassFlow); + VentilationMechanical(1).CalcMechVentController(*state, SysMassFlow, OAMassFlow); EXPECT_NEAR(41.0, OAMassFlow, 0.00001); // Case 3 - Turn off remaining zones @@ -5508,7 +5510,7 @@ TEST_F(EnergyPlusFixture, MechVentController_ZoneSumTests) ScheduleManager::Schedule(1).CurrentValue = 0.0; ScheduleManager::Schedule(2).CurrentValue = 0.0; ScheduleManager::Schedule(3).CurrentValue = 0.0; - VentilationMechanical(1).CalcMechVentController(state, SysMassFlow, OAMassFlow); + VentilationMechanical(1).CalcMechVentController(*state, SysMassFlow, OAMassFlow); EXPECT_EQ(0.0, OAMassFlow); DataHeatBalance::ZoneIntGain.deallocate(); @@ -5595,8 +5597,8 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) ContaminantControlledZone(1).ZoneMinCO2SchedIndex = 6; ContaminantControlledZone(1).ZoneMaxCO2SchedIndex = 7; - state.dataAirLoop->AirLoopControlInfo.allocate(1); - state.dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; + state->dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirLoopControlInfo(1).LoopFlowRateSet = true; OARequirements.allocate(1); OARequirements(1).Name = "CM DSOA WEST ZONE"; OARequirements(1).OAFlowMethod = OAFlowSum; @@ -5613,21 +5615,21 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) Zone(1).FloorArea = 10.0; Zone(1).ZoneContamControllerSchedIndex = 4; - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirLoop->AirLoopFlow(1).OAFrac = 0.01; // DataAirLoop variable (AirloopHVAC) - state.dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.01; // DataAirLoop variable (AirloopHVAC) + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow(1).OAFrac = 0.01; // DataAirLoop variable (AirloopHVAC) + state->dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.01; // DataAirLoop variable (AirloopHVAC) - GetOAControllerInputs(state); + GetOAControllerInputs(*state); EXPECT_EQ(8, VentilationMechanical(1).SystemOAMethod); - EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(state, OAController(1).OANode)); + EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(*state, OAController(1).OANode)); EXPECT_NEAR(0.00314899, VentilationMechanical(1).ZoneOAPeopleRate(1), 0.00001); EXPECT_NEAR(0.000407, VentilationMechanical(1).ZoneOAAreaRate(1), 0.00001); StdRhoAir = 1.2; OAController(1).MixMassFlow = 1.7 * StdRhoAir; OAController(1).MaxOAMassFlowRate = 1.7 * StdRhoAir; - state.dataAirLoop->AirLoopFlow(1).DesSupply = 1.7; + state->dataAirLoop->AirLoopFlow(1).DesSupply = 1.7; VentilationMechanical(1).SchPtr = 1; Schedule(1).CurrentValue = 1.0; @@ -5667,15 +5669,15 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) Zone(1).ZoneMaxCO2SchedIndex = 7; Schedule(8).CurrentValue = 0.01; - OAController(1).CalcOAController(state, 1, true); + OAController(1).CalcOAController(*state, 1, true); EXPECT_NEAR(0.003183055786, OAController(1).OAMassFlow, 0.00001); EXPECT_NEAR(0.001560321463, OAController(1).MinOAFracLimit, 0.00001); // #5846 OAController(1).MinOAMassFlowRate = 0.05; - state.dataGlobal->WarmupFlag = false; - OAController(1).CalcOAController(state, 1, true); + state->dataGlobal->WarmupFlag = false; + OAController(1).CalcOAController(*state, 1, true); EXPECT_NEAR(0.006, OAController(1).OAMassFlow, 0.0001); std::string const error_string = delimited_string({ " ** Warning ** CalcOAController: Minimum OA fraction > Mechanical Ventilation Controller request for Controller:OutdoorAir=OA CONTROLLER 1, Min OA fraction is used.", @@ -5686,11 +5688,11 @@ TEST_F(EnergyPlusFixture, CO2ControlDesignOARateTest) EXPECT_TRUE(compare_err_stream(error_string, true)); - state.dataAirLoop->AirLoopControlInfo.deallocate(); + state->dataAirLoop->AirLoopControlInfo.deallocate(); OARequirements.deallocate(); ZoneAirDistribution.deallocate(); Zone.deallocate(); - state.dataAirLoop->AirLoopFlow.deallocate(); + state->dataAirLoop->AirLoopFlow.deallocate(); People.deallocate(); ZoneAirCO2.deallocate(); ZoneEquipConfig.deallocate(); @@ -5922,11 +5924,11 @@ TEST_F(EnergyPlusFixture, MixedAir_OAControllerOrderInControllersListTest) ASSERT_TRUE(process_idf(idf_objects)); - GetOAControllerInputs(state); + GetOAControllerInputs(*state); - GetOutsideAirSysInputs(state); + GetOutsideAirSysInputs(*state); - auto &CurrentOASystem(state.dataAirLoop->OutsideAirSys[0]); + auto &CurrentOASystem(state->dataAirLoop->OutsideAirSys[0]); EXPECT_EQ(CurrentOASystem.NumControllers, 3); EXPECT_EQ(CurrentOASystem.ControllerType(1), "CONTROLLER:WATERCOIL"); @@ -5940,7 +5942,7 @@ TEST_F(EnergyPlusFixture, MixedAir_OAControllerOrderInControllersListTest) int AirLoopNum = 0; bool FirstHVACIteration = true; // sim OAController with OAControllerIndex = 0 for the first time only - SimOAController(state, CurrentOASystem.OAControllerName, CurrentOASystem.OAControllerIndex, FirstHVACIteration, AirLoopNum); + SimOAController(*state, CurrentOASystem.OAControllerName, CurrentOASystem.OAControllerIndex, FirstHVACIteration, AirLoopNum); // OAControllerIndex is set during first time InitOAController run EXPECT_EQ(CurrentOASystem.OAControllerIndex, 1); } @@ -6004,9 +6006,9 @@ TEST_F(EnergyPlusFixture, OAController_ProportionalMinimum_HXBypassTest) }); ASSERT_TRUE(process_idf(idf_objects)); - GetOAControllerInputs(state); + GetOAControllerInputs(*state); EXPECT_EQ(2, OAController(1).OANode); - EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(state, OAController(1).OANode)); + EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(*state, OAController(1).OANode)); int OAControllerNum(1); int AirLoopNum(1); @@ -6014,16 +6016,16 @@ TEST_F(EnergyPlusFixture, OAController_ProportionalMinimum_HXBypassTest) DataHVACGlobals::NumPrimaryAirSys = 1; StdBaroPress = StdPressureSeaLevel; // assume dry air (zero humidity ratio) - StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, StdBaroPress, 20.0, 0.0); + StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, StdBaroPress, 20.0, 0.0); - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); - auto &curAirLoopFlow(state.dataAirLoop->AirLoopFlow(AirLoopNum)); + auto &curAirLoopFlow(state->dataAirLoop->AirLoopFlow(AirLoopNum)); auto &curOACntrl(OAController(OAControllerNum)); - auto &AirLoopCntrlInfo(state.dataAirLoop->AirLoopControlInfo(AirLoopNum)); - auto &PrimaryAirSys(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum)); + auto &AirLoopCntrlInfo(state->dataAirLoop->AirLoopControlInfo(AirLoopNum)); + auto &PrimaryAirSys(state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum)); PrimaryAirSys.NumBranches = 1; PrimaryAirSys.Branch.allocate(1); @@ -6091,7 +6093,7 @@ TEST_F(EnergyPlusFixture, OAController_ProportionalMinimum_HXBypassTest) OAMassFlowActual = OutAirMassFlowFracActual * MixedAirMassFlow; // run OA controller and OA economizer - curOACntrl.CalcOAController(state, AirLoopNum, true); + curOACntrl.CalcOAController(*state, AirLoopNum, true); // check min OA flow and fraction EXPECT_EQ(OAMassFlowAMin, curAirLoopFlow.MinOutAir); @@ -6102,7 +6104,7 @@ TEST_F(EnergyPlusFixture, OAController_ProportionalMinimum_HXBypassTest) // check HX bypass status EXPECT_GT(OAMassFlowActual, OAMassFlowAMin); EXPECT_EQ(1, curOACntrl.HeatRecoveryBypassStatus); - EXPECT_TRUE(state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); + EXPECT_TRUE(state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); } TEST_F(EnergyPlusFixture, OAController_FixedMinimum_MinimumLimitTypeTest) @@ -6190,17 +6192,17 @@ TEST_F(EnergyPlusFixture, OAController_FixedMinimum_MinimumLimitTypeTest) }); ASSERT_TRUE(process_idf(idf_objects)); - GetOutsideAirSysInputs(state); - EXPECT_EQ(1, state.dataAirLoop->NumOASystems); - EXPECT_EQ("OA SYS", state.dataAirLoop->OutsideAirSys(1).Name); + GetOutsideAirSysInputs(*state); + EXPECT_EQ(1, state->dataAirLoop->NumOASystems); + EXPECT_EQ("OA SYS", state->dataAirLoop->OutsideAirSys(1).Name); - EXPECT_EQ(2, state.dataAirLoop->OutsideAirSys(1).NumComponents); - EXPECT_EQ("OA HEAT RECOVERY", state.dataAirLoop->OutsideAirSys(1).ComponentName(1)); - EXPECT_EQ("OA MIXER", state.dataAirLoop->OutsideAirSys(1).ComponentName(2)); + EXPECT_EQ(2, state->dataAirLoop->OutsideAirSys(1).NumComponents); + EXPECT_EQ("OA HEAT RECOVERY", state->dataAirLoop->OutsideAirSys(1).ComponentName(1)); + EXPECT_EQ("OA MIXER", state->dataAirLoop->OutsideAirSys(1).ComponentName(2)); - GetOAControllerInputs(state); + GetOAControllerInputs(*state); EXPECT_EQ(5, OAController(1).OANode); - EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(state, OAController(1).OANode)); + EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(*state, OAController(1).OANode)); int OAControllerNum(1); int AirLoopNum(1); @@ -6208,16 +6210,16 @@ TEST_F(EnergyPlusFixture, OAController_FixedMinimum_MinimumLimitTypeTest) DataHVACGlobals::NumPrimaryAirSys = 1; StdBaroPress = StdPressureSeaLevel; // assume dry air (zero humidity ratio) - StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, StdBaroPress, 20.0, 0.0); + StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, StdBaroPress, 20.0, 0.0); - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); - auto &curAirLoopFlow(state.dataAirLoop->AirLoopFlow(AirLoopNum)); + auto &curAirLoopFlow(state->dataAirLoop->AirLoopFlow(AirLoopNum)); auto &curOACntrl(OAController(OAControllerNum)); - auto &AirLoopCntrlInfo(state.dataAirLoop->AirLoopControlInfo(AirLoopNum)); - auto &PrimaryAirSys(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum)); + auto &AirLoopCntrlInfo(state->dataAirLoop->AirLoopControlInfo(AirLoopNum)); + auto &PrimaryAirSys(state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum)); PrimaryAirSys.NumBranches = 1; PrimaryAirSys.Branch.allocate(1); @@ -6286,7 +6288,7 @@ TEST_F(EnergyPlusFixture, OAController_FixedMinimum_MinimumLimitTypeTest) OAMassFlowActual = OutAirMassFlowFracActual * MixedAirMassFlow; // run OA controller and OA economizer - curOACntrl.CalcOAController(state, AirLoopNum, true); + curOACntrl.CalcOAController(*state, AirLoopNum, true); // check min OA flow and fraction EXPECT_EQ(OAMassFlowAMin, curAirLoopFlow.MinOutAir); @@ -6297,7 +6299,7 @@ TEST_F(EnergyPlusFixture, OAController_FixedMinimum_MinimumLimitTypeTest) // check HX bypass status EXPECT_GT(OAMassFlowActual, OAMassFlowAMin); EXPECT_EQ(1, curOACntrl.HeatRecoveryBypassStatus); - EXPECT_TRUE(state.dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); + EXPECT_TRUE(state->dataAirLoop->AirLoopControlInfo(AirLoopNum).HeatRecoveryBypass); } TEST_F(EnergyPlusFixture, OAController_HighExhaustMassFlowTest) @@ -6397,18 +6399,18 @@ TEST_F(EnergyPlusFixture, OAController_HighExhaustMassFlowTest) }); ASSERT_TRUE(process_idf(idf_objects)); - GetOutsideAirSysInputs(state); - EXPECT_EQ(1, state.dataAirLoop->NumOASystems); - EXPECT_EQ("OA SYS", state.dataAirLoop->OutsideAirSys(1).Name); + GetOutsideAirSysInputs(*state); + EXPECT_EQ(1, state->dataAirLoop->NumOASystems); + EXPECT_EQ("OA SYS", state->dataAirLoop->OutsideAirSys(1).Name); - EXPECT_EQ(3, state.dataAirLoop->OutsideAirSys(1).NumComponents); - EXPECT_EQ("OA HEAT RECOVERY", state.dataAirLoop->OutsideAirSys(1).ComponentName(1)); - EXPECT_EQ("OA SYS HEATING COIL", state.dataAirLoop->OutsideAirSys(1).ComponentName(2)); - EXPECT_EQ("OA MIXER", state.dataAirLoop->OutsideAirSys(1).ComponentName(3)); + EXPECT_EQ(3, state->dataAirLoop->OutsideAirSys(1).NumComponents); + EXPECT_EQ("OA HEAT RECOVERY", state->dataAirLoop->OutsideAirSys(1).ComponentName(1)); + EXPECT_EQ("OA SYS HEATING COIL", state->dataAirLoop->OutsideAirSys(1).ComponentName(2)); + EXPECT_EQ("OA MIXER", state->dataAirLoop->OutsideAirSys(1).ComponentName(3)); - GetOAControllerInputs(state); + GetOAControllerInputs(*state); EXPECT_EQ(5, OAController(1).OANode); - EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(state, OAController(1).OANode)); + EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(*state, OAController(1).OANode)); int OAControllerNum(1); int AirLoopNum(1); @@ -6416,16 +6418,16 @@ TEST_F(EnergyPlusFixture, OAController_HighExhaustMassFlowTest) DataHVACGlobals::NumPrimaryAirSys = 1; DataEnvironment::StdBaroPress = DataEnvironment::StdPressureSeaLevel; // assume dry air (zero humidity ratio) - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::StdBaroPress, 20.0, 0.0); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::StdBaroPress, 20.0, 0.0); - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); - auto &curAirLoopFlow(state.dataAirLoop->AirLoopFlow(AirLoopNum)); + auto &curAirLoopFlow(state->dataAirLoop->AirLoopFlow(AirLoopNum)); auto &curOACntrl(OAController(OAControllerNum)); - auto &AirLoopCntrlInfo(state.dataAirLoop->AirLoopControlInfo(AirLoopNum)); - auto &PrimaryAirSys(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum)); + auto &AirLoopCntrlInfo(state->dataAirLoop->AirLoopControlInfo(AirLoopNum)); + auto &PrimaryAirSys(state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum)); PrimaryAirSys.NumBranches = 1; PrimaryAirSys.Branch.allocate(1); @@ -6496,7 +6498,7 @@ TEST_F(EnergyPlusFixture, OAController_HighExhaustMassFlowTest) OAMassFlowActual = OutAirMassFlowFracActual * MixedAirMassFlow; // run OA controller and OA economizer - curOACntrl.CalcOAController(state, AirLoopNum, true); + curOACntrl.CalcOAController(*state, AirLoopNum, true); // actual OA mass flow is not allowed to fall below exhaust mass flow // actual OA mass flow is dectated by the amount of exhaust mass flow OAMassFlowActual = max(curOACntrl.ExhMassFlow, curOACntrl.OAMassFlow); @@ -6528,7 +6530,7 @@ TEST_F(EnergyPlusFixture, OAController_HighExhaustMassFlowTest) // calc actual OA mass flow OAMassFlowActual = OutAirMassFlowFracActual * MixedAirMassFlow; // run OA controller and OA economizer - curOACntrl.CalcOAController(state, AirLoopNum, true); + curOACntrl.CalcOAController(*state, AirLoopNum, true); // actual OA mass flow is not allowed to fall below exhaust mass flow // actual OA mass flow is dectated by the amount of exhaust mass flow OAMassFlowActual = max(curOACntrl.ExhMassFlow, curOACntrl.OAMassFlow); @@ -6648,18 +6650,18 @@ TEST_F(EnergyPlusFixture, OAController_LowExhaustMassFlowTest) }); ASSERT_TRUE(process_idf(idf_objects)); - GetOutsideAirSysInputs(state); - EXPECT_EQ(1, state.dataAirLoop->NumOASystems); - EXPECT_EQ("OA SYS", state.dataAirLoop->OutsideAirSys(1).Name); + GetOutsideAirSysInputs(*state); + EXPECT_EQ(1, state->dataAirLoop->NumOASystems); + EXPECT_EQ("OA SYS", state->dataAirLoop->OutsideAirSys(1).Name); - EXPECT_EQ(3, state.dataAirLoop->OutsideAirSys(1).NumComponents); - EXPECT_EQ("OA HEAT RECOVERY", state.dataAirLoop->OutsideAirSys(1).ComponentName(1)); - EXPECT_EQ("OA SYS HEATING COIL", state.dataAirLoop->OutsideAirSys(1).ComponentName(2)); - EXPECT_EQ("OA MIXER", state.dataAirLoop->OutsideAirSys(1).ComponentName(3)); + EXPECT_EQ(3, state->dataAirLoop->OutsideAirSys(1).NumComponents); + EXPECT_EQ("OA HEAT RECOVERY", state->dataAirLoop->OutsideAirSys(1).ComponentName(1)); + EXPECT_EQ("OA SYS HEATING COIL", state->dataAirLoop->OutsideAirSys(1).ComponentName(2)); + EXPECT_EQ("OA MIXER", state->dataAirLoop->OutsideAirSys(1).ComponentName(3)); - GetOAControllerInputs(state); + GetOAControllerInputs(*state); EXPECT_EQ(5, OAController(1).OANode); - EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(state, OAController(1).OANode)); + EXPECT_TRUE(OutAirNodeManager::CheckOutAirNodeNumber(*state, OAController(1).OANode)); int OAControllerNum(1); int AirLoopNum(1); @@ -6667,16 +6669,16 @@ TEST_F(EnergyPlusFixture, OAController_LowExhaustMassFlowTest) DataHVACGlobals::NumPrimaryAirSys = 1; DataEnvironment::StdBaroPress = DataEnvironment::StdPressureSeaLevel; // assume dry air (zero humidity ratio) - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::StdBaroPress, 20.0, 0.0); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::StdBaroPress, 20.0, 0.0); - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); - auto &curAirLoopFlow(state.dataAirLoop->AirLoopFlow(AirLoopNum)); + auto &curAirLoopFlow(state->dataAirLoop->AirLoopFlow(AirLoopNum)); auto &curOACntrl(OAController(OAControllerNum)); - auto &AirLoopCntrlInfo(state.dataAirLoop->AirLoopControlInfo(AirLoopNum)); - auto &PrimaryAirSys(state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum)); + auto &AirLoopCntrlInfo(state->dataAirLoop->AirLoopControlInfo(AirLoopNum)); + auto &PrimaryAirSys(state->dataAirSystemsData->PrimaryAirSystems(AirLoopNum)); PrimaryAirSys.NumBranches = 1; PrimaryAirSys.Branch.allocate(1); @@ -6746,7 +6748,7 @@ TEST_F(EnergyPlusFixture, OAController_LowExhaustMassFlowTest) // calc actual OA mass flow OAMassFlowActual = OutAirMassFlowFracActual * MixedAirMassFlow; // run OA controller and OA economizer - curOACntrl.CalcOAController(state, AirLoopNum, true); + curOACntrl.CalcOAController(*state, AirLoopNum, true); OAMassFlowActual = max(curOACntrl.ExhMassFlow, curOACntrl.OAMassFlow); OutAirMassFlowFracActual = OAMassFlowActual / curOACntrl.MixMassFlow; // check min OA flow and fraction @@ -6776,7 +6778,7 @@ TEST_F(EnergyPlusFixture, OAController_LowExhaustMassFlowTest) // calc actual OA mass flow OAMassFlowActual = OutAirMassFlowFracActual * MixedAirMassFlow; // actual OA mass flow is not allowed to fall below exhaust mass flow - curOACntrl.CalcOAController(state, AirLoopNum, true); + curOACntrl.CalcOAController(*state, AirLoopNum, true); OAMassFlowActual = max(curOACntrl.ExhMassFlow, curOACntrl.OAMassFlow); OutAirMassFlowFracActual = OAMassFlowActual / curOACntrl.MixMassFlow; // check min OA flow and fraction diff --git a/tst/EnergyPlus/unit/MixerComponent.unit.cc b/tst/EnergyPlus/unit/MixerComponent.unit.cc index 21e6595fad6..a985de4d466 100644 --- a/tst/EnergyPlus/unit/MixerComponent.unit.cc +++ b/tst/EnergyPlus/unit/MixerComponent.unit.cc @@ -54,6 +54,7 @@ #include "Fixtures/EnergyPlusFixture.hh" #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::MixerComponent; @@ -74,10 +75,10 @@ TEST_F(EnergyPlusFixture, GetZoneMixerIndex) MixerCond(1).MixerName = "SPACE1-1 ATU Mixer"; MixerCond(2).MixerName = "SPACE2-1 ATU Mixer"; MixerCond(3).MixerName = "SPACE3-1 ATU Mixer"; - GetZoneMixerIndex(state, MixerCond(2).MixerName, MixerIndex, errFlag, CurrentModuleObject); + GetZoneMixerIndex(*state, MixerCond(2).MixerName, MixerIndex, errFlag, CurrentModuleObject); EXPECT_EQ(2, MixerIndex); EXPECT_FALSE(errFlag); - GetZoneMixerIndex(state, "SPACE3-3 ATU Mixer", MixerIndex, errFlag, CurrentModuleObject); + GetZoneMixerIndex(*state, "SPACE3-3 ATU Mixer", MixerIndex, errFlag, CurrentModuleObject); EXPECT_EQ(0, MixerIndex); EXPECT_TRUE(errFlag); } diff --git a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc index f02193564df..8538ae31fe2 100644 --- a/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc +++ b/tst/EnergyPlus/unit/MoistureBalanceEMPD.unit.cc @@ -68,6 +68,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; @@ -99,7 +100,7 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc) ASSERT_TRUE(process_idf(idf_objects)); bool errors_found(false); - HeatBalanceManager::GetMaterialData(state, errors_found); + HeatBalanceManager::GetMaterialData(*state, errors_found); ASSERT_FALSE(errors_found) << "Errors in GetMaterialData"; // Surface @@ -122,16 +123,16 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc) // Construction surface.Construction = 1; - state.dataConstruction->Construct.allocate(1); - Construction::ConstructionProps &construction = state.dataConstruction->Construct(1); + state->dataConstruction->Construct.allocate(1); + Construction::ConstructionProps &construction = state->dataConstruction->Construct(1); construction.TotLayers = 1; construction.LayerPoint(construction.TotLayers) = UtilityRoutines::FindItemInList("CONCRETE", dataMaterial.Material); // Initialize and get inputs - MoistureBalanceEMPDManager::InitMoistureBalanceEMPD(state); + MoistureBalanceEMPDManager::InitMoistureBalanceEMPD(*state); // Set up conditions - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZone = 0.25; DataEnvironment::OutBaroPress = 101325.; DataMoistureBalanceEMPD::RVSurface(1) = 0.007077173214149593; DataMoistureBalanceEMPD::RVSurfaceOld(1) = DataMoistureBalanceEMPD::RVSurface(1); @@ -144,7 +145,7 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc) // Do calcs Real64 Tsat(0.0); - MoistureBalanceEMPDManager::CalcMoistureBalanceEMPD(state, 1, 19.907302679986064, 19.901185713164697, Tsat); + MoistureBalanceEMPDManager::CalcMoistureBalanceEMPD(*state, 1, 19.907302679986064, 19.901185713164697, Tsat); auto const &report_vars = MoistureBalanceEMPDManager::EMPDReportVars(1); EXPECT_DOUBLE_EQ(6.3445188238394508, Tsat); @@ -188,9 +189,9 @@ TEST_F(EnergyPlusFixture, EMPDAutocalcDepth) ASSERT_TRUE(process_idf(idf_objects)); bool errors_found(false); - HeatBalanceManager::GetMaterialData(state, errors_found); + HeatBalanceManager::GetMaterialData(*state, errors_found); ASSERT_FALSE(errors_found) << "Errors in GetMaterialData"; - MoistureBalanceEMPDManager::GetMoistureBalanceEMPDInput(state); + MoistureBalanceEMPDManager::GetMoistureBalanceEMPDInput(*state); const Material::MaterialProperties &material = dataMaterial.Material(1); ASSERT_NEAR(material.EMPDSurfaceDepth, 0.014143, 0.000001); @@ -225,7 +226,7 @@ TEST_F(EnergyPlusFixture, EMPDRcoating) ASSERT_TRUE(process_idf(idf_objects)); bool errors_found(false); - HeatBalanceManager::GetMaterialData(state, errors_found); + HeatBalanceManager::GetMaterialData(*state, errors_found); ASSERT_FALSE(errors_found) << "Errors in GetMaterialData"; // Surface @@ -248,16 +249,16 @@ TEST_F(EnergyPlusFixture, EMPDRcoating) // Construction surface.Construction = 1; - state.dataConstruction->Construct.allocate(1); - Construction::ConstructionProps &construction = state.dataConstruction->Construct(1); + state->dataConstruction->Construct.allocate(1); + Construction::ConstructionProps &construction = state->dataConstruction->Construct(1); construction.TotLayers = 1; construction.LayerPoint(construction.TotLayers) = UtilityRoutines::FindItemInList("CONCRETE", dataMaterial.Material); // Initialize and get inputs - MoistureBalanceEMPDManager::InitMoistureBalanceEMPD(state); + MoistureBalanceEMPDManager::InitMoistureBalanceEMPD(*state); // Set up conditions - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZone = 0.25; DataEnvironment::OutBaroPress = 101325.; DataMoistureBalanceEMPD::RVSurface(1) = 0.007077173214149593; DataMoistureBalanceEMPD::RVSurfaceOld(1) = DataMoistureBalanceEMPD::RVSurface(1); @@ -270,7 +271,7 @@ TEST_F(EnergyPlusFixture, EMPDRcoating) // Do calcs Real64 Tsat(0.0); - MoistureBalanceEMPDManager::CalcMoistureBalanceEMPD(state, 1, 19.907302679986064, 19.901185713164697, Tsat); + MoistureBalanceEMPDManager::CalcMoistureBalanceEMPD(*state, 1, 19.907302679986064, 19.901185713164697, Tsat); auto const &report_vars = MoistureBalanceEMPDManager::EMPDReportVars(1); EXPECT_DOUBLE_EQ(6.3445188238394508, Tsat); @@ -314,7 +315,7 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc_Slope) ASSERT_TRUE(process_idf(idf_objects)); bool errors_found(false); - HeatBalanceManager::GetMaterialData(state, errors_found); + HeatBalanceManager::GetMaterialData(*state, errors_found); ASSERT_FALSE(errors_found) << "Errors in GetMaterialData"; // Surface @@ -340,16 +341,16 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc_Slope) // Construction int constNum = 1; surface.Construction = constNum; - state.dataConstruction->Construct.allocate( constNum ); - Construction::ConstructionProps &construction = state.dataConstruction->Construct( constNum ); + state->dataConstruction->Construct.allocate( constNum ); + Construction::ConstructionProps &construction = state->dataConstruction->Construct( constNum ); construction.TotLayers = constNum; construction.LayerPoint(construction.TotLayers) = UtilityRoutines::FindItemInList("WOOD", dataMaterial.Material); // Initialize and get inputs - MoistureBalanceEMPDManager::InitMoistureBalanceEMPD(state); + MoistureBalanceEMPDManager::InitMoistureBalanceEMPD(*state); // Set up conditions - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZone = 0.25; DataEnvironment::OutBaroPress = 101325.; DataMoistureBalanceEMPD::RVSurface(surfNum) = 0.0070277983586713262; DataMoistureBalanceEMPD::RVSurfaceOld(surfNum) = DataMoistureBalanceEMPD::RVSurface( surfNum ); @@ -379,9 +380,9 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc_Slope) material.MoistCCoeff * material.MoistDCoeff * pow(RHaver, material.MoistDCoeff - 1); // Convert stored vapor density to RH. - Real64 RH_deep_layer_old = PsyRhFnTdbRhov(state, Taver, RV_Deep_Old); - Real64 RH_surf_layer_old = PsyRhFnTdbRhov(state, Taver, RVaver); - Real64 mass_flux_surf_deep_max = material.EMPDDeepDepth * material.Density * dU_dRH * (RH_surf_layer_old - RH_deep_layer_old) / (state.dataGlobal->TimeStepZone * 3600.0); + Real64 RH_deep_layer_old = PsyRhFnTdbRhov(*state, Taver, RV_Deep_Old); + Real64 RH_surf_layer_old = PsyRhFnTdbRhov(*state, Taver, RVaver); + Real64 mass_flux_surf_deep_max = material.EMPDDeepDepth * material.Density * dU_dRH * (RH_surf_layer_old - RH_deep_layer_old) / (state->dataGlobal->TimeStepZone * 3600.0); Real64 hm_deep_layer = 6.9551289450635225e-05; Real64 mass_flux_surf_deep_result = hm_deep_layer * (RVaver - RV_Deep_Old); @@ -390,7 +391,7 @@ TEST_F(EnergyPlusFixture, CheckEMPDCalc_Slope) } // Calculate and verify it against the results determined above - MoistureBalanceEMPDManager::CalcMoistureBalanceEMPD(state, 1, Taver, Taver, Tsat); + MoistureBalanceEMPDManager::CalcMoistureBalanceEMPD(*state, 1, Taver, Taver, Tsat); auto const &report_vars = MoistureBalanceEMPDManager::EMPDReportVars(surfNum); EXPECT_DOUBLE_EQ(mass_flux_surf_deep_result, report_vars.mass_flux_deep); diff --git a/tst/EnergyPlus/unit/NodeInputManager.unit.cc b/tst/EnergyPlus/unit/NodeInputManager.unit.cc index 6a068ff7355..b474d9f26e8 100644 --- a/tst/EnergyPlus/unit/NodeInputManager.unit.cc +++ b/tst/EnergyPlus/unit/NodeInputManager.unit.cc @@ -59,6 +59,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::NodeInputManager; @@ -95,22 +96,22 @@ TEST_F(EnergyPlusFixture, NodeMoreInfoEMSsensorCheck1) ASSERT_TRUE(process_idf(idf_objects)); - OutAirNodeManager::SetOutAirNodes(state); + OutAirNodeManager::SetOutAirNodes(*state); - NodeInputManager::SetupNodeVarsForReporting(state); + NodeInputManager::SetupNodeVarsForReporting(*state); - EMSManager::CheckIfAnyEMS(state); + EMSManager::CheckIfAnyEMS(*state); EMSManager::FinishProcessingUserInput = true; bool anyEMSRan; - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyEMSRan, ObjexxFCL::Optional_int_const()); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyEMSRan, ObjexxFCL::Optional_int_const()); DataLoopNode::Node(1).Temp = 20.0; DataLoopNode::Node(1).HumRat = 0.01; DataEnvironment::OutBaroPress = 100000; - NodeInputManager::CalcMoreNodeInfo(state); + NodeInputManager::CalcMoreNodeInfo(*state); EXPECT_NEAR(DataLoopNode::MoreNodeInfo(1).RelHumidity, 67.65, 0.01); EXPECT_NEAR(DataLoopNode::MoreNodeInfo(1).AirDewPointTemp, 13.84, 0.01); @@ -122,22 +123,22 @@ TEST_F(EnergyPlusFixture, CheckUniqueNodesTest_Test1) { bool UniqueNodeError(false); - InitUniqueNodeCheck(state, "Context"); + InitUniqueNodeCheck(*state, "Context"); // set up initial list using names - CheckUniqueNodes(state, "NodeFieldName", "NodeName", UniqueNodeError, "TestInputNode1", _, "ObjectName"); - CheckUniqueNodes(state, "NodeFieldName", "NodeName", UniqueNodeError, "TestOutputNode1", _, "ObjectName"); - CheckUniqueNodes(state, "NodeFieldName", "NodeName", UniqueNodeError, "TestInputNode2", _, "ObjectName"); - CheckUniqueNodes(state, "NodeFieldName", "NodeName", UniqueNodeError, "TestOutputNode2", _, "ObjectName"); + CheckUniqueNodes(*state, "NodeFieldName", "NodeName", UniqueNodeError, "TestInputNode1", _, "ObjectName"); + CheckUniqueNodes(*state, "NodeFieldName", "NodeName", UniqueNodeError, "TestOutputNode1", _, "ObjectName"); + CheckUniqueNodes(*state, "NodeFieldName", "NodeName", UniqueNodeError, "TestInputNode2", _, "ObjectName"); + CheckUniqueNodes(*state, "NodeFieldName", "NodeName", UniqueNodeError, "TestOutputNode2", _, "ObjectName"); // now to test if a new node is in the list - should not be an error and should be false - CheckUniqueNodes(state, "NodeFieldName", "NodeName", UniqueNodeError, "NonUsedNode", _, "ObjectName"); + CheckUniqueNodes(*state, "NodeFieldName", "NodeName", UniqueNodeError, "NonUsedNode", _, "ObjectName"); EXPECT_FALSE(UniqueNodeError); // try one that is already in the list - should be an error and show up as true - CheckUniqueNodes(state, "NodeFieldName", "NodeName", UniqueNodeError, "TestInputNode2", _, "ObjectName"); + CheckUniqueNodes(*state, "NodeFieldName", "NodeName", UniqueNodeError, "TestInputNode2", _, "ObjectName"); EXPECT_TRUE(UniqueNodeError); - EndUniqueNodeCheck(state, "Context"); + EndUniqueNodeCheck(*state, "Context"); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc b/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc index 9fa114bfb2e..e5cfd020f05 100644 --- a/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc +++ b/tst/EnergyPlus/unit/OASystemHWPreheatCoil.unit.cc @@ -62,6 +62,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace ObjexxFCL; @@ -1041,22 +1042,22 @@ TEST_F(EnergyPlusFixture, OASystem_HotWaterPreheatCoilScheduledOffSim) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - SimulationManager::ManageSimulation(state); + SimulationManager::ManageSimulation(*state); - EXPECT_EQ(1, state.dataAirLoop->NumOASystems); - EXPECT_EQ("OA SYS 1", state.dataAirLoop->OutsideAirSys(OASysNum).Name); - EXPECT_EQ(2, state.dataAirLoop->OutsideAirSys(OASysNum).NumComponents); // there are two components in OA system - EXPECT_EQ("OA PREHEAT HW COIL", state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(1)); // pre heat hot water coil - EXPECT_EQ(state.dataWaterCoils->WaterCoil(1).Name, state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(1)); // pre heat hot water coil - EXPECT_EQ("OA MIXING BOX", state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(2)); // OA mixer + EXPECT_EQ(1, state->dataAirLoop->NumOASystems); + EXPECT_EQ("OA SYS 1", state->dataAirLoop->OutsideAirSys(OASysNum).Name); + EXPECT_EQ(2, state->dataAirLoop->OutsideAirSys(OASysNum).NumComponents); // there are two components in OA system + EXPECT_EQ("OA PREHEAT HW COIL", state->dataAirLoop->OutsideAirSys(OASysNum).ComponentName(1)); // pre heat hot water coil + EXPECT_EQ(state->dataWaterCoils->WaterCoil(1).Name, state->dataAirLoop->OutsideAirSys(OASysNum).ComponentName(1)); // pre heat hot water coil + EXPECT_EQ("OA MIXING BOX", state->dataAirLoop->OutsideAirSys(OASysNum).ComponentName(2)); // OA mixer // simulate the outdoor air system - ManageOutsideAirSystem(state, state.dataAirLoop->OutsideAirSys(OASysNum).Name, false, AirLoopNum, OASysNum); + ManageOutsideAirSystem(*state, state->dataAirLoop->OutsideAirSys(OASysNum).Name, false, AirLoopNum, OASysNum); // Hot water coil is scheduled off, inlet and outlet conditions are the same - EXPECT_DOUBLE_EQ(state.dataWaterCoils->WaterCoil(1).InletAirTemp, -17.3); // preheat Hot Water coil air inlet temp is the heating design day outdoor air temp - EXPECT_DOUBLE_EQ(state.dataWaterCoils->WaterCoil(1).OutletAirTemp, -17.3); // preheat Hot Water coil is scheduled off - EXPECT_DOUBLE_EQ(0.0, state.dataWaterCoils->WaterCoil(1).TotWaterHeatingCoilRate); // preheat Hot Water coil is scheduled off + EXPECT_DOUBLE_EQ(state->dataWaterCoils->WaterCoil(1).InletAirTemp, -17.3); // preheat Hot Water coil air inlet temp is the heating design day outdoor air temp + EXPECT_DOUBLE_EQ(state->dataWaterCoils->WaterCoil(1).OutletAirTemp, -17.3); // preheat Hot Water coil is scheduled off + EXPECT_DOUBLE_EQ(0.0, state->dataWaterCoils->WaterCoil(1).TotWaterHeatingCoilRate); // preheat Hot Water coil is scheduled off } TEST_F(EnergyPlusFixture, OASystem_HotWaterPreheatCoilScheduledOnSim) @@ -2019,34 +2020,34 @@ TEST_F(EnergyPlusFixture, OASystem_HotWaterPreheatCoilScheduledOnSim) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - SimulationManager::ManageSimulation(state); + SimulationManager::ManageSimulation(*state); - EXPECT_EQ(1, state.dataAirLoop->NumOASystems); - EXPECT_EQ("OA SYS 1", state.dataAirLoop->OutsideAirSys(OASysNum).Name); - EXPECT_EQ(2, state.dataAirLoop->OutsideAirSys(OASysNum).NumComponents); // there are two components in OA system - EXPECT_EQ("OA PREHEAT HW COIL", state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(1)); // pre heat hot water coil - EXPECT_EQ(state.dataWaterCoils->WaterCoil(1).Name, state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(1)); // pre heat hot water coil - EXPECT_EQ("OA MIXING BOX", state.dataAirLoop->OutsideAirSys(OASysNum).ComponentName(2)); // OA mixer + EXPECT_EQ(1, state->dataAirLoop->NumOASystems); + EXPECT_EQ("OA SYS 1", state->dataAirLoop->OutsideAirSys(OASysNum).Name); + EXPECT_EQ(2, state->dataAirLoop->OutsideAirSys(OASysNum).NumComponents); // there are two components in OA system + EXPECT_EQ("OA PREHEAT HW COIL", state->dataAirLoop->OutsideAirSys(OASysNum).ComponentName(1)); // pre heat hot water coil + EXPECT_EQ(state->dataWaterCoils->WaterCoil(1).Name, state->dataAirLoop->OutsideAirSys(OASysNum).ComponentName(1)); // pre heat hot water coil + EXPECT_EQ("OA MIXING BOX", state->dataAirLoop->OutsideAirSys(OASysNum).ComponentName(2)); // OA mixer // simulate the outdoor air system - ManageOutsideAirSystem(state, state.dataAirLoop->OutsideAirSys(OASysNum).Name, false, AirLoopNum, OASysNum); + ManageOutsideAirSystem(*state, state->dataAirLoop->OutsideAirSys(OASysNum).Name, false, AirLoopNum, OASysNum); - EXPECT_DOUBLE_EQ(state.dataWaterCoils->WaterCoil(1).InletAirTemp, -17.3); // preheat Hot Water coil air inlet temp is the heating design day outdoor air temp + EXPECT_DOUBLE_EQ(state->dataWaterCoils->WaterCoil(1).InletAirTemp, -17.3); // preheat Hot Water coil air inlet temp is the heating design day outdoor air temp - EXPECT_DOUBLE_EQ(11.6, Node(state.dataWaterCoils->WaterCoil(1).AirOutletNodeNum).TempSetPoint); // check the setpoint at the preheat Hot Water coil air outlet node - EXPECT_NEAR(11.6, state.dataWaterCoils->WaterCoil(1).OutletAirTemp, 0.01); // preheat hot water coil is on and is heating the OA air stream + EXPECT_DOUBLE_EQ(11.6, Node(state->dataWaterCoils->WaterCoil(1).AirOutletNodeNum).TempSetPoint); // check the setpoint at the preheat Hot Water coil air outlet node + EXPECT_NEAR(11.6, state->dataWaterCoils->WaterCoil(1).OutletAirTemp, 0.01); // preheat hot water coil is on and is heating the OA air stream - AirInletNodeNum = state.dataWaterCoils->WaterCoil(1).AirInletNodeNum; + AirInletNodeNum = state->dataWaterCoils->WaterCoil(1).AirInletNodeNum; CpAir = PsyCpAirFnW(Node(AirInletNodeNum).HumRat); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).TotWaterHeatingCoilRate, - state.dataWaterCoils->WaterCoil(1).InletAirMassFlowRate * CpAir * (state.dataWaterCoils->WaterCoil(1).OutletAirTemp - state.dataWaterCoils->WaterCoil(1).InletAirTemp), + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).TotWaterHeatingCoilRate, + state->dataWaterCoils->WaterCoil(1).InletAirMassFlowRate * CpAir * (state->dataWaterCoils->WaterCoil(1).OutletAirTemp - state->dataWaterCoils->WaterCoil(1).InletAirTemp), 1.0); // test that OA sys water coil bypasses normal controller calls before air loop simulation EXPECT_EQ("PREHEAT COIL CONTROLLER", HVACControllers::ControllerProps(1).ControllerName); EXPECT_TRUE(HVACControllers::ControllerProps(1).BypassControllerCalc); // test that water coil knows which controller controls the HW coil - EXPECT_EQ(state.dataWaterCoils->WaterCoil(1).ControllerIndex, 1); + EXPECT_EQ(state->dataWaterCoils->WaterCoil(1).ControllerIndex, 1); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/OutAirNodeManager.unit.cc b/tst/EnergyPlus/unit/OutAirNodeManager.unit.cc index 70940d7b993..10c90cab954 100644 --- a/tst/EnergyPlus/unit/OutAirNodeManager.unit.cc +++ b/tst/EnergyPlus/unit/OutAirNodeManager.unit.cc @@ -57,6 +57,7 @@ #include #include #include +#include //#include @@ -75,7 +76,7 @@ TEST_F(EnergyPlusFixture, OutAirNodeManager_OATdbTwbOverrideTest) DataEnvironment::WindSpeed = 2.0; DataEnvironment::WindDir = 0.0; DataEnvironment::OutBaroPress = 101325; - DataEnvironment::OutHumRat = Psychrometrics::PsyWFnTdbTwbPb(state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutWetBulbTemp, DataEnvironment::OutBaroPress); + DataEnvironment::OutHumRat = Psychrometrics::PsyWFnTdbTwbPb(*state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutWetBulbTemp, DataEnvironment::OutBaroPress); ScheduleManager::Schedule(1).CurrentValue = 24.0; OutsideAirNodeList(1) = 1; @@ -98,7 +99,7 @@ TEST_F(EnergyPlusFixture, OutAirNodeManager_OATdbTwbOverrideTest) DataLoopNode::Node(3).OutAirDryBulb = DataEnvironment::OutDryBulbTemp; DataLoopNode::Node(3).OutAirWetBulb = DataEnvironment::OutWetBulbTemp; - InitOutAirNodes(state); + InitOutAirNodes(*state); EXPECT_NEAR(14.6467, DataLoopNode::Node(1).OutAirWetBulb, 0.0001); EXPECT_NEAR(0.007253013, DataLoopNode::Node(2).HumRat, 0.000001); diff --git a/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc b/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc index 32f2111b7ad..93faf341d03 100644 --- a/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc +++ b/tst/EnergyPlus/unit/OutdoorAirUnit.unit.cc @@ -75,6 +75,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::CurveManager; @@ -289,11 +290,11 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataSizing::CurZoneEqNum = 1; DataEnvironment::OutBaroPress = 101325; // sea level DataZoneEquipment::ZoneEquipInputsFilled = true; // denotes zone equipment has been read in - DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); ZoneEqSizing.allocate(1); ZoneSizingRunDone = true; ZoneEqSizing(CurZoneEqNum).DesignSizeFromParent = false; @@ -302,12 +303,12 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) ZoneSysEnergyDemand.allocate(1); - ProcessScheduleInput(state); // read schedules - GetCurveInput(state); // read curves - GetZoneData(state, ErrorsFound); // read zone data + ProcessScheduleInput(*state); // read schedules + GetCurveInput(*state); // read curves + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - GetZoneEquipmentData(state); // read equipment list and connections + GetZoneEquipmentData(*state); // read equipment list and connections // Test coil sizing @@ -329,7 +330,7 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) FinalZoneSizing(CurZoneEqNum).CoolDesTemp = 13.1; // 55.58 F FinalZoneSizing(CurZoneEqNum).CoolDesHumRat = 0.009297628698818194; // humrat at 12.77777 C db / 12.6 C wb - ZoneInletNode = GetOutdoorAirUnitZoneInletNode(state, OAUnitNum); + ZoneInletNode = GetOutdoorAirUnitZoneInletNode(*state, OAUnitNum); // schedule values will get reset to 0 if initialized before GetInput Schedule(1).CurrentValue = 1.0; // enable the VRF condenser @@ -339,8 +340,8 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) DataLoopNode::Node(EAFanInletNode).MassFlowRate = 0.60215437; // zone exhaust flow rate DataLoopNode::Node(EAFanInletNode).MassFlowRateMaxAvail = 0.60215437; // exhaust fan will not turn on unless max avail is set - SetPredefinedTables(state); - SimOutdoorAirUnit(state, + SetPredefinedTables(*state); + SimOutdoorAirUnit(*state, "ZONE1OUTAIR", CurZoneNum, FirstHVACIteration, SysOutputProvided, LatOutputProvided, ZoneEquipList(CurZoneEqNum).EquipIndex(EquipPtr)); EXPECT_DOUBLE_EQ(FinalZoneSizing(CurZoneEqNum).MinOA, OutAirUnit(OAUnitNum).OutAirVolFlow); @@ -357,7 +358,7 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_AutoSize) // #6173 OutAirUnit(OAUnitNum).ExtAirMassFlow = 0.0; - CalcOutdoorAirUnit(state, OAUnitNum, CurZoneNum, FirstHVACIteration, SysOutputProvided, LatOutputProvided); + CalcOutdoorAirUnit(*state, OAUnitNum, CurZoneNum, FirstHVACIteration, SysOutputProvided, LatOutputProvided); std::string const error_string = delimited_string({ " ** Warning ** Air mass flow between zone supply and exhaust is not balanced. Only the first occurrence is reported.", @@ -548,24 +549,24 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_WaterCoolingCoilAutoSizeTest) ASSERT_TRUE(process_idf(idf_objects)); DataEnvironment::OutBaroPress = 101325.0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - state.dataGlobal->DoingSizing = true; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->DoingSizing = true; InitializePsychRoutines(); bool ErrorsFound(false); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ("THERMAL ZONE 1", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - Fans::GetFanInput(state); + Fans::GetFanInput(*state); - GetOutdoorAirUnitInputs(state); + GetOutdoorAirUnitInputs(*state); int OAUnitNum(1); EXPECT_EQ("OAU SUPPLY FAN", OutAirUnit(OAUnitNum).SFanName); @@ -593,37 +594,37 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_WaterCoolingCoilAutoSizeTest) loopsidebranch.Comp.allocate(1); } - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(1).Name = "ChilledWaterLoop"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = TypeOf_CoilWaterCooling; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; PlantSizData(1).PlantLoopName = "ChilledWaterLoop"; PlantSizData(1).ExitTemp = 6.7; PlantSizData(1).DeltaT = 5.0; PlantSizData(1).LoopType = DataSizing::CoolingLoop; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataGlobal->HourOfDay = 15; + state->dataGlobal->HourOfDay = 15; DataEnvironment::DSTIndicator = 0; DataEnvironment::Month = 7; DataEnvironment::DayOfMonth = 21; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; - DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, state.dataGlobal->HourOfDay); + DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, state->dataGlobal->HourOfDay); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); CurDeadBandOrSetback.allocate(1); @@ -643,7 +644,7 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_WaterCoolingCoilAutoSizeTest) FinalZoneSizing(CurZoneEqNum).DesCoolCoilInTemp = 30.0; FinalZoneSizing(CurZoneEqNum).DesCoolCoilInHumRat = 0.01; - DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(state, OutBaroPress, 30.0, 0.0); + DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(*state, OutBaroPress, 30.0, 0.0); FinalZoneSizing(CurZoneEqNum).CoolDesTemp = 12.8; FinalZoneSizing(CurZoneEqNum).CoolDesHumRat = 0.0080; @@ -652,18 +653,18 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_WaterCoolingCoilAutoSizeTest) OutAirUnit(OAUnitNum).OAEquip(1).MaxVolWaterFlow = DataSizing::AutoSize; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; bool FirstHVACIteration(true); int ZoneNum(1); - InitOutdoorAirUnit(state, OAUnitNum, ZoneNum, FirstHVACIteration); - EXPECT_EQ(state.dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate, OutAirUnit(OAUnitNum).OAEquip(1).MaxVolWaterFlow); + InitOutdoorAirUnit(*state, OAUnitNum, ZoneNum, FirstHVACIteration); + EXPECT_EQ(state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate, OutAirUnit(OAUnitNum).OAEquip(1).MaxVolWaterFlow); // calculate fan heat to get fan air-side delta T DataSizing::DataFanEnumType = DataAirSystems::objectVectorOOFanSystemModel; DataSizing::DataFanIndex = 0; DataSizing::DataAirFlowUsedForSizing = FinalZoneSizing(CurZoneEqNum).DesCoolVolFlow; - Real64 FanCoolLoad = DataAirSystems::calcFanDesignHeatGain(state, DataFanEnumType, DataFanIndex, DataAirFlowUsedForSizing); + Real64 FanCoolLoad = DataAirSystems::calcFanDesignHeatGain(*state, DataFanEnumType, DataFanIndex, DataAirFlowUsedForSizing); // do water flow rate sizing calculation Real64 DesAirMassFlow = FinalZoneSizing(CurZoneEqNum).DesCoolMassFlow; @@ -672,12 +673,12 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_WaterCoolingCoilAutoSizeTest) Real64 DesWaterCoolingCoilLoad = DesAirMassFlow * (EnthalpyAirIn - EnthalpyAirOut) + FanCoolLoad; Real64 CoilDesWaterDeltaT = PlantSizData(1).DeltaT; - Real64 Cp = GetSpecificHeatGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, " "); - Real64 rho = GetDensityGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, " "); + Real64 Cp = GetSpecificHeatGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, " "); + Real64 rho = GetDensityGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, " "); Real64 DesCoolingCoilWaterVolFlowRate = DesWaterCoolingCoilLoad / (CoilDesWaterDeltaT * Cp * rho); // check water coil water flow rate calc - EXPECT_EQ(DesWaterCoolingCoilLoad, state.dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate); - EXPECT_EQ(DesCoolingCoilWaterVolFlowRate, state.dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate); + EXPECT_EQ(DesWaterCoolingCoilLoad, state->dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate); + EXPECT_EQ(DesCoolingCoilWaterVolFlowRate, state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate); } TEST_F(EnergyPlusFixture, OutdoorAirUnit_SteamHeatingCoilAutoSizeTest) @@ -854,24 +855,24 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_SteamHeatingCoilAutoSizeTest) DataEnvironment::StdRhoAir = 1.20; DataEnvironment::OutBaroPress = 101325.0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - state.dataGlobal->DoingSizing = true; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->DoingSizing = true; InitializePsychRoutines(); bool ErrorsFound(false); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ("THERMAL ZONE 1", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - Fans::GetFanInput(state); + Fans::GetFanInput(*state); - GetOutdoorAirUnitInputs(state); + GetOutdoorAirUnitInputs(*state); int OAUnitNum(1); EXPECT_EQ("OAU SUPPLY FAN", OutAirUnit(OAUnitNum).SFanName); @@ -899,37 +900,37 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_SteamHeatingCoilAutoSizeTest) loopsidebranch.Comp.allocate(1); } - state.dataSteamCoils->SteamCoil(1).LoopNum = 1; - state.dataSteamCoils->SteamCoil(1).LoopSide = 1; - state.dataSteamCoils->SteamCoil(1).BranchNum = 1; - state.dataSteamCoils->SteamCoil(1).CompNum = 1; + state->dataSteamCoils->SteamCoil(1).LoopNum = 1; + state->dataSteamCoils->SteamCoil(1).LoopSide = 1; + state->dataSteamCoils->SteamCoil(1).BranchNum = 1; + state->dataSteamCoils->SteamCoil(1).CompNum = 1; PlantLoop(1).Name = "SteamLoop"; PlantLoop(1).FluidIndex = 0; PlantLoop(1).FluidName = "STEAM"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataSteamCoils->SteamCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataSteamCoils->SteamCoil(1).Name; PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = TypeOf_CoilSteamAirHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataSteamCoils->SteamCoil(1).SteamInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataSteamCoils->SteamCoil(1).SteamOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataSteamCoils->SteamCoil(1).SteamInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataSteamCoils->SteamCoil(1).SteamOutletNodeNum; PlantSizData(1).PlantLoopName = "SteamLoop"; PlantSizData(1).ExitTemp = 100.0; PlantSizData(1).DeltaT = 5.0; PlantSizData(1).LoopType = DataSizing::SteamLoop; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(2); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(2) = true; - state.dataGlobal->HourOfDay = 15; + state->dataGlobal->HourOfDay = 15; DataEnvironment::DSTIndicator = 0; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; - DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, state.dataGlobal->HourOfDay); + DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, state->dataGlobal->HourOfDay); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); CurDeadBandOrSetback.allocate(1); @@ -949,7 +950,7 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_SteamHeatingCoilAutoSizeTest) FinalZoneSizing(CurZoneEqNum).DesHeatCoilInTemp = 5.0; FinalZoneSizing(CurZoneEqNum).DesHeatCoilInHumRat = 0.005; - DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(state, OutBaroPress, 5.0, 0.0); + DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(*state, OutBaroPress, 5.0, 0.0); OutAirUnit(OAUnitNum).OAEquip(1).MaxVolWaterFlow = DataSizing::AutoSize; FinalZoneSizing(CurZoneEqNum).HeatDesTemp = 50.0; @@ -957,12 +958,12 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_SteamHeatingCoilAutoSizeTest) FinalZoneSizing(CurZoneEqNum).DesHeatDens = DataEnvironment::StdRhoAir; FinalZoneSizing(CurZoneEqNum).DesHeatMassFlow = FinalZoneSizing(CurZoneEqNum).DesHeatVolFlow * FinalZoneSizing(CurZoneEqNum).DesHeatDens; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; bool FirstHVACIteration(true); int ZoneNum(1); - InitOutdoorAirUnit(state, OAUnitNum, ZoneNum, FirstHVACIteration); - EXPECT_EQ(state.dataSteamCoils->SteamCoil(1).MaxSteamVolFlowRate, OutAirUnit(OAUnitNum).OAEquip(1).MaxVolWaterFlow); + InitOutdoorAirUnit(*state, OAUnitNum, ZoneNum, FirstHVACIteration); + EXPECT_EQ(state->dataSteamCoils->SteamCoil(1).MaxSteamVolFlowRate, OutAirUnit(OAUnitNum).OAEquip(1).MaxVolWaterFlow); Real64 DesCoilInTemp = FinalZoneSizing(CurZoneEqNum).DesHeatCoilInTemp; Real64 DesCoilOutTemp = FinalZoneSizing(CurZoneEqNum).HeatDesTemp; @@ -973,15 +974,15 @@ TEST_F(EnergyPlusFixture, OutdoorAirUnit_SteamHeatingCoilAutoSizeTest) Real64 DesSteamCoilLoad = DesAirMassFlow * CpAirAvg * (DesCoilOutTemp - DesCoilInTemp); // do steam flow rate sizing calculation - Real64 EnthSteamIn = GetSatEnthalpyRefrig(state, "STEAM", DataGlobalConstants::SteamInitConvTemp(), 1.0, state.dataSteamCoils->SteamCoil(1).FluidIndex, ""); - Real64 EnthSteamOut = GetSatEnthalpyRefrig(state, "STEAM", DataGlobalConstants::SteamInitConvTemp(), 0.0, state.dataSteamCoils->SteamCoil(1).FluidIndex, ""); - Real64 SteamDensity = GetSatDensityRefrig(state, "STEAM", DataGlobalConstants::SteamInitConvTemp(), 1.0, state.dataSteamCoils->SteamCoil(1).FluidIndex, ""); - Real64 CpOfCondensate = GetSatSpecificHeatRefrig(state, "STEAM", DataGlobalConstants::SteamInitConvTemp(), 0.0, state.dataSteamCoils->SteamCoil(1).FluidIndex, ""); + Real64 EnthSteamIn = GetSatEnthalpyRefrig(*state, "STEAM", DataGlobalConstants::SteamInitConvTemp(), 1.0, state->dataSteamCoils->SteamCoil(1).FluidIndex, ""); + Real64 EnthSteamOut = GetSatEnthalpyRefrig(*state, "STEAM", DataGlobalConstants::SteamInitConvTemp(), 0.0, state->dataSteamCoils->SteamCoil(1).FluidIndex, ""); + Real64 SteamDensity = GetSatDensityRefrig(*state, "STEAM", DataGlobalConstants::SteamInitConvTemp(), 1.0, state->dataSteamCoils->SteamCoil(1).FluidIndex, ""); + Real64 CpOfCondensate = GetSatSpecificHeatRefrig(*state, "STEAM", DataGlobalConstants::SteamInitConvTemp(), 0.0, state->dataSteamCoils->SteamCoil(1).FluidIndex, ""); Real64 LatentHeatChange = EnthSteamIn - EnthSteamOut; - Real64 DesMaxSteamVolFlowRate = DesSteamCoilLoad / (SteamDensity * (LatentHeatChange + state.dataSteamCoils->SteamCoil(1).DegOfSubcooling * CpOfCondensate)); + Real64 DesMaxSteamVolFlowRate = DesSteamCoilLoad / (SteamDensity * (LatentHeatChange + state->dataSteamCoils->SteamCoil(1).DegOfSubcooling * CpOfCondensate)); // check water coil water flow rate calc - EXPECT_EQ(DesSteamCoilLoad, state.dataSteamCoils->SteamCoil(1).DesCoilCapacity); - EXPECT_EQ(DesMaxSteamVolFlowRate, state.dataSteamCoils->SteamCoil(1).MaxSteamVolFlowRate); + EXPECT_EQ(DesSteamCoilLoad, state->dataSteamCoils->SteamCoil(1).DesCoilCapacity); + EXPECT_EQ(DesMaxSteamVolFlowRate, state->dataSteamCoils->SteamCoil(1).MaxSteamVolFlowRate); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/OutputFiles.unit.cc b/tst/EnergyPlus/unit/OutputFiles.unit.cc index b598611884e..def8d500037 100644 --- a/tst/EnergyPlus/unit/OutputFiles.unit.cc +++ b/tst/EnergyPlus/unit/OutputFiles.unit.cc @@ -53,6 +53,7 @@ // EnergyPlus Headers #include "Fixtures/EnergyPlusFixture.hh" +#include namespace EnergyPlus { TEST_F(EnergyPlusFixture, OutputFiles_Expected_Formatting_Tests) diff --git a/tst/EnergyPlus/unit/OutputProcessor.unit.cc b/tst/EnergyPlus/unit/OutputProcessor.unit.cc index ea9f1a1a15c..b07c1c43a3f 100644 --- a/tst/EnergyPlus/unit/OutputProcessor.unit.cc +++ b/tst/EnergyPlus/unit/OutputProcessor.unit.cc @@ -65,6 +65,7 @@ #include #include +#include using namespace EnergyPlus::PurchasedAirManager; using namespace EnergyPlus::WeatherManager; @@ -96,7 +97,7 @@ namespace OutputProcessor { ResourceTypes.insert(std::pair(varN, DataGlobalConstants::ResourceType::None)); } - GetMeteredVariables(state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); + GetMeteredVariables(*state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); EXPECT_EQ(0, NumFound); @@ -116,7 +117,7 @@ namespace OutputProcessor { EnergyMeters.allocate(10); EnergyMeters(1).ResourceType = NameOfComp; - GetMeteredVariables(state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); + GetMeteredVariables(*state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); EXPECT_EQ(1, NumFound); } @@ -152,9 +153,9 @@ namespace OutputProcessor { TimeStepStampReportNbr = 1; TimeStepStampReportChr = "1"; - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->DayOfSimChr = "1"; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSimChr = "1"; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 21; DataEnvironment::DSTIndicator = 0; @@ -164,7 +165,7 @@ namespace OutputProcessor { int StartMinute = 0; bool PrintESOTimeStamp = true; - ReportTSMeters(state, StartMinute, EndMinute, PrintESOTimeStamp, true); + ReportTSMeters(*state, StartMinute, EndMinute, PrintESOTimeStamp, true); auto result = queryResult("SELECT * FROM Time;", "Time"); @@ -218,9 +219,9 @@ namespace OutputProcessor { TimeStepStampReportNbr = 1; TimeStepStampReportChr = "1"; - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->DayOfSimChr = "1"; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSimChr = "1"; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 21; DataEnvironment::DSTIndicator = 0; @@ -230,7 +231,7 @@ namespace OutputProcessor { int StartMinute = 0; bool PrintESOTimeStamp = false; - ReportTSMeters(state, StartMinute, EndMinute, PrintESOTimeStamp, true); + ReportTSMeters(*state, StartMinute, EndMinute, PrintESOTimeStamp, true); auto result = queryResult("SELECT * FROM Time;", "Time"); @@ -282,16 +283,16 @@ namespace OutputProcessor { TimeStepStampReportNbr = 1; TimeStepStampReportChr = "1"; - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->DayOfSimChr = "1"; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSimChr = "1"; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 21; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 3; - ReportHRMeters(state, true); + ReportHRMeters(*state, true); auto result = queryResult("SELECT * FROM Time;", "Time"); @@ -350,16 +351,16 @@ namespace OutputProcessor { DailyStampReportNbr = 1; DailyStampReportChr = "1"; - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->DayOfSimChr = "1"; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSimChr = "1"; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 21; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 3; - ReportDYMeters(state, true); + ReportDYMeters(*state, true); auto result = queryResult("SELECT * FROM Time;", "Time"); @@ -422,16 +423,16 @@ namespace OutputProcessor { MonthlyStampReportNbr = 1; MonthlyStampReportChr = "1"; - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->DayOfSimChr = "1"; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSimChr = "1"; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 21; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 3; - ReportMNMeters(state, true); + ReportMNMeters(*state, true); auto result = queryResult("SELECT * FROM Time;", "Time"); @@ -494,16 +495,16 @@ namespace OutputProcessor { RunPeriodStampReportNbr = 1; RunPeriodStampReportChr = "1"; - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->DayOfSimChr = "1"; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSimChr = "1"; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 21; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 3; - ReportSMMeters(state, true); + ReportSMMeters(*state, true); auto result = queryResult("SELECT * FROM Time;", "Time"); @@ -566,18 +567,18 @@ namespace OutputProcessor { YearlyStampReportNbr = 1; YearlyStampReportChr = "1"; - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->DayOfSimChr = "1"; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->CalendarYear = 2017; - state.dataGlobal->CalendarYearChr = "2017"; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSimChr = "1"; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->CalendarYear = 2017; + state->dataGlobal->CalendarYearChr = "2017"; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 21; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 3; - OutputProcessor::ReportYRMeters(state, true); + OutputProcessor::ReportYRMeters(*state, true); auto result = queryResult("SELECT * FROM Time;", "Time"); @@ -616,20 +617,20 @@ namespace OutputProcessor { int RunPeriodStampReportNbr = 1; std::string RunPeriodStampReportChr = "1"; - state.dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSim = 1; std::string DayOfSimChr = "1"; bool PrintTimeStamp = true; int Month = 12; int DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; int EndMinute = 10; int StartMinute = 0; int DSTIndicator = 0; int CurDayType = 10; // TSMeter - WriteTimeStampFormatData(state, - state.files.mtr, + WriteTimeStampFormatData(*state, + state->files.mtr, ReportingFrequency::TimeStep, TimeStepStampReportNbr, TimeStepStampReportChr, @@ -637,7 +638,7 @@ namespace OutputProcessor { PrintTimeStamp, Month, DayOfMonth, - state.dataGlobal->HourOfDay, + state->dataGlobal->HourOfDay, EndMinute, StartMinute, DSTIndicator, @@ -645,8 +646,8 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,1,12,21, 0, 1, 0.00,10.00,WinterDesignDay"}, "\n"))); // TSMeter - WriteTimeStampFormatData(state, - state.files.mtr, + WriteTimeStampFormatData(*state, + state->files.mtr, ReportingFrequency::EachCall, TimeStepStampReportNbr, TimeStepStampReportChr, @@ -654,7 +655,7 @@ namespace OutputProcessor { PrintTimeStamp, Month, DayOfMonth, - state.dataGlobal->HourOfDay, + state->dataGlobal->HourOfDay, EndMinute, StartMinute, DSTIndicator, @@ -662,8 +663,8 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,1,12,21, 0, 1, 0.00,10.00,WinterDesignDay"}, "\n"))); // HRMeter - WriteTimeStampFormatData(state, - state.files.mtr, + WriteTimeStampFormatData(*state, + state->files.mtr, ReportingFrequency::Hourly, TimeStepStampReportNbr, TimeStepStampReportChr, @@ -671,7 +672,7 @@ namespace OutputProcessor { PrintTimeStamp, Month, DayOfMonth, - state.dataGlobal->HourOfDay, + state->dataGlobal->HourOfDay, _, _, DSTIndicator, @@ -679,8 +680,8 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,1,12,21, 0, 1, 0.00,60.00,WinterDesignDay"}, "\n"))); // DYMeter - WriteTimeStampFormatData(state, - state.files.mtr, + WriteTimeStampFormatData(*state, + state->files.mtr, ReportingFrequency::Daily, DailyStampReportNbr, DailyStampReportChr, @@ -696,8 +697,8 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,1,12,21, 0,WinterDesignDay"}, "\n"))); // MNMeter - WriteTimeStampFormatData(state, - state.files.mtr, + WriteTimeStampFormatData(*state, + state->files.mtr, ReportingFrequency::Monthly, MonthlyStampReportNbr, MonthlyStampReportChr, @@ -713,8 +714,8 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,1,12"}, "\n"))); // SMMeter - WriteTimeStampFormatData(state, - state.files.mtr, + WriteTimeStampFormatData(*state, + state->files.mtr, ReportingFrequency::Simulation, RunPeriodStampReportNbr, RunPeriodStampReportChr, @@ -730,8 +731,8 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,1"}, "\n"))); // Bad input - WriteTimeStampFormatData(state, - state.files.mtr, + WriteTimeStampFormatData(*state, + state->files.mtr, static_cast(999), RunPeriodStampReportNbr, RunPeriodStampReportChr, @@ -762,21 +763,21 @@ namespace OutputProcessor { TEST_F(SQLiteFixture, OutputProcessor_writeReportMeterData) { - state.dataGlobal->MinutesPerTimeStep = 10; + state->dataGlobal->MinutesPerTimeStep = 10; EnergyPlus::sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); EnergyPlus::sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false, _); - WriteReportMeterData(state, 1, "1", 999.9, ReportingFrequency::TimeStep, 0.0, 0, 0.0, 0, false); + WriteReportMeterData(*state, 1, "1", 999.9, ReportingFrequency::TimeStep, 0.0, 0, 0.0, 0, false); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,999.9"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,999.9"}, "\n"))); - WriteReportMeterData(state, 1, "1", 999.9, ReportingFrequency::EachCall, 0.0, 0, 0.0, 0, false); + WriteReportMeterData(*state, 1, "1", 999.9, ReportingFrequency::EachCall, 0.0, 0, 0.0, 0, false); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,999.9"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,999.9"}, "\n"))); - WriteReportMeterData(state, + WriteReportMeterData(*state, 1, "1", 616771620.98702729, @@ -789,7 +790,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,616771620.9870273"}, "\n"))); - WriteReportMeterData(state, + WriteReportMeterData(*state, 1, "1", 616771620.98702729, @@ -802,7 +803,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273,4283136.251683925, 1,10,4283136.2587211779,24,60"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,616771620.9870273,4283136.251683925, 1,10,4283136.2587211779,24,60"}, "\n"))); - WriteReportMeterData(state, + WriteReportMeterData(*state, 1, "1", 616771620.98702729, @@ -815,7 +816,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273,4283136.251683925,21, 1,10,4283136.2587211779,21,24,60"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,616771620.9870273,4283136.251683925,21, 1,10,4283136.2587211779,21,24,60"}, "\n"))); - WriteReportMeterData(state, + WriteReportMeterData(*state, 1, "1", 616771620.98702729, @@ -828,7 +829,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273,4283136.251683925,12,21, 1,10,4283136.2587211779,12,21,24,60"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,616771620.9870273,4283136.251683925,12,21, 1,10,4283136.2587211779,12,21,24,60"}, "\n"))); - WriteReportMeterData(state, + WriteReportMeterData(*state, 1, "1", 616771620.98702729, @@ -840,7 +841,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273"}, "\n"))); - WriteReportMeterData(state, + WriteReportMeterData(*state, 1, "1", 616771620.98702729, @@ -852,7 +853,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273"}, "\n"))); - WriteReportMeterData(state, + WriteReportMeterData(*state, 1, "1", 616771620.98702729, @@ -864,7 +865,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273"}, "\n"))); - WriteReportMeterData(state, + WriteReportMeterData(*state, 1, "1", 616771620.98702729, @@ -876,7 +877,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273,4283136.251683925, 1,10,4283136.2587211779,24,60"}, "\n"))); - WriteReportMeterData(state, + WriteReportMeterData(*state, 1, "1", 616771620.98702729, @@ -888,7 +889,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273,4283136.251683925,21, 1,10,4283136.2587211779,21,24,60"}, "\n"))); - WriteReportMeterData(state, + WriteReportMeterData(*state, 1, "1", 616771620.98702729, @@ -900,7 +901,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273,4283136.251683925,12,21, 1,10,4283136.2587211779,12,21,24,60"}, "\n"))); - WriteReportMeterData(state, 1, "1", 0, ReportingFrequency::TimeStep, 0.0, 0, 0.0, 0, false); + WriteReportMeterData(*state, 1, "1", 0, ReportingFrequency::TimeStep, 0.0, 0, 0.0, 0, false); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,0.0"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.0"}, "\n"))); @@ -941,20 +942,20 @@ namespace OutputProcessor { EnergyPlus::sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false, _); - WriteReportRealData(state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::TimeStep, 0.0, 0, 0.0, 0); + WriteReportRealData(*state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::TimeStep, 0.0, 0, 0.0, 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,999.9"}, "\n"))); - WriteReportRealData(state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::EachCall, 0.0, 0, 0.0, 0); + WriteReportRealData(*state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::EachCall, 0.0, 0, 0.0, 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,999.9"}, "\n"))); - WriteReportRealData(state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::Hourly, 0.0, 0, 0.0, 0); + WriteReportRealData(*state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::Hourly, 0.0, 0, 0.0, 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,999.9"}, "\n"))); - WriteReportRealData(state, + WriteReportRealData(*state, 1, "1", 616771620.98702729, StoreType::Summed, 1, ReportingFrequency::Daily, 4283136.2516839253, 12210110, 4283136.2587211775, 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,616771620.9870273,4283136.251683925, 1,10,4283136.2587211779,24,60"}, "\n"))); - WriteReportRealData(state,1, + WriteReportRealData(*state,1, "1", 616771620.98702729, StoreType::Summed, @@ -966,7 +967,7 @@ namespace OutputProcessor { 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,616771620.9870273,4283136.251683925,21, 1,10,4283136.2587211779,21,24,60"}, "\n"))); - WriteReportRealData(state,1, + WriteReportRealData(*state,1, "1", 616771620.98702729, StoreType::Summed, @@ -978,7 +979,7 @@ namespace OutputProcessor { 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,616771620.9870273,4283136.251683925,12,21, 1,10,4283136.2587211779,12,21,24,60"}, "\n"))); - WriteReportRealData(state,1, + WriteReportRealData(*state,1, "1", 616771620.98702729, StoreType::Averaged, @@ -990,7 +991,7 @@ namespace OutputProcessor { 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.09870273"}, "\n"))); - WriteReportRealData(state,1, + WriteReportRealData(*state,1, "1", 616771620.98702729, StoreType::Averaged, @@ -1002,7 +1003,7 @@ namespace OutputProcessor { 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.09870273"}, "\n"))); - WriteReportRealData(state,1, + WriteReportRealData(*state,1, "1", 616771620.98702729, StoreType::Averaged, @@ -1014,7 +1015,7 @@ namespace OutputProcessor { 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.09870273"}, "\n"))); - WriteReportRealData(state,1, + WriteReportRealData(*state,1, "1", 616771620.98702729, StoreType::Averaged, @@ -1026,7 +1027,7 @@ namespace OutputProcessor { 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.09870273,4283136.251683925, 1,10,4283136.2587211779,24,60"}, "\n"))); - WriteReportRealData(state,1, + WriteReportRealData(*state,1, "1", 616771620.98702729, StoreType::Averaged, @@ -1038,7 +1039,7 @@ namespace OutputProcessor { 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.09870273,4283136.251683925,21, 1,10,4283136.2587211779,21,24,60"}, "\n"))); - WriteReportRealData(state,1, + WriteReportRealData(*state,1, "1", 616771620.98702729, StoreType::Averaged, @@ -1050,7 +1051,7 @@ namespace OutputProcessor { 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.09870273,4283136.251683925,12,21, 1,10,4283136.2587211779,12,21,24,60"}, "\n"))); - WriteReportRealData(state, 1, "1", 0, StoreType::Summed, 1, ReportingFrequency::TimeStep, 0.0, 0, 0.0, 0); + WriteReportRealData(*state, 1, "1", 0, StoreType::Summed, 1, ReportingFrequency::TimeStep, 0.0, 0, 0.0, 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.0"}, "\n"))); auto reportDataResults = queryResult("SELECT * FROM ReportData;", "ReportData"); @@ -1088,49 +1089,49 @@ namespace OutputProcessor { EnergyPlus::sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false, _); - WriteReportIntegerData(state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::TimeStep, 0, 0, 0, 0); + WriteReportIntegerData(*state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::TimeStep, 0, 0, 0, 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,999.9"}, "\n"))); - WriteReportIntegerData(state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::EachCall, 0, 0, 0, 0); + WriteReportIntegerData(*state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::EachCall, 0, 0, 0, 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,999.9"}, "\n"))); - WriteReportIntegerData(state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::Hourly, 0, 0, 0, 0); + WriteReportIntegerData(*state, 1, "1", 999.9, StoreType::Summed, 1, ReportingFrequency::Hourly, 0, 0, 0, 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,999.9"}, "\n"))); WriteReportIntegerData( - state, 1, "1", 616771620.98702729, StoreType::Summed, 1, ReportingFrequency::Daily, 4283136, 12210110, 4283196, 12212460); + *state, 1, "1", 616771620.98702729, StoreType::Summed, 1, ReportingFrequency::Daily, 4283136, 12210110, 4283196, 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,616771620.987027,4283136, 1,10,4283196,24,60"}, "\n"))); WriteReportIntegerData( - state, 1, "1", 616771620.98702729, StoreType::Summed, 1, ReportingFrequency::Monthly, 4283136, 12210110, 4283196, 12212460); + *state, 1, "1", 616771620.98702729, StoreType::Summed, 1, ReportingFrequency::Monthly, 4283136, 12210110, 4283196, 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,616771620.987027,4283136,21, 1,10,4283196,21,24,60"}, "\n"))); - WriteReportIntegerData(state, + WriteReportIntegerData(*state, 1, "1", 616771620.98702729, StoreType::Summed, 1, ReportingFrequency::Simulation, 4283136, 12210110, 4283196, 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,616771620.987027,4283136,12,21, 1,10,4283196,12,21,24,60"}, "\n"))); - WriteReportIntegerData(state, 1, "1", 616771620.98702729, StoreType::Averaged, 10, ReportingFrequency::TimeStep, 0, 0, 0, 0); + WriteReportIntegerData(*state, 1, "1", 616771620.98702729, StoreType::Averaged, 10, ReportingFrequency::TimeStep, 0, 0, 0, 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.0987027"}, "\n"))); - WriteReportIntegerData(state, 1, "1", 616771620.98702729, StoreType::Averaged, 10, ReportingFrequency::EachCall, 0, 0, 0, 0); + WriteReportIntegerData(*state, 1, "1", 616771620.98702729, StoreType::Averaged, 10, ReportingFrequency::EachCall, 0, 0, 0, 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.0987027"}, "\n"))); - WriteReportIntegerData(state, 1, "1", 616771620.98702729, StoreType::Averaged, 10, ReportingFrequency::Hourly, 0, 0, 0, 0); + WriteReportIntegerData(*state, 1, "1", 616771620.98702729, StoreType::Averaged, 10, ReportingFrequency::Hourly, 0, 0, 0, 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.0987027"}, "\n"))); WriteReportIntegerData( - state, 1, "1", 616771620.98702729, StoreType::Averaged, 10, ReportingFrequency::Daily, 4283136, 12210110, 4283196, 12212460); + *state, 1, "1", 616771620.98702729, StoreType::Averaged, 10, ReportingFrequency::Daily, 4283136, 12210110, 4283196, 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.0987027,4283136, 1,10,4283196,24,60"}, "\n"))); - WriteReportIntegerData(state, + WriteReportIntegerData(*state, 1, "1", 616771620.98702729, StoreType::Averaged, 10, ReportingFrequency::Monthly, 4283136, 12210110, 4283196, 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.0987027,4283136,21, 1,10,4283196,21,24,60"}, "\n"))); - WriteReportIntegerData(state, + WriteReportIntegerData(*state, 1, "1", 616771620.98702729, StoreType::Averaged, 10, ReportingFrequency::Simulation, 4283136, 12210110, 4283196, 12212460); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,61677162.0987027,4283136,12,21, 1,10,4283196,12,21,24,60"}, "\n"))); - WriteReportIntegerData(state, 1, "1", 0, StoreType::Summed, 1, ReportingFrequency::TimeStep, 0, 0, 0, 0); + WriteReportIntegerData(*state, 1, "1", 0, StoreType::Summed, 1, ReportingFrequency::TimeStep, 0, 0, 0, 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.0"}, "\n"))); auto reportDataResults = queryResult("SELECT * FROM ReportData;", "ReportData"); @@ -1168,25 +1169,25 @@ namespace OutputProcessor { EnergyPlus::sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false, _); - WriteNumericData(state, 1, "1", 999); + WriteNumericData(*state, 1, "1", 999); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,999"}, "\n"))); - WriteNumericData(state, 1, "1", 0); + WriteNumericData(*state, 1, "1", 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0"}, "\n"))); - WriteNumericData(state, 1, "1", -999); + WriteNumericData(*state, 1, "1", -999); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,-999"}, "\n"))); - WriteNumericData(state, 1, "1", 999.9); + WriteNumericData(*state, 1, "1", 999.9); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,999.9"}, "\n"))); - WriteNumericData(state, 1, "1", 0.0); + WriteNumericData(*state, 1, "1", 0.0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.0"}, "\n"))); - WriteNumericData(state, 1, "1", -999.9); + WriteNumericData(*state, 1, "1", -999.9); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,-999.9"}, "\n"))); - WriteNumericData(state, 1, "1", 0); + WriteNumericData(*state, 1, "1", 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0"}, "\n"))); auto reportDataResults = queryResult("SELECT * FROM ReportData;", "ReportData"); @@ -1270,7 +1271,7 @@ namespace OutputProcessor { bool error_found = false; for (auto const &meterType : resource_map) { - GetStandardMeterResourceType(state, out_resource_type, meterType.first, error_found); + GetStandardMeterResourceType(*state, out_resource_type, meterType.first, error_found); EXPECT_EQ(meterType.second, out_resource_type); EXPECT_FALSE(error_found); } @@ -1280,7 +1281,7 @@ namespace OutputProcessor { auto const meterType = "BAD INPUT"; out_resource_type = "BAD INPUT"; - GetStandardMeterResourceType(state, out_resource_type, meterType, error_found); + GetStandardMeterResourceType(*state, out_resource_type, meterType, error_found); EXPECT_EQ(meterType, out_resource_type); EXPECT_TRUE(error_found); @@ -1326,14 +1327,14 @@ namespace OutputProcessor { auto const calledFrom = "UnitTest"; for (auto const &indexGroup : resource_map) { - EXPECT_EQ(indexGroup.second, ValidateTimeStepType(state, indexGroup.first, calledFrom)) << "where indexTypeKey is " << indexGroup.first; + EXPECT_EQ(indexGroup.second, ValidateTimeStepType(*state, indexGroup.first, calledFrom)) << "where indexTypeKey is " << indexGroup.first; } } TEST_F(SQLiteFixture, OutputProcessor_DeathTest_validateTimeStepType) { auto const calledFrom = "UnitTest"; - EXPECT_ANY_THROW(ValidateTimeStepType(state, "BAD INPUT", calledFrom)); + EXPECT_ANY_THROW(ValidateTimeStepType(*state, "BAD INPUT", calledFrom)); } TEST_F(SQLiteFixture, OutputProcessor_standardIndexTypeKey) @@ -1358,14 +1359,14 @@ namespace OutputProcessor { {"SUMMED", StoreType::Summed}}; for (auto const &variableType : resource_map) { - EXPECT_EQ(variableType.second, validateVariableType(state, variableType.first)) << "where variableTypeKey is " << variableType.first; + EXPECT_EQ(variableType.second, validateVariableType(*state, variableType.first)) << "where variableTypeKey is " << variableType.first; } EnergyPlus::sqlite->createSQLiteSimulationsRecord(1, "EnergyPlus Version", "Current Time"); std::string const variableTypeKey = "BAD INPUT"; - auto index = validateVariableType(state, variableTypeKey); + auto index = validateVariableType(*state, variableTypeKey); EXPECT_EQ(StoreType::Averaged, index); @@ -1388,43 +1389,43 @@ namespace OutputProcessor { int ipUnits = -999999; bool errorFound = false; - DetermineMeterIPUnits(state, ipUnits, "ELEC", OutputProcessor::Unit::J, errorFound); + DetermineMeterIPUnits(*state, ipUnits, "ELEC", OutputProcessor::Unit::J, errorFound); EXPECT_EQ(RT_IPUnits_Electricity, ipUnits); EXPECT_FALSE(errorFound); - DetermineMeterIPUnits(state, ipUnits, "GAS", OutputProcessor::Unit::J, errorFound); + DetermineMeterIPUnits(*state, ipUnits, "GAS", OutputProcessor::Unit::J, errorFound); EXPECT_EQ(RT_IPUnits_Gas, ipUnits); EXPECT_FALSE(errorFound); - DetermineMeterIPUnits(state, ipUnits, "COOL", OutputProcessor::Unit::J, errorFound); + DetermineMeterIPUnits(*state, ipUnits, "COOL", OutputProcessor::Unit::J, errorFound); EXPECT_EQ(RT_IPUnits_Cooling, ipUnits); EXPECT_FALSE(errorFound); - DetermineMeterIPUnits(state, ipUnits, "WATER", OutputProcessor::Unit::m3, errorFound); + DetermineMeterIPUnits(*state, ipUnits, "WATER", OutputProcessor::Unit::m3, errorFound); EXPECT_EQ(RT_IPUnits_Water, ipUnits); EXPECT_FALSE(errorFound); - DetermineMeterIPUnits(state, ipUnits, "OTHER", OutputProcessor::Unit::m3, errorFound); + DetermineMeterIPUnits(*state, ipUnits, "OTHER", OutputProcessor::Unit::m3, errorFound); EXPECT_EQ(RT_IPUnits_OtherM3, ipUnits); EXPECT_FALSE(errorFound); - DetermineMeterIPUnits(state, ipUnits, "OTHER", OutputProcessor::Unit::kg, errorFound); + DetermineMeterIPUnits(*state, ipUnits, "OTHER", OutputProcessor::Unit::kg, errorFound); EXPECT_EQ(RT_IPUnits_OtherKG, ipUnits); EXPECT_FALSE(errorFound); - DetermineMeterIPUnits(state, ipUnits, "OTHER", OutputProcessor::Unit::L, errorFound); + DetermineMeterIPUnits(*state, ipUnits, "OTHER", OutputProcessor::Unit::L, errorFound); EXPECT_EQ(RT_IPUnits_OtherL, ipUnits); EXPECT_FALSE(errorFound); EnergyPlus::sqlite->createSQLiteSimulationsRecord(1, "EnergyPlus Version", "Current Time"); ipUnits = -999999; - DetermineMeterIPUnits(state, ipUnits, "UNKONWN", OutputProcessor::Unit::unknown, errorFound); // was "badunits" + DetermineMeterIPUnits(*state, ipUnits, "UNKONWN", OutputProcessor::Unit::unknown, errorFound); // was "badunits" EXPECT_EQ(RT_IPUnits_OtherJ, ipUnits); EXPECT_TRUE(errorFound); ipUnits = -999999; - DetermineMeterIPUnits(state, ipUnits, "ELEC", OutputProcessor::Unit::unknown, errorFound); // was "kWh" + DetermineMeterIPUnits(*state, ipUnits, "ELEC", OutputProcessor::Unit::unknown, errorFound); // was "kWh" EXPECT_EQ(RT_IPUnits_Electricity, ipUnits); EXPECT_TRUE(errorFound); @@ -1471,11 +1472,11 @@ namespace OutputProcessor { TEST_F(SQLiteFixture, OutputProcessor_writeMeterDictionaryItem) { - InitializeOutput(state); + InitializeOutput(*state); EnergyPlus::sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::TimeStep, StoreType::Averaged, 1, @@ -1489,7 +1490,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,1,meterName [J] !TimeStep"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1,meterName [J] !TimeStep"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::TimeStep, StoreType::Summed, 2, @@ -1503,7 +1504,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"2,1,meterName [W] !TimeStep"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"2,1,meterName [W] !TimeStep"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::TimeStep, StoreType::Averaged, 3, @@ -1517,7 +1518,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"3,1,Cumulative meterName [J] !TimeStep"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"3,1,Cumulative meterName [J] !TimeStep"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::TimeStep, StoreType::Averaged, 4, @@ -1530,7 +1531,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"4,1,meterName [W] !TimeStep"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::TimeStep, StoreType::Averaged, 5, @@ -1543,7 +1544,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"5,1,Cumulative meterName [W] !TimeStep"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::EachCall, StoreType::Averaged, 6, @@ -1557,7 +1558,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"6,1,meterName [J] !Each Call"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"6,1,meterName [J] !Each Call"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::EachCall, StoreType::Summed, 7, @@ -1571,7 +1572,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"7,1,meterName [J] !Each Call"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"7,1,meterName [J] !Each Call"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::EachCall, StoreType::Averaged, 8, @@ -1585,7 +1586,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"8,1,Cumulative meterName [J] !Each Call"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"8,1,Cumulative meterName [J] !Each Call"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::EachCall, StoreType::Averaged, 9, @@ -1598,7 +1599,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"9,1,meterName [J] !Each Call"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::EachCall, StoreType::Averaged, 10, @@ -1611,7 +1612,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"10,1,Cumulative meterName [J] !Each Call"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Hourly, StoreType::Averaged, 11, @@ -1625,7 +1626,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"11,1,meterName [J] !Hourly"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"11,1,meterName [J] !Hourly"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Hourly, StoreType::Summed, 12, @@ -1639,7 +1640,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"12,1,meterName [] !Hourly"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"12,1,meterName [] !Hourly"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Hourly, StoreType::Averaged, 13, @@ -1653,7 +1654,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"13,1,Cumulative meterName [] !Hourly"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"13,1,Cumulative meterName [] !Hourly"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Hourly, StoreType::Averaged, 14, @@ -1666,7 +1667,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"14,1,meterName [] !Hourly"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Hourly, StoreType::Averaged, 15, @@ -1679,7 +1680,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"15,1,Cumulative meterName [] !Hourly"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Daily, StoreType::Averaged, 16, @@ -1693,7 +1694,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"16,7,meterName [] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"16,7,meterName [] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Daily, StoreType::Summed, 17, @@ -1707,7 +1708,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"17,7,meterName [] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"17,7,meterName [] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Daily, StoreType::Averaged, 18, @@ -1721,7 +1722,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"18,1,Cumulative meterName [deltaC] !Daily "}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"18,1,Cumulative meterName [deltaC] !Daily "}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Daily, StoreType::Averaged, 19, @@ -1734,7 +1735,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"19,7,meterName [deltaC] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Daily, StoreType::Averaged, 20, @@ -1747,7 +1748,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"20,1,Cumulative meterName [deltaC] !Daily "}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Monthly, StoreType::Averaged, 21, @@ -1761,7 +1762,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"21,9,meterName [deltaC] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"21,9,meterName [deltaC] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Monthly, StoreType::Summed, 22, @@ -1775,7 +1776,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"22,9,meterName [deltaC] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"22,9,meterName [deltaC] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Monthly, StoreType::Averaged, 23, @@ -1789,7 +1790,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"23,1,Cumulative meterName [deltaC] !Monthly "}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"23,1,Cumulative meterName [deltaC] !Monthly "}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Monthly, StoreType::Averaged, 24, @@ -1802,7 +1803,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"24,9,meterName [deltaC] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Monthly, StoreType::Averaged, 25, @@ -1815,7 +1816,7 @@ namespace OutputProcessor { true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"25,1,Cumulative meterName [deltaC] !Monthly "}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Simulation, StoreType::Averaged, 26, @@ -1831,7 +1832,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_eso_stream( delimited_string({"26,11,meterName [deltaC] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Simulation, StoreType::Summed, 27, @@ -1847,7 +1848,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_eso_stream( delimited_string({"27,11,meterName [deltaC] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Simulation, StoreType::Averaged, 28, @@ -1861,7 +1862,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream(delimited_string({"28,1,Cumulative meterName [deltaC] !RunPeriod "}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"28,1,Cumulative meterName [deltaC] !RunPeriod "}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Simulation, StoreType::Averaged, 29, @@ -1875,7 +1876,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_mtr_stream( delimited_string({"29,11,meterName [deltaC] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n"))); - WriteMeterDictionaryItem(state, + WriteMeterDictionaryItem(*state, ReportingFrequency::Simulation, StoreType::Averaged, 30, @@ -1932,7 +1933,7 @@ namespace OutputProcessor { TEST_F(SQLiteFixture, OutputProcessor_writeReportVariableDictionaryItem) { - InitializeOutput(state); + InitializeOutput(*state); EnergyPlus::sqlite->createSQLiteTimeIndexRecord(4, 1, 1, 0, 2017); @@ -1947,7 +1948,7 @@ namespace OutputProcessor { OutputProcessor::TimeStepType aThirdTimeStepType = OutputProcessor::TimeStepType::TimeStepZone; std::string aThirdTimeStepString = timeStepZoneString; - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::TimeStep, StoreType::Averaged, 1, @@ -1962,7 +1963,7 @@ namespace OutputProcessor { _); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1,keyedValue,variableName [m3/s] !TimeStep"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::TimeStep, StoreType::Summed, 2, @@ -1977,7 +1978,7 @@ namespace OutputProcessor { _); EXPECT_TRUE(compare_eso_stream(delimited_string({"2,1,keyedValue,variableName [m3/s] !TimeStep"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::TimeStep, StoreType::Averaged, 3, @@ -1992,7 +1993,7 @@ namespace OutputProcessor { "scheduleName"); EXPECT_TRUE(compare_eso_stream(delimited_string({"3,1,keyedValue,variableName [m3/s] !TimeStep,scheduleName"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::TimeStep, StoreType::Averaged, 4, @@ -2008,7 +2009,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_eso_stream(delimited_string({"4,1,keyedValue,variableName [m3/s] !TimeStep"}, "\n"))); // Hum, can no longer pass Something else than what's in the enum... - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::TimeStep, StoreType::Averaged, 5, @@ -2023,7 +2024,7 @@ namespace OutputProcessor { _); EXPECT_TRUE(compare_eso_stream(delimited_string({"5,1,keyedValue,variableName [m3/s] !TimeStep"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::EachCall, StoreType::Averaged, 6, @@ -2038,7 +2039,7 @@ namespace OutputProcessor { _); EXPECT_TRUE(compare_eso_stream(delimited_string({"6,1,keyedValue,variableName [m3/s] !Each Call"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::EachCall, StoreType::Summed, 7, @@ -2053,7 +2054,7 @@ namespace OutputProcessor { _); EXPECT_TRUE(compare_eso_stream(delimited_string({"7,1,keyedValue,variableName [m3/s] !Each Call"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::EachCall, StoreType::Averaged, 8, @@ -2068,7 +2069,7 @@ namespace OutputProcessor { "scheduleName"); EXPECT_TRUE(compare_eso_stream(delimited_string({"8,1,keyedValue,variableName [m3/s] !Each Call,scheduleName"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::EachCall, StoreType::Averaged, 9, @@ -2083,7 +2084,7 @@ namespace OutputProcessor { _); EXPECT_TRUE(compare_eso_stream(delimited_string({"9,1,keyedValue,variableName [m3/s] !Each Call"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::EachCall, StoreType::Averaged, 10, @@ -2098,7 +2099,7 @@ namespace OutputProcessor { _); EXPECT_TRUE(compare_eso_stream(delimited_string({"10,1,keyedValue,variableName [m3/s] !Each Call"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Hourly, StoreType::Averaged, 11, @@ -2115,7 +2116,7 @@ namespace OutputProcessor { TrackingHourlyVariables = false; EXPECT_TRUE(compare_eso_stream(delimited_string({"11,1,keyedValue,variableName [m3/s] !Hourly"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Hourly, StoreType::Summed, 12, @@ -2132,7 +2133,7 @@ namespace OutputProcessor { TrackingHourlyVariables = false; EXPECT_TRUE(compare_eso_stream(delimited_string({"12,1,keyedValue,variableName [m3/s] !Hourly"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Hourly, StoreType::Averaged, 13, @@ -2149,7 +2150,7 @@ namespace OutputProcessor { TrackingHourlyVariables = false; EXPECT_TRUE(compare_eso_stream(delimited_string({"13,1,keyedValue,variableName [m3/s] !Hourly,scheduleName"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Hourly, StoreType::Averaged, 14, @@ -2166,7 +2167,7 @@ namespace OutputProcessor { TrackingHourlyVariables = false; EXPECT_TRUE(compare_eso_stream(delimited_string({"14,1,keyedValue,variableName [m3/s] !Hourly"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Hourly, StoreType::Averaged, 15, @@ -2183,7 +2184,7 @@ namespace OutputProcessor { TrackingHourlyVariables = false; EXPECT_TRUE(compare_eso_stream(delimited_string({"15,1,keyedValue,variableName [m3/s] !Hourly"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Daily, StoreType::Averaged, 16, @@ -2200,7 +2201,7 @@ namespace OutputProcessor { TrackingDailyVariables = false; EXPECT_TRUE(compare_eso_stream(delimited_string({"16,7,keyedValue,variableName [m3/s] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Daily, StoreType::Summed, 17, @@ -2217,7 +2218,7 @@ namespace OutputProcessor { TrackingDailyVariables = false; EXPECT_TRUE(compare_eso_stream(delimited_string({"17,7,keyedValue,variableName [m3/s] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Daily, StoreType::Averaged, 18, @@ -2235,7 +2236,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_eso_stream( delimited_string({"18,7,keyedValue,variableName [m3/s] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute],scheduleName"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Daily, StoreType::Averaged, 19, @@ -2252,7 +2253,7 @@ namespace OutputProcessor { TrackingDailyVariables = false; EXPECT_TRUE(compare_eso_stream(delimited_string({"19,7,keyedValue,variableName [m3/s] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Daily, StoreType::Averaged, 20, @@ -2269,7 +2270,7 @@ namespace OutputProcessor { TrackingDailyVariables = false; EXPECT_TRUE(compare_eso_stream(delimited_string({"20,7,keyedValue,variableName [m3/s] !Daily [Value,Min,Hour,Minute,Max,Hour,Minute]"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Monthly, StoreType::Averaged, 21, @@ -2287,7 +2288,7 @@ namespace OutputProcessor { EXPECT_TRUE( compare_eso_stream(delimited_string({"21,9,keyedValue,variableName [m3/s] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Monthly, StoreType::Summed, 22, @@ -2305,7 +2306,7 @@ namespace OutputProcessor { EXPECT_TRUE( compare_eso_stream(delimited_string({"22,9,keyedValue,variableName [m3/s] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Monthly, StoreType::Averaged, 23, @@ -2323,7 +2324,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_eso_stream( delimited_string({"23,9,keyedValue,variableName [m3/s] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute],scheduleName"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Monthly, StoreType::Averaged, 24, @@ -2341,7 +2342,7 @@ namespace OutputProcessor { EXPECT_TRUE( compare_eso_stream(delimited_string({"24,9,keyedValue,variableName [m3/s] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Monthly, StoreType::Averaged, 25, @@ -2359,7 +2360,7 @@ namespace OutputProcessor { EXPECT_TRUE( compare_eso_stream(delimited_string({"25,9,keyedValue,variableName [m3/s] !Monthly [Value,Min,Day,Hour,Minute,Max,Day,Hour,Minute]"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Simulation, StoreType::Averaged, 26, @@ -2377,7 +2378,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_eso_stream( delimited_string({"26,11,keyedValue,variableName [m3/s] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Simulation, StoreType::Summed, 27, @@ -2395,7 +2396,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_eso_stream( delimited_string({"27,11,keyedValue,variableName [m3/s] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Simulation, StoreType::Averaged, 28, @@ -2413,7 +2414,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_eso_stream(delimited_string( {"28,11,keyedValue,variableName [m3/s] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute],scheduleName"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Simulation, StoreType::Averaged, 29, @@ -2431,7 +2432,7 @@ namespace OutputProcessor { EXPECT_TRUE(compare_eso_stream( delimited_string({"29,11,keyedValue,variableName [m3/s] !RunPeriod [Value,Min,Month,Day,Hour,Minute,Max,Month,Day,Hour,Minute]"}, "\n"))); - WriteReportVariableDictionaryItem(state, + WriteReportVariableDictionaryItem(*state, ReportingFrequency::Simulation, StoreType::Averaged, 30, @@ -2491,17 +2492,17 @@ namespace OutputProcessor { EnergyPlus::sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false, _); - WriteCumulativeReportMeterData(state, 1, "1", 616771620.98702729, true); + WriteCumulativeReportMeterData(*state, 1, "1", 616771620.98702729, true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273"}, "\n"))); - WriteCumulativeReportMeterData(state, 1, "1", 616771620.98702729, false); + WriteCumulativeReportMeterData(*state, 1, "1", 616771620.98702729, false); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,616771620.9870273"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,616771620.9870273"}, "\n"))); - WriteCumulativeReportMeterData(state, 1, "1", 0, true); + WriteCumulativeReportMeterData(*state, 1, "1", 0, true); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,0.0"}, "\n"))); - WriteCumulativeReportMeterData(state, 1, "1", 0, false); + WriteCumulativeReportMeterData(*state, 1, "1", 0, false); EXPECT_TRUE(compare_mtr_stream(delimited_string({"1,0.0"}, "\n"))); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.0"}, "\n"))); @@ -2527,206 +2528,206 @@ namespace OutputProcessor { EnergyPlus::sqlite->createSQLiteReportDictionaryRecord( 1, 1, "Zone", "Environment", "Site Outdoor Air Drybulb Temperature", 1, "C", 1, false, _); - WriteNumericData(state, 1, "1", 0); + WriteNumericData(*state, 1, "1", 0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0"}, "\n"))); - WriteNumericData(state, 1, "1", 0.1); + WriteNumericData(*state, 1, "1", 0.1); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.1"}, "\n"))); - WriteNumericData(state, 1, "1", -0.1); + WriteNumericData(*state, 1, "1", -0.1); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,-0.1"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e-2); + WriteNumericData(*state, 1, "1", 1.0e-2); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.01"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.01"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-3); + WriteNumericData(*state, 1, "1", 1.0e-3); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.001"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.001"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-4); + WriteNumericData(*state, 1, "1", 1.0e-4); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.0001"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.0001"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-5); + WriteNumericData(*state, 1, "1", 1.0e-5); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.00001"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.00001"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-6); + WriteNumericData(*state, 1, "1", 1.0e-6); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.000001"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.000001"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-7); + WriteNumericData(*state, 1, "1", 1.0e-7); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-7"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-7"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-8); + WriteNumericData(*state, 1, "1", 1.0e-8); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-8"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-8"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-9); + WriteNumericData(*state, 1, "1", 1.0e-9); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-9"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-9"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-10); + WriteNumericData(*state, 1, "1", 1.0e-10); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-10"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-10"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-11); + WriteNumericData(*state, 1, "1", 1.0e-11); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-11"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-11"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-12); + WriteNumericData(*state, 1, "1", 1.0e-12); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-12"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-12"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-13); + WriteNumericData(*state, 1, "1", 1.0e-13); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-13"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-13"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-14); + WriteNumericData(*state, 1, "1", 1.0e-14); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-14"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-14"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-15); + WriteNumericData(*state, 1, "1", 1.0e-15); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-15"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-15"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-16); + WriteNumericData(*state, 1, "1", 1.0e-16); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-16"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-16"}, "\n"))); #endif - WriteNumericData(state, 1, "1", -1.0e-16); + WriteNumericData(*state, 1, "1", -1.0e-16); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,-1e-16"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,-1e-16"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e-19); + WriteNumericData(*state, 1, "1", 1.0e-19); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-19"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e-19"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 0.5); + WriteNumericData(*state, 1, "1", 0.5); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,0.5"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0); + WriteNumericData(*state, 1, "1", 1.0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1.0"}, "\n"))); - WriteNumericData(state, 1, "1", 10.0); + WriteNumericData(*state, 1, "1", 10.0); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,10.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e2); + WriteNumericData(*state, 1, "1", 1.0e2); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,100.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e3); + WriteNumericData(*state, 1, "1", 1.0e3); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e4); + WriteNumericData(*state, 1, "1", 1.0e4); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,10000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e5); + WriteNumericData(*state, 1, "1", 1.0e5); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,100000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e6); + WriteNumericData(*state, 1, "1", 1.0e6); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e7); + WriteNumericData(*state, 1, "1", 1.0e7); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,10000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e8); + WriteNumericData(*state, 1, "1", 1.0e8); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,100000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e9); + WriteNumericData(*state, 1, "1", 1.0e9); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1000000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e10); + WriteNumericData(*state, 1, "1", 1.0e10); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,10000000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e11); + WriteNumericData(*state, 1, "1", 1.0e11); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,100000000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e12); + WriteNumericData(*state, 1, "1", 1.0e12); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1000000000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e13); + WriteNumericData(*state, 1, "1", 1.0e13); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,10000000000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e14); + WriteNumericData(*state, 1, "1", 1.0e14); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,100000000000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e15); + WriteNumericData(*state, 1, "1", 1.0e15); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1000000000000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e16); + WriteNumericData(*state, 1, "1", 1.0e16); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,10000000000000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", 1.0e17); + WriteNumericData(*state, 1, "1", 1.0e17); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,100000000000000000.0"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,100000000000000000.0"}, "\n"))); #endif - WriteNumericData(state, 1, "1", -1.0e16); + WriteNumericData(*state, 1, "1", -1.0e16); EXPECT_TRUE(compare_eso_stream(delimited_string({"1,-10000000000000000.0"}, "\n"))); - WriteNumericData(state, 1, "1", -1.0e17); + WriteNumericData(*state, 1, "1", -1.0e17); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,-100000000000000000.0"}, "\n"))); #else EXPECT_TRUE(compare_eso_stream(delimited_string({"1,-100000000000000000.0"}, "\n"))); #endif - WriteNumericData(state, 1, "1", 1.0e25); + WriteNumericData(*state, 1, "1", 1.0e25); #if defined(_WIN32) && _MSC_VER < 1900 EXPECT_TRUE(compare_eso_stream(delimited_string({"1,1e25"}, "\n"))); #else @@ -2797,7 +2798,7 @@ namespace OutputProcessor { EXPECT_EQ(0, NumEnergyMeters); EXPECT_EQ(0ul, EnergyMeters.size()); - AddMeter(state, name, units, resourceType, endUse, endUseSub, group); + AddMeter(*state, name, units, resourceType, endUse, endUseSub, group); ASSERT_EQ(1, NumEnergyMeters); ASSERT_EQ(1ul, EnergyMeters.size()); @@ -2832,7 +2833,7 @@ namespace OutputProcessor { auto const endUse2("testEndUse2"); auto const endUseSub2("testEndUseSub2"); auto const group2("testGroup2"); - AddMeter(state, name2, units2, resourceType2, endUse2, endUseSub2, group2); + AddMeter(*state, name2, units2, resourceType2, endUse2, endUseSub2, group2); auto errorData = queryResult("SELECT * FROM Errors;", "Errors"); @@ -3056,14 +3057,14 @@ namespace OutputProcessor { for (auto &meter : input_map) { errorFound = false; if (meter.size() == 5) { - ValidateNStandardizeMeterTitles(state, OutputProcessor::Unit::J, + ValidateNStandardizeMeterTitles(*state, OutputProcessor::Unit::J, meter[1], meter[2], meter[3], meter[4], errorFound); // the first argument was meter[ 0 ] } else if (meter.size() == 6) { - ValidateNStandardizeMeterTitles(state, OutputProcessor::Unit::J, + ValidateNStandardizeMeterTitles(*state, OutputProcessor::Unit::J, meter[1], meter[2], meter[3], @@ -3090,7 +3091,7 @@ namespace OutputProcessor { std::string group = "BAD INPUT"; errorFound = false; - ValidateNStandardizeMeterTitles(state, units, resourceType, endUse, endUseSub, group, errorFound); + ValidateNStandardizeMeterTitles(*state, units, resourceType, endUse, endUseSub, group, errorFound); EXPECT_TRUE(errorFound); units = OutputProcessor::Unit::J; @@ -3100,7 +3101,7 @@ namespace OutputProcessor { group = "HVAC"; errorFound = false; - ValidateNStandardizeMeterTitles(state, units, resourceType, endUse, endUseSub, group, errorFound); + ValidateNStandardizeMeterTitles(*state, units, resourceType, endUse, endUseSub, group, errorFound); EXPECT_TRUE(errorFound); auto errorData = queryResult("SELECT * FROM Errors;", "Errors"); @@ -3118,14 +3119,14 @@ namespace OutputProcessor { auto timeStep = 1.0; - SetupTimePointers(state, "Zone", timeStep); + SetupTimePointers(*state, "Zone", timeStep); EXPECT_DOUBLE_EQ(timeStep, *TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep); EXPECT_DOUBLE_EQ(0.0, TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute); timeStep = 2.0; - SetupTimePointers(state, "HVAC", timeStep); + SetupTimePointers(*state, "HVAC", timeStep); EXPECT_DOUBLE_EQ(timeStep, *TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep); EXPECT_DOUBLE_EQ(0.0, TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute); @@ -3143,9 +3144,9 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - GetReportVariableInput(state); + GetReportVariableInput(*state); - NumOfReqVariables = inputProcessor->getNumObjectsFound(state, "Output:Variable"); + NumOfReqVariables = inputProcessor->getNumObjectsFound(*state, "Output:Variable"); EXPECT_EQ(5, NumOfReqVariables); @@ -3198,7 +3199,7 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - GetReportVariableInput(state); + GetReportVariableInput(*state); auto const keyed_value = "ENVIRONMENT"; auto const var_name = "SITE OUTDOOR AIR DRYBULB TEMPERATURE"; @@ -3261,33 +3262,33 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - inputProcessor->preScanReportingVariables(state); - InitializeOutput(state); + inputProcessor->preScanReportingVariables(*state); + InitializeOutput(*state); Real64 ilgrGarage; Real64 ilgrLiving; Real64 ilgrAttic; - SetupOutputVariable(state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrGarage, "Zone", "Sum", "Garage"); - SetupOutputVariable(state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrLiving, "Zone", "Sum", "Living"); - SetupOutputVariable(state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrAttic, "Zone", "Sum", "Attic"); + SetupOutputVariable(*state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrGarage, "Zone", "Sum", "Garage"); + SetupOutputVariable(*state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrLiving, "Zone", "Sum", "Living"); + SetupOutputVariable(*state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrAttic, "Zone", "Sum", "Attic"); Real64 isgrGarage; Real64 isgrLiving; Real64 isgrAttic; - SetupOutputVariable(state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrGarage, "Zone", "Sum", "Garage"); - SetupOutputVariable(state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrLiving, "Zone", "Sum", "Living"); - SetupOutputVariable(state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrAttic, "Zone", "Sum", "Attic"); + SetupOutputVariable(*state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrGarage, "Zone", "Sum", "Garage"); + SetupOutputVariable(*state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrLiving, "Zone", "Sum", "Living"); + SetupOutputVariable(*state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrAttic, "Zone", "Sum", "Attic"); - state.dataGlobal->DoWeathSim = true; - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->TimeStepZone = 0.25; - OutputReportTabular::GetInputTabularMonthly(state); + OutputReportTabular::GetInputTabularMonthly(*state); EXPECT_EQ(OutputReportTabular::MonthlyInputCount, 1); - OutputReportTabular::InitializeTabularMonthly(state); + OutputReportTabular::InitializeTabularMonthly(*state); - GetReportVariableInput(state); + GetReportVariableInput(*state); NumExtraVars = 0; BuildKeyVarList("LIVING", "ZONE TOTAL INTERNAL LATENT GAIN RATE", 1, 3); @@ -3318,33 +3319,33 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - inputProcessor->preScanReportingVariables(state); - InitializeOutput(state); + inputProcessor->preScanReportingVariables(*state); + InitializeOutput(*state); Real64 ilgrGarage; Real64 ilgrLiving1; Real64 ilgrLiving2; - SetupOutputVariable(state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrGarage, "Zone", "Sum", "Garage"); - SetupOutputVariable(state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrLiving1, "Zone", "Sum", "Living1"); - SetupOutputVariable(state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrLiving2, "Zone", "Sum", "Living2"); + SetupOutputVariable(*state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrGarage, "Zone", "Sum", "Garage"); + SetupOutputVariable(*state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrLiving1, "Zone", "Sum", "Living1"); + SetupOutputVariable(*state, "Zone Total Internal Latent Gain Rate", OutputProcessor::Unit::J, ilgrLiving2, "Zone", "Sum", "Living2"); Real64 isgrGarage; Real64 isgrLiving; Real64 isgrAttic; - SetupOutputVariable(state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrGarage, "Zone", "Sum", "Garage"); - SetupOutputVariable(state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrLiving, "Zone", "Sum", "Living1"); - SetupOutputVariable(state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrAttic, "Zone", "Sum", "Living2"); + SetupOutputVariable(*state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrGarage, "Zone", "Sum", "Garage"); + SetupOutputVariable(*state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrLiving, "Zone", "Sum", "Living1"); + SetupOutputVariable(*state, "Zone Total Internal Sensible Gain Rate", OutputProcessor::Unit::J, isgrAttic, "Zone", "Sum", "Living2"); - state.dataGlobal->DoWeathSim = true; - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->TimeStepZone = 0.25; - OutputReportTabular::GetInputTabularMonthly(state); + OutputReportTabular::GetInputTabularMonthly(*state); EXPECT_EQ(OutputReportTabular::MonthlyInputCount, 1); - OutputReportTabular::InitializeTabularMonthly(state); + OutputReportTabular::InitializeTabularMonthly(*state); - GetReportVariableInput(state); + GetReportVariableInput(*state); NumExtraVars = 0; BuildKeyVarList("LIVING1", "ZONE TOTAL INTERNAL LATENT GAIN RATE", 1, 2); @@ -3367,9 +3368,9 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - InitializeOutput(state); + InitializeOutput(*state); - GetReportVariableInput(state); + GetReportVariableInput(*state); auto const var_name = "Site Outdoor Air Drybulb Temperature"; @@ -3434,7 +3435,7 @@ namespace OutputProcessor { ReportingFrequency report_freq = ReportingFrequency::EachCall; for (auto const option : valid_options) { - report_freq = determineFrequency(state, option.first); + report_freq = determineFrequency(*state, option.first); EXPECT_EQ(option.second, report_freq); } } @@ -3508,8 +3509,8 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - GetReportVariableInput(state); - SetupOutputVariable(state, + GetReportVariableInput(*state); + SetupOutputVariable(*state, "Site Outdoor Air Drybulb Temperature", OutputProcessor::Unit::C, DataEnvironment::OutDryBulbTemp, "Zone", "Average", "Environment"); auto reportDataDictionaryResults = queryResult("SELECT * FROM ReportDataDictionary;", "ReportDataDictionary"); @@ -3547,10 +3548,10 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - GetReportVariableInput(state); + GetReportVariableInput(*state); Real64 cooling_consumption = 0.; - SetupOutputVariable(state, "Chiller Electricity Energy", + SetupOutputVariable(*state, "Chiller Electricity Energy", OutputProcessor::Unit::J, cooling_consumption, "System", @@ -3564,7 +3565,7 @@ namespace OutputProcessor { Real64 light_consumption = 0.; - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -3580,7 +3581,7 @@ namespace OutputProcessor { 1); Real64 fuel_oil_co2 = 0.; - SetupOutputVariable(state, "Environmental Impact Fuel Oil No 2 CO2 Emissions Mass", + SetupOutputVariable(*state, "Environmental Impact Fuel Oil No 2 CO2 Emissions Mass", OutputProcessor::Unit::kg, fuel_oil_co2, "System", @@ -3648,11 +3649,11 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - GetReportVariableInput(state); + GetReportVariableInput(*state); Real64 fuel_used = 999; - SetupOutputVariable(state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler1"); - SetupOutputVariable(state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler2"); - SetupOutputVariable(state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler3"); + SetupOutputVariable(*state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler1"); + SetupOutputVariable(*state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler2"); + SetupOutputVariable(*state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler3"); auto reportDataDictionaryResults = queryResult("SELECT * FROM ReportDataDictionary;", "ReportDataDictionary"); @@ -3679,11 +3680,11 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - GetReportVariableInput(state); + GetReportVariableInput(*state); Real64 fuel_used = 999; - SetupOutputVariable(state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler1"); - SetupOutputVariable(state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler2"); - SetupOutputVariable(state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler3"); + SetupOutputVariable(*state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler1"); + SetupOutputVariable(*state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler2"); + SetupOutputVariable(*state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler3"); auto reportDataDictionaryResults = queryResult("SELECT * FROM ReportDataDictionary;", "ReportDataDictionary"); @@ -3708,11 +3709,11 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - GetReportVariableInput(state); + GetReportVariableInput(*state); Real64 fuel_used = 999; - SetupOutputVariable(state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler1"); - SetupOutputVariable(state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler2"); - SetupOutputVariable(state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler3"); + SetupOutputVariable(*state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler1"); + SetupOutputVariable(*state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler2"); + SetupOutputVariable(*state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler3"); auto reportDataDictionaryResults = queryResult("SELECT * FROM ReportDataDictionary;", "ReportDataDictionary"); @@ -3739,15 +3740,15 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - GetReportVariableInput(state); + GetReportVariableInput(*state); Real64 vol_flow = 999; - SetupOutputVariable(state, + SetupOutputVariable(*state, "AFN Linkage Node 1 to Node 2 Volume Flow Rate", OutputProcessor::Unit::m3_s, vol_flow, "System", "Average", "Zn003:Wall001"); - SetupOutputVariable(state, + SetupOutputVariable(*state, "AFN Linkage Node 1 to Node 2 Volume Flow Rate", OutputProcessor::Unit::m3_s, vol_flow, "System", "Average", "Zn003:Wall002"); - SetupOutputVariable(state, + SetupOutputVariable(*state, "AFN Linkage Node 1 to Node 2 Volume Flow Rate", OutputProcessor::Unit::m3_s, vol_flow, "System", "Average", "Zn003:Wall002:Win001"); - SetupOutputVariable(state, + SetupOutputVariable(*state, "AFN Linkage Node 1 to Node 2 Volume Flow Rate", OutputProcessor::Unit::m3_s, vol_flow, "System", "Average", "Zn003:Wall003"); auto reportDataDictionaryResults = queryResult("SELECT * FROM ReportDataDictionary;", "ReportDataDictionary"); @@ -3789,15 +3790,15 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - GetReportVariableInput(state); + GetReportVariableInput(*state); Real64 vol_flow = 999; - SetupOutputVariable(state, + SetupOutputVariable(*state, "AFN Linkage Node 1 to Node 2 Volume Flow Rate", OutputProcessor::Unit::m3_s, vol_flow, "System", "Average", "ZN003:WALL001"); - SetupOutputVariable(state, + SetupOutputVariable(*state, "AFN Linkage Node 1 to Node 2 Volume Flow Rate", OutputProcessor::Unit::m3_s, vol_flow, "System", "Average", "ZN003:WALL002"); - SetupOutputVariable(state, + SetupOutputVariable(*state, "AFN Linkage Node 1 to Node 2 Volume Flow Rate", OutputProcessor::Unit::m3_s, vol_flow, "System", "Average", "ZN003:WALL002:WIN001"); - SetupOutputVariable(state, + SetupOutputVariable(*state, "AFN Linkage Node 1 to Node 2 Volume Flow Rate", OutputProcessor::Unit::m3_s, vol_flow, "System", "Average", "ZN003:WALL003"); auto reportDataDictionaryResults = queryResult("SELECT * FROM ReportDataDictionary;", "ReportDataDictionary"); @@ -3846,10 +3847,10 @@ namespace OutputProcessor { auto const keyed_value = "Environment"; auto const var_name = "Site Outdoor Air Drybulb Temperature"; - InitializeOutput(state); + InitializeOutput(*state); - GetReportVariableInput(state); - CheckReportVariable(state, keyed_value, var_name); + GetReportVariableInput(*state); + CheckReportVariable(*state, keyed_value, var_name); EXPECT_EQ(5, NumOfReqVariables); @@ -3926,7 +3927,7 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); Real64 light_consumption = 0; - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -3940,7 +3941,7 @@ namespace OutputProcessor { "SPACE1-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -3954,7 +3955,7 @@ namespace OutputProcessor { "SPACE2-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -3968,7 +3969,7 @@ namespace OutputProcessor { "SPACE3-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -3982,7 +3983,7 @@ namespace OutputProcessor { "SPACE4-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -3997,15 +3998,15 @@ namespace OutputProcessor { 1, 1); Real64 zone_infil_total_loss = 0; - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE1-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE2-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE3-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE4-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE5-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE1-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE2-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE3-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE4-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE5-1"); bool errors_found = false; - GetCustomMeterInput(state, errors_found); + GetCustomMeterInput(*state, errors_found); ASSERT_FALSE(errors_found); @@ -4054,7 +4055,7 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - InitializeOutput(state); + InitializeOutput(*state); int meter_array_ptr = -1; bool errors_found = false; @@ -4065,7 +4066,7 @@ namespace OutputProcessor { std::string group("Building"); std::string const zoneName("SPACE1-1"); - AttachMeters(state, OutputProcessor::Unit::J, resourceType, endUse, endUseSub, group, zoneName, 1, meter_array_ptr, errors_found); + AttachMeters(*state, OutputProcessor::Unit::J, resourceType, endUse, endUseSub, group, zoneName, 1, meter_array_ptr, errors_found); EXPECT_FALSE(errors_found); EXPECT_EQ(1, meter_array_ptr); @@ -4109,28 +4110,28 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->DayOfSim = 365; - state.dataGlobal->DayOfSimChr = "365"; + state->dataGlobal->DayOfSim = 365; + state->dataGlobal->DayOfSimChr = "365"; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 31; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 3; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->HourOfDay = 24; - state.dataGlobal->NumOfDayInEnvrn = 365; - state.dataGlobal->MinutesPerTimeStep = 10; - - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { - state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { - state.dataGlobal->EndDayFlag = true; - if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { - state.dataGlobal->EndEnvrnFlag = true; + state->dataGlobal->HourOfDay = 24; + state->dataGlobal->NumOfDayInEnvrn = 365; + state->dataGlobal->MinutesPerTimeStep = 10; + + if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + state->dataGlobal->EndHourFlag = true; + if (state->dataGlobal->HourOfDay == 24) { + state->dataGlobal->EndDayFlag = true; + if ((!state->dataGlobal->WarmupFlag) && (state->dataGlobal->DayOfSim == state->dataGlobal->NumOfDayInEnvrn)) { + state->dataGlobal->EndEnvrnFlag = true; } } } - if (DataEnvironment::DayOfMonth == state.dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { + if (DataEnvironment::DayOfMonth == state->dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { DataEnvironment::EndMonthFlag = true; } @@ -4138,17 +4139,17 @@ namespace OutputProcessor { auto timeStep = 1.0 / 6; - SetupTimePointers(state, "Zone", timeStep); - SetupTimePointers(state, "HVAC", timeStep); + SetupTimePointers(*state, "Zone", timeStep); + SetupTimePointers(*state, "HVAC", timeStep); TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 50; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 50; - GetReportVariableInput(state); - SetupOutputVariable(state, + GetReportVariableInput(*state); + SetupOutputVariable(*state, "Site Outdoor Air Drybulb Temperature", OutputProcessor::Unit::C, DataEnvironment::OutDryBulbTemp, "Zone", "Average", "Environment"); Real64 light_consumption = 999; - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4162,7 +4163,7 @@ namespace OutputProcessor { "SPACE1-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4176,7 +4177,7 @@ namespace OutputProcessor { "SPACE2-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4190,7 +4191,7 @@ namespace OutputProcessor { "SPACE3-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4204,7 +4205,7 @@ namespace OutputProcessor { "SPACE4-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4219,15 +4220,15 @@ namespace OutputProcessor { 1, 1); Real64 zone_infil_total_loss = 999; - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE1-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE2-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE3-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE4-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE5-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE1-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE2-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE3-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE4-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE5-1"); - UpdateMeterReporting(state); + UpdateMeterReporting(*state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); auto timeResults = queryResult("SELECT * FROM Time;", "Time"); @@ -4353,28 +4354,28 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->DayOfSim = 365; - state.dataGlobal->DayOfSimChr = "365"; + state->dataGlobal->DayOfSim = 365; + state->dataGlobal->DayOfSimChr = "365"; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 31; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 3; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->HourOfDay = 24; - state.dataGlobal->NumOfDayInEnvrn = 365; - state.dataGlobal->MinutesPerTimeStep = 10; - - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { - state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { - state.dataGlobal->EndDayFlag = true; - if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { - state.dataGlobal->EndEnvrnFlag = true; + state->dataGlobal->HourOfDay = 24; + state->dataGlobal->NumOfDayInEnvrn = 365; + state->dataGlobal->MinutesPerTimeStep = 10; + + if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + state->dataGlobal->EndHourFlag = true; + if (state->dataGlobal->HourOfDay == 24) { + state->dataGlobal->EndDayFlag = true; + if ((!state->dataGlobal->WarmupFlag) && (state->dataGlobal->DayOfSim == state->dataGlobal->NumOfDayInEnvrn)) { + state->dataGlobal->EndEnvrnFlag = true; } } } - if (DataEnvironment::DayOfMonth == state.dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { + if (DataEnvironment::DayOfMonth == state->dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { DataEnvironment::EndMonthFlag = true; } @@ -4382,17 +4383,17 @@ namespace OutputProcessor { auto timeStep = 1.0 / 6; - SetupTimePointers(state, "Zone", timeStep); - SetupTimePointers(state, "HVAC", timeStep); + SetupTimePointers(*state, "Zone", timeStep); + SetupTimePointers(*state, "HVAC", timeStep); TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 50; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 50; - GetReportVariableInput(state); - SetupOutputVariable(state, + GetReportVariableInput(*state); + SetupOutputVariable(*state, "Site Outdoor Air Drybulb Temperature", OutputProcessor::Unit::C, DataEnvironment::OutDryBulbTemp, "Zone", "Average", "Environment"); Real64 light_consumption = 999; - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4406,7 +4407,7 @@ namespace OutputProcessor { "SPACE1-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4420,7 +4421,7 @@ namespace OutputProcessor { "SPACE2-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4434,7 +4435,7 @@ namespace OutputProcessor { "SPACE3-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4448,7 +4449,7 @@ namespace OutputProcessor { "SPACE4-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4463,19 +4464,19 @@ namespace OutputProcessor { 1, 1); Real64 zone_infil_total_loss = 999; - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE1-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE2-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE3-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE4-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE5-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE1-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE2-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE3-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE4-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE5-1"); Real64 fuel_used = 999; Real64 boiler_load = 999; - SetupOutputVariable(state, "Boiler Heating Rate", OutputProcessor::Unit::W, boiler_load, "System", "Average", "Boiler1"); - SetupOutputVariable(state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler1"); + SetupOutputVariable(*state, "Boiler Heating Rate", OutputProcessor::Unit::W, boiler_load, "System", "Average", "Boiler1"); + SetupOutputVariable(*state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler1"); - UpdateMeterReporting(state); + UpdateMeterReporting(*state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); auto timeResults = queryResult("SELECT * FROM Time;", "Time"); @@ -4610,28 +4611,28 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->DayOfSim = 365; - state.dataGlobal->DayOfSimChr = "365"; + state->dataGlobal->DayOfSim = 365; + state->dataGlobal->DayOfSimChr = "365"; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 31; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 3; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->HourOfDay = 24; - state.dataGlobal->NumOfDayInEnvrn = 365; - state.dataGlobal->MinutesPerTimeStep = 10; - - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { - state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { - state.dataGlobal->EndDayFlag = true; - if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { - state.dataGlobal->EndEnvrnFlag = true; + state->dataGlobal->HourOfDay = 24; + state->dataGlobal->NumOfDayInEnvrn = 365; + state->dataGlobal->MinutesPerTimeStep = 10; + + if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + state->dataGlobal->EndHourFlag = true; + if (state->dataGlobal->HourOfDay == 24) { + state->dataGlobal->EndDayFlag = true; + if ((!state->dataGlobal->WarmupFlag) && (state->dataGlobal->DayOfSim == state->dataGlobal->NumOfDayInEnvrn)) { + state->dataGlobal->EndEnvrnFlag = true; } } } - if (DataEnvironment::DayOfMonth == state.dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { + if (DataEnvironment::DayOfMonth == state->dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { DataEnvironment::EndMonthFlag = true; } @@ -4639,17 +4640,17 @@ namespace OutputProcessor { auto timeStep = 1.0 / 6; - SetupTimePointers(state, "Zone", timeStep); - SetupTimePointers(state, "HVAC", timeStep); + SetupTimePointers(*state, "Zone", timeStep); + SetupTimePointers(*state, "HVAC", timeStep); TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 50; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 50; - GetReportVariableInput(state); - SetupOutputVariable(state, + GetReportVariableInput(*state); + SetupOutputVariable(*state, "Site Outdoor Air Drybulb Temperature", OutputProcessor::Unit::C, DataEnvironment::OutDryBulbTemp, "Zone", "Average", "Environment"); Real64 light_consumption = 999; - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4663,7 +4664,7 @@ namespace OutputProcessor { "SPACE1-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4677,7 +4678,7 @@ namespace OutputProcessor { "SPACE2-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4691,7 +4692,7 @@ namespace OutputProcessor { "SPACE3-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4705,7 +4706,7 @@ namespace OutputProcessor { "SPACE4-1", 1, 1); - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -4720,19 +4721,19 @@ namespace OutputProcessor { 1, 1); Real64 zone_infil_total_loss = 999; - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE1-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE2-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE3-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE4-1"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE5-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE1-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE2-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE3-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE4-1"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, zone_infil_total_loss, "System", "Sum", "SPACE5-1"); Real64 fuel_used = 999; Real64 boiler_load = 999; - SetupOutputVariable(state, "Boiler Heating Rate", OutputProcessor::Unit::W, boiler_load, "System", "Average", "Boiler1"); - SetupOutputVariable(state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler1"); + SetupOutputVariable(*state, "Boiler Heating Rate", OutputProcessor::Unit::W, boiler_load, "System", "Average", "Boiler1"); + SetupOutputVariable(*state, "Boiler NaturalGas Rate", OutputProcessor::Unit::W, fuel_used, "System", "Average", "Boiler1"); - UpdateMeterReporting(state); + UpdateMeterReporting(*state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); auto timeResults = queryResult("SELECT * FROM Time;", "Time"); @@ -4815,46 +4816,46 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); // Setup so that UpdateDataandReport can be called. - state.dataGlobal->DayOfSim = 365; - state.dataGlobal->DayOfSimChr = "365"; + state->dataGlobal->DayOfSim = 365; + state->dataGlobal->DayOfSimChr = "365"; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 31; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 3; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->HourOfDay = 24; - state.dataGlobal->NumOfDayInEnvrn = 365; - state.dataGlobal->MinutesPerTimeStep = 10; - - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { - state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { - state.dataGlobal->EndDayFlag = true; - if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { - state.dataGlobal->EndEnvrnFlag = true; + state->dataGlobal->HourOfDay = 24; + state->dataGlobal->NumOfDayInEnvrn = 365; + state->dataGlobal->MinutesPerTimeStep = 10; + + if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + state->dataGlobal->EndHourFlag = true; + if (state->dataGlobal->HourOfDay == 24) { + state->dataGlobal->EndDayFlag = true; + if ((!state->dataGlobal->WarmupFlag) && (state->dataGlobal->DayOfSim == state->dataGlobal->NumOfDayInEnvrn)) { + state->dataGlobal->EndEnvrnFlag = true; } } } - if (DataEnvironment::DayOfMonth == state.dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { + if (DataEnvironment::DayOfMonth == state->dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { DataEnvironment::EndMonthFlag = true; } // OutputProcessor::TimeValue.allocate(2); auto timeStep = 1.0 / 6; - SetupTimePointers(state, "Zone", timeStep); - SetupTimePointers(state, "HVAC", timeStep); + SetupTimePointers(*state, "Zone", timeStep); + SetupTimePointers(*state, "HVAC", timeStep); TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 10; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 10; - state.dataGlobal->WarmupFlag = true; + state->dataGlobal->WarmupFlag = true; - ReportOutputFileHeaders(state); + ReportOutputFileHeaders(*state); - GetReportVariableInput(state); + GetReportVariableInput(*state); Array1D PurchAir; // Used to specify purchased air parameters PurchAir.allocate(1); - SetupOutputVariable(state, "Zone Ideal Loads Supply Air Total Heating Energy", + SetupOutputVariable(*state, "Zone Ideal Loads Supply Air Total Heating Energy", OutputProcessor::Unit::J, PurchAir(1).TotHeatEnergy, "System", @@ -4867,34 +4868,34 @@ namespace OutputProcessor { "System"); PurchAir(1).TotHeatEnergy = 1.1; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); PurchAir(1).TotHeatEnergy = 1.3; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); PurchAir(1).TotHeatEnergy = 1.5; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); PurchAir(1).TotHeatEnergy = 1.7; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); PurchAir(1).TotHeatEnergy = 1.9; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); PurchAir(1).TotHeatEnergy = 2.2; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); - state.dataGlobal->WarmupFlag = false; + state->dataGlobal->WarmupFlag = false; PurchAir(1).TotHeatEnergy = 2.4; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); // zone timestep + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); // zone timestep compare_eso_stream(delimited_string({ "1,5,Environment Title[],Latitude[deg],Longitude[deg],Time Zone[],Elevation[m]", @@ -4924,16 +4925,16 @@ namespace OutputProcessor { ResetAccumulationWhenWarmupComplete(); PurchAir(1).TotHeatEnergy = 100.0; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); PurchAir(1).TotHeatEnergy = 200.0; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); PurchAir(1).TotHeatEnergy = 300.0; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); // zone timestep + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); // zone timestep compare_eso_stream(delimited_string({ "2,365,12,31, 0,24, 0.00,10.00,Tuesday", @@ -4955,28 +4956,28 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->DayOfSim = 365; - state.dataGlobal->DayOfSimChr = "365"; + state->dataGlobal->DayOfSim = 365; + state->dataGlobal->DayOfSimChr = "365"; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 31; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 3; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->HourOfDay = 24; - state.dataGlobal->NumOfDayInEnvrn = 365; - state.dataGlobal->MinutesPerTimeStep = 10; - - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { - state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { - state.dataGlobal->EndDayFlag = true; - if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { - state.dataGlobal->EndEnvrnFlag = true; + state->dataGlobal->HourOfDay = 24; + state->dataGlobal->NumOfDayInEnvrn = 365; + state->dataGlobal->MinutesPerTimeStep = 10; + + if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + state->dataGlobal->EndHourFlag = true; + if (state->dataGlobal->HourOfDay == 24) { + state->dataGlobal->EndDayFlag = true; + if ((!state->dataGlobal->WarmupFlag) && (state->dataGlobal->DayOfSim == state->dataGlobal->NumOfDayInEnvrn)) { + state->dataGlobal->EndEnvrnFlag = true; } } } - if (DataEnvironment::DayOfMonth == state.dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { + if (DataEnvironment::DayOfMonth == state->dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { DataEnvironment::EndMonthFlag = true; } @@ -4984,17 +4985,17 @@ namespace OutputProcessor { auto timeStep = 1.0 / 6; - SetupTimePointers(state, "Zone", timeStep); - SetupTimePointers(state, "HVAC", timeStep); + SetupTimePointers(*state, "Zone", timeStep); + SetupTimePointers(*state, "HVAC", timeStep); TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 50; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 50; - GetReportVariableInput(state); - SetupOutputVariable(state, + GetReportVariableInput(*state); + SetupOutputVariable(*state, "Site Outdoor Air Drybulb Temperature", OutputProcessor::Unit::C, DataEnvironment::OutDryBulbTemp, "Zone", "Average", "Environment"); Real64 light_consumption = 999; - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -5008,10 +5009,10 @@ namespace OutputProcessor { "SPACE1-1", 1, 1); - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); - GenOutputVariablesAuditReport(state); + GenOutputVariablesAuditReport(*state); std::string errMsg = delimited_string({ " ** Warning ** The following Report Variables were requested but not generated -- check.rdd file", @@ -5033,28 +5034,28 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->DayOfSim = 365; - state.dataGlobal->DayOfSimChr = "365"; + state->dataGlobal->DayOfSim = 365; + state->dataGlobal->DayOfSimChr = "365"; DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 31; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 3; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->HourOfDay = 24; - state.dataGlobal->NumOfDayInEnvrn = 365; - state.dataGlobal->MinutesPerTimeStep = 10; - - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { - state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { - state.dataGlobal->EndDayFlag = true; - if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { - state.dataGlobal->EndEnvrnFlag = true; + state->dataGlobal->HourOfDay = 24; + state->dataGlobal->NumOfDayInEnvrn = 365; + state->dataGlobal->MinutesPerTimeStep = 10; + + if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + state->dataGlobal->EndHourFlag = true; + if (state->dataGlobal->HourOfDay == 24) { + state->dataGlobal->EndDayFlag = true; + if ((!state->dataGlobal->WarmupFlag) && (state->dataGlobal->DayOfSim == state->dataGlobal->NumOfDayInEnvrn)) { + state->dataGlobal->EndEnvrnFlag = true; } } } - if (DataEnvironment::DayOfMonth == state.dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { + if (DataEnvironment::DayOfMonth == state->dataWeatherManager->EndDayOfMonth(DataEnvironment::Month)) { DataEnvironment::EndMonthFlag = true; } @@ -5062,20 +5063,20 @@ namespace OutputProcessor { auto timeStep = 1.0 / 6; - SetupTimePointers(state, "Zone", timeStep); - SetupTimePointers(state, "HVAC", timeStep); + SetupTimePointers(*state, "Zone", timeStep); + SetupTimePointers(*state, "HVAC", timeStep); TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).CurMinute = 50; TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).CurMinute = 50; - OutputReportTabular::GetInputTabularMonthly(state); - OutputReportTabular::InitializeTabularMonthly(state); + OutputReportTabular::GetInputTabularMonthly(*state); + OutputReportTabular::InitializeTabularMonthly(*state); - GetReportVariableInput(state); - SetupOutputVariable(state, + GetReportVariableInput(*state); + SetupOutputVariable(*state, "Site Outdoor Air Drybulb Temperature", OutputProcessor::Unit::C, DataEnvironment::OutDryBulbTemp, "Zone", "Average", "Environment"); Real64 light_consumption = 999; - SetupOutputVariable(state, "Lights Electricity Energy", + SetupOutputVariable(*state, "Lights Electricity Energy", OutputProcessor::Unit::J, light_consumption, "Zone", @@ -5089,8 +5090,8 @@ namespace OutputProcessor { "SPACE1-1", 1, 1); - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); NumExtraVars = 0; BuildKeyVarList("Air Loop 1|AirSupply InletNode", "SYSTEM NODE SETPOINT TEMPERATURE", 1, 2); @@ -5100,7 +5101,7 @@ namespace OutputProcessor { BuildKeyVarList("Air Loop 1|AirSupply InletNode", "SYSTEM NODE TEMPERATURE", 1, 2); EXPECT_EQ(1, NumExtraVars); - GenOutputVariablesAuditReport(state); + GenOutputVariablesAuditReport(*state); compare_err_stream(""); } @@ -5235,26 +5236,26 @@ namespace OutputProcessor { ASSERT_TRUE(process_idf(idf_objects)); bool errors_found = false; Real64 transferredenergy = 0; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(DataHVACGlobals::NumPrimaryAirSys); - state.dataAirSystemsData->PrimaryAirSystems(1).Name = "Air Loop 1"; - DataZoneEquipment::ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); - DataZoneEquipment::ZoneEquipConfig(state.dataGlobal->NumOfZones).IsControlled = true; - SetupOutputVariable(state, "Surface Average Face Conduction Heat Transfer Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); - SetupOutputVariable(state, "Surface Window Heat Loss Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); - SetupOutputVariable(state, "Zone Windows Total Heat Gain Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); - SetupOutputVariable(state, "Surface Window Heat Gain Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); - SetupOutputVariable(state, "Zone Ventilation Total Heat Gain Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); - SetupOutputVariable(state, "Zone Ventilation Total Heat Loss Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Gain Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); - SetupOutputVariable(state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); - SetupOutputVariable(state, "Zone Electric Equipment Total Heating Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); - SetupOutputVariable(state, "Zone Lights Total Heating Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); - SetupOutputVariable(state, "People Total Heating Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); - SystemReports::AllocateAndSetUpVentReports(state); - SystemReports::AllocateAndSetUpVentReports(state); - GetCustomMeterInput(state, errors_found); + state->dataAirSystemsData->PrimaryAirSystems.allocate(DataHVACGlobals::NumPrimaryAirSys); + state->dataAirSystemsData->PrimaryAirSystems(1).Name = "Air Loop 1"; + DataZoneEquipment::ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipConfig(state->dataGlobal->NumOfZones).IsControlled = true; + SetupOutputVariable(*state, "Surface Average Face Conduction Heat Transfer Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); + SetupOutputVariable(*state, "Surface Window Heat Loss Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); + SetupOutputVariable(*state, "Zone Windows Total Heat Gain Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); + SetupOutputVariable(*state, "Surface Window Heat Gain Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); + SetupOutputVariable(*state, "Zone Ventilation Total Heat Gain Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); + SetupOutputVariable(*state, "Zone Ventilation Total Heat Loss Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Gain Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); + SetupOutputVariable(*state, "Zone Infiltration Total Heat Loss Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); + SetupOutputVariable(*state, "Zone Electric Equipment Total Heating Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); + SetupOutputVariable(*state, "Zone Lights Total Heating Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); + SetupOutputVariable(*state, "People Total Heating Energy", OutputProcessor::Unit::J, transferredenergy, "Zone", "Sum", "*"); + SystemReports::AllocateAndSetUpVentReports(*state); + SystemReports::AllocateAndSetUpVentReports(*state); + GetCustomMeterInput(*state, errors_found); EXPECT_FALSE(errors_found); EXPECT_EQ(15, NumEnergyMeters); EXPECT_EQ(EnergyMeters(1).Name, "METER SURFACE AVERAGE FACE CONDUCTION HEAT TRANSFER ENERGY"); @@ -5281,7 +5282,7 @@ namespace OutputProcessor { bool errors_found = false; - GetCustomMeterInput(state, errors_found); + GetCustomMeterInput(*state, errors_found); EXPECT_FALSE(errors_found); @@ -5403,7 +5404,7 @@ namespace OutputProcessor { bool errors_found = false; - GetCustomMeterInput(state, errors_found); + GetCustomMeterInput(*state, errors_found); EXPECT_FALSE(errors_found); } diff --git a/tst/EnergyPlus/unit/OutputReportData.unit.cc b/tst/EnergyPlus/unit/OutputReportData.unit.cc index 01c5ce6d3c3..659a5eb5037 100644 --- a/tst/EnergyPlus/unit/OutputReportData.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportData.unit.cc @@ -57,6 +57,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace ObjexxFCL; @@ -83,15 +84,15 @@ TEST_F(EnergyPlusFixture, OutputReportData_getVariableKeys) Real64 extLitPow; Real64 extLitUse; - SetupOutputVariable(state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", "Sum", "Lite1", _, "Electricity", + SetupOutputVariable(*state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", "Sum", "Lite1", _, "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", "Sum", "Lite2", _, "Electricity", + SetupOutputVariable(*state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", "Sum", "Lite2", _, "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", "Sum", "Lite3", _, "Electricity", + SetupOutputVariable(*state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", "Sum", "Lite3", _, "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite1"); - SetupOutputVariable(state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite2"); - SetupOutputVariable(state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite3"); + SetupOutputVariable(*state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite1"); + SetupOutputVariable(*state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite2"); + SetupOutputVariable(*state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite3"); int keyCount = 0; int typeVar = 0; @@ -100,10 +101,10 @@ TEST_F(EnergyPlusFixture, OutputReportData_getVariableKeys) OutputProcessor::Unit unitsVar = OutputProcessor::Unit::None; fldStTest.m_variMeter = "EXTERIOR LIGHTS ELECTRIC ENERGY"; - keyCount = fldStTest.getVariableKeyCountandTypeFromFldSt(state, typeVar, avgSumVar, stepTypeVar, unitsVar); + keyCount = fldStTest.getVariableKeyCountandTypeFromFldSt(*state, typeVar, avgSumVar, stepTypeVar, unitsVar); EXPECT_EQ(keyCount, 3); - fldStTest.getVariableKeysFromFldSt(state, typeVar, keyCount, fldStTest.m_namesOfKeys, fldStTest.m_indexesForKeyVar); + fldStTest.getVariableKeysFromFldSt(*state, typeVar, keyCount, fldStTest.m_namesOfKeys, fldStTest.m_indexesForKeyVar); EXPECT_EQ(fldStTest.m_namesOfKeys[0], "LITE1"); EXPECT_EQ(fldStTest.m_namesOfKeys[1], "LITE2"); diff --git a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc index e0f815f8030..86f440d6b20 100644 --- a/tst/EnergyPlus/unit/OutputReportTabular.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabular.unit.cc @@ -94,6 +94,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::DataGlobalConstants; @@ -124,8 +125,8 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_ConfirmSetUnitsStyleFromString TEST_F(EnergyPlusFixture, OutputReportTabularTest_Basic) { OutputTableBinned.allocate(10); - EXPECT_TRUE(warningAboutKeyNotFound(state, 0, 1, "moduleName")); - EXPECT_FALSE(warningAboutKeyNotFound(state, 100, 1, "moduleName")); + EXPECT_TRUE(warningAboutKeyNotFound(*state, 0, 1, "moduleName")); + EXPECT_FALSE(warningAboutKeyNotFound(*state, 100, 1, "moduleName")); } TEST_F(EnergyPlusFixture, OutputReportTabularTest_RealToStr) @@ -215,18 +216,18 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_unitsFromHeading) unitsStyle = unitsStyleInchPound; unitString = ""; - EXPECT_EQ(97, unitsFromHeading(state, unitString)); + EXPECT_EQ(97, unitsFromHeading(*state, unitString)); EXPECT_EQ("", unitString); unitString = "Zone Floor Area {m2}"; - EXPECT_EQ(46, unitsFromHeading(state, unitString)); + EXPECT_EQ(46, unitsFromHeading(*state, unitString)); EXPECT_EQ("Zone Floor Area {ft2}", unitString); unitString = "Fictional field {nonsense}"; - EXPECT_EQ(0, unitsFromHeading(state, unitString)); + EXPECT_EQ(0, unitsFromHeading(*state, unitString)); EXPECT_EQ("Fictional field {nonsense}", unitString); // Check a few report column headings too unitString = "Standard Rated Net Cooling Capacity [W]"; - indexUnitConv = unitsFromHeading(state, unitString); + indexUnitConv = unitsFromHeading(*state, unitString); GetUnitConversion(indexUnitConv, curConversionFactor, curConversionOffset, curUnits); // We expect W to convert to tons because it's cooling EXPECT_EQ(70, indexUnitConv); @@ -235,7 +236,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_unitsFromHeading) EXPECT_EQ(0.0, curConversionOffset); unitString = "Rated Net Cooling Capacity Test A [W]"; - indexUnitConv = unitsFromHeading(state, unitString); + indexUnitConv = unitsFromHeading(*state, unitString); GetUnitConversion(indexUnitConv, curConversionFactor, curConversionOffset, curUnits); // We expect W to convert to tons because it's cooling EXPECT_EQ(70, indexUnitConv); @@ -287,7 +288,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetUnitConversion) SetupUnitConversions(); varNameWithUnits = "ZONE AIR SYSTEM SENSIBLE COOLING RATE[W]"; - LookupSItoIP(state, varNameWithUnits, indexUnitConv, curUnits); + LookupSItoIP(*state, varNameWithUnits, indexUnitConv, curUnits); GetUnitConversion(indexUnitConv, curConversionFactor, curConversionOffset, curUnits); EXPECT_EQ(70, indexUnitConv); EXPECT_EQ("ton", curUnits); @@ -295,7 +296,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetUnitConversion) EXPECT_EQ(0.0, curConversionOffset); varNameWithUnits = "SITE OUTDOOR AIR DRYBULB TEMPERATURE[C]"; - LookupSItoIP(state, varNameWithUnits, indexUnitConv, curUnits); + LookupSItoIP(*state, varNameWithUnits, indexUnitConv, curUnits); GetUnitConversion(indexUnitConv, curConversionFactor, curConversionOffset, curUnits); EXPECT_EQ(11, indexUnitConv); EXPECT_EQ("F", curUnits); @@ -303,7 +304,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetUnitConversion) EXPECT_EQ(32., curConversionOffset); varNameWithUnits = "ZONE ELECTRIC EQUIPMENT ELECTRICITY ENERGY[J]"; - LookupSItoIP(state, varNameWithUnits, indexUnitConv, curUnits); + LookupSItoIP(*state, varNameWithUnits, indexUnitConv, curUnits); GetUnitConversion(indexUnitConv, curConversionFactor, curConversionOffset, curUnits); EXPECT_EQ(20, indexUnitConv); EXPECT_EQ("kWh", curUnits); @@ -311,7 +312,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetUnitConversion) EXPECT_EQ(0.0, curConversionOffset); varNameWithUnits = "ZONE COOLING SETPOINT NOT MET TIME[hr]"; - LookupSItoIP(state, varNameWithUnits, indexUnitConv, curUnits); + LookupSItoIP(*state, varNameWithUnits, indexUnitConv, curUnits); GetUnitConversion(indexUnitConv, curConversionFactor, curConversionOffset, curUnits); EXPECT_EQ(17, indexUnitConv); EXPECT_EQ("hr", curUnits); @@ -319,7 +320,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetUnitConversion) EXPECT_EQ(0.0, curConversionOffset); varNameWithUnits = "ZONE LIGHTS TOTAL HEATING ENERGY[Invalid/Undefined]"; - LookupSItoIP(state, varNameWithUnits, indexUnitConv, curUnits); + LookupSItoIP(*state, varNameWithUnits, indexUnitConv, curUnits); GetUnitConversion(indexUnitConv, curConversionFactor, curConversionOffset, curUnits); EXPECT_EQ(96, indexUnitConv); EXPECT_EQ("Invalid/Undefined", curUnits); @@ -327,7 +328,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetUnitConversion) EXPECT_EQ(0.0, curConversionOffset); varNameWithUnits = "FICTIONAL VARIABLE[qqq]"; - LookupSItoIP(state, varNameWithUnits, indexUnitConv, curUnits); + LookupSItoIP(*state, varNameWithUnits, indexUnitConv, curUnits); GetUnitConversion(indexUnitConv, curConversionFactor, curConversionOffset, curUnits); EXPECT_EQ(0, indexUnitConv); EXPECT_EQ("", curUnits); @@ -335,7 +336,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetUnitConversion) EXPECT_EQ(0.0, curConversionOffset); varNameWithUnits = "ZONE PEOPLE OCCUPANT COUNT[]"; - LookupSItoIP(state, varNameWithUnits, indexUnitConv, curUnits); + LookupSItoIP(*state, varNameWithUnits, indexUnitConv, curUnits); GetUnitConversion(indexUnitConv, curConversionFactor, curConversionOffset, curUnits); EXPECT_EQ(97, indexUnitConv); EXPECT_EQ("", curUnits); @@ -393,7 +394,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetUnitConversion) }; for (auto u : units) { - LookupSItoIP(state, u, indexUnitConv, curUnits); + LookupSItoIP(*state, u, indexUnitConv, curUnits); EXPECT_NE(indexUnitConv, 0); } } @@ -499,11 +500,11 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_AllocateLoadComponentArraysTes { TotDesDays = 2; TotRunDesPersDays = 3; - state.dataGlobal->NumOfZones = 4; + state->dataGlobal->NumOfZones = 4; TotSurfaces = 7; - state.dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->NumOfTimeStepInHour = 4; - AllocateLoadComponentArrays(state); + AllocateLoadComponentArrays(*state); // radiantPulseTimestep.allocate( { 0, TotDesDays + TotRunDesPersDays }, NumOfZones ); EXPECT_EQ(radiantPulseTimestep.size(), 24u); @@ -1435,7 +1436,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_ZoneMultiplierTest) ASSERT_TRUE(process_idf(idf_objects)); - ManageSimulation(state); // run the design day over the warmup period (24 hrs, 25 days) + ManageSimulation(*state); // run the design day over the warmup period (24 hrs, 25 days) EXPECT_EQ(10.0, (Zone(2).Volume * Zone(2).Multiplier * Zone(2).ListMultiplier) / (Zone(1).Volume * Zone(1).Multiplier * Zone(1).ListMultiplier)); // leaving a little wiggle room on these @@ -1446,9 +1447,9 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_ZoneMultiplierTest) (DataZoneEnergyDemands::ZoneSysEnergyDemand(2).TotalOutputRequired / DataZoneEnergyDemands::ZoneSysEnergyDemand(1).TotalOutputRequired), 0.00001); - state.dataGlobal->DoWeathSim = true; // flag to trick tabular reports to scan meters - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::RunPeriodWeather; // fake a weather run since a weather file can't be used (could it?) - UpdateTabularReports(state, OutputProcessor::TimeStepType::TimeStepSystem); + state->dataGlobal->DoWeathSim = true; // flag to trick tabular reports to scan meters + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::RunPeriodWeather; // fake a weather run since a weather file can't be used (could it?) + UpdateTabularReports(*state, OutputProcessor::TimeStepType::TimeStepSystem); // zone equipment should report single zone magnitude, multipliers do not apply, should be > 0 or what's the point EXPECT_EQ(DataHeatBalance::ZnRpt(1).PeopleRadGain, DataHeatBalance::ZnRpt(2).PeopleRadGain); @@ -2470,13 +2471,13 @@ TEST_F(EnergyPlusFixture, AirloopHVAC_ZoneSumTest) ASSERT_TRUE(process_idf(idf_objects)); - ManageSimulation(state); // run the design day over the warmup period (24 hrs, 25 days) + ManageSimulation(*state); // run the design day over the warmup period (24 hrs, 25 days) EXPECT_EQ(10.0, (Zone(2).Volume * Zone(2).Multiplier * Zone(2).ListMultiplier) / (Zone(1).Volume * Zone(1).Multiplier * Zone(1).ListMultiplier)); - state.dataGlobal->DoWeathSim = true; // flag to trick tabular reports to scan meters - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::RunPeriodWeather; // fake a weather run since a weather file can't be used (could it?) - UpdateTabularReports(state, OutputProcessor::TimeStepType::TimeStepSystem); + state->dataGlobal->DoWeathSim = true; // flag to trick tabular reports to scan meters + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::RunPeriodWeather; // fake a weather run since a weather file can't be used (could it?) + UpdateTabularReports(*state, OutputProcessor::TimeStepType::TimeStepSystem); EXPECT_NEAR(1.86168, DataSizing::FinalSysSizing(1).DesOutAirVolFlow, 0.0001); } @@ -3442,14 +3443,14 @@ TEST_F(EnergyPlusFixture, AirloopHVAC_ZoneSumTest) // ASSERT_TRUE( process_idf( idf_objects ) ); // OutputProcessor::TimeValue.allocate(2); -////state.dataGlobal->DDOnlySimulation = true; +////state->dataGlobal->DDOnlySimulation = true; // ManageSimulation(); // run the design day over the warmup period (24 hrs, 25 days) // EXPECT_EQ( 10.0, ( Zone( 2 ).Volume * Zone( 2 ).Multiplier * Zone( 2 ).ListMultiplier ) / ( Zone( 1 ).Volume * Zone( 1 ).Multiplier * Zone( 1 // ).ListMultiplier ) ); -// state.dataGlobal->DoWeathSim = true; // flag to trick tabular reports to scan meters +// state->dataGlobal->DoWeathSim = true; // flag to trick tabular reports to scan meters // DataGlobals::KindOfSim = DataGlobalConstants::KindOfSim::RunPeriodWeather; // fake a weather run since a weather file can't be used (could it?) // UpdateTabularReports( OutputProcessor::TimeStepType::TimeStepSystem ); @@ -3475,7 +3476,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_ResetMonthlyGathering) Real64 extLitUse; - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -3485,7 +3486,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_ResetMonthlyGathering) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -3495,7 +3496,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_ResetMonthlyGathering) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -3506,32 +3507,32 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_ResetMonthlyGathering) "Exterior Lights", "General"); - state.dataGlobal->DoWeathSim = true; - state.dataGlobal->TimeStepZone = 0.25; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; - GetInputTabularMonthly(state); + GetInputTabularMonthly(*state); EXPECT_EQ(MonthlyInputCount, 1); - InitializeTabularMonthly(state); + InitializeTabularMonthly(*state); extLitUse = 1.01; DataEnvironment::Month = 12; - GatherMonthlyResultsForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherMonthlyResultsForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(extLitUse * 1, MonthlyColumns(1).reslt(12)); - GatherMonthlyResultsForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherMonthlyResultsForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(extLitUse * 2, MonthlyColumns(1).reslt(12)); - GatherMonthlyResultsForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherMonthlyResultsForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(extLitUse * 3, MonthlyColumns(1).reslt(12)); ResetMonthlyGathering(); EXPECT_EQ(0., MonthlyColumns(1).reslt(12)); - GatherMonthlyResultsForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherMonthlyResultsForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(extLitUse * 1, MonthlyColumns(1).reslt(12)); } @@ -3540,7 +3541,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_ConfirmResetBEPSGathering) Real64 extLitUse; - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -3550,7 +3551,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_ConfirmResetBEPSGathering) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -3560,7 +3561,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_ConfirmResetBEPSGathering) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -3571,38 +3572,38 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_ConfirmResetBEPSGathering) "Exterior Lights", "General"); - state.dataGlobal->DoWeathSim = true; - state.dataGlobal->TimeStepZone = 1.0; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->TimeStepZone = 1.0; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; displayTabularBEPS = true; // OutputProcessor::TimeValue.allocate(2); auto timeStep = 1.0; - SetupTimePointers(state, "Zone", timeStep); - SetupTimePointers(state, "HVAC", timeStep); + SetupTimePointers(*state, "Zone", timeStep); + SetupTimePointers(*state, "HVAC", timeStep); *TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep = 60; *TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep = 60; - GetInputOutputTableSummaryReports(state); + GetInputOutputTableSummaryReports(*state); extLitUse = 1.01; DataEnvironment::Month = 12; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); GatherBEPSResultsForTimestep(OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(extLitUse * 3, gatherEndUseBEPS(1, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights))); - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); GatherBEPSResultsForTimestep(OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(extLitUse * 6, gatherEndUseBEPS(1, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights))); - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); GatherBEPSResultsForTimestep(OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(extLitUse * 9, gatherEndUseBEPS(1, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights))); @@ -3610,8 +3611,8 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_ConfirmResetBEPSGathering) EXPECT_EQ(0., gatherEndUseBEPS(1, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights))); - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); GatherBEPSResultsForTimestep(OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(extLitUse * 3, gatherEndUseBEPS(1, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights))); } @@ -3622,7 +3623,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherPeakDemandForTimestep) displayDemandEndUse = true; displayLEEDSummary = true; - state.dataGlobal->TimeStepZoneSec = 900.0; + state->dataGlobal->TimeStepZoneSec = 900.0; int resourceNum = 1; int totalMeterNum = 2; @@ -3653,11 +3654,11 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherPeakDemandForTimestep) // first "timestep" - EnergyMeters(totalMeterNum).CurTSValue = 123.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the total meter - EnergyMeters(endUseMeterNum).CurTSValue = 47.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the end use meter - EnergyMeters(subEndUseMeterNum).CurTSValue = 28.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the sub end use meter + EnergyMeters(totalMeterNum).CurTSValue = 123.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the total meter + EnergyMeters(endUseMeterNum).CurTSValue = 47.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the end use meter + EnergyMeters(subEndUseMeterNum).CurTSValue = 28.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the sub end use meter - GatherPeakDemandForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherPeakDemandForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(123., gatherDemandTotal(resourceNum)); @@ -3669,11 +3670,11 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherPeakDemandForTimestep) // next "timestep" total higher - EnergyMeters(totalMeterNum).CurTSValue = 133.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the total meter - EnergyMeters(endUseMeterNum).CurTSValue = 57.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the end use meter - EnergyMeters(subEndUseMeterNum).CurTSValue = 38.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the sub end use meter + EnergyMeters(totalMeterNum).CurTSValue = 133.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the total meter + EnergyMeters(endUseMeterNum).CurTSValue = 57.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the end use meter + EnergyMeters(subEndUseMeterNum).CurTSValue = 38.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the sub end use meter - GatherPeakDemandForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherPeakDemandForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(133., gatherDemandTotal(resourceNum)); @@ -3685,11 +3686,11 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherPeakDemandForTimestep) // next "timestep" total lower but end use higher and sub end use higher - EnergyMeters(totalMeterNum).CurTSValue = 103.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the total meter - EnergyMeters(endUseMeterNum).CurTSValue = 61.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the end use meter - EnergyMeters(subEndUseMeterNum).CurTSValue = 42.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the sub end use meter + EnergyMeters(totalMeterNum).CurTSValue = 103.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the total meter + EnergyMeters(endUseMeterNum).CurTSValue = 61.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the end use meter + EnergyMeters(subEndUseMeterNum).CurTSValue = 42.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the sub end use meter - GatherPeakDemandForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherPeakDemandForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(133., gatherDemandTotal(resourceNum)); @@ -3701,11 +3702,11 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherPeakDemandForTimestep) // next "timestep" total higher but end use lower and sub end use lower - EnergyMeters(totalMeterNum).CurTSValue = 143.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the total meter - EnergyMeters(endUseMeterNum).CurTSValue = 59.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the end use meter - EnergyMeters(subEndUseMeterNum).CurTSValue = 39.0 * state.dataGlobal->TimeStepZoneSec; // create the current value for the sub end use meter + EnergyMeters(totalMeterNum).CurTSValue = 143.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the total meter + EnergyMeters(endUseMeterNum).CurTSValue = 59.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the end use meter + EnergyMeters(subEndUseMeterNum).CurTSValue = 39.0 * state->dataGlobal->TimeStepZoneSec; // create the current value for the sub end use meter - GatherPeakDemandForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherPeakDemandForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); EXPECT_EQ(143., gatherDemandTotal(resourceNum)); @@ -3724,7 +3725,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherHeatEmissionReport) { displayHeatEmissionsSummary = true; - state.dataGlobal->DoWeathSim = true; + state->dataGlobal->DoWeathSim = true; DataHVACGlobals::TimeStepSys = 10.0; DataEnvironment::OutHumRat = 0.005; DataEnvironment::OutDryBulbTemp = 25.0; @@ -3733,16 +3734,16 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherHeatEmissionReport) MixedAir::OAController.allocate(2); MixedAir::OAController(1).RelTotalLossRate = 1.0; MixedAir::OAController(2).RelTotalLossRate = 1.0; - state.dataCondenserLoopTowers->NumSimpleTowers = 1; - state.dataCondenserLoopTowers->towers.allocate(1); - state.dataCondenserLoopTowers->towers(1).Qactual = 1.0; - state.dataCondenserLoopTowers->towers(1).FanEnergy = 50.0; + state->dataCondenserLoopTowers->NumSimpleTowers = 1; + state->dataCondenserLoopTowers->towers.allocate(1); + state->dataCondenserLoopTowers->towers(1).Qactual = 1.0; + state->dataCondenserLoopTowers->towers(1).FanEnergy = 50.0; Real64 TimeStepSysSec = DataHVACGlobals::TimeStepSys * DataGlobalConstants::SecInHour(); Real64 reliefEnergy = 2.0 * TimeStepSysSec; Real64 condenserReject = 1.0 * TimeStepSysSec + 50.0; - GatherHeatEmissionReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + GatherHeatEmissionReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); EXPECT_EQ(reliefEnergy, DataHeatBalance::SysTotalHVACReliefHeatLoss); EXPECT_EQ(reliefEnergy * DataGlobalConstants::convertJtoGJ(), BuildingPreDefRep.emiHVACRelief); @@ -3767,7 +3768,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherHeatEmissionReport) DXCoils::DXCoil(2).CrankcaseHeaterConsumption = 0.0; Real64 coilReject = 1.0 * TimeStepSysSec + 200.0 + 10.0; - GatherHeatEmissionReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + GatherHeatEmissionReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); EXPECT_EQ(reliefEnergy, DataHeatBalance::SysTotalHVACReliefHeatLoss); EXPECT_EQ(2 * reliefEnergy * DataGlobalConstants::convertJtoGJ(), BuildingPreDefRep.emiHVACRelief); EXPECT_EQ(condenserReject + coilReject, DataHeatBalance::SysTotalHVACRejectHeatLoss); @@ -3785,9 +3786,9 @@ TEST_F(EnergyPlusFixture, OutputTableTimeBins_GetInput) "Always1; !- Schedule Name"}); ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->DoWeathSim = true; + state->dataGlobal->DoWeathSim = true; - GetInputTabularTimeBins(state); + GetInputTabularTimeBins(*state); EXPECT_EQ(OutputReportTabular::OutputTableBinned.size(), 1u); EXPECT_EQ(OutputTableBinned(1).keyValue, "SYSTEM1"); @@ -4918,7 +4919,7 @@ TEST_F(EnergyPlusFixture, OutputTableTimeBins_GetInput) // ASSERT_TRUE( process_idf( idf_objects ) ); // OutputProcessor::TimeValue.allocate(2); -////state.dataGlobal->DDOnlySimulation = true; +////state->dataGlobal->DDOnlySimulation = true; // ManageSimulation(); //// compare_err_stream( "" ); @@ -6014,7 +6015,7 @@ TEST_F(EnergyPlusFixture, OutputTableTimeBins_GetInput) // ASSERT_TRUE( process_idf( idf_objects ) ); // OutputProcessor::TimeValue.allocate(2); -////state.dataGlobal->DDOnlySimulation = true; +////state->dataGlobal->DDOnlySimulation = true; // ManageSimulation(); ////compare_err_stream( "" ); @@ -6027,7 +6028,7 @@ TEST_F(EnergyPlusFixture, OutputTableTimeBins_GetInput) TEST_F(EnergyPlusFixture, OutputReportTabularTest_PredefinedTableRowMatchingTest) { - SetPredefinedTables(state); + SetPredefinedTables(*state); PreDefTableEntry(pdchLeedPerfElEneUse, "Exterior Lighting", 1000., 2); EXPECT_EQ("1000.00", RetrievePreDefTableEntry(pdchLeedPerfElEneUse, "Exterior Lighting")); @@ -6114,8 +6115,8 @@ TEST_F(SQLiteFixture, WriteVeriSumTableAreasTest) FrameDivider(2).FrameWidth = 0.2; // zone - state.dataGlobal->NumOfZones = 1; - Zone.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + Zone.allocate(state->dataGlobal->NumOfZones); Zone(1).SystemZoneNodeNumber = 1; Zone(1).Multiplier = 1.; Zone(1).ListMultiplier = 1.; @@ -6126,7 +6127,7 @@ TEST_F(SQLiteFixture, WriteVeriSumTableAreasTest) Zone(1).ExteriorTotalGroundSurfArea = 0; Zone(1).ExtWindowArea = Surface(3).GrossArea + Surface(4).GrossArea; - WriteVeriSumTable(state); + WriteVeriSumTable(*state); auto tabularData = queryResult("SELECT * FROM TabularData;", "TabularData"); auto strings = queryResult("SELECT * FROM Strings;", "Strings"); @@ -6245,8 +6246,8 @@ TEST_F(SQLiteFixture, WriteVeriSumTable_TestNotPartOfTotal) ZoneElectric(3).DesignLevel = 5.0; // zone - state.dataGlobal->NumOfZones = 3; - Zone.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 3; + Zone.allocate(state->dataGlobal->NumOfZones); Zone(1).Name = "PartofTot Conditioned Zone"; Zone(1).SystemZoneNodeNumber = 1; // Conditioned Zone(1).isPartOfTotalArea = true; @@ -6283,7 +6284,7 @@ TEST_F(SQLiteFixture, WriteVeriSumTable_TestNotPartOfTotal) Zone(3).ExteriorTotalGroundSurfArea = 0; Zone(3).ExtWindowArea = 0.0; - WriteVeriSumTable(state); + WriteVeriSumTable(*state); /*********************************************************************************************************************************************** * Check Yes/No flag * @@ -6411,7 +6412,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_invalidAggregationOrder) Real64 extLitUse; - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -6421,7 +6422,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_invalidAggregationOrder) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -6431,7 +6432,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_invalidAggregationOrder) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -6442,15 +6443,15 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_invalidAggregationOrder) "Exterior Lights", "General"); - state.dataGlobal->DoWeathSim = true; - state.dataGlobal->TimeStepZone = 0.25; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; - GetInputTabularMonthly(state); + GetInputTabularMonthly(*state); EXPECT_EQ(MonthlyInputCount, 1); - InitializeTabularMonthly(state); + InitializeTabularMonthly(*state); - EXPECT_TRUE(isInvalidAggregationOrder(state)); + EXPECT_TRUE(isInvalidAggregationOrder(*state)); } TEST_F(EnergyPlusFixture, OutputReportTabularTest_CollectPeakZoneConditions_test) @@ -6468,12 +6469,12 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_CollectPeakZoneConditions_test Zone(1).ListMultiplier = 1; Zone(1).FloorArea = 12.; - state.dataWeatherManager->DesDayInput.allocate(1); - state.dataWeatherManager->DesDayInput(1).Month = 5; - state.dataWeatherManager->DesDayInput(1).DayOfMonth = 21; + state->dataWeatherManager->DesDayInput.allocate(1); + state->dataWeatherManager->DesDayInput(1).Month = 5; + state->dataWeatherManager->DesDayInput(1).DayOfMonth = 21; - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 15; CoolPeakDateHrMin.allocate(1); @@ -6494,7 +6495,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_CollectPeakZoneConditions_test FinalZoneSizing.allocate(1); FinalZoneSizing(1).DesCoolLoad = 600.; - CollectPeakZoneConditions(state, compLoad, 1, timeOfMax, zoneIndex, isCooling); + CollectPeakZoneConditions(*state, compLoad, 1, timeOfMax, zoneIndex, isCooling); EXPECT_EQ(compLoad.peakDateHrMin, "5/21 15:45:00"); EXPECT_EQ(compLoad.outsideDryBulb, 38.); @@ -6535,7 +6536,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetZoneComponentAreas_test) areas.allocate(1); Zone.allocate(1); - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; Zone(1).FloorArea = 12.; Surface.allocate(13); @@ -6618,7 +6619,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetZoneComponentAreas_test) Surface(13).Zone = 1; Surface(13).HeatTransSurf = true; - GetZoneComponentAreas(state, areas); + GetZoneComponentAreas(*state, areas); EXPECT_EQ(12., areas(1).floor); EXPECT_EQ(8., areas(1).roof); @@ -6719,13 +6720,13 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_LoadSummaryUnitConversion_test compLoad.totCapPerArea = 0.15; unitsStyle = unitsStyleInchPound; - Real64 powerConversion = getSpecificUnitMultiplier(state, "W", "Btu/h"); - Real64 areaConversion = getSpecificUnitMultiplier(state, "m2", "ft2"); - Real64 airFlowConversion = getSpecificUnitMultiplier(state, "m3/s", "ft3/min"); - Real64 airFlowPerAreaConversion = getSpecificUnitMultiplier(state, "m3/s-m2", "ft3/min-ft2"); + Real64 powerConversion = getSpecificUnitMultiplier(*state, "W", "Btu/h"); + Real64 areaConversion = getSpecificUnitMultiplier(*state, "m2", "ft2"); + Real64 airFlowConversion = getSpecificUnitMultiplier(*state, "m3/s", "ft3/min"); + Real64 airFlowPerAreaConversion = getSpecificUnitMultiplier(*state, "m3/s-m2", "ft3/min-ft2"); int tempConvIndx = getSpecificUnitIndex("C", "F"); - LoadSummaryUnitConversion(state, compLoad); + LoadSummaryUnitConversion(*state, compLoad); EXPECT_EQ(3. * powerConversion, compLoad.cells(cSensInst, rLights)); EXPECT_EQ(10. * powerConversion, compLoad.cells(cLatent, rLights)); @@ -6743,11 +6744,11 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_CreateListOfZonesForAirLoop_te CompLoadTablesType compLoad; Array1D_int zoneToAirLoop; - state.dataGlobal->NumOfZones = 15; - compLoad.zoneIndices.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 15; + compLoad.zoneIndices.allocate(state->dataGlobal->NumOfZones); compLoad.zoneIndices = 0; - zoneToAirLoop.allocate(state.dataGlobal->NumOfZones); + zoneToAirLoop.allocate(state->dataGlobal->NumOfZones); zoneToAirLoop(1) = 3; zoneToAirLoop(2) = 2; zoneToAirLoop(3) = 1; @@ -6764,7 +6765,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_CreateListOfZonesForAirLoop_te zoneToAirLoop(14) = 3; zoneToAirLoop(15) = 1; - CreateListOfZonesForAirLoop(state, compLoad, zoneToAirLoop, 1); + CreateListOfZonesForAirLoop(*state, compLoad, zoneToAirLoop, 1); EXPECT_EQ(3, compLoad.zoneIndices(1)); EXPECT_EQ(4, compLoad.zoneIndices(2)); EXPECT_EQ(7, compLoad.zoneIndices(3)); @@ -6775,7 +6776,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_CreateListOfZonesForAirLoop_te EXPECT_EQ(0, compLoad.zoneIndices(8)); compLoad.zoneIndices = 0; - CreateListOfZonesForAirLoop(state, compLoad, zoneToAirLoop, 2); + CreateListOfZonesForAirLoop(*state, compLoad, zoneToAirLoop, 2); EXPECT_EQ(2, compLoad.zoneIndices(1)); EXPECT_EQ(5, compLoad.zoneIndices(2)); EXPECT_EQ(9, compLoad.zoneIndices(3)); @@ -6783,7 +6784,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_CreateListOfZonesForAirLoop_te EXPECT_EQ(0, compLoad.zoneIndices(5)); compLoad.zoneIndices = 0; - CreateListOfZonesForAirLoop(state, compLoad, zoneToAirLoop, 3); + CreateListOfZonesForAirLoop(*state, compLoad, zoneToAirLoop, 3); EXPECT_EQ(1, compLoad.zoneIndices(1)); EXPECT_EQ(6, compLoad.zoneIndices(2)); EXPECT_EQ(13, compLoad.zoneIndices(3)); @@ -6798,10 +6799,10 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) int iZone = 1; TotDesDays = 2; TotRunDesPersDays = 3; - state.dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->NumOfZones = 4; - Zone.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 4; + Zone.allocate(state->dataGlobal->NumOfZones); Zone(iZone).SurfaceFirst = 1; Zone(iZone).SurfaceLast = 1; @@ -6813,48 +6814,48 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) Surface(1).Class = SurfaceClass::Window; Array1D peopleDelaySeq; - peopleDelaySeq.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + peopleDelaySeq.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); peopleDelaySeq = 0.; Array1D peopleDelaySeqCool; - peopleDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + peopleDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); peopleDelaySeqCool = 0.; Array1D equipDelaySeqCool; - equipDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + equipDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); equipDelaySeqCool = 0.; Array1D hvacLossDelaySeqCool; - hvacLossDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + hvacLossDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); hvacLossDelaySeqCool = 0.; Array1D powerGenDelaySeqCool; - powerGenDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + powerGenDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); powerGenDelaySeqCool = 0.; Array1D lightDelaySeqCool; - lightDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + lightDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); lightDelaySeqCool = 0.; Array1D feneSolarDelaySeqCool; - feneSolarDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + feneSolarDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); feneSolarDelaySeqCool = 0.; Array3D feneCondInstantSeq; - feneCondInstantSeq.allocate(TotDesDays + TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); + feneCondInstantSeq.allocate(TotDesDays + TotRunDesPersDays, state->dataGlobal->NumOfTimeStepInHour * 24, state->dataGlobal->NumOfZones); feneCondInstantSeq = 0.0; Array2D surfDelaySeqCool; - surfDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, TotSurfaces); + surfDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24, TotSurfaces); surfDelaySeqCool = 0.0; - AllocateLoadComponentArrays(state); + AllocateLoadComponentArrays(*state); feneCondInstantSeq(coolDesSelected, 1, 1) = 0.88; netSurfRadSeq(coolDesSelected, 1, 1) = 0.05; - GetDelaySequences(state, + GetDelaySequences(*state, coolDesSelected, true, iZone, @@ -6869,7 +6870,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesTwice_test) EXPECT_EQ(0.83, feneCondInstantSeq(coolDesSelected, 1, 1)); // the first time the subtraction operation should have occurred - GetDelaySequences(state, + GetDelaySequences(*state, coolDesSelected, true, iZone, @@ -6899,16 +6900,16 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo DataSizing::FinalSysSizing.allocate(DataHVACGlobals::NumPrimaryAirSys); DataSizing::CalcSysSizing.allocate(DataHVACGlobals::NumPrimaryAirSys); int numDesDays = 2; - state.dataAirLoop->AirToZoneNodeInfo.allocate(DataHVACGlobals::NumPrimaryAirSys); - state.dataGlobal->NumOfZones = 0; + state->dataAirLoop->AirToZoneNodeInfo.allocate(DataHVACGlobals::NumPrimaryAirSys); + state->dataGlobal->NumOfZones = 0; displayAirLoopComponentLoadSummary = true; - state.dataGlobal->CompLoadReportIsReq = true; + state->dataGlobal->CompLoadReportIsReq = true; SysSizPeakDDNum(DataHVACGlobals::NumPrimaryAirSys).TimeStepAtTotCoolPk.allocate(numDesDays); SysSizPeakDDNum(DataHVACGlobals::NumPrimaryAirSys).TotCoolPeakDD = 0; // set to zero to indicate no design day chosen SysSizPeakDDNum(DataHVACGlobals::NumPrimaryAirSys).HeatPeakDD = 0; // set to zero to indicate no design day chosen - WriteLoadComponentSummaryTables(state); + WriteLoadComponentSummaryTables(*state); auto tabularData = queryResult("SELECT * FROM TabularData;", "TabularData"); auto strings = queryResult("SELECT * FROM Strings;", "Strings"); @@ -6936,7 +6937,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo OutputReportTabular::displayAirLoopComponentLoadSummary = true; OutputReportTabular::displayZoneComponentLoadSummary = true; OutputReportTabular::displayFacilityComponentLoadSummary = true; - state.dataGlobal->CompLoadReportIsReq = true; + state->dataGlobal->CompLoadReportIsReq = true; Psychrometrics::InitializePsychRoutines(); @@ -6946,20 +6947,20 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo int numDesDays = 2; DataEnvironment::TotDesDays = numDesDays; DataEnvironment::TotRunDesPersDays = 0; - state.dataWeatherManager->DesDayInput.allocate(2); - state.dataWeatherManager->DesDayInput(1).Month = 7; - state.dataWeatherManager->DesDayInput(1).DayOfMonth = 21; - state.dataWeatherManager->DesDayInput(2).Month = 1; - state.dataWeatherManager->DesDayInput(2).DayOfMonth = 21; + state->dataWeatherManager->DesDayInput.allocate(2); + state->dataWeatherManager->DesDayInput(1).Month = 7; + state->dataWeatherManager->DesDayInput(1).DayOfMonth = 21; + state->dataWeatherManager->DesDayInput(2).Month = 1; + state->dataWeatherManager->DesDayInput(2).DayOfMonth = 21; - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 15; int numTimeStepInDay = 96; // One Zone - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataHeatBalance::Zone.allocate(1); DataHeatBalance::Zone(1).Multiplier = 1; DataHeatBalance::Zone(1).ListMultiplier = 1; @@ -6971,7 +6972,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo // Cool Peak on 1st DD at 16:00 and Heat Peak on 2nd DD at 1:00 - DataSizing::CalcFinalZoneSizing.allocate(state.dataGlobal->NumOfZones); + DataSizing::CalcFinalZoneSizing.allocate(state->dataGlobal->NumOfZones); int coolDDNum = 1; int coolTimeOfMax = 64; @@ -7026,19 +7027,19 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo DataSizing::CalcFinalZoneSizing(1).DesHeatVolFlow = 3.3; - DataSizing::CalcZoneSizing.allocate(numDesDays, state.dataGlobal->NumOfZones); + DataSizing::CalcZoneSizing.allocate(numDesDays, state->dataGlobal->NumOfZones); DataSizing::CalcZoneSizing(1, 1).DOASHeatAddSeq.allocate(numTimeStepInDay); DataSizing::CalcZoneSizing(1, 1).DOASLatAddSeq.allocate(numTimeStepInDay); DataSizing::CalcZoneSizing(2, 1).DOASHeatAddSeq.allocate(numTimeStepInDay); DataSizing::CalcZoneSizing(2, 1).DOASLatAddSeq.allocate(numTimeStepInDay); - state.dataAirLoop->AirToZoneNodeInfo.allocate(DataHVACGlobals::NumPrimaryAirSys); - state.dataAirLoop->AirToZoneNodeInfo(1).NumZonesCooled = 1; - state.dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums(1) = 1; - state.dataAirLoop->AirToZoneNodeInfo(1).NumZonesHeated = 1; - state.dataAirLoop->AirToZoneNodeInfo(1).HeatCtrlZoneNums.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(1).HeatCtrlZoneNums(1) = 1; + state->dataAirLoop->AirToZoneNodeInfo.allocate(DataHVACGlobals::NumPrimaryAirSys); + state->dataAirLoop->AirToZoneNodeInfo(1).NumZonesCooled = 1; + state->dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums(1) = 1; + state->dataAirLoop->AirToZoneNodeInfo(1).NumZonesHeated = 1; + state->dataAirLoop->AirToZoneNodeInfo(1).HeatCtrlZoneNums.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(1).HeatCtrlZoneNums(1) = 1; // same Design Days peak and timestep peak as the zone it serves. This is the critical part of the test @@ -7059,8 +7060,8 @@ TEST_F(SQLiteFixture, OutputReportTabular_WriteLoadComponentSummaryTables_AirLoo DataSizing::CalcFinalFacilitySizing.TimeStepNumAtHeatMax = heatTimeOfMax; - AllocateLoadComponentArrays(state); - WriteLoadComponentSummaryTables(state); + AllocateLoadComponentArrays(*state); + WriteLoadComponentSummaryTables(*state); // TableName, ReportName, value std::vector> results_strings({ @@ -7142,7 +7143,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_hasSizingPeriodsDays_Sizing ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_TRUE(hasSizingPeriodsDays(state)); + EXPECT_TRUE(hasSizingPeriodsDays(*state)); } TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_hasSizingPeriodsDays_SizingPeriodWeatherFileDays) @@ -7161,7 +7162,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_hasSizingPeriodsDays_Sizing ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_TRUE(hasSizingPeriodsDays(state)); + EXPECT_TRUE(hasSizingPeriodsDays(*state)); } TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_hasSizingPeriodsDays_SizingPeriodWeatherFileConditionType) @@ -7178,7 +7179,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_hasSizingPeriodsDays_Sizing ASSERT_TRUE(process_idf(idf_objects)); // this test should show a false since this type of sizing period is not compatible with the component loads calculations - EXPECT_FALSE(hasSizingPeriodsDays(state)); + EXPECT_FALSE(hasSizingPeriodsDays(*state)); } // This tests aims to ensure that the needed Output:Variables for the Predefined Monthly table @@ -7194,8 +7195,8 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthlyPredefined_FindNeededOutputV ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_EQ(1, inputProcessor->getNumObjectsFound(state, "Output:Table:SummaryReports")); - EXPECT_EQ(0, inputProcessor->getNumObjectsFound(state, "Output:Variable")); + EXPECT_EQ(1, inputProcessor->getNumObjectsFound(*state, "Output:Table:SummaryReports")); + EXPECT_EQ(0, inputProcessor->getNumObjectsFound(*state, "Output:Variable")); // InputProcessor::addVariablesForMonthlyReport should have requested 5 variables // for the SetpointsNotMetWithTemperatureMonthly report @@ -7211,20 +7212,20 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthlyPredefined_FindNeededOutputV std::vector ZoneNames({"Zone1", "Zone2"}); for (int i = 0; i < 2; ++i) { - SetupOutputVariable(state, "Zone Mean Air Temperature", OutputProcessor::Unit::C, zoneTemp, "Zone", "Average", ZoneNames[i]); + SetupOutputVariable(*state, "Zone Mean Air Temperature", OutputProcessor::Unit::C, zoneTemp, "Zone", "Average", ZoneNames[i]); - SetupOutputVariable(state, "Zone Heating Setpoint Not Met Time", OutputProcessor::Unit::hr, timeNotMet, "Zone", "Sum", ZoneNames[i]); - SetupOutputVariable(state, "Zone Heating Setpoint Not Met While Occupied Time", OutputProcessor::Unit::hr, timeNotMet, "Zone", "Sum", ZoneNames[i]); - SetupOutputVariable(state, "Zone Cooling Setpoint Not Met Time", OutputProcessor::Unit::hr, timeNotMet, "Zone", "Sum", ZoneNames[i]); - SetupOutputVariable(state, "Zone Cooling Setpoint Not Met While Occupied Time", OutputProcessor::Unit::hr, timeNotMet, "Zone", "Sum", ZoneNames[i]); + SetupOutputVariable(*state, "Zone Heating Setpoint Not Met Time", OutputProcessor::Unit::hr, timeNotMet, "Zone", "Sum", ZoneNames[i]); + SetupOutputVariable(*state, "Zone Heating Setpoint Not Met While Occupied Time", OutputProcessor::Unit::hr, timeNotMet, "Zone", "Sum", ZoneNames[i]); + SetupOutputVariable(*state, "Zone Cooling Setpoint Not Met Time", OutputProcessor::Unit::hr, timeNotMet, "Zone", "Sum", ZoneNames[i]); + SetupOutputVariable(*state, "Zone Cooling Setpoint Not Met While Occupied Time", OutputProcessor::Unit::hr, timeNotMet, "Zone", "Sum", ZoneNames[i]); } // We do need to trick it into thinking it's a weather simulation, otherwise the monthly reports aren't reported - state.dataGlobal->DoWeathSim = true; // flag to trick tabular reports to scan meters + state->dataGlobal->DoWeathSim = true; // flag to trick tabular reports to scan meters - OutputProcessor::GetReportVariableInput(state); - OutputReportTabular::GetInputOutputTableSummaryReports(state); - OutputReportTabular::InitializeTabularMonthly(state); + OutputProcessor::GetReportVariableInput(*state); + OutputReportTabular::GetInputOutputTableSummaryReports(*state); + OutputReportTabular::InitializeTabularMonthly(*state); // We check that the Predefined Table is actually set to show EXPECT_EQ("SetpointsNotMetWithTemperaturesMonthly", namedMonthly(31).title); @@ -7257,7 +7258,7 @@ TEST_F(SQLiteFixture, OutputReportTabularTest_PredefinedTableDXConversion) SetupUnitConversions(); OutputReportTabular::unitsStyle = OutputReportTabular::unitsStyleInchPound; - SetPredefinedTables(state); + SetPredefinedTables(*state); std::string CompName = "My DX Coil with 10000W cooling"; PreDefTableEntry(pdchDXCoolCoilType, CompName, "Coil:Cooling:DX:SingleSpeed"); @@ -7276,7 +7277,7 @@ TEST_F(SQLiteFixture, OutputReportTabularTest_PredefinedTableDXConversion) EXPECT_EQ("EquipmentSummary", OutputReportPredefined::reportName(5).name); OutputReportPredefined::reportName(5).show = true; - WritePredefinedTables(state); + WritePredefinedTables(*state); EnergyPlus::sqlite->sqliteCommit(); EnergyPlus::sqlite->initializeIndexes(); @@ -7315,7 +7316,7 @@ TEST_F(SQLiteFixture, OutputReportTabularTest_PredefinedTableCoilHumRat) SetupUnitConversions(); OutputReportTabular::unitsStyle = OutputReportTabular::unitsStyleInchPound; - SetPredefinedTables(state); + SetPredefinedTables(*state); std::string CompName = "My DX Coil"; PreDefTableEntry(pdchDXCoolCoilType, CompName, "Coil:Cooling:DX:SingleSpeed"); @@ -7329,7 +7330,7 @@ TEST_F(SQLiteFixture, OutputReportTabularTest_PredefinedTableCoilHumRat) EXPECT_EQ("CoilSizingDetails", OutputReportPredefined::reportName(7).name); OutputReportPredefined::reportName(7).show = true; - WritePredefinedTables(state); + WritePredefinedTables(*state); EnergyPlus::sqlite->sqliteCommit(); EnergyPlus::sqlite->initializeIndexes(); @@ -7385,11 +7386,11 @@ TEST_F(EnergyPlusFixture, AzimuthToCardinal) // Allocate some needed arrays DataHeatBalance::Zone.allocate(1); DataHeatBalance::Zone(1).ListMultiplier = 1; - state.dataConstruction->Construct.allocate(1); - state.dataConstruction->Construct(1).Name = "A Construction"; + state->dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct(1).Name = "A Construction"; // Avoid trigerring CalcNominalWindowCond - state.dataConstruction->Construct(1).SummerSHGC = 0.70; - state.dataConstruction->Construct(1).VisTransNorm = 0.80; + state->dataConstruction->Construct(1).SummerSHGC = 0.70; + state->dataConstruction->Construct(1).VisTransNorm = 0.80; DataHeatBalance::NominalU.allocate(1); DataHeatBalance::NominalU(1) = 0.2; @@ -7433,10 +7434,10 @@ TEST_F(EnergyPlusFixture, AzimuthToCardinal) } // Setup pre def tables - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // Call the routine that fills up the table we care about - HeatBalanceSurfaceManager::GatherForPredefinedReport(state); + HeatBalanceSurfaceManager::GatherForPredefinedReport(*state); // Looking for Report 'EnvelopeSummary' (pdrEnvelope) @@ -7509,9 +7510,9 @@ TEST_F(EnergyPlusFixture, InteriorSurfaceEnvelopeSummaryReport) DataHeatBalance::Zone.allocate(2); DataHeatBalance::Zone(1).ListMultiplier = 1; DataHeatBalance::Zone(2).ListMultiplier = 1; - state.dataConstruction->Construct.allocate(1); - state.dataConstruction->Construct(1).Name = "A Construction"; - state.dataConstruction->Construct(1).OutsideAbsorpSolar = 0.4; + state->dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct(1).Name = "A Construction"; + state->dataConstruction->Construct(1).OutsideAbsorpSolar = 0.4; DataHeatBalance::NominalU.allocate(1); DataHeatBalance::NominalU(1) = 0.2; @@ -7555,10 +7556,10 @@ TEST_F(EnergyPlusFixture, InteriorSurfaceEnvelopeSummaryReport) DataSurfaces::Surface(4).ExtBoundCondName = "Interzonal_Door_1"; // Setup pre def tables - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // Call the routine that fills up the table we care about - HeatBalanceSurfaceManager::GatherForPredefinedReport(state); + HeatBalanceSurfaceManager::GatherForPredefinedReport(*state); // Looking for Report 'EnvelopeSummary' (pdrEnvelope) @@ -7716,8 +7717,8 @@ TEST_F(SQLiteFixture, WriteSourceEnergyEndUseSummary_TestPerArea) { ZoneElectric(3).DesignLevel = 5.0; // zone - state.dataGlobal->NumOfZones = 3; - Zone.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 3; + Zone.allocate(state->dataGlobal->NumOfZones); Zone(1).Name = "PartofTot Conditioned Zone"; Zone(1).SystemZoneNodeNumber = 1; // Conditioned Zone(1).isPartOfTotalArea = true; @@ -7766,7 +7767,7 @@ TEST_F(SQLiteFixture, WriteSourceEnergyEndUseSummary_TestPerArea) { OutputReportTabular::unitsStyle = OutputReportTabular::unitsStyleJtoKWH; // Now we're ready to call the actual function of interest - OutputReportTabular::WriteSourceEnergyEndUseSummary(state); + OutputReportTabular::WriteSourceEnergyEndUseSummary(*state); // Before we test the reporting itself, we check that DetermineBuildingFloorArea (called from WriteSourceEnergyEndUseSummary) @@ -7828,14 +7829,14 @@ TEST_F(SQLiteFixture, OutputReportTabular_EndUseBySubcategorySQL) // Needed to avoid crash (from ElectricPowerServiceManager.hh) createFacilityElectricPowerServiceObject(); - SetPredefinedTables(state); + SetPredefinedTables(*state); Real64 extLitUse = 1e8; Real64 CoalHeating = 2e8; Real64 GasolineHeating = 3e8; Real64 PropaneHeating = 4e8; - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -7845,7 +7846,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_EndUseBySubcategorySQL) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -7855,7 +7856,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_EndUseBySubcategorySQL) "Electricity", "Exterior Lights", "AnotherEndUseSubCat"); - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -7865,7 +7866,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_EndUseBySubcategorySQL) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Heating Coal Energy", + SetupOutputVariable(*state, "Heating Coal Energy", OutputProcessor::Unit::J, CoalHeating, "Zone", @@ -7875,7 +7876,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_EndUseBySubcategorySQL) "Coal", "Heating", "General"); - SetupOutputVariable(state, "Heating Gasoline Energy", + SetupOutputVariable(*state, "Heating Gasoline Energy", OutputProcessor::Unit::J, GasolineHeating, "Zone", @@ -7885,7 +7886,7 @@ TEST_F(SQLiteFixture, OutputReportTabular_EndUseBySubcategorySQL) "Gasoline", "Heating", "General"); - SetupOutputVariable(state, "Heating Propane Energy", + SetupOutputVariable(*state, "Heating Propane Energy", OutputProcessor::Unit::J, PropaneHeating, "Zone", @@ -7895,56 +7896,56 @@ TEST_F(SQLiteFixture, OutputReportTabular_EndUseBySubcategorySQL) "Propane", "Heating", "General"); - state.dataGlobal->DoWeathSim = true; - state.dataGlobal->TimeStepZone = 1.0; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->TimeStepZone = 1.0; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; displayTabularBEPS = true; // OutputProcessor::TimeValue.allocate(2); auto timeStep = 1.0; - SetupTimePointers(state, "Zone", timeStep); - SetupTimePointers(state, "HVAC", timeStep); + SetupTimePointers(*state, "Zone", timeStep); + SetupTimePointers(*state, "HVAC", timeStep); *TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep = 60; *TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep = 60; - GetInputOutputTableSummaryReports(state); + GetInputOutputTableSummaryReports(*state); DataEnvironment::Month = 12; - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); GatherBEPSResultsForTimestep(OutputProcessor::TimeStepType::TimeStepZone); - GatherPeakDemandForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherPeakDemandForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); EXPECT_NEAR(extLitUse * 3, gatherEndUseBEPS(1, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights)), 1.); // General EXPECT_NEAR(extLitUse * 2, gatherEndUseSubBEPS(1, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights), 1), 1.); // AnotherEndUseSubCat EXPECT_NEAR(extLitUse * 1, gatherEndUseSubBEPS(2, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights), 1), 1.); - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); GatherBEPSResultsForTimestep(OutputProcessor::TimeStepType::TimeStepZone); - GatherPeakDemandForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherPeakDemandForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); EXPECT_NEAR(extLitUse * 6, gatherEndUseBEPS(1, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights)), 1.); // General EXPECT_NEAR(extLitUse * 4, gatherEndUseSubBEPS(1, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights), 1), 1.); // AnotherEndUseSubCat EXPECT_NEAR(extLitUse * 2, gatherEndUseSubBEPS(2, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights), 1), 1.); - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); GatherBEPSResultsForTimestep(OutputProcessor::TimeStepType::TimeStepZone); - GatherPeakDemandForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherPeakDemandForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); EXPECT_NEAR(extLitUse * 9, gatherEndUseBEPS(1, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights)), 1.); // General EXPECT_NEAR(extLitUse * 6, gatherEndUseSubBEPS(1, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights), 1), 1.); // AnotherEndUseSubCat EXPECT_NEAR(extLitUse * 3, gatherEndUseSubBEPS(2, DataGlobalConstants::iEndUse.at(DataGlobalConstants::EndUse::ExteriorLights), 1), 1.); - OutputReportTabular::WriteBEPSTable(state); - OutputReportTabular::WriteDemandEndUseSummary(state); + OutputReportTabular::WriteBEPSTable(*state); + OutputReportTabular::WriteDemandEndUseSummary(*state); EnergyPlus::sqlite->sqliteCommit(); @@ -8131,10 +8132,10 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ int iZone = 1; TotDesDays = 2; TotRunDesPersDays = 3; - state.dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->NumOfZones = 1; - Zone.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + Zone.allocate(state->dataGlobal->NumOfZones); Zone(iZone).SurfaceFirst = 1; Zone(iZone).SurfaceLast = 4; @@ -8145,42 +8146,42 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ Surface.allocate(TotSurfaces); Array1D peopleDelaySeq; - peopleDelaySeq.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + peopleDelaySeq.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); peopleDelaySeq = 0.; Array1D peopleDelaySeqCool; - peopleDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + peopleDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); peopleDelaySeqCool = 0.; Array1D equipDelaySeqCool; - equipDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + equipDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); equipDelaySeqCool = 0.; Array1D hvacLossDelaySeqCool; - hvacLossDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + hvacLossDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); hvacLossDelaySeqCool = 0.; Array1D powerGenDelaySeqCool; - powerGenDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + powerGenDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); powerGenDelaySeqCool = 0.; Array1D lightDelaySeqCool; - lightDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + lightDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); lightDelaySeqCool = 0.; Array1D feneSolarDelaySeqCool; - feneSolarDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24); + feneSolarDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24); feneSolarDelaySeqCool = 0.; Array3D feneCondInstantSeq; - feneCondInstantSeq.allocate(TotDesDays + TotRunDesPersDays, state.dataGlobal->NumOfTimeStepInHour * 24, state.dataGlobal->NumOfZones); + feneCondInstantSeq.allocate(TotDesDays + TotRunDesPersDays, state->dataGlobal->NumOfTimeStepInHour * 24, state->dataGlobal->NumOfZones); feneCondInstantSeq = 0.0; Array2D surfDelaySeqCool; - surfDelaySeqCool.allocate(state.dataGlobal->NumOfTimeStepInHour * 24, TotSurfaces); + surfDelaySeqCool.allocate(state->dataGlobal->NumOfTimeStepInHour * 24, TotSurfaces); surfDelaySeqCool = 0.0; - AllocateLoadComponentArrays(state); + AllocateLoadComponentArrays(*state); // Set surface values std::vector surfBaseValue{100.0, 200.0, 300.0, 400.0}; @@ -8210,7 +8211,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ } } - GetDelaySequences(state, + GetDelaySequences(*state, coolDesSelected, true, iZone, @@ -8259,7 +8260,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_GetDelaySequencesSurfaceOrder_ } } - GetDelaySequences(state, + GetDelaySequences(*state, coolDesSelected, true, iZone, @@ -8296,7 +8297,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_ConfirmConversionFactors) bool fFScheduleUsed; int ffScheduleIndex; - PollutionModule::GetFuelFactorInfo(state, "Steam", fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); + PollutionModule::GetFuelFactorInfo(*state, "Steam", fuelFactorUsed, curSourceFactor, fFScheduleUsed, ffScheduleIndex); EXPECT_EQ(curSourceFactor, 1.2); @@ -8304,15 +8305,15 @@ TEST_F(EnergyPlusFixture, OutputReportTabularTest_ConfirmConversionFactors) TEST_F(EnergyPlusFixture, OutputReportTabular_GatherHeatGainReport) { - EnergyPlus::OutputReportTabular::clear_state(state); - state.dataGlobal->DoWeathSim = true; + EnergyPlus::OutputReportTabular::clear_state(*state); + state->dataGlobal->DoWeathSim = true; EnergyPlus::OutputReportPredefined::pdrSensibleGain = 1; EnergyPlus::OutputReportPredefined::reportName.allocate(1); EnergyPlus::OutputReportPredefined::reportName(pdrSensibleGain).show = true; EnergyPlus::DataHVACGlobals::TimeStepSys = 10.0; - state.dataGlobal->TimeStepZone = 20.0; + state->dataGlobal->TimeStepZone = 20.0; EnergyPlus::DataDefineEquip::NumAirDistUnits = 1; EnergyPlus::DataHeatBalance::ZonePreDefRep.allocate(1); @@ -8323,8 +8324,8 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherHeatGainReport) EnergyPlus::DataDefineEquip::AirDistUnit(1).HeatRate = 3.0; EnergyPlus::DataDefineEquip::AirDistUnit(1).CoolRate = 4.0; - state.dataGlobal->NumOfZones = 1; - EnergyPlus::DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + EnergyPlus::DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); EnergyPlus::DataHeatBalance::Zone(1).Multiplier = 1; EnergyPlus::DataHeatBalance::Zone(1).ListMultiplier = 1; @@ -8334,7 +8335,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabular_GatherHeatGainReport) EnergyPlus::DataHeatBalance::ZoneWinHeatGainRepEnergy.allocate(1); EnergyPlus::DataHeatBalance::ZoneWinHeatLossRepEnergy.allocate(1); - GatherHeatGainReport(state, OutputProcessor::TimeStepType::TimeStepSystem); + GatherHeatGainReport(*state, OutputProcessor::TimeStepType::TimeStepSystem); EXPECT_EQ(1.0*(EnergyPlus::DataHVACGlobals::TimeStepSys)*DataGlobalConstants::SecInHour(), DataHeatBalance::ZonePreDefRep(1).SHGSAnZoneEqHt); EXPECT_EQ(0.0*(EnergyPlus::DataHVACGlobals::TimeStepSys)*DataGlobalConstants::SecInHour(), DataHeatBalance::ZonePreDefRep(1).SHGSAnZoneEqCl); @@ -8382,7 +8383,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_8317_ValidateOutputTableMon Real64 extLitUse; - SetupOutputVariable(state, "Exterior Lights Electricity Energy", + SetupOutputVariable(*state, "Exterior Lights Electricity Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -8392,7 +8393,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_8317_ValidateOutputTableMon "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electricity Rate", + SetupOutputVariable(*state, "Exterior Lights Electricity Rate", OutputProcessor::Unit::W, extLitUse, "Zone", @@ -8403,11 +8404,11 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_8317_ValidateOutputTableMon "Exterior Lights", "General"); - state.dataGlobal->DoWeathSim = true; - state.dataGlobal->TimeStepZone = 0.25; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * 60.0; + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * 60.0; - InitializeOutput(state); + InitializeOutput(*state); int meter_array_ptr = -1; bool errors_found = false; @@ -8418,13 +8419,13 @@ TEST_F(EnergyPlusFixture, OutputReportTabularMonthly_8317_ValidateOutputTableMon std::string group(""); std::string const zoneName(""); - AttachMeters(state, OutputProcessor::Unit::J, resourceType, endUse, endUseSub, group, zoneName, 1, meter_array_ptr, errors_found); + AttachMeters(*state, OutputProcessor::Unit::J, resourceType, endUse, endUseSub, group, zoneName, 1, meter_array_ptr, errors_found); EXPECT_FALSE(errors_found); EXPECT_EQ(3, meter_array_ptr); // 2 meters were setup via SetupOutputVariable already - OutputReportTabular::GetInputTabularMonthly(state); - OutputReportTabular::InitializeTabularMonthly(state); + OutputReportTabular::GetInputTabularMonthly(*state); + OutputReportTabular::InitializeTabularMonthly(*state); std::string expected_error = delimited_string({ " ** Warning ** In Output:Table:Monthly 'MY REPORT' invalid Variable or Meter Name 'HEATING:GAS'", diff --git a/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc b/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc index 5f4bb79ee0c..1665c7b50f6 100644 --- a/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc +++ b/tst/EnergyPlus/unit/OutputReportTabularAnnual.unit.cc @@ -59,6 +59,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::OutputReportTabularAnnual; @@ -82,9 +83,9 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GetInput) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->DoWeathSim = true; + state->dataGlobal->DoWeathSim = true; - GetInputTabularAnnual(state); + GetInputTabularAnnual(*state); EXPECT_EQ(OutputReportTabularAnnual::annualTables.size(), 1u); @@ -130,7 +131,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_SetupGathering) Real64 extLitPow; Real64 extLitUse; - SetupOutputVariable(state, "Exterior Lights Electric Energy", + SetupOutputVariable(*state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -140,7 +141,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_SetupGathering) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electric Energy", + SetupOutputVariable(*state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -150,7 +151,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_SetupGathering) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electric Energy", + SetupOutputVariable(*state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -160,13 +161,13 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_SetupGathering) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite1"); - SetupOutputVariable(state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite2"); - SetupOutputVariable(state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite3"); + SetupOutputVariable(*state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite1"); + SetupOutputVariable(*state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite2"); + SetupOutputVariable(*state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite3"); - state.dataGlobal->DoWeathSim = true; + state->dataGlobal->DoWeathSim = true; - GetInputTabularAnnual(state); // this also calls setupGathering + GetInputTabularAnnual(*state); // this also calls setupGathering EXPECT_EQ(OutputReportTabularAnnual::annualTables.size(), 1u); std::vector::iterator firstTable = OutputReportTabularAnnual::annualTables.begin(); @@ -201,7 +202,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults) Real64 extLitPow; Real64 extLitUse; - SetupOutputVariable(state, "Exterior Lights Electric Energy", + SetupOutputVariable(*state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -211,7 +212,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electric Energy", + SetupOutputVariable(*state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -221,7 +222,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electric Energy", + SetupOutputVariable(*state, "Exterior Lights Electric Energy", OutputProcessor::Unit::J, extLitUse, "Zone", @@ -231,21 +232,21 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults) "Electricity", "Exterior Lights", "General"); - SetupOutputVariable(state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite1"); - SetupOutputVariable(state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite2"); - SetupOutputVariable(state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite3"); + SetupOutputVariable(*state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite1"); + SetupOutputVariable(*state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite2"); + SetupOutputVariable(*state, "Exterior Lights Electric Power", OutputProcessor::Unit::W, extLitPow, "Zone", "Average", "Lite3"); - state.dataGlobal->DoWeathSim = true; - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->DoWeathSim = true; + state->dataGlobal->TimeStepZone = 0.25; - GetInputTabularAnnual(state); + GetInputTabularAnnual(*state); EXPECT_EQ(OutputReportTabularAnnual::annualTables.size(), 1u); extLitPow = 2.01; extLitUse = 1.01; // UpdateDataandReport( 1 ); not sure if this is needed - GatherAnnualResultsForTimeStep(state, OutputProcessor::TimeStepType::TimeStepZone); + GatherAnnualResultsForTimeStep(*state, OutputProcessor::TimeStepType::TimeStepZone); // STOPPPED HERE. NOT SEEING THE POWER VARIABLE SHOWING UP @@ -255,7 +256,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults) TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults_MinMaxHrsShown) { - state.dataGlobal->TimeStepZone = 1.0; + state->dataGlobal->TimeStepZone = 1.0; DataHVACGlobals::TimeStepSys = 1.0; @@ -266,14 +267,14 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults_MinMaxHrsShown std::vector annualTables; - annualTables.push_back(AnnualTable(state, "PEAK ELECTRICTY ANNUAL MYTH REPORT", "", "")); + annualTables.push_back(AnnualTable(*state, "PEAK ELECTRICTY ANNUAL MYTH REPORT", "", "")); annualTables.back().addFieldSet("HEATING:MYTH:VARIABLE", AnnualFieldSet::AggregationKind::hoursPositive, 2); annualTables.back().addFieldSet("ELECTRICITY:MYTH", AnnualFieldSet::AggregationKind::maximumDuringHoursShown, 2); - annualTables.back().setupGathering(state); + annualTables.back().setupGathering(*state); OutputProcessor::EnergyMeters(1).CurTSValue = -10.; OutputProcessor::EnergyMeters(2).CurTSValue = 50.; - annualTables.back().gatherForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + annualTables.back().gatherForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); std::vector fieldSetParams = annualTables.back().inspectTableFieldSets(0); EXPECT_EQ(fieldSetParams[0], "HEATING:MYTH:VARIABLE"); // m_colHead @@ -285,7 +286,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_GatherResults_MinMaxHrsShown OutputProcessor::EnergyMeters(1).CurTSValue = 15.; OutputProcessor::EnergyMeters(2).CurTSValue = 55.; - annualTables.back().gatherForTimestep(state, OutputProcessor::TimeStepType::TimeStepZone); + annualTables.back().gatherForTimestep(*state, OutputProcessor::TimeStepType::TimeStepZone); fieldSetParams = annualTables.back().inspectTableFieldSets(0); EXPECT_EQ(fieldSetParams[0], "HEATING:MYTH:VARIABLE"); // m_colHead @@ -329,7 +330,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_columnHeadersToTitleCase) ASSERT_TRUE(process_idf(idf_objects)); Real64 facilUse; - SetupOutputVariable(state, "Misc Facility Electric Energy", + SetupOutputVariable(*state, "Misc Facility Electric Energy", OutputProcessor::Unit::J, facilUse, "Zone", @@ -345,9 +346,9 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_columnHeadersToTitleCase) OutputProcessor::EnergyMeters(1).Name = "Electricity:Facility"; //"ELECTRICITY:FACILITY"; OutputProcessor::EnergyMeters(2).Name = "ELECTRICITY:LIGHTING"; - state.dataGlobal->DoWeathSim = true; + state->dataGlobal->DoWeathSim = true; - OutputReportTabularAnnual::GetInputTabularAnnual(state); + OutputReportTabularAnnual::GetInputTabularAnnual(*state); EXPECT_EQ(OutputReportTabularAnnual::annualTables.size(), 1u); @@ -386,7 +387,7 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_invalidAggregationOrder) ASSERT_TRUE(process_idf(idf_objects)); Real64 facilUse; - SetupOutputVariable(state, "Misc Facility Electric Energy", + SetupOutputVariable(*state, "Misc Facility Electric Energy", OutputProcessor::Unit::J, facilUse, "Zone", @@ -402,13 +403,13 @@ TEST_F(EnergyPlusFixture, OutputReportTabularAnnual_invalidAggregationOrder) OutputProcessor::EnergyMeters(1).Name = "Electricity:Facility"; //"ELECTRICITY:FACILITY"; OutputProcessor::EnergyMeters(2).Name = "ELECTRICITY:LIGHTING"; - state.dataGlobal->DoWeathSim = true; + state->dataGlobal->DoWeathSim = true; - OutputReportTabularAnnual::GetInputTabularAnnual(state); + OutputReportTabularAnnual::GetInputTabularAnnual(*state); EXPECT_EQ(OutputReportTabularAnnual::annualTables.size(), 1u); std::vector::iterator firstTable = OutputReportTabularAnnual::annualTables.begin(); - EXPECT_TRUE(firstTable->invalidAggregationOrder(state)); + EXPECT_TRUE(firstTable->invalidAggregationOrder(*state)); } diff --git a/tst/EnergyPlus/unit/OutputReports.unit.cc b/tst/EnergyPlus/unit/OutputReports.unit.cc index 2f0a3861da1..6f59fc1cb84 100644 --- a/tst/EnergyPlus/unit/OutputReports.unit.cc +++ b/tst/EnergyPlus/unit/OutputReports.unit.cc @@ -59,6 +59,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace ObjexxFCL; @@ -122,34 +123,34 @@ TEST_F(EnergyPlusFixture, OutputReports_SurfaceDetailsReport) ASSERT_TRUE(process_idf(idf_objects)); bool foundErrors(false); - HeatBalanceManager::GetProjectControlData(state, foundErrors); // read project control data + HeatBalanceManager::GetProjectControlData(*state, foundErrors); // read project control data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetMaterialData(state, foundErrors); // read material data + HeatBalanceManager::GetMaterialData(*state, foundErrors); // read material data EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetConstructData(state, foundErrors); // read construction data + HeatBalanceManager::GetConstructData(*state, foundErrors); // read construction data compare_err_stream(""); EXPECT_FALSE(foundErrors); // expect no errors - HeatBalanceManager::GetZoneData(state, foundErrors); // read zone data + HeatBalanceManager::GetZoneData(*state, foundErrors); // read zone data EXPECT_FALSE(foundErrors); // expect no errors - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, foundErrors); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, foundErrors); // setup zone geometry and get zone data EXPECT_FALSE(foundErrors); // expect no errors // reset eio stream has_eio_output(true); - DetailsForSurfaces(state, 10); // 10 = Details Only, Surface details report + DetailsForSurfaces(*state, 10); // 10 = Details Only, Surface details report std::string const eiooutput = delimited_string( {"! ,Zone Name,# Surfaces", "! ,Number of Shading Surfaces,# Surfaces", "! ,Surface Name,Surface Class,Base Surface,Heat Transfer Algorithm,Construction,Nominal U (w/o film coefs) " diff --git a/tst/EnergyPlus/unit/PVWatts.unit.cc b/tst/EnergyPlus/unit/PVWatts.unit.cc index 40c6145d05c..18f10b4a824 100644 --- a/tst/EnergyPlus/unit/PVWatts.unit.cc +++ b/tst/EnergyPlus/unit/PVWatts.unit.cc @@ -60,6 +60,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; @@ -67,7 +68,7 @@ TEST_F(EnergyPlusFixture, PVWattsGenerator_Constructor) { using namespace PVWatts; - PVWattsGenerator pvw(state, "PVArray", 4000.0, ModuleType::STANDARD, ArrayType::FIXED_ROOF_MOUNTED); + PVWattsGenerator pvw(*state, "PVArray", 4000.0, ModuleType::STANDARD, ArrayType::FIXED_ROOF_MOUNTED); EXPECT_DOUBLE_EQ(4000.0, pvw.getDCSystemCapacity()); EXPECT_EQ(ModuleType::STANDARD, pvw.getModuleType()); EXPECT_EQ(ArrayType::FIXED_ROOF_MOUNTED, pvw.getArrayType()); @@ -78,7 +79,7 @@ TEST_F(EnergyPlusFixture, PVWattsGenerator_Constructor) EXPECT_DOUBLE_EQ(0.4, pvw.getGroundCoverageRatio()); ASSERT_THROW( - PVWattsGenerator pvw2(state, "", -1000.0, ModuleType::PREMIUM, ArrayType::FIXED_OPEN_RACK, 1.1, GeometryType::TILT_AZIMUTH, 91.0, 360.0, 0, -0.1), + PVWattsGenerator pvw2(*state, "", -1000.0, ModuleType::PREMIUM, ArrayType::FIXED_OPEN_RACK, 1.1, GeometryType::TILT_AZIMUTH, 91.0, 360.0, 0, -0.1), std::runtime_error); std::string const error_string = delimited_string( {" ** Severe ** PVWatts: name cannot be blank.", " ** Severe ** PVWatts: DC system capacity must be greater than zero.", @@ -129,13 +130,13 @@ TEST_F(EnergyPlusFixture, PVWattsGenerator_GetInputs) "Output:Variable,*,Generator Produced DC Electricity Rate,timestep;"}); process_idf(idfTxt); EXPECT_FALSE(has_err_output()); - PVWattsGenerator &pvw1 = GetOrCreatePVWattsGenerator(state, "PVWattsArray1"); + PVWattsGenerator &pvw1 = GetOrCreatePVWattsGenerator(*state, "PVWattsArray1"); EXPECT_EQ(pvw1.getModuleType(), ModuleType::PREMIUM); EXPECT_EQ(pvw1.getArrayType(), ArrayType::ONE_AXIS); EXPECT_DOUBLE_EQ(0.4, pvw1.getGroundCoverageRatio()); - PVWattsGenerator &pvw2 = GetOrCreatePVWattsGenerator(state, "PVWattsArray2"); + PVWattsGenerator &pvw2 = GetOrCreatePVWattsGenerator(*state, "PVWattsArray2"); EXPECT_DOUBLE_EQ(0.4, pvw2.getGroundCoverageRatio()); - PVWattsGenerator &pvw3 = GetOrCreatePVWattsGenerator(state, "PVWattsArray3"); + PVWattsGenerator &pvw3 = GetOrCreatePVWattsGenerator(*state, "PVWattsArray3"); EXPECT_DOUBLE_EQ(175.0, pvw3.getAzimuth()); EXPECT_DOUBLE_EQ(21.0, pvw3.getTilt()); EXPECT_DOUBLE_EQ(0.5, pvw3.getGroundCoverageRatio()); @@ -150,7 +151,7 @@ TEST_F(EnergyPlusFixture, PVWattsGenerator_GetInputsFailure) "FixedRoofMount,", // misspelled ",", "asdf,", ",", ";", "Output:Variable,*,Generator Produced DC Electricity Rate,timestep;"}); EXPECT_FALSE(process_idf(idfTxt, false)); - ASSERT_THROW(GetOrCreatePVWattsGenerator(state, "PVWattsArray1"), std::runtime_error); + ASSERT_THROW(GetOrCreatePVWattsGenerator(*state, "PVWattsArray1"), std::runtime_error); std::string const error_string = delimited_string( {" ** Severe ** [Generator:PVWatts][PVWattsArray1][array_geometry_type] - \"asdf\" - Failed to match against any enum values.", " ** Severe ** [Generator:PVWatts][PVWattsArray1][array_type] - \"FixedRoofMount\" - Failed to match against any enum values.", @@ -167,29 +168,29 @@ TEST_F(EnergyPlusFixture, PVWattsGenerator_Calc) using namespace PVWatts; // USA_AZ_Phoenix-Sky.Harbor.Intl.AP.722780_TMY3.epw // 6/15 at 7am - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1.0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1.0; DataHVACGlobals::TimeStepSys = 1.0; - state.dataGlobal->BeginTimeStepFlag = true; - state.dataGlobal->MinutesPerTimeStep = 60; - state.dataGlobal->NumOfTimeStepInHour = 1; - WeatherManager::AllocateWeatherData(state); // gets us the albedo array initialized + state->dataGlobal->BeginTimeStepFlag = true; + state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + WeatherManager::AllocateWeatherData(*state); // gets us the albedo array initialized DataEnvironment::Year = 1986; DataEnvironment::Month = 6; DataEnvironment::DayOfMonth = 15; - state.dataGlobal->HourOfDay = 8; // 8th hour of day, 7-8am - state.dataWeatherManager->WeatherFileLatitude = 33.45; - state.dataWeatherManager->WeatherFileLongitude = -111.98; - state.dataWeatherManager->WeatherFileTimeZone = -7; + state->dataGlobal->HourOfDay = 8; // 8th hour of day, 7-8am + state->dataWeatherManager->WeatherFileLatitude = 33.45; + state->dataWeatherManager->WeatherFileLongitude = -111.98; + state->dataWeatherManager->WeatherFileTimeZone = -7; DataEnvironment::BeamSolarRad = 728; DataEnvironment::DifSolarRad = 70; DataEnvironment::WindSpeed = 3.1; DataEnvironment::OutDryBulbTemp = 31.7; - PVWattsGenerator pvwa(state, "PVWattsArrayA", 4000.0, ModuleType::STANDARD, ArrayType::FIXED_ROOF_MOUNTED); + PVWattsGenerator pvwa(*state, "PVWattsArrayA", 4000.0, ModuleType::STANDARD, ArrayType::FIXED_ROOF_MOUNTED); pvwa.setCellTemperature(30.345); pvwa.setPlaneOfArrayIrradiance(92.257); - pvwa.calc(state); + pvwa.calc(*state); Real64 generatorPower, generatorEnergy, thermalPower, thermalEnergy; pvwa.getResults(generatorPower, generatorEnergy, thermalPower, thermalEnergy); EXPECT_DOUBLE_EQ(thermalPower, 0.0); @@ -197,41 +198,41 @@ TEST_F(EnergyPlusFixture, PVWattsGenerator_Calc) EXPECT_NEAR(generatorPower, 884.137, 0.5); EXPECT_NEAR(generatorEnergy, generatorPower * 60 * 60, 1); - PVWattsGenerator pvwb(state, "PVWattsArrayB", 3000.0, ModuleType::PREMIUM, ArrayType::ONE_AXIS, 0.16, GeometryType::TILT_AZIMUTH, 25.0, 100.); + PVWattsGenerator pvwb(*state, "PVWattsArrayB", 3000.0, ModuleType::PREMIUM, ArrayType::ONE_AXIS, 0.16, GeometryType::TILT_AZIMUTH, 25.0, 100.); pvwb.setCellTemperature(38.620); pvwb.setPlaneOfArrayIrradiance(478.641); - pvwb.calc(state); + pvwb.calc(*state); pvwb.getResults(generatorPower, generatorEnergy, thermalPower, thermalEnergy); EXPECT_DOUBLE_EQ(thermalPower, 0.0); EXPECT_DOUBLE_EQ(thermalEnergy, 0.0); EXPECT_NEAR(generatorPower, 1621.100, 0.5); EXPECT_NEAR(generatorEnergy, generatorPower * 60 * 60, 1); - PVWattsGenerator pvwc(state, "PVWattsArrayC", 1000.0, ModuleType::THIN_FILM, ArrayType::FIXED_OPEN_RACK, 0.1, GeometryType::TILT_AZIMUTH, 30.0, 140.); + PVWattsGenerator pvwc(*state, "PVWattsArrayC", 1000.0, ModuleType::THIN_FILM, ArrayType::FIXED_OPEN_RACK, 0.1, GeometryType::TILT_AZIMUTH, 30.0, 140.); pvwc.setCellTemperature(33.764); pvwc.setPlaneOfArrayIrradiance(255.213); - pvwc.calc(state); + pvwc.calc(*state); pvwc.getResults(generatorPower, generatorEnergy, thermalPower, thermalEnergy); EXPECT_DOUBLE_EQ(thermalPower, 0.0); EXPECT_DOUBLE_EQ(thermalEnergy, 0.0); EXPECT_NEAR(generatorPower, 433.109, 0.5); EXPECT_NEAR(generatorEnergy, generatorPower * 60 * 60, 1); - PVWattsGenerator pvwd(state, "PVWattsArrayD", 5500.0, ModuleType::STANDARD, ArrayType::ONE_AXIS_BACKTRACKING, 0.05, GeometryType::TILT_AZIMUTH, 34.0, + PVWattsGenerator pvwd(*state, "PVWattsArrayD", 5500.0, ModuleType::STANDARD, ArrayType::ONE_AXIS_BACKTRACKING, 0.05, GeometryType::TILT_AZIMUTH, 34.0, 180.); pvwd.setCellTemperature(29.205); pvwd.setPlaneOfArrayIrradiance(36.799); - pvwd.calc(state); + pvwd.calc(*state); pvwd.getResults(generatorPower, generatorEnergy, thermalPower, thermalEnergy); EXPECT_DOUBLE_EQ(thermalPower, 0.0); EXPECT_DOUBLE_EQ(thermalEnergy, 0.0); EXPECT_NEAR(generatorPower, 2485.686, 0.5); EXPECT_NEAR(generatorEnergy, generatorPower * 60 * 60, 1); - PVWattsGenerator pvwe(state, "PVWattsArrayE", 3800.0, ModuleType::PREMIUM, ArrayType::TWO_AXIS, 0.08, GeometryType::TILT_AZIMUTH, 34.0, 180.); + PVWattsGenerator pvwe(*state, "PVWattsArrayE", 3800.0, ModuleType::PREMIUM, ArrayType::TWO_AXIS, 0.08, GeometryType::TILT_AZIMUTH, 34.0, 180.); pvwe.setCellTemperature(42.229); pvwe.setPlaneOfArrayIrradiance(647.867); - pvwe.calc(state); + pvwe.calc(*state); pvwe.getResults(generatorPower, generatorEnergy, thermalPower, thermalEnergy); EXPECT_DOUBLE_EQ(thermalPower, 0.0); EXPECT_DOUBLE_EQ(thermalEnergy, 0.0); @@ -289,10 +290,10 @@ TEST_F(EnergyPlusFixture, PVWattsInverter_Constructor) ",", ";"}); ASSERT_TRUE(process_idf(idfTxt)); - auto eplc(ElectPowerLoadCenter(state, 1)); + auto eplc(ElectPowerLoadCenter(*state, 1)); ASSERT_TRUE(eplc.inverterPresent); EXPECT_DOUBLE_EQ(eplc.inverterObj->pvWattsDCCapacity(), 4000.0); DataHVACGlobals::TimeStepSys = 1.0; - eplc.inverterObj->simulate(state, 884.018); + eplc.inverterObj->simulate(*state, 884.018); EXPECT_NEAR(eplc.inverterObj->aCPowerOut(), 842.527, 0.001); } diff --git a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc index 02e7385cf9b..4d6fd876ae6 100644 --- a/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/PackagedTerminalHeatPump.unit.cc @@ -79,6 +79,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::BranchInputManager; @@ -440,12 +441,12 @@ TEST_F(EnergyPlusFixture, PackagedTerminalHP_VSCoils_Sizing) // Test for #7053: // Fake that there is at least one UnitarySystemPerformance:Multispeed object UnitarySystems::DesignSpecMSHP fakeDesignSpecMSHP; - state.dataUnitarySystems->designSpecMSHP.push_back(fakeDesignSpecMSHP); + state->dataUnitarySystems->designSpecMSHP.push_back(fakeDesignSpecMSHP); bool ErrorsFound(false); - GetZoneData(state, ErrorsFound); - GetZoneEquipmentData(state); - GetPTUnit(state); + GetZoneData(*state, ErrorsFound); + GetZoneEquipmentData(*state); + GetPTUnit(*state); TotNumLoops = 2; PlantLoop.allocate(TotNumLoops); @@ -464,19 +465,19 @@ TEST_F(EnergyPlusFixture, PackagedTerminalHP_VSCoils_Sizing) PlantLoop(2).FluidName = "ChilledWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataVariableSpeedCoils->VarSpeedCoil(1).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataVariableSpeedCoils->VarSpeedCoil(1).Name; PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilVSWAHPCoolingEquationFit; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataVariableSpeedCoils->VarSpeedCoil(1).WaterInletNodeNum; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataVariableSpeedCoils->VarSpeedCoil(1).WaterOutletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataVariableSpeedCoils->VarSpeedCoil(1).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataVariableSpeedCoils->VarSpeedCoil(1).WaterOutletNodeNum; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataVariableSpeedCoils->VarSpeedCoil(2).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataVariableSpeedCoils->VarSpeedCoil(2).Name; PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilVSWAHPHeatingEquationFit; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataVariableSpeedCoils->VarSpeedCoil(2).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataVariableSpeedCoils->VarSpeedCoil(2).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataVariableSpeedCoils->VarSpeedCoil(2).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataVariableSpeedCoils->VarSpeedCoil(2).WaterOutletNodeNum; DataSizing::CurZoneEqNum = 1; DataSizing::ZoneSizingRunDone = true; @@ -488,50 +489,50 @@ TEST_F(EnergyPlusFixture, PackagedTerminalHP_VSCoils_Sizing) DataSizing::FinalZoneSizing(DataSizing::CurZoneEqNum).CoolDesHumRat = 0.05; DataEnvironment::OutBaroPress = 101325; DataEnvironment::StdRhoAir = 1.0; - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); DataSizing::ZoneEqSizing.allocate(1); DataSizing::ZoneEqSizing(DataSizing::CurZoneEqNum).SizingMethod.allocate(16); - SizePTUnit(state, 1); + SizePTUnit(*state, 1); // This VS coil is rather quirky. It sizes the capacity based on zone sizing air flow rate. // Then uses that capacity to back calculate the air flow needed to keep the reference air flow per capacity ratio constant. // For this reason, the parent object would size to an air flow that was different than the child. // identify coil - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).Name, "LOBBY_ZN_1_FLR_2 WSHP COOLING MODE"); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "LOBBY_ZN_1_FLR_2 WSHP COOLING MODE"); // expect coil air flow to equal PTUnit cooling air flow - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate, PTUnit(1).MaxCoolAirVolFlow); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9), PTUnit(1).MaxCoolAirVolFlow); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate, PTUnit(1).MaxCoolAirVolFlow); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9), PTUnit(1).MaxCoolAirVolFlow); // expect the ratio of air flow to capacity to be equal to the reference air flow and capacity ratio specified in coil input Real64 refAirflowCapacityRatio = 0.891980668 / 16092.825525; // speed 9 reference cooling data Real64 sizingAirflowCapacityRatio = - state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9) / state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedTotCap(9); + state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9) / state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedTotCap(9); EXPECT_EQ(refAirflowCapacityRatio, sizingAirflowCapacityRatio); // this same ratio should also equal the internal flow per capacity variable used to back calculate operating air flow rate - EXPECT_EQ(sizingAirflowCapacityRatio, state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowPerRatedTotCap(9)); + EXPECT_EQ(sizingAirflowCapacityRatio, state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowPerRatedTotCap(9)); // identify coil - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).Name, "LOBBY_ZN_1_FLR_2 WSHP HEATING MODE"); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).Name, "LOBBY_ZN_1_FLR_2 WSHP HEATING MODE"); // expect coil air flow to equal PTUnit heating air flow - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).RatedAirVolFlowRate, ZoneEqSizing(CurZoneEqNum).HeatingAirVolFlow); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).RatedAirVolFlowRate, PTUnit(1).MaxHeatAirVolFlow); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(9), PTUnit(1).MaxHeatAirVolFlow); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).RatedAirVolFlowRate, ZoneEqSizing(CurZoneEqNum).HeatingAirVolFlow); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).RatedAirVolFlowRate, PTUnit(1).MaxHeatAirVolFlow); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(9), PTUnit(1).MaxHeatAirVolFlow); // expect the ratio of air flow to capacity to equal to the reference air flow and capacity specified in coil input refAirflowCapacityRatio = 0.891980668 / 20894.501936; // speed 9 reference heating data - sizingAirflowCapacityRatio = state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(9) / state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedTotCap(9); + sizingAirflowCapacityRatio = state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(9) / state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedTotCap(9); EXPECT_EQ(refAirflowCapacityRatio, sizingAirflowCapacityRatio); // this same ratio should also equal the internal flow per capacity variable used to back calculate operating air flow rate - EXPECT_EQ(sizingAirflowCapacityRatio, state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowPerRatedTotCap(9)); + EXPECT_EQ(sizingAirflowCapacityRatio, state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowPerRatedTotCap(9)); - SizeFan(state, 1); + SizeFan(*state, 1); // the fan vol flow rate should equal the max of cooling and heating coil flow rates - Real64 maxCoilAirFlow = max(state.dataVariableSpeedCoils->VarSpeedCoil( 1 ).RatedAirVolFlowRate, state.dataVariableSpeedCoils->VarSpeedCoil( 2 ).RatedAirVolFlowRate); + Real64 maxCoilAirFlow = max(state->dataVariableSpeedCoils->VarSpeedCoil( 1 ).RatedAirVolFlowRate, state->dataVariableSpeedCoils->VarSpeedCoil( 2 ).RatedAirVolFlowRate); EXPECT_EQ(Fan(1).MaxAirFlowRate, maxCoilAirFlow); EXPECT_EQ(Fan(1).MaxAirFlowRate, max(PTUnit(1).MaxCoolAirVolFlow, PTUnit(1).MaxHeatAirVolFlow)); @@ -540,8 +541,8 @@ TEST_F(EnergyPlusFixture, PackagedTerminalHP_VSCoils_Sizing) Real64 ZoneLoad(0.0); // cooling or heating needed by zone [watts] // Also set BeginEnvrnFlag so code is tested for coil initialization and does not crash - state.dataGlobal->BeginEnvrnFlag = true; - InitPTUnit(state, 1, DataSizing::CurZoneEqNum, true, OnOffAirFlowRatio, ZoneLoad); + state->dataGlobal->BeginEnvrnFlag = true; + InitPTUnit(*state, 1, DataSizing::CurZoneEqNum, true, OnOffAirFlowRatio, ZoneLoad); // check that an intermediate speed has the correct flow ratio Real64 refAirflowRatio = 0.530468926 / 0.891980668; // speed 4 reference cooling data and full flow rate at speed 9 @@ -558,7 +559,7 @@ TEST_F(EnergyPlusFixture, PackagedTerminalHP_VSCoils_Sizing) // VS coils set SystemAirFlow to true and AirVolFlow to a value, all PTUnits set CoolingAirFlow and HeatingAirFlow, and CoolingAirVolFlow and // HeatingAirVolFlow EXPECT_TRUE(ZoneEqSizing(1).SystemAirFlow); - EXPECT_EQ(ZoneEqSizing(1).AirVolFlow, state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate); + EXPECT_EQ(ZoneEqSizing(1).AirVolFlow, state->dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate); EXPECT_TRUE(ZoneEqSizing(1).CoolingAirFlow); EXPECT_TRUE(ZoneEqSizing(1).HeatingAirFlow); EXPECT_EQ(ZoneEqSizing(1).CoolingAirVolFlow, PTUnit(1).MaxCoolAirVolFlow); @@ -789,19 +790,19 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetPTUnit(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetPTUnit(*state); GetPTUnitInputFlag = false; //// get input test for terminal air single duct mixer on inlet side of PTAC @@ -810,7 +811,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) EXPECT_EQ("COIL:HEATING:FUEL", PTUnit(1).ACHeatCoilType); // PTAC heating coil type EXPECT_EQ(HeatingCoil(1).HCoilType_Num, Coil_HeatingGasOrOtherFuel); // gas heating coil type - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // set input variables DataEnvironment::OutBaroPress = 101325.0; @@ -873,7 +874,7 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) PTUnit(1).ControlZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->SysSizingCalc = true; TempControlType.allocate(1); TempControlType(1) = 1; @@ -896,11 +897,11 @@ TEST_F(EnergyPlusFixture, AirTerminalSingleDuctMixer_SimPTAC_HeatingCoilTest) // initialized to false ASSERT_FALSE(PackagedTerminalHeatPump::HeatingLoad); // Init PTAC zoneHVAC equipment - InitPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); + InitPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // init sets heating mode to true due to cold ventilation air ASSERT_TRUE(PackagedTerminalHeatPump::HeatingLoad); // simulate PTAC zoneHVAC equipment - SimPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); + SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); // no zone heating load ASSERT_DOUBLE_EQ(QZnReq, 0.0); // no net heating delivered to the zone @@ -1141,22 +1142,22 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ProcessScheduleInput(*state); // read schedules InitializePsychRoutines(); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - GetZoneEquipmentData1(state); - GetZoneAirLoopEquipment(state); - GetPTUnit(state); + GetZoneEquipmentData1(*state); + GetZoneAirLoopEquipment(*state); + GetPTUnit(*state); GetPTUnitInputFlag = false; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; // set input variables DataEnvironment::OutBaroPress = 101325.0; @@ -1219,7 +1220,7 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) PTUnit(1).ControlZoneNum = 1; SysSizingRunDone = true; ZoneSizingRunDone = true; - state.dataGlobal->SysSizingCalc = false; + state->dataGlobal->SysSizingCalc = false; DataZoneEquipment::ZoneEquipInputsFilled = true; // denotes zone equipment has been read in TempControlType.allocate(1); @@ -1243,13 +1244,13 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) // initialized to false ASSERT_FALSE(PackagedTerminalHeatPump::HeatingLoad); // Init PTAC zoneHVAC equipment - InitPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); - state.dataGlobal->BeginEnvrnFlag = false; - InitPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); + InitPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); + state->dataGlobal->BeginEnvrnFlag = false; + InitPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, OnOffAirFlowRatio, QZnReq); // init sets heating mode to true due to cold ventilation air ASSERT_TRUE(PackagedTerminalHeatPump::HeatingLoad); // simulate PTAC zoneHVAC equipment - SimPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); + SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); // no zone heating load ASSERT_DOUBLE_EQ(QZnReq, 0.0); // no net heating delivered to the zone @@ -1267,20 +1268,20 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) // loads below the bounday load should operate at the minimum air flow rate ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 1000.0; // set heating load to non-zero value below lower boundary load QZnReq = ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP; // initialize zone heating load - SimPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); + SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); ASSERT_NEAR(Node(PTUnit(PTUnitNum).AirInNode).MassFlowRate, PTUnit(PTUnitNum).MaxNoCoolHeatAirMassFlow, 0.001); ASSERT_GT(PTUnit(PTUnitNum).DesignMaxOutletTemp, HeatingCoils::HeatingCoil(1).OutletAirTemp); ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 2000.0; // set heating load to just below lower boundary load QZnReq = ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP; // initialize zone heating load - SimPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); + SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); ASSERT_NEAR(Node(PTUnit(PTUnitNum).AirInNode).MassFlowRate, PTUnit(PTUnitNum).MaxNoCoolHeatAirMassFlow, 0.001); ASSERT_GT(PTUnit(PTUnitNum).DesignMaxOutletTemp, HeatingCoils::HeatingCoil(1).OutletAirTemp); // loads above the lower bounday load should operate above the minimum air flow rate ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 2010.0; // set heating load to just above lower boundary load QZnReq = ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP; // initialize zone heating load - SimPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); + SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); ASSERT_NEAR(PTUnit(PTUnitNum).DesignMaxOutletTemp, HeatingCoils::HeatingCoil(1).OutletAirTemp, 0.1); ASSERT_GT(Node(PTUnit(PTUnitNum).AirInNode).MassFlowRate, PTUnit(PTUnitNum).MaxNoCoolHeatAirMassFlow); @@ -1288,7 +1289,7 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) // system should operate below the maximum air flow rate at loads less than 2995.2 W ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 2990.0; // set heating load to just below upper boundary load QZnReq = ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP; // initialize zone heating load - SimPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); + SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); ASSERT_NEAR(PTUnit(PTUnitNum).DesignMaxOutletTemp, HeatingCoils::HeatingCoil(1).OutletAirTemp, 0.1); ASSERT_GT(Node(PTUnit(PTUnitNum).AirInNode).MassFlowRate, PTUnit(PTUnitNum).MaxNoCoolHeatAirMassFlow); ASSERT_LT(Node(PTUnit(PTUnitNum).AirInNode).MassFlowRate, PTUnit(PTUnitNum).MaxHeatAirMassFlow); @@ -1298,7 +1299,7 @@ TEST_F(EnergyPlusFixture, SimPTAC_SZVAVTest) // outlet air temperture is allowed to be above the design maximum supply air temperature in heating mode ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 3000.0; // set heating load to just above upper boundary load QZnReq = ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP; // initialize zone heating load - SimPTUnit(state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); + SimPTUnit(*state, PTUnitNum, ZoneNum, FirstHVACIteration, QUnitOut, OnOffAirFlowRatio, QZnReq, LatOutputProvided); ASSERT_GT(HeatingCoils::HeatingCoil(1).OutletAirTemp, PTUnit(PTUnitNum).DesignMaxOutletTemp); ASSERT_NEAR(Node(PTUnit(PTUnitNum).AirInNode).MassFlowRate, PTUnit(PTUnitNum).MaxHeatAirMassFlow, 0.0001); } diff --git a/tst/EnergyPlus/unit/Photovoltaics.unit.cc b/tst/EnergyPlus/unit/Photovoltaics.unit.cc index c3facc58a41..46d43cbaa9c 100644 --- a/tst/EnergyPlus/unit/Photovoltaics.unit.cc +++ b/tst/EnergyPlus/unit/Photovoltaics.unit.cc @@ -57,6 +57,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; @@ -89,7 +90,7 @@ TEST_F(EnergyPlusFixture, PV_ReportPV_ZoneIndexNonZero) DataHeatBalance::Zone.allocate(2); DataSurfaces::Surface.allocate(3); - state.dataGlobal->NumOfZones = 2; + state->dataGlobal->NumOfZones = 2; DataHeatBalance::Zone(1).Name = "Zone1"; DataHeatBalance::Zone(1).ListMultiplier = 1.0; DataHeatBalance::Zone(1).Multiplier = 5.0; @@ -114,22 +115,22 @@ TEST_F(EnergyPlusFixture, PV_ReportPV_ZoneIndexNonZero) // Test 1: Zone 1--PV has multiplier, Zone index already set EnergyPlus::DataPhotovoltaics::PVarray(1).Report.DCPower = 1000.0; - EnergyPlus::DataPhotovoltaics::PVarray(1).Zone = Photovoltaics::GetPVZone(state, EnergyPlus::DataPhotovoltaics::PVarray(1).SurfacePtr); - Photovoltaics::ReportPV(state, 1); + EnergyPlus::DataPhotovoltaics::PVarray(1).Zone = Photovoltaics::GetPVZone(*state, EnergyPlus::DataPhotovoltaics::PVarray(1).SurfacePtr); + Photovoltaics::ReportPV(*state, 1); EXPECT_EQ(EnergyPlus::DataPhotovoltaics::PVarray(1).Zone, 1); EXPECT_NEAR(EnergyPlus::DataPhotovoltaics::PVarray(1).Report.DCPower, 5000.0, 0.1); // Test 2: Zone 2--PV has multiplier, Zone index not set yet EnergyPlus::DataPhotovoltaics::PVarray(2).Report.DCPower = 1000.0; - EnergyPlus::DataPhotovoltaics::PVarray(2).Zone = Photovoltaics::GetPVZone(state, EnergyPlus::DataPhotovoltaics::PVarray(2).SurfacePtr); - Photovoltaics::ReportPV(state, 2); + EnergyPlus::DataPhotovoltaics::PVarray(2).Zone = Photovoltaics::GetPVZone(*state, EnergyPlus::DataPhotovoltaics::PVarray(2).SurfacePtr); + Photovoltaics::ReportPV(*state, 2); EXPECT_EQ(EnergyPlus::DataPhotovoltaics::PVarray(2).Zone, 2); EXPECT_NEAR(EnergyPlus::DataPhotovoltaics::PVarray(2).Report.DCPower, 10000.0, 0.1); // Test 3: Zone 3--PV not attached to any zone, Zone Index does not get set EnergyPlus::DataPhotovoltaics::PVarray(3).Report.DCPower = 1000.0; - EnergyPlus::DataPhotovoltaics::PVarray(3).Zone = Photovoltaics::GetPVZone(state, EnergyPlus::DataPhotovoltaics::PVarray(3).SurfacePtr); - Photovoltaics::ReportPV(state, 3); + EnergyPlus::DataPhotovoltaics::PVarray(3).Zone = Photovoltaics::GetPVZone(*state, EnergyPlus::DataPhotovoltaics::PVarray(3).SurfacePtr); + Photovoltaics::ReportPV(*state, 3); EXPECT_EQ(EnergyPlus::DataPhotovoltaics::PVarray(3).Zone, 0); EXPECT_NEAR(EnergyPlus::DataPhotovoltaics::PVarray(3).Report.DCPower, 1000.0, 0.1); } diff --git a/tst/EnergyPlus/unit/PierceSurface.unit.cc b/tst/EnergyPlus/unit/PierceSurface.unit.cc index e363f0cdb2e..d0db7a0ff10 100644 --- a/tst/EnergyPlus/unit/PierceSurface.unit.cc +++ b/tst/EnergyPlus/unit/PierceSurface.unit.cc @@ -54,6 +54,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include // ObjexxFCL Headers #include diff --git a/tst/EnergyPlus/unit/Pipes.unit.cc b/tst/EnergyPlus/unit/Pipes.unit.cc index 1b034ad0c2b..ad0f3b6f3b9 100644 --- a/tst/EnergyPlus/unit/Pipes.unit.cc +++ b/tst/EnergyPlus/unit/Pipes.unit.cc @@ -53,6 +53,7 @@ #include "Fixtures/EnergyPlusFixture.hh" #include #include +#include namespace EnergyPlus { @@ -71,7 +72,7 @@ TEST_F(EnergyPlusFixture, TestPipesInput) }); ASSERT_TRUE(process_idf(idf_objects)); - Pipes::GetPipeInput(state); + Pipes::GetPipeInput(*state); EXPECT_EQ(2u, Pipes::LocalPipe.size()); EXPECT_EQ(DataPlant::TypeOf_Pipe, Pipes::LocalPipe(1).TypeOf); EXPECT_EQ(DataPlant::TypeOf_PipeSteam, Pipes::LocalPipe(2).TypeOf); diff --git a/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc b/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc index 51b6d175bf1..cbc54196fd5 100644 --- a/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc +++ b/tst/EnergyPlus/unit/PlantCentralGSHP.unit.cc @@ -57,6 +57,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; @@ -138,22 +139,22 @@ TEST_F(EnergyPlusFixture, ChillerHeater_Autosize) PlantCentralGSHP::Wrapper(1).GLHELoopNum = PltSizCondNum; // Calculate expected values - Real64 rho_evap = FluidProperties::GetDensityGlycol(state, DataPlant::PlantLoop(PltSizNum).FluidName, + Real64 rho_evap = FluidProperties::GetDensityGlycol(*state, DataPlant::PlantLoop(PltSizNum).FluidName, DataGlobalConstants::CWInitConvTemp(), DataPlant::PlantLoop(PltSizNum).FluidIndex, "ChillerHeater_Autosize_TEST"); - Real64 Cp_evap = FluidProperties::GetSpecificHeatGlycol(state, DataPlant::PlantLoop(PltSizNum).FluidName, + Real64 Cp_evap = FluidProperties::GetSpecificHeatGlycol(*state, DataPlant::PlantLoop(PltSizNum).FluidName, DataGlobalConstants::CWInitConvTemp(), DataPlant::PlantLoop(PltSizNum).FluidIndex, "ChillerHeater_Autosize_TEST"); - Real64 rho_cond = FluidProperties::GetDensityGlycol(state, DataPlant::PlantLoop(PltSizCondNum).FluidName, + Real64 rho_cond = FluidProperties::GetDensityGlycol(*state, DataPlant::PlantLoop(PltSizCondNum).FluidName, DataGlobalConstants::CWInitConvTemp(), DataPlant::PlantLoop(PltSizCondNum).FluidIndex, "ChillerHeater_Autosize_TEST"); - Real64 Cp_cond = FluidProperties::GetSpecificHeatGlycol(state, DataPlant::PlantLoop(PltSizCondNum).FluidName, + Real64 Cp_cond = FluidProperties::GetSpecificHeatGlycol(*state, DataPlant::PlantLoop(PltSizCondNum).FluidName, PlantCentralGSHP::Wrapper(1).ChillerHeater(1).TempRefCondInCooling, DataPlant::PlantLoop(PltSizCondNum).FluidIndex, "ChillerHeater_Autosize_TEST"); @@ -172,7 +173,7 @@ TEST_F(EnergyPlusFixture, ChillerHeater_Autosize) // now call sizing routine DataPlant::PlantFirstSizesOkayToFinalize = true; - PlantCentralGSHP::Wrapper(1).SizeWrapper(state); + PlantCentralGSHP::Wrapper(1).SizeWrapper(*state); // Careful of actually using PlantCentralGSHP::Wrapper(1).ChillerHeater(1) and not PlantCentralGSHP::ChillerHeater since this array isn't used // anymore by the module diff --git a/tst/EnergyPlus/unit/PlantChillers.unit.cc b/tst/EnergyPlus/unit/PlantChillers.unit.cc index 5a1e988d3a1..9b06435f341 100644 --- a/tst/EnergyPlus/unit/PlantChillers.unit.cc +++ b/tst/EnergyPlus/unit/PlantChillers.unit.cc @@ -56,6 +56,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace PlantChillers; @@ -63,20 +64,20 @@ using namespace PlantChillers; TEST_F(EnergyPlusFixture, GTChiller_HeatRecoveryAutosizeTest) { // unit test for autosizing heat recovery in Chiller:CombustionTurbine - state.dataPlantChillers->GTChiller.allocate(1); + state->dataPlantChillers->GTChiller.allocate(1); - state.dataPlantChillers->GTChiller(1).SizFac = 1.0; - state.dataPlantChillers->GTChiller(1).DesignHeatRecVolFlowRateWasAutoSized = true; - state.dataPlantChillers->GTChiller(1).HeatRecCapacityFraction = 0.5; - state.dataPlantChillers->GTChiller(1).HeatRecActive = true; - state.dataPlantChillers->GTChiller(1).CondenserType = DataPlant::CondenserType::WATERCOOLED; - state.dataPlantChillers->GTChiller(1).CWLoopNum = 1; - state.dataPlantChillers->GTChiller(1).CDLoopNum = 2; - state.dataPlantChillers->GTChiller(1).EvapVolFlowRate = 1.0; - state.dataPlantChillers->GTChiller(1).CondVolFlowRate = 1.0; - state.dataPlantChillers->GTChiller(1).NomCap = 10000; - state.dataPlantChillers->GTChiller(1).COP = 3.0; - state.dataPlantChillers->GTChiller(1).engineCapacityScalar = 1.0; + state->dataPlantChillers->GTChiller(1).SizFac = 1.0; + state->dataPlantChillers->GTChiller(1).DesignHeatRecVolFlowRateWasAutoSized = true; + state->dataPlantChillers->GTChiller(1).HeatRecCapacityFraction = 0.5; + state->dataPlantChillers->GTChiller(1).HeatRecActive = true; + state->dataPlantChillers->GTChiller(1).CondenserType = DataPlant::CondenserType::WATERCOOLED; + state->dataPlantChillers->GTChiller(1).CWLoopNum = 1; + state->dataPlantChillers->GTChiller(1).CDLoopNum = 2; + state->dataPlantChillers->GTChiller(1).EvapVolFlowRate = 1.0; + state->dataPlantChillers->GTChiller(1).CondVolFlowRate = 1.0; + state->dataPlantChillers->GTChiller(1).NomCap = 10000; + state->dataPlantChillers->GTChiller(1).COP = 3.0; + state->dataPlantChillers->GTChiller(1).engineCapacityScalar = 1.0; DataPlant::PlantLoop.allocate(2); DataSizing::PlantSizData.allocate(1); @@ -88,11 +89,11 @@ TEST_F(EnergyPlusFixture, GTChiller_HeatRecoveryAutosizeTest) DataPlant::PlantFirstSizesOkayToFinalize = true; // now call sizing routine - state.dataPlantChillers->GTChiller(1).size(state); + state->dataPlantChillers->GTChiller(1).size(*state); // see if heat recovery flow rate is as expected - EXPECT_NEAR(state.dataPlantChillers->GTChiller(1).DesignHeatRecVolFlowRate, 0.5, 0.00001); + EXPECT_NEAR(state->dataPlantChillers->GTChiller(1).DesignHeatRecVolFlowRate, 0.5, 0.00001); - state.dataPlantChillers->GTChiller.deallocate(); + state->dataPlantChillers->GTChiller.deallocate(); DataSizing::PlantSizData.deallocate(); DataPlant::PlantLoop.deallocate(); } @@ -100,19 +101,19 @@ TEST_F(EnergyPlusFixture, GTChiller_HeatRecoveryAutosizeTest) TEST_F(EnergyPlusFixture, EngineDrivenChiller_HeatRecoveryAutosizeTest) { // unit test for autosizing heat recovery in Chiller:EngineDriven - state.dataPlantChillers->EngineDrivenChiller.allocate(1); + state->dataPlantChillers->EngineDrivenChiller.allocate(1); - state.dataPlantChillers->EngineDrivenChiller(1).SizFac = 1.0; - state.dataPlantChillers->EngineDrivenChiller(1).DesignHeatRecVolFlowRateWasAutoSized = true; - state.dataPlantChillers->EngineDrivenChiller(1).HeatRecCapacityFraction = 0.5; - state.dataPlantChillers->EngineDrivenChiller(1).HeatRecActive = true; - state.dataPlantChillers->EngineDrivenChiller(1).CondenserType = DataPlant::CondenserType::WATERCOOLED; - state.dataPlantChillers->EngineDrivenChiller(1).CWLoopNum = 1; - state.dataPlantChillers->EngineDrivenChiller(1).CDLoopNum = 2; - state.dataPlantChillers->EngineDrivenChiller(1).EvapVolFlowRate = 1.0; - state.dataPlantChillers->EngineDrivenChiller(1).CondVolFlowRate = 1.0; - state.dataPlantChillers->EngineDrivenChiller(1).NomCap = 10000; - state.dataPlantChillers->EngineDrivenChiller(1).COP = 3.0; + state->dataPlantChillers->EngineDrivenChiller(1).SizFac = 1.0; + state->dataPlantChillers->EngineDrivenChiller(1).DesignHeatRecVolFlowRateWasAutoSized = true; + state->dataPlantChillers->EngineDrivenChiller(1).HeatRecCapacityFraction = 0.5; + state->dataPlantChillers->EngineDrivenChiller(1).HeatRecActive = true; + state->dataPlantChillers->EngineDrivenChiller(1).CondenserType = DataPlant::CondenserType::WATERCOOLED; + state->dataPlantChillers->EngineDrivenChiller(1).CWLoopNum = 1; + state->dataPlantChillers->EngineDrivenChiller(1).CDLoopNum = 2; + state->dataPlantChillers->EngineDrivenChiller(1).EvapVolFlowRate = 1.0; + state->dataPlantChillers->EngineDrivenChiller(1).CondVolFlowRate = 1.0; + state->dataPlantChillers->EngineDrivenChiller(1).NomCap = 10000; + state->dataPlantChillers->EngineDrivenChiller(1).COP = 3.0; DataPlant::PlantLoop.allocate(2); DataSizing::PlantSizData.allocate(1); @@ -124,11 +125,11 @@ TEST_F(EnergyPlusFixture, EngineDrivenChiller_HeatRecoveryAutosizeTest) DataPlant::PlantFirstSizesOkayToFinalize = true; // now call sizing routine - state.dataPlantChillers->EngineDrivenChiller(1).size(state); + state->dataPlantChillers->EngineDrivenChiller(1).size(*state); // see if heat recovery flow rate is as expected - EXPECT_NEAR(state.dataPlantChillers->EngineDrivenChiller(1).DesignHeatRecVolFlowRate, 0.5, 0.00001); + EXPECT_NEAR(state->dataPlantChillers->EngineDrivenChiller(1).DesignHeatRecVolFlowRate, 0.5, 0.00001); - state.dataPlantChillers->EngineDrivenChiller.deallocate(); + state->dataPlantChillers->EngineDrivenChiller.deallocate(); DataSizing::PlantSizData.deallocate(); DataPlant::PlantLoop.deallocate(); } @@ -223,10 +224,10 @@ TEST_F(EnergyPlusFixture, EngineDrivenChiller_Fueltype) }); ASSERT_TRUE(process_idf(idf_objects)); - EngineDrivenChillerSpecs::getInput(state); + EngineDrivenChillerSpecs::getInput(*state); - EXPECT_EQ(1, state.dataPlantChillers->NumEngineDrivenChillers); - EXPECT_EQ(state.dataPlantChillers->EngineDrivenChiller(1).FuelType, "Diesel"); + EXPECT_EQ(1, state->dataPlantChillers->NumEngineDrivenChillers); + EXPECT_EQ(state->dataPlantChillers->EngineDrivenChiller(1).FuelType, "Diesel"); } TEST_F(EnergyPlusFixture, CombustionTurbineChiller_Fueltype) @@ -292,8 +293,8 @@ TEST_F(EnergyPlusFixture, CombustionTurbineChiller_Fueltype) }); ASSERT_TRUE(process_idf(idf_objects)); - GTChillerSpecs::getInput(state); + GTChillerSpecs::getInput(*state); - EXPECT_EQ(1, state.dataPlantChillers->NumGTChillers); - EXPECT_EQ(state.dataPlantChillers->GTChiller(1).FuelType, "NaturalGas"); + EXPECT_EQ(1, state->dataPlantChillers->NumGTChillers); + EXPECT_EQ(state->dataPlantChillers->GTChiller(1).FuelType, "NaturalGas"); } diff --git a/tst/EnergyPlus/unit/PlantComponentTemperatureSources.unit.cc b/tst/EnergyPlus/unit/PlantComponentTemperatureSources.unit.cc index de73e1bdfdf..33d5915463c 100644 --- a/tst/EnergyPlus/unit/PlantComponentTemperatureSources.unit.cc +++ b/tst/EnergyPlus/unit/PlantComponentTemperatureSources.unit.cc @@ -54,6 +54,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -93,9 +94,9 @@ TEST_F(EnergyPlusFixture, TestPlantComponentTemperatureSource) // First call is for initialization only bool firstHVACIteration; bool runFlag = false; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataPlant::PlantFirstSizesOkayToFinalize = true; - PlantComponentTemperatureSources::GetWaterSourceInput(state); + PlantComponentTemperatureSources::GetWaterSourceInput(*state); // We can check that GetInput happened properly here EXPECT_EQ(1u, PlantComponentTemperatureSources::WaterSource.size()); @@ -107,13 +108,13 @@ TEST_F(EnergyPlusFixture, TestPlantComponentTemperatureSource) // Second call is on firstHVAC, no load at the moment firstHVACIteration = true; PlantLocation loc; - waterSource1.simulate(state, loc, firstHVACIteration, myLoad, runFlag); + waterSource1.simulate(*state, loc, firstHVACIteration, myLoad, runFlag); EXPECT_NEAR(0.0, waterSource1.MassFlowRate, 0.00001); // Third call is no longer firstHVAC, and we now have a load firstHVACIteration = false; myLoad = 1696.55; - waterSource1.simulate(state, loc, firstHVACIteration, myLoad, runFlag); + waterSource1.simulate(*state, loc, firstHVACIteration, myLoad, runFlag); EXPECT_NEAR(0.05, waterSource1.MassFlowRate, 0.001); // Do this for scheduled temperature diff --git a/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc b/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc index 024e3287159..cd454cc7388 100644 --- a/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc +++ b/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc @@ -58,6 +58,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; @@ -133,7 +134,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Sequential) Real64 loopDemand = 550.0; Real64 remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 100.0); @@ -154,7 +155,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Sequential) loopDemand = 50.0; remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 50.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 0.0); @@ -174,7 +175,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Sequential) loopDemand = 5000.0; remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 100.0); @@ -200,7 +201,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Sequential) thisBranch.Comp(10).Available = false; thisBranch.Comp(12).Available = false; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 100.0); @@ -232,7 +233,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Sequential) loopDemand = 5.0; remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 5.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -242,7 +243,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Sequential) loopDemand = 25.0; remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 25.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -252,7 +253,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Sequential) loopDemand = 50.0; remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 10.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -262,7 +263,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Sequential) loopDemand = 100.0; remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 60.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -272,7 +273,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Sequential) loopDemand = 150.0; remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(remainingLoopDemand, 10.0); @@ -282,7 +283,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Sequential) loopDemand = 200.0; remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(remainingLoopDemand, 60.0); @@ -302,7 +303,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Uniform) Real64 remainingLoopDemand = 0.0; Real64 loopDemand = 550.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 100.0); @@ -315,7 +316,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Uniform) remainingLoopDemand = 0.0; loopDemand = 50.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 10.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 10.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 10.0); @@ -332,7 +333,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Uniform) thisBranch.Comp(4).MaxLoad = 50.0; thisBranch.Comp(3).Available = false; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 90.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 0.0); @@ -353,7 +354,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Uniform) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 10.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 5.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 5.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -362,7 +363,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Uniform) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 25.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 12.5); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 12.5); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -371,7 +372,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Uniform) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 50.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 25.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 25.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -380,7 +381,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Uniform) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 100.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 60.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -389,7 +390,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Uniform) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 150.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(remainingLoopDemand, 10.0); @@ -398,7 +399,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Uniform) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 200.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(remainingLoopDemand, 60.0); @@ -425,7 +426,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Optimal) Real64 remainingLoopDemand = 0.0; Real64 loopDemand = 550.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 100.0); @@ -438,7 +439,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Optimal) remainingLoopDemand = 0.0; loopDemand = 440.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 99.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 97.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 97.0); @@ -453,7 +454,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Optimal) loopDemand = 340.0; thisBranch.Comp(3).Available = false; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 97.5); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 96.25); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 0.0); @@ -474,7 +475,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Optimal) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 5.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 5.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -483,7 +484,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Optimal) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 25.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 24.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 1.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -492,7 +493,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Optimal) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 50.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 24.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 26.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -501,7 +502,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Optimal) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 100.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 60.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -510,7 +511,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Optimal) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 150.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(remainingLoopDemand, 10.0); @@ -519,7 +520,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Optimal) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 200.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(remainingLoopDemand, 60.0); @@ -530,7 +531,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_Optimal) loopDemand = 200.0; thisBranch.Comp(1).Available = false; thisBranch.Comp(2).Available = false; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 0.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(remainingLoopDemand, 200.0); @@ -555,7 +556,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_UniformPLR) Real64 loopDemand = 550.0; Real64 remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 100.0); @@ -569,7 +570,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_UniformPLR) loopDemand = 45.0; remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 10.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 10.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 10.0); @@ -586,7 +587,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_UniformPLR) remainingLoopDemand = 0.0; thisBranch.Comp(3).Available = false; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 80.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 80.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 0.0); @@ -607,7 +608,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_UniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 5.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 5.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -616,7 +617,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_UniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 10.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 10.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -625,7 +626,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_UniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 25.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_NEAR(thisBranch.Comp(1).MyLoad, 25.0,0.1); EXPECT_NEAR(thisBranch.Comp(2).MyLoad, 0.0,0.1); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -634,7 +635,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_UniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 50.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_NEAR(thisBranch.Comp(1).MyLoad, 14.29,0.1); EXPECT_NEAR(thisBranch.Comp(2).MyLoad, 35.71,0.1); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -643,7 +644,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_UniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 100.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_NEAR(thisBranch.Comp(1).MyLoad, 28.57,0.1); EXPECT_NEAR(thisBranch.Comp(2).MyLoad, 71.43,0.1); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -652,7 +653,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_UniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 150.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(remainingLoopDemand, 10.0); @@ -678,7 +679,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_SequentialUniformPLR) Real64 remainingLoopDemand = 0.0; Real64 loopDemand = 550.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 100.0); @@ -692,7 +693,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_SequentialUniformPLR) loopDemand = 45.0; remainingLoopDemand = 0.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 45.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 0.0); @@ -709,7 +710,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_SequentialUniformPLR) remainingLoopDemand = 0.0; thisBranch.Comp(3).Available = false; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 90.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 90.0); EXPECT_EQ(thisBranch.Comp(3).MyLoad, 0.0); @@ -730,7 +731,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_SequentialUniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 5.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 5.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -739,7 +740,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_SequentialUniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 10.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 10.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -748,7 +749,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_SequentialUniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 25.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 25.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 0.0); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -757,7 +758,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_SequentialUniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 50.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_NEAR(thisBranch.Comp(1).MyLoad, 14.3,0.1); EXPECT_NEAR(thisBranch.Comp(2).MyLoad, 35.71,0.1); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -766,7 +767,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_SequentialUniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 100.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_NEAR(thisBranch.Comp(1).MyLoad, 28.6,0.1); EXPECT_NEAR(thisBranch.Comp(2).MyLoad, 71.43,0.1); EXPECT_EQ(remainingLoopDemand, 0.0); @@ -775,7 +776,7 @@ TEST_F(DistributePlantLoadTest, DistributePlantLoad_SequentialUniformPLR) DistributePlantLoadTest::ResetLoads(); remainingLoopDemand = 0.0; loopDemand = 150.0; - PlantCondLoopOperation::DistributePlantLoad(state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); + PlantCondLoopOperation::DistributePlantLoad(*state, 1, 1, 1, 1, loopDemand, remainingLoopDemand); EXPECT_EQ(thisBranch.Comp(1).MyLoad, 40.0); EXPECT_EQ(thisBranch.Comp(2).MyLoad, 100.0); EXPECT_EQ(remainingLoopDemand, 10.0); @@ -849,7 +850,7 @@ TEST_F(EnergyPlusFixture, ThermalEnergyStorageWithIceForceDualOp) { int LoopNum = 1; int SchemeNum = 1; std::string CurrentModuleObject = "PlantEquipmentOperation:ThermalEnergyStorage"; - PlantCondLoopOperation::FindCompSPInput(state, CurrentModuleObject, TESSPBO, LoopNum, SchemeNum, ErrorsFound); + PlantCondLoopOperation::FindCompSPInput(*state, CurrentModuleObject, TESSPBO, LoopNum, SchemeNum, ErrorsFound); EXPECT_FALSE(ErrorsFound); diff --git a/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc b/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc index ab005c7b0f7..b12c46a359a 100644 --- a/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc +++ b/tst/EnergyPlus/unit/PlantHeatExchangerFluidToFluid.unit.cc @@ -66,6 +66,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -1060,62 +1061,62 @@ TEST_F(EnergyPlusFixture, PlantHXModulatedDualDeadDefectFileHi) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); - OutputReportPredefined::SetPredefinedTables(state); - HeatBalanceManager::SetPreConstructionInputParameters(state); // establish array bounds for constructions early + OutputReportPredefined::SetPredefinedTables(*state); + HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); - PlantManager::CheckIfAnyPlant(state); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); + PlantManager::CheckIfAnyPlant(*state); createFacilityElectricPowerServiceObject(); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); - SimulationManager::SetupSimulation(state, ErrorsFound); - state.dataGlobal->KickOffSimulation = false; + WeatherManager::ResetEnvironmentCounter(*state); + SimulationManager::SetupSimulation(*state, ErrorsFound); + state->dataGlobal->KickOffSimulation = false; int EnvCount = 0; - state.dataGlobal->WarmupFlag = true; + state->dataGlobal->WarmupFlag = true; bool Available(true); while (Available) { - WeatherManager::GetNextEnvironment(state, Available, ErrorsFound); + WeatherManager::GetNextEnvironment(*state, Available, ErrorsFound); if (!Available) break; if (ErrorsFound) break; ++EnvCount; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->EndEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->EndEnvrnFlag = false; DataEnvironment::EndMonthFlag = false; - state.dataGlobal->WarmupFlag = true; - state.dataGlobal->DayOfSim = 0; - state.dataGlobal->DayOfSimChr = "0"; + state->dataGlobal->WarmupFlag = true; + state->dataGlobal->DayOfSim = 0; + state->dataGlobal->DayOfSimChr = "0"; - while ((state.dataGlobal->DayOfSim < state.dataGlobal->NumOfDayInEnvrn) || (state.dataGlobal->WarmupFlag)) { // Begin day loop ... + while ((state->dataGlobal->DayOfSim < state->dataGlobal->NumOfDayInEnvrn) || (state->dataGlobal->WarmupFlag)) { // Begin day loop ... - ++state.dataGlobal->DayOfSim; + ++state->dataGlobal->DayOfSim; - if (!state.dataGlobal->WarmupFlag) { + if (!state->dataGlobal->WarmupFlag) { ++DataEnvironment::CurrentOverallSimDay; } - state.dataGlobal->BeginDayFlag = true; - state.dataGlobal->EndDayFlag = false; + state->dataGlobal->BeginDayFlag = true; + state->dataGlobal->EndDayFlag = false; - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... - state.dataGlobal->BeginHourFlag = true; - state.dataGlobal->EndHourFlag = false; + state->dataGlobal->BeginHourFlag = true; + state->dataGlobal->EndHourFlag = false; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { - state.dataGlobal->BeginTimeStepFlag = true; + state->dataGlobal->BeginTimeStepFlag = true; // Set the End__Flag variables to true if necessary. Note that // each flag builds on the previous level. EndDayFlag cannot be @@ -1124,31 +1125,31 @@ TEST_F(EnergyPlusFixture, PlantHXModulatedDualDeadDefectFileHi) // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the // SubTimeStepFlags can/will be set/reset in the HVAC Manager. - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { - state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { - state.dataGlobal->EndDayFlag = true; - if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { - state.dataGlobal->EndEnvrnFlag = true; + if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + state->dataGlobal->EndHourFlag = true; + if (state->dataGlobal->HourOfDay == 24) { + state->dataGlobal->EndDayFlag = true; + if ((!state->dataGlobal->WarmupFlag) && (state->dataGlobal->DayOfSim == state->dataGlobal->NumOfDayInEnvrn)) { + state->dataGlobal->EndEnvrnFlag = true; } } } - WeatherManager::ManageWeather(state); + WeatherManager::ManageWeather(*state); - HeatBalanceManager::ManageHeatBalance(state); + HeatBalanceManager::ManageHeatBalance(*state); // After the first iteration of HeatBalance, all the 'input' has been gotten - state.dataGlobal->BeginHourFlag = false; - state.dataGlobal->BeginDayFlag = false; - state.dataGlobal->BeginEnvrnFlag = false; - state.dataGlobal->BeginSimFlag = false; - state.dataGlobal->BeginFullSimFlag = false; + state->dataGlobal->BeginHourFlag = false; + state->dataGlobal->BeginDayFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginSimFlag = false; + state->dataGlobal->BeginFullSimFlag = false; } // TimeStep loop - state.dataGlobal->PreviousHour = state.dataGlobal->HourOfDay; + state->dataGlobal->PreviousHour = state->dataGlobal->HourOfDay; } // ... End hour loop. @@ -2151,62 +2152,62 @@ TEST_F(EnergyPlusFixture, PlantHXModulatedDualDeadDefectFileLo) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); - OutputReportPredefined::SetPredefinedTables(state); - HeatBalanceManager::SetPreConstructionInputParameters(state); // establish array bounds for constructions early + OutputReportPredefined::SetPredefinedTables(*state); + HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early // OutputProcessor::TimeValue.allocate(2); - OutputProcessor::SetupTimePointers(state, "Zone", state.dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); - PlantManager::CheckIfAnyPlant(state); + OutputProcessor::SetupTimePointers(*state, "Zone", state->dataGlobal->TimeStepZone); // Set up Time pointer for HB/Zone Simulation + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); + PlantManager::CheckIfAnyPlant(*state); createFacilityElectricPowerServiceObject(); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = true; + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = true; - WeatherManager::ResetEnvironmentCounter(state); - SimulationManager::SetupSimulation(state, ErrorsFound); - state.dataGlobal->KickOffSimulation = false; + WeatherManager::ResetEnvironmentCounter(*state); + SimulationManager::SetupSimulation(*state, ErrorsFound); + state->dataGlobal->KickOffSimulation = false; int EnvCount = 0; - state.dataGlobal->WarmupFlag = true; + state->dataGlobal->WarmupFlag = true; bool Available(true); while (Available) { - WeatherManager::GetNextEnvironment(state, Available, ErrorsFound); + WeatherManager::GetNextEnvironment(*state, Available, ErrorsFound); if (!Available) break; if (ErrorsFound) break; ++EnvCount; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->EndEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->EndEnvrnFlag = false; DataEnvironment::EndMonthFlag = false; - state.dataGlobal->WarmupFlag = true; - state.dataGlobal->DayOfSim = 0; - state.dataGlobal->DayOfSimChr = "0"; + state->dataGlobal->WarmupFlag = true; + state->dataGlobal->DayOfSim = 0; + state->dataGlobal->DayOfSimChr = "0"; - while ((state.dataGlobal->DayOfSim < state.dataGlobal->NumOfDayInEnvrn) || (state.dataGlobal->WarmupFlag)) { // Begin day loop ... + while ((state->dataGlobal->DayOfSim < state->dataGlobal->NumOfDayInEnvrn) || (state->dataGlobal->WarmupFlag)) { // Begin day loop ... - ++state.dataGlobal->DayOfSim; + ++state->dataGlobal->DayOfSim; - if (!state.dataGlobal->WarmupFlag) { + if (!state->dataGlobal->WarmupFlag) { ++DataEnvironment::CurrentOverallSimDay; } - state.dataGlobal->BeginDayFlag = true; - state.dataGlobal->EndDayFlag = false; + state->dataGlobal->BeginDayFlag = true; + state->dataGlobal->EndDayFlag = false; - for (state.dataGlobal->HourOfDay = 1; state.dataGlobal->HourOfDay <= 24; ++state.dataGlobal->HourOfDay) { // Begin hour loop ... + for (state->dataGlobal->HourOfDay = 1; state->dataGlobal->HourOfDay <= 24; ++state->dataGlobal->HourOfDay) { // Begin hour loop ... - state.dataGlobal->BeginHourFlag = true; - state.dataGlobal->EndHourFlag = false; + state->dataGlobal->BeginHourFlag = true; + state->dataGlobal->EndHourFlag = false; - for (state.dataGlobal->TimeStep = 1; state.dataGlobal->TimeStep <= state.dataGlobal->NumOfTimeStepInHour; ++state.dataGlobal->TimeStep) { + for (state->dataGlobal->TimeStep = 1; state->dataGlobal->TimeStep <= state->dataGlobal->NumOfTimeStepInHour; ++state->dataGlobal->TimeStep) { - state.dataGlobal->BeginTimeStepFlag = true; + state->dataGlobal->BeginTimeStepFlag = true; // Set the End__Flag variables to true if necessary. Note that // each flag builds on the previous level. EndDayFlag cannot be @@ -2215,31 +2216,31 @@ TEST_F(EnergyPlusFixture, PlantHXModulatedDualDeadDefectFileLo) // Note also that BeginTimeStepFlag, EndTimeStepFlag, and the // SubTimeStepFlags can/will be set/reset in the HVAC Manager. - if (state.dataGlobal->TimeStep == state.dataGlobal->NumOfTimeStepInHour) { - state.dataGlobal->EndHourFlag = true; - if (state.dataGlobal->HourOfDay == 24) { - state.dataGlobal->EndDayFlag = true; - if ((!state.dataGlobal->WarmupFlag) && (state.dataGlobal->DayOfSim == state.dataGlobal->NumOfDayInEnvrn)) { - state.dataGlobal->EndEnvrnFlag = true; + if (state->dataGlobal->TimeStep == state->dataGlobal->NumOfTimeStepInHour) { + state->dataGlobal->EndHourFlag = true; + if (state->dataGlobal->HourOfDay == 24) { + state->dataGlobal->EndDayFlag = true; + if ((!state->dataGlobal->WarmupFlag) && (state->dataGlobal->DayOfSim == state->dataGlobal->NumOfDayInEnvrn)) { + state->dataGlobal->EndEnvrnFlag = true; } } } - WeatherManager::ManageWeather(state); + WeatherManager::ManageWeather(*state); - HeatBalanceManager::ManageHeatBalance(state); + HeatBalanceManager::ManageHeatBalance(*state); // After the first iteration of HeatBalance, all the 'input' has been gotten - state.dataGlobal->BeginHourFlag = false; - state.dataGlobal->BeginDayFlag = false; - state.dataGlobal->BeginEnvrnFlag = false; - state.dataGlobal->BeginSimFlag = false; - state.dataGlobal->BeginFullSimFlag = false; + state->dataGlobal->BeginHourFlag = false; + state->dataGlobal->BeginDayFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginSimFlag = false; + state->dataGlobal->BeginFullSimFlag = false; } // TimeStep loop - state.dataGlobal->PreviousHour = state.dataGlobal->HourOfDay; + state->dataGlobal->PreviousHour = state->dataGlobal->HourOfDay; } // ... End hour loop. @@ -2264,19 +2265,19 @@ TEST_F(EnergyPlusFixture, PlantHXControlWithFirstHVACIteration) PlantHeatExchangerFluidToFluid::FluidHX.allocate(1); // get availability schedule to work - 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 + 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 ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); PlantHeatExchangerFluidToFluid::FluidHX(1).AvailSchedNum = -1; // setup four plant nodes for HX @@ -2345,13 +2346,13 @@ TEST_F(EnergyPlusFixture, PlantHXControlWithFirstHVACIteration) // when FirstHVACIteration is true, mass flow should match design max bool testFirstHVACIteration = true; - PlantHeatExchangerFluidToFluid::FluidHX(1).control(state, 1, -1000.0, testFirstHVACIteration); + PlantHeatExchangerFluidToFluid::FluidHX(1).control(*state, 1, -1000.0, testFirstHVACIteration); EXPECT_NEAR(DataLoopNode::Node(2).MassFlowRate, PlantHeatExchangerFluidToFluid::FluidHX(1).DemandSideLoop.MassFlowRateMax, 0.001); // when FirstHVACIteration is false, mass flow should be zero testFirstHVACIteration = false; - PlantHeatExchangerFluidToFluid::FluidHX(1).control(state, 1, -1000.0, testFirstHVACIteration); + PlantHeatExchangerFluidToFluid::FluidHX(1).control(*state, 1, -1000.0, testFirstHVACIteration); EXPECT_NEAR(DataLoopNode::Node(2).MassFlowRate, 0.0, 0.001); } @@ -2363,19 +2364,19 @@ TEST_F(EnergyPlusFixture, PlantHXControl_CoolingSetpointOnOffWithComponentOverri PlantHeatExchangerFluidToFluid::FluidHX.allocate(1); // get availability schedule to work - 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 + 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 ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); PlantHeatExchangerFluidToFluid::FluidHX(1).AvailSchedNum = -1; // setup four plant nodes for HX @@ -2468,14 +2469,14 @@ TEST_F(EnergyPlusFixture, PlantHXControl_CoolingSetpointOnOffWithComponentOverri DataLoopNode::Node(3).TempSetPoint = 11.0; // now call the init routine - PlantHeatExchangerFluidToFluid::FluidHX(1).initialize(state); + PlantHeatExchangerFluidToFluid::FluidHX(1).initialize(*state); // check value in FreeCoolCntrlMinCntrlTemp EXPECT_NEAR(DataPlant::PlantLoop(1).LoopSide(2).Branch(2).Comp(1).FreeCoolCntrlMinCntrlTemp, 11.0, 0.001); // change the tolerance and check the result, issue 5626 fix subtracts tolerance PlantHeatExchangerFluidToFluid::FluidHX(1).TempControlTol = 1.5; - PlantHeatExchangerFluidToFluid::FluidHX(1).initialize(state); + PlantHeatExchangerFluidToFluid::FluidHX(1).initialize(*state); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc b/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc index 89b1ca152f4..628ed46c40e 100644 --- a/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc +++ b/tst/EnergyPlus/unit/PlantLoopHeatPumpEIR.unit.cc @@ -65,6 +65,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::EIRPlantLoopHeatPumps; @@ -112,7 +113,7 @@ TEST_F(EnergyPlusFixture, ConstructionFullObjectsHeatingAndCooling_WaterSource) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(2u, heatPumps.size()); @@ -138,10 +139,10 @@ TEST_F(EnergyPlusFixture, ConstructionFullObjectsHeatingAndCooling_WaterSource) EXPECT_EQ(1, thisCoolingPLHP->powerRatioFuncPLRCurveIndex); // calling the factory with an invalid name or type will call ShowFatalError, which will trigger a runtime exception - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "fake"), std::runtime_error); - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP HEATING SIDE"), std::runtime_error); - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "fake"), std::runtime_error); - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP COOLING SIDE"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "fake"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP HEATING SIDE"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "fake"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP COOLING SIDE"), std::runtime_error); } TEST_F(EnergyPlusFixture, PairingCompanionCoils) @@ -160,7 +161,7 @@ TEST_F(EnergyPlusFixture, PairingCompanionCoils) coil2->companionCoilName = "name1"; coil2->plantTypeOfNum = DataPlant::TypeOf_HeatPumpEIRHeating; coil2->companionHeatPumpCoil = nullptr; - EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::pairUpCompanionCoils(state); + EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::pairUpCompanionCoils(*state); EXPECT_EQ(coil2, coil1->companionHeatPumpCoil); EXPECT_EQ(coil1, coil2->companionHeatPumpCoil); } @@ -175,7 +176,7 @@ TEST_F(EnergyPlusFixture, PairingCompanionCoils) coil2->companionCoilName = "name1"; coil2->plantTypeOfNum = DataPlant::TypeOf_HeatPumpEIRHeating; coil2->companionHeatPumpCoil = nullptr; - EXPECT_THROW(EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::pairUpCompanionCoils(state), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::pairUpCompanionCoils(*state), std::runtime_error); } { @@ -188,7 +189,7 @@ TEST_F(EnergyPlusFixture, PairingCompanionCoils) coil2->companionCoilName = "name1"; coil2->plantTypeOfNum = DataPlant::TypeOf_HeatPumpEIRCooling; coil2->companionHeatPumpCoil = nullptr; - EXPECT_THROW(EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::pairUpCompanionCoils(state), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPumps::EIRPlantLoopHeatPump::pairUpCompanionCoils(*state), std::runtime_error); } } @@ -219,7 +220,7 @@ TEST_F(EnergyPlusFixture, HeatingConstructionFullObjectsNoCompanion) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -236,8 +237,8 @@ TEST_F(EnergyPlusFixture, HeatingConstructionFullObjectsNoCompanion) EXPECT_EQ(1, thisHeatingPLHP->powerRatioFuncPLRCurveIndex); // calling the factory with an invalid name or type will call ShowFatalError, which will trigger a runtime exception - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "fake"), std::runtime_error); - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP HEATING SIDE"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "fake"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP HEATING SIDE"), std::runtime_error); } TEST_F(EnergyPlusFixture, CoolingConstructionFullObjectsNoCompanion) @@ -267,7 +268,7 @@ TEST_F(EnergyPlusFixture, CoolingConstructionFullObjectsNoCompanion) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -284,8 +285,8 @@ TEST_F(EnergyPlusFixture, CoolingConstructionFullObjectsNoCompanion) EXPECT_EQ(1, thisCoolingPLHP->powerRatioFuncPLRCurveIndex); // calling the factory with an invalid name or type will call ShowFatalError, which will trigger a runtime exception - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "fake"), std::runtime_error); - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP COOLING SIDE"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "fake"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP COOLING SIDE"), std::runtime_error); } TEST_F(EnergyPlusFixture, CoolingConstructionFullObjectWithDefaults) @@ -315,7 +316,7 @@ TEST_F(EnergyPlusFixture, CoolingConstructionFullObjectWithDefaults) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -356,7 +357,7 @@ TEST_F(EnergyPlusFixture, CoolingConstructionFullyAutoSized_WaterSource) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -373,8 +374,8 @@ TEST_F(EnergyPlusFixture, CoolingConstructionFullyAutoSized_WaterSource) EXPECT_EQ(1, thisCoolingPLHP->powerRatioFuncPLRCurveIndex); // calling the factory with an invalid name or type will call ShowFatalError, which will trigger a runtime exception - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "fake"), std::runtime_error); - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP COOLING SIDE"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "fake"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP COOLING SIDE"), std::runtime_error); } TEST_F(EnergyPlusFixture, CatchErrorsOnBadCurves) @@ -397,7 +398,7 @@ TEST_F(EnergyPlusFixture, CatchErrorsOnBadCurves) " dummyCurveC;"}); ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs, it should throw for the bad curves - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"), std::runtime_error); } TEST_F(EnergyPlusFixture, Initialization) @@ -450,7 +451,7 @@ TEST_F(EnergyPlusFixture, Initialization) PlantLocation myLocation = PlantLocation(1, 2, 1, 1); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -465,8 +466,8 @@ TEST_F(EnergyPlusFixture, Initialization) PLHPPlantLoadSourceComp.NodeNumIn = thisCoolingPLHP->sourceSideNodes.inlet; // call for initialization, oneTimeInit only first - state.dataGlobal->BeginEnvrnFlag = false; - thisCoolingPLHP->onInitLoopEquip(state, myLocation); + state->dataGlobal->BeginEnvrnFlag = false; + thisCoolingPLHP->onInitLoopEquip(*state, myLocation); // validate that location work got done correctly EXPECT_EQ(1, thisCoolingPLHP->loadSideLocation.loopNum); @@ -479,9 +480,9 @@ TEST_F(EnergyPlusFixture, Initialization) EXPECT_EQ(1, thisCoolingPLHP->sourceSideLocation.compNum); // now call for initialization again, for begin environment - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataPlant::PlantFirstSizesOkayToFinalize = true; - thisCoolingPLHP->onInitLoopEquip(state, myLocation); + thisCoolingPLHP->onInitLoopEquip(*state, myLocation); // validate that plant sizing went ok Real64 const flowTol = 0.001; @@ -543,7 +544,7 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_WaterSou ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(2u, heatPumps.size()); @@ -613,11 +614,11 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_WaterSou PlantLocation myHeatingLoadLocation = PlantLocation(1, 2, 1, 2); // set a couple global flags - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; // initialize so the components can find themselves on the plant - thisCoolingPLHP->onInitLoopEquip(state, myCoolingLoadLocation); - thisHeatingPLHP->onInitLoopEquip(state, myHeatingLoadLocation); + thisCoolingPLHP->onInitLoopEquip(*state, myCoolingLoadLocation); + thisHeatingPLHP->onInitLoopEquip(*state, myHeatingLoadLocation); DataPlant::PlantFinalSizesOkayToReport = true; DataPlant::PlantFirstSizesOkayToReport = true; @@ -640,8 +641,8 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_WaterSou Real64 expectedCapacity = expectedLoadRho * expectedLoadFlow * expectedLoadCp * plantSizingLoadDeltaT; Real64 const baseExpectedSourceFlow = plantSizingLoadVolFlow * 2.0; Real64 expectedSourceFlow = baseExpectedSourceFlow * (expectedLoadRho * expectedLoadCp) / (expectedSourceRho * expectedSourceCp); - thisCoolingPLHP->sizeLoadSide(state); - thisCoolingPLHP->sizeSrcSideWSHP(state); + thisCoolingPLHP->sizeLoadSide(*state); + thisCoolingPLHP->sizeSrcSideWSHP(*state); EXPECT_NEAR(expectedLoadFlow, thisCoolingPLHP->loadSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(expectedSourceFlow, thisCoolingPLHP->sourceSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(expectedCapacity, thisCoolingPLHP->referenceCapacity, 0.0001); @@ -649,13 +650,13 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_WaterSou // with a sizing run complete, we can also go ahead and get the design capacities... // they should be nonzero for the load side of things Real64 tmpMin = -1.0, tmpMax = -1.0, tmpOpt = -1.0; - thisCoolingPLHP->getDesignCapacities(state, myCoolingLoadLocation, tmpMax, tmpMin, tmpOpt); + thisCoolingPLHP->getDesignCapacities(*state, myCoolingLoadLocation, tmpMax, tmpMin, tmpOpt); EXPECT_NEAR(0.0, tmpMin, 0.001); EXPECT_NEAR(expectedCapacity, tmpMax, 0.001); EXPECT_NEAR(expectedCapacity, tmpOpt, 0.001); // but always zero for the source side of things tmpMin = -1.0, tmpMax = -1.0, tmpOpt = -1.0; - thisCoolingPLHP->getDesignCapacities(state, myCoolingSourceLocation, tmpMax, tmpMin, tmpOpt); + thisCoolingPLHP->getDesignCapacities(*state, myCoolingSourceLocation, tmpMax, tmpMin, tmpOpt); EXPECT_NEAR(0.0, tmpMin, 0.001); EXPECT_NEAR(0.0, tmpMax, 0.001); EXPECT_NEAR(0.0, tmpOpt, 0.001); @@ -668,8 +669,8 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_WaterSou thisCoolingPLHP->sourceSideDesignVolFlowRate = DataSizing::AutoSize; thisCoolingPLHP->referenceCapacity = DataSizing::AutoSize; DataSizing::PlantSizData(1).DesVolFlowRate = 0.0; - thisCoolingPLHP->sizeLoadSide(state); - thisCoolingPLHP->sizeSrcSideWSHP(state); + thisCoolingPLHP->sizeLoadSide(*state); + thisCoolingPLHP->sizeSrcSideWSHP(*state); EXPECT_NEAR(0.0, thisCoolingPLHP->loadSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(0.0, thisCoolingPLHP->sourceSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(0.0, thisCoolingPLHP->referenceCapacity, 0.0001); @@ -680,8 +681,8 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_WaterSou thisCoolingPLHP->referenceCapacity = expectedCapacity; expectedSourceFlow = baseExpectedSourceFlow * (expectedSourceRho * expectedSourceCp) / (expectedLoadRho * expectedLoadCp); expectedCapacity = expectedSourceRho * expectedLoadFlow * expectedSourceCp * plantSizingLoadDeltaT; - thisHeatingPLHP->sizeLoadSide(state); - thisHeatingPLHP->sizeSrcSideWSHP(state); + thisHeatingPLHP->sizeLoadSide(*state); + thisHeatingPLHP->sizeSrcSideWSHP(*state); EXPECT_NEAR(expectedLoadFlow, thisHeatingPLHP->loadSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(expectedSourceFlow, thisHeatingPLHP->sourceSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(expectedCapacity, thisHeatingPLHP->referenceCapacity, 0.0001); @@ -730,7 +731,7 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyHardsizedHeatingWithCompanion) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(2u, heatPumps.size()); @@ -797,11 +798,11 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyHardsizedHeatingWithCompanion) PlantLocation myLoadLocation = PlantLocation(1, 2, 1, 1); // set a couple global flags - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->DisplayExtraWarnings = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->DisplayExtraWarnings = true; // initialize so the components can find themselves on the plant - thisHeatingPLHP->onInitLoopEquip(state, myLoadLocation); + thisHeatingPLHP->onInitLoopEquip(*state, myLoadLocation); DataPlant::PlantFinalSizesOkayToReport = true; DataPlant::PlantFirstSizesOkayToReport = true; @@ -809,16 +810,16 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyHardsizedHeatingWithCompanion) // The values really should just come out all as the hard-sized values, this just makes sure that function didn't // botch something up. - thisHeatingPLHP->sizeLoadSide(state); - thisHeatingPLHP->sizeSrcSideWSHP(state); + thisHeatingPLHP->sizeLoadSide(*state); + thisHeatingPLHP->sizeSrcSideWSHP(*state); EXPECT_NEAR(0.01, thisHeatingPLHP->loadSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(0.02, thisHeatingPLHP->sourceSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(1200, thisHeatingPLHP->referenceCapacity, 0.0001); // Call it again, but this time with PlantSizing on, it should come out the same again - state.dataGlobal->DoPlantSizing = true; - thisHeatingPLHP->sizeLoadSide(state); - thisHeatingPLHP->sizeSrcSideWSHP(state); + state->dataGlobal->DoPlantSizing = true; + thisHeatingPLHP->sizeLoadSide(*state); + thisHeatingPLHP->sizeSrcSideWSHP(*state); EXPECT_NEAR(0.01, thisHeatingPLHP->loadSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(0.02, thisHeatingPLHP->sourceSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(1200, thisHeatingPLHP->referenceCapacity, 0.0001); @@ -867,7 +868,7 @@ TEST_F(EnergyPlusFixture, TestSizing_WithCompanionNoPlantSizing) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(2u, heatPumps.size()); @@ -927,11 +928,11 @@ TEST_F(EnergyPlusFixture, TestSizing_WithCompanionNoPlantSizing) PlantLocation myHeatingLoadLocation = PlantLocation(1, 2, 1, 2); // set a couple global flags - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; // initialize so the components can find themselves on the plant - thisCoolingPLHP->onInitLoopEquip(state, myCoolingLoadLocation); - thisHeatingPLHP->onInitLoopEquip(state, myHeatingLoadLocation); + thisCoolingPLHP->onInitLoopEquip(*state, myCoolingLoadLocation); + thisHeatingPLHP->onInitLoopEquip(*state, myHeatingLoadLocation); DataPlant::PlantFinalSizesOkayToReport = true; DataPlant::PlantFirstSizesOkayToReport = true; @@ -946,8 +947,8 @@ TEST_F(EnergyPlusFixture, TestSizing_WithCompanionNoPlantSizing) // the load flow should be the companion load flow // with no source plant sizing, the source flow will actually work out to be the same as the load flow (not the source flow) // the capacity will be the companion capacity - thisCoolingPLHP->sizeLoadSide(state); - thisCoolingPLHP->sizeSrcSideWSHP(state); + thisCoolingPLHP->sizeLoadSide(*state); + thisCoolingPLHP->sizeSrcSideWSHP(*state); EXPECT_NEAR(0.1, thisCoolingPLHP->loadSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(0.1, thisCoolingPLHP->sourceSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(1000.0, thisCoolingPLHP->referenceCapacity, 0.0001); @@ -980,7 +981,7 @@ TEST_F(EnergyPlusFixture, TestSizing_NoCompanionNoPlantSizingError) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -1029,17 +1030,17 @@ TEST_F(EnergyPlusFixture, TestSizing_NoCompanionNoPlantSizingError) PlantLocation myHeatingLoadLocation = PlantLocation(1, 2, 1, 1); // set a couple global flags - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; // initialize so the components can find themselves on the plant - thisHeatingPLHP->onInitLoopEquip(state, myHeatingLoadLocation); + thisHeatingPLHP->onInitLoopEquip(*state, myHeatingLoadLocation); DataPlant::PlantFinalSizesOkayToReport = true; DataPlant::PlantFirstSizesOkayToReport = true; DataPlant::PlantFirstSizesOkayToFinalize = true; // with no plant sizing available and no companion coil to size from, it should throw a fatal - EXPECT_THROW(thisHeatingPLHP->sizeLoadSide(state), std::runtime_error); + EXPECT_THROW(thisHeatingPLHP->sizeLoadSide(*state), std::runtime_error); } TEST_F(EnergyPlusFixture, TestSizing_NoCompanionNoPlantSizingHardSized) @@ -1069,7 +1070,7 @@ TEST_F(EnergyPlusFixture, TestSizing_NoCompanionNoPlantSizingHardSized) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -1118,18 +1119,18 @@ TEST_F(EnergyPlusFixture, TestSizing_NoCompanionNoPlantSizingHardSized) PlantLocation myHeatingLoadLocation = PlantLocation(1, 2, 1, 1); // set a couple global flags - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; // initialize so the components can find themselves on the plant - thisHeatingPLHP->onInitLoopEquip(state, myHeatingLoadLocation); + thisHeatingPLHP->onInitLoopEquip(*state, myHeatingLoadLocation); DataPlant::PlantFinalSizesOkayToReport = true; DataPlant::PlantFirstSizesOkayToReport = true; DataPlant::PlantFirstSizesOkayToFinalize = true; // this should report out to the sizing output, but just the user defined stuff - thisHeatingPLHP->sizeLoadSide(state); - thisHeatingPLHP->sizeSrcSideWSHP(state); + thisHeatingPLHP->sizeLoadSide(*state); + thisHeatingPLHP->sizeSrcSideWSHP(*state); EXPECT_NEAR(0.1, thisHeatingPLHP->loadSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(0.1, thisHeatingPLHP->sourceSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(1000, thisHeatingPLHP->referenceCapacity, 0.0001); @@ -1175,7 +1176,7 @@ TEST_F(EnergyPlusFixture, CoolingOutletSetpointWorker) PLHPPlantLoadSideComp.TypeOf_Num = DataPlant::TypeOf_HeatPumpEIRCooling; // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -1200,18 +1201,18 @@ TEST_F(EnergyPlusFixture, CoolingOutletSetpointWorker) PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::CompSetPtBasedSchemeType; DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.outlet).TempSetPoint = 3.141; DataLoopNode::Node(5).TempSetPoint = 2.718; - EXPECT_NEAR(3.141, thisCoolingPLHP->getLoadSideOutletSetPointTemp(state), 0.001); + EXPECT_NEAR(3.141, thisCoolingPLHP->getLoadSideOutletSetPointTemp(*state), 0.001); PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::CoolingRBOpSchemeType; - EXPECT_NEAR(2.718, thisCoolingPLHP->getLoadSideOutletSetPointTemp(state), 0.001); + EXPECT_NEAR(2.718, thisCoolingPLHP->getLoadSideOutletSetPointTemp(*state), 0.001); // test for dual setpoint operation PLHPPlantLoadSideLoop.LoopDemandCalcScheme = DataPlant::DualSetPointDeadBand; PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::CompSetPtBasedSchemeType; DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.outlet).TempSetPointHi = 6.282; DataLoopNode::Node(5).TempSetPointHi = 5.436; - EXPECT_NEAR(6.282, thisCoolingPLHP->getLoadSideOutletSetPointTemp(state), 0.001); + EXPECT_NEAR(6.282, thisCoolingPLHP->getLoadSideOutletSetPointTemp(*state), 0.001); PLHPPlantLoadSideComp.CurOpSchemeType = DataPlant::CoolingRBOpSchemeType; - EXPECT_NEAR(5.436, thisCoolingPLHP->getLoadSideOutletSetPointTemp(state), 0.001); + EXPECT_NEAR(5.436, thisCoolingPLHP->getLoadSideOutletSetPointTemp(*state), 0.001); } TEST_F(EnergyPlusFixture, Initialization2_WaterSource) @@ -1264,7 +1265,7 @@ TEST_F(EnergyPlusFixture, Initialization2_WaterSource) PlantLocation myLocation = PlantLocation(1, 2, 1, 1); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -1279,13 +1280,13 @@ TEST_F(EnergyPlusFixture, Initialization2_WaterSource) PLHPPlantLoadSourceComp.NodeNumIn = thisCoolingPLHP->sourceSideNodes.inlet; // call for all initialization - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataPlant::PlantFirstSizesOkayToFinalize = true; - thisCoolingPLHP->onInitLoopEquip(state, myLocation); + thisCoolingPLHP->onInitLoopEquip(*state, myLocation); // call with run flag off, loose limits on node min/max thisCoolingPLHP->running = false; - thisCoolingPLHP->setOperatingFlowRatesWSHP(state); + thisCoolingPLHP->setOperatingFlowRatesWSHP(*state); EXPECT_NEAR(0.0, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0.0, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); @@ -1293,7 +1294,7 @@ TEST_F(EnergyPlusFixture, Initialization2_WaterSource) DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRateMinAvail = 0.1; DataLoopNode::Node(thisCoolingPLHP->sourceSideNodes.inlet).MassFlowRateMinAvail = 0.2; thisCoolingPLHP->running = false; - thisCoolingPLHP->setOperatingFlowRatesWSHP(state); + thisCoolingPLHP->setOperatingFlowRatesWSHP(*state); EXPECT_NEAR(0.1, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0.2, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); @@ -1302,7 +1303,7 @@ TEST_F(EnergyPlusFixture, Initialization2_WaterSource) DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 0.24; DataLoopNode::Node(thisCoolingPLHP->sourceSideNodes.inlet).MassFlowRateMinAvail = 0.0; thisCoolingPLHP->running = false; - thisCoolingPLHP->setOperatingFlowRatesWSHP(state); + thisCoolingPLHP->setOperatingFlowRatesWSHP(*state); EXPECT_NEAR(0.24, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0.0, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); @@ -1312,7 +1313,7 @@ TEST_F(EnergyPlusFixture, Initialization2_WaterSource) DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 0.0; DataLoopNode::Node(thisCoolingPLHP->sourceSideNodes.inlet).MassFlowRate = 0.2; thisCoolingPLHP->running = true; - thisCoolingPLHP->setOperatingFlowRatesWSHP(state); + thisCoolingPLHP->setOperatingFlowRatesWSHP(*state); EXPECT_NEAR(0.0, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0.2, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); @@ -1322,7 +1323,7 @@ TEST_F(EnergyPlusFixture, Initialization2_WaterSource) DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 0.2; DataLoopNode::Node(thisCoolingPLHP->sourceSideNodes.inlet).MassFlowRate = 0.0; thisCoolingPLHP->running = true; - thisCoolingPLHP->setOperatingFlowRatesWSHP(state); + thisCoolingPLHP->setOperatingFlowRatesWSHP(*state); EXPECT_NEAR(0.2, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0.0, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); @@ -1332,7 +1333,7 @@ TEST_F(EnergyPlusFixture, Initialization2_WaterSource) DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 0.0; DataLoopNode::Node(thisCoolingPLHP->sourceSideNodes.inlet).MassFlowRate = 0.0; thisCoolingPLHP->running = true; - thisCoolingPLHP->setOperatingFlowRatesWSHP(state); + thisCoolingPLHP->setOperatingFlowRatesWSHP(*state); EXPECT_NEAR(0.0, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0.0, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); @@ -1342,7 +1343,7 @@ TEST_F(EnergyPlusFixture, Initialization2_WaterSource) DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 0.14; DataLoopNode::Node(thisCoolingPLHP->sourceSideNodes.inlet).MassFlowRate = 0.13; thisCoolingPLHP->running = true; - thisCoolingPLHP->setOperatingFlowRatesWSHP(state); + thisCoolingPLHP->setOperatingFlowRatesWSHP(*state); EXPECT_NEAR(0.14, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0.13, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); } @@ -1406,7 +1407,7 @@ TEST_F(EnergyPlusFixture, OnInitLoopEquipTopologyErrorCases) extraPLHPPlantDemandSideComp.TypeOf_Num = DataPlant::TypeOf_HeatPumpEIRCooling; // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); EXPECT_EQ(1u, heatPumps.size()); EIRPlantLoopHeatPump *thisCoolingPLHP = &heatPumps[0]; @@ -1418,7 +1419,7 @@ TEST_F(EnergyPlusFixture, OnInitLoopEquipTopologyErrorCases) PlantLocation myLoadLocation = PlantLocation(1, 2, 1, 1); // set a couple global flags - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataPlant::PlantFirstSizesOkayToFinalize = true; // test the case where the heat pump is connected to both the supply and demand sides of the same loop @@ -1427,7 +1428,7 @@ TEST_F(EnergyPlusFixture, OnInitLoopEquipTopologyErrorCases) extraPLHPPlantSupplySideComp.NodeNumIn = -1; extraPLHPPlantDemandSideComp.NodeNumIn = -1; // call for all initialization, it should abort because the coil load and supply sides were on the same loop - EXPECT_THROW(thisCoolingPLHP->onInitLoopEquip(state, myLoadLocation), std::runtime_error); + EXPECT_THROW(thisCoolingPLHP->onInitLoopEquip(*state, myLoadLocation), std::runtime_error); // test the case where the heat pump source side cannot be found PLHPPlantSupplySideComp.NodeNumIn = thisCoolingPLHP->loadSideNodes.inlet; @@ -1435,7 +1436,7 @@ TEST_F(EnergyPlusFixture, OnInitLoopEquipTopologyErrorCases) extraPLHPPlantSupplySideComp.NodeNumIn = -1; extraPLHPPlantDemandSideComp.NodeNumIn = -1; // call for all initialization, it should abort because the coil source side inlet node is not found on plant - EXPECT_THROW(thisCoolingPLHP->onInitLoopEquip(state, myLoadLocation), std::runtime_error); + EXPECT_THROW(thisCoolingPLHP->onInitLoopEquip(*state, myLoadLocation), std::runtime_error); // test the case where the heat pump load side cannot be found PLHPPlantSupplySideComp.NodeNumIn = -1; @@ -1443,7 +1444,7 @@ TEST_F(EnergyPlusFixture, OnInitLoopEquipTopologyErrorCases) extraPLHPPlantSupplySideComp.NodeNumIn = -1; extraPLHPPlantDemandSideComp.NodeNumIn = -1; // call for all initialization, it should abort because the coil load side inlet node is not found on plant - EXPECT_THROW(thisCoolingPLHP->onInitLoopEquip(state, myLoadLocation), std::runtime_error); + EXPECT_THROW(thisCoolingPLHP->onInitLoopEquip(*state, myLoadLocation), std::runtime_error); // test the case where the heat pump source side is found, but it's on the supply side of a loop // still need to drop the load side onto a (extra) plant supply to trigger this condition @@ -1452,7 +1453,7 @@ TEST_F(EnergyPlusFixture, OnInitLoopEquipTopologyErrorCases) extraPLHPPlantSupplySideComp.NodeNumIn = thisCoolingPLHP->loadSideNodes.inlet; extraPLHPPlantDemandSideComp.NodeNumIn = -1; // call for all initialization, it should abort because the coil source was found on a supply side - EXPECT_THROW(thisCoolingPLHP->onInitLoopEquip(state, myLoadLocation), std::runtime_error); + EXPECT_THROW(thisCoolingPLHP->onInitLoopEquip(*state, myLoadLocation), std::runtime_error); // test the case where the heat pump load side is found, but it's on the demand side of a loop // still need to drop the source side onto a (extra) plant demand to trigger this condition @@ -1461,7 +1462,7 @@ TEST_F(EnergyPlusFixture, OnInitLoopEquipTopologyErrorCases) extraPLHPPlantSupplySideComp.NodeNumIn = -1; extraPLHPPlantDemandSideComp.NodeNumIn = thisCoolingPLHP->sourceSideNodes.inlet; // call for all initialization, it should abort because the coil load was found on a demand side - EXPECT_THROW(thisCoolingPLHP->onInitLoopEquip(state, myLoadLocation), std::runtime_error); + EXPECT_THROW(thisCoolingPLHP->onInitLoopEquip(*state, myLoadLocation), std::runtime_error); } TEST_F(EnergyPlusFixture, CoolingSimulate_WaterSource) @@ -1517,7 +1518,7 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_WaterSource) PlantLocation mySourceLocation = PlantLocation(2, 1, 1, 1); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -1532,9 +1533,9 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_WaterSource) PLHPPlantLoadSourceComp.NodeNumIn = thisCoolingPLHP->sourceSideNodes.inlet; // call for all initialization - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataPlant::PlantFirstSizesOkayToFinalize = true; - thisCoolingPLHP->onInitLoopEquip(state, myLoadLocation); + thisCoolingPLHP->onInitLoopEquip(*state, myLoadLocation); // call from load side location, firsthvac, no load, not running, verify the unit doesn't have any values lingering thisCoolingPLHP->loadSideHeatTransfer = 1000; @@ -1547,7 +1548,7 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_WaterSource) bool firstHVAC = true; Real64 curLoad = 0.0; bool runFlag = false; - thisCoolingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisCoolingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); EXPECT_NEAR(0.0, thisCoolingPLHP->loadSideHeatTransfer, 0.001); EXPECT_NEAR(0.0, thisCoolingPLHP->sourceSideHeatTransfer, 0.001); EXPECT_NEAR(0.0, thisCoolingPLHP->powerUsage, 0.001); @@ -1557,7 +1558,7 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_WaterSource) // call from source side location, firsthvac, no load, not running, connected loop should be triggered to resimulate DataPlant::PlantLoop(1).LoopSide(2).SimLoopSideNeeded = false; DataPlant::PlantLoop(2).LoopSide(1).SimLoopSideNeeded = false; - thisCoolingPLHP->simulate(state, mySourceLocation, firstHVAC, curLoad, runFlag); + thisCoolingPLHP->simulate(*state, mySourceLocation, firstHVAC, curLoad, runFlag); EXPECT_TRUE(DataPlant::PlantLoop(2).LoopSide(1).SimLoopSideNeeded); // now we can call it again from the load side, but this time there is load (still firsthvac, unit can meet load) @@ -1572,7 +1573,7 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_WaterSource) DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint; DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).Temp = calculatedLoadInletTemp; DataLoopNode::Node(thisCoolingPLHP->sourceSideNodes.inlet).Temp = 30; - thisCoolingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisCoolingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); // expect it to meet setpoint and have some pre-evaluated conditions EXPECT_NEAR(specifiedLoadSetpoint, thisCoolingPLHP->loadSideOutletTemp, 0.001); EXPECT_NEAR(-curLoad, thisCoolingPLHP->loadSideHeatTransfer, 0.001); @@ -1591,7 +1592,7 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_WaterSource) DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint; DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).Temp = calculatedLoadInletTemp; DataLoopNode::Node(thisCoolingPLHP->sourceSideNodes.inlet).Temp = 30; - thisCoolingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisCoolingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); // expect it to miss setpoint and be at max capacity EXPECT_NEAR(15.597, thisCoolingPLHP->loadSideOutletTemp, 0.001); EXPECT_NEAR(availableCapacity, thisCoolingPLHP->loadSideHeatTransfer, 0.001); @@ -1650,7 +1651,7 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_WaterSource) PlantLocation myLoadLocation = PlantLocation(1, 2, 1, 1); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -1665,9 +1666,9 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_WaterSource) PLHPPlantLoadSourceComp.NodeNumIn = thisHeatingPLHP->sourceSideNodes.inlet; // call for all initialization - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataPlant::PlantFirstSizesOkayToFinalize = true; - thisHeatingPLHP->onInitLoopEquip(state, myLoadLocation); + thisHeatingPLHP->onInitLoopEquip(*state, myLoadLocation); // call it from the load side, but this time there is a negative (cooling) load - shouldn't try to run { @@ -1679,7 +1680,7 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_WaterSource) DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint; DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.inlet).Temp = loadInletTemp; DataLoopNode::Node(thisHeatingPLHP->sourceSideNodes.inlet).Temp = 30; - thisHeatingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisHeatingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); // expect it to meet setpoint and have some pre-evaluated conditions EXPECT_NEAR(loadInletTemp, thisHeatingPLHP->loadSideOutletTemp, 0.001); EXPECT_NEAR(0.0, thisHeatingPLHP->loadSideHeatTransfer, 0.001); @@ -1697,7 +1698,7 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_WaterSource) DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint; DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.inlet).Temp = calculatedLoadInletTemp; DataLoopNode::Node(thisHeatingPLHP->sourceSideNodes.inlet).Temp = 30; - thisHeatingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisHeatingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); // expect it to meet setpoint and have some pre-evaluated conditions EXPECT_NEAR(specifiedLoadSetpoint, thisHeatingPLHP->loadSideOutletTemp, 0.001); EXPECT_NEAR(curLoad, thisHeatingPLHP->loadSideHeatTransfer, 0.001); @@ -1716,7 +1717,7 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_WaterSource) DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint; DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.inlet).Temp = calculatedLoadInletTemp; DataLoopNode::Node(thisHeatingPLHP->sourceSideNodes.inlet).Temp = 30; - thisHeatingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisHeatingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); // expect it to miss setpoint and be at max capacity EXPECT_NEAR(44.402, thisHeatingPLHP->loadSideOutletTemp, 0.001); EXPECT_NEAR(availableCapacity, thisHeatingPLHP->loadSideHeatTransfer, 0.001); @@ -1742,7 +1743,7 @@ TEST_F(EnergyPlusFixture, TestConcurrentOperationChecking) coil4->running = true; // check to warn about concurrent operation - EIRPlantLoopHeatPump::checkConcurrentOperation(state); + EIRPlantLoopHeatPump::checkConcurrentOperation(*state); // that will just add a recurring warning to the end, so to check whether // a warning was actually made, I'll just check the warning index values @@ -1795,7 +1796,7 @@ TEST_F(EnergyPlusFixture, ConstructionFullObjectsHeatingAndCooling_AirSource) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(2u, heatPumps.size()); @@ -1821,10 +1822,10 @@ TEST_F(EnergyPlusFixture, ConstructionFullObjectsHeatingAndCooling_AirSource) EXPECT_EQ(1, thisCoolingPLHP->powerRatioFuncPLRCurveIndex); // calling the factory with an invalid name or type will call ShowFatalError, which will trigger a runtime exception - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "fake"), std::runtime_error); - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP HEATING SIDE"), std::runtime_error); - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "fake"), std::runtime_error); - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP COOLING SIDE"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "fake"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP HEATING SIDE"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "fake"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP COOLING SIDE"), std::runtime_error); } TEST_F(EnergyPlusFixture, CoolingSimulate_AirSource) @@ -1871,7 +1872,7 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_AirSource) PlantLocation myLoadLocation = PlantLocation(1, 2, 1, 1); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -1884,9 +1885,9 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_AirSource) PLHPPlantLoadSideComp.NodeNumIn = thisCoolingPLHP->loadSideNodes.inlet; // call for all initialization - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataPlant::PlantFirstSizesOkayToFinalize = true; - thisCoolingPLHP->onInitLoopEquip(state, myLoadLocation); + thisCoolingPLHP->onInitLoopEquip(*state, myLoadLocation); // call from load side location, firsthvac, no load, not running, verify the unit doesn't have any values lingering thisCoolingPLHP->loadSideHeatTransfer = 1000; @@ -1899,7 +1900,7 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_AirSource) bool firstHVAC = true; Real64 curLoad = 0.0; bool runFlag = false; - thisCoolingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisCoolingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); EXPECT_NEAR(0.0, thisCoolingPLHP->loadSideHeatTransfer, 0.001); EXPECT_NEAR(0.0, thisCoolingPLHP->sourceSideHeatTransfer, 0.001); EXPECT_NEAR(0.0, thisCoolingPLHP->powerUsage, 0.001); @@ -1918,7 +1919,7 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_AirSource) DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint; DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).Temp = calculatedLoadInletTemp; DataLoopNode::Node(thisCoolingPLHP->sourceSideNodes.inlet).Temp = 30; - thisCoolingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisCoolingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); // expect it to meet setpoint and have some pre-evaluated conditions EXPECT_NEAR(specifiedLoadSetpoint, thisCoolingPLHP->loadSideOutletTemp, 0.001); EXPECT_NEAR(-curLoad, thisCoolingPLHP->loadSideHeatTransfer, 0.001); @@ -1937,7 +1938,7 @@ TEST_F(EnergyPlusFixture, CoolingSimulate_AirSource) DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint; DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).Temp = calculatedLoadInletTemp; DataLoopNode::Node(thisCoolingPLHP->sourceSideNodes.inlet).Temp = 30; - thisCoolingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisCoolingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); // expect it to miss setpoint and be at max capacity EXPECT_NEAR(15.597, thisCoolingPLHP->loadSideOutletTemp, 0.001); EXPECT_NEAR(availableCapacity, thisCoolingPLHP->loadSideHeatTransfer, 0.001); @@ -1988,7 +1989,7 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_AirSource) PlantLocation myLoadLocation = PlantLocation(1, 2, 1, 1); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -2001,9 +2002,9 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_AirSource) PLHPPlantLoadSideComp.NodeNumIn = thisHeatingPLHP->loadSideNodes.inlet; // call for all initialization - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataPlant::PlantFirstSizesOkayToFinalize = true; - thisHeatingPLHP->onInitLoopEquip(state, myLoadLocation); + thisHeatingPLHP->onInitLoopEquip(*state, myLoadLocation); // call it from the load side, but this time there is a negative (cooling) load - shouldn't try to run { @@ -2015,7 +2016,7 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_AirSource) DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint; DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.inlet).Temp = loadInletTemp; DataLoopNode::Node(thisHeatingPLHP->sourceSideNodes.inlet).Temp = 30; - thisHeatingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisHeatingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); // expect it to meet setpoint and have some pre-evaluated conditions EXPECT_NEAR(loadInletTemp, thisHeatingPLHP->loadSideOutletTemp, 0.001); EXPECT_NEAR(0.0, thisHeatingPLHP->loadSideHeatTransfer, 0.001); @@ -2033,7 +2034,7 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_AirSource) DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint; DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.inlet).Temp = calculatedLoadInletTemp; DataLoopNode::Node(thisHeatingPLHP->sourceSideNodes.inlet).Temp = 30; - thisHeatingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisHeatingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); // expect it to meet setpoint and have some pre-evaluated conditions EXPECT_NEAR(specifiedLoadSetpoint, thisHeatingPLHP->loadSideOutletTemp, 0.001); EXPECT_NEAR(curLoad, thisHeatingPLHP->loadSideHeatTransfer, 0.001); @@ -2052,7 +2053,7 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_AirSource) DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint; DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.inlet).Temp = calculatedLoadInletTemp; DataLoopNode::Node(thisHeatingPLHP->sourceSideNodes.inlet).Temp = 30; - thisHeatingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisHeatingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); // expect it to miss setpoint and be at max capacity EXPECT_NEAR(44.402, thisHeatingPLHP->loadSideOutletTemp, 0.001); EXPECT_NEAR(availableCapacity, thisHeatingPLHP->loadSideHeatTransfer, 0.001); @@ -2070,7 +2071,7 @@ TEST_F(EnergyPlusFixture, HeatingSimulate_AirSource) DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.outlet).TempSetPoint = specifiedLoadSetpoint; DataLoopNode::Node(thisHeatingPLHP->loadSideNodes.inlet).Temp = calculatedLoadInletTemp; DataLoopNode::Node(thisHeatingPLHP->sourceSideNodes.inlet).Temp = 30; - thisHeatingPLHP->simulate(state, myLoadLocation, firstHVAC, curLoad, runFlag); + thisHeatingPLHP->simulate(*state, myLoadLocation, firstHVAC, curLoad, runFlag); // expect it to miss setpoint and be at max capacity EXPECT_NEAR(45.0, thisHeatingPLHP->loadSideOutletTemp, 0.001); EXPECT_NEAR(30.0, thisHeatingPLHP->sourceSideOutletTemp, 0.001); @@ -2104,7 +2105,7 @@ TEST_F(EnergyPlusFixture, CoolingConstructionFullyAutoSized_AirSource) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -2121,8 +2122,8 @@ TEST_F(EnergyPlusFixture, CoolingConstructionFullyAutoSized_AirSource) EXPECT_EQ(1, thisCoolingPLHP->powerRatioFuncPLRCurveIndex); // calling the factory with an invalid name or type will call ShowFatalError, which will trigger a runtime exception - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "fake"), std::runtime_error); - EXPECT_THROW(EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP COOLING SIDE"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "fake"), std::runtime_error); + EXPECT_THROW(EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP COOLING SIDE"), std::runtime_error); } TEST_F(EnergyPlusFixture, ClearState) @@ -2152,7 +2153,7 @@ TEST_F(EnergyPlusFixture, ClearState) ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); EXPECT_EQ(heatPumps.size(), 1u); // test that vector is cleared @@ -2202,7 +2203,7 @@ TEST_F(EnergyPlusFixture, Initialization2_AirSource) PlantLocation myLocation = PlantLocation(1, 2, 1, 1); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -2215,20 +2216,20 @@ TEST_F(EnergyPlusFixture, Initialization2_AirSource) PLHPPlantLoadSideComp.NodeNumIn = thisCoolingPLHP->loadSideNodes.inlet; // call for all initialization - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataPlant::PlantFirstSizesOkayToFinalize = true; - thisCoolingPLHP->onInitLoopEquip(state, myLocation); + thisCoolingPLHP->onInitLoopEquip(*state, myLocation); // call with run flag off, loose limits on node min/max thisCoolingPLHP->running = false; - thisCoolingPLHP->setOperatingFlowRatesASHP(state); + thisCoolingPLHP->setOperatingFlowRatesASHP(*state); EXPECT_NEAR(0.0, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0.0, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); // call with run flag off, nonzero minimums DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRateMinAvail = 0.1; thisCoolingPLHP->running = false; - thisCoolingPLHP->setOperatingFlowRatesASHP(state); + thisCoolingPLHP->setOperatingFlowRatesASHP(*state); EXPECT_NEAR(0.1, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); @@ -2236,7 +2237,7 @@ TEST_F(EnergyPlusFixture, Initialization2_AirSource) DataPlant::PlantLoop(1).LoopSide(2).FlowLock = true; DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 0.24; thisCoolingPLHP->running = false; - thisCoolingPLHP->setOperatingFlowRatesASHP(state); + thisCoolingPLHP->setOperatingFlowRatesASHP(*state); EXPECT_NEAR(0.24, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0.0, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); @@ -2244,7 +2245,7 @@ TEST_F(EnergyPlusFixture, Initialization2_AirSource) DataPlant::PlantLoop(1).LoopSide(2).FlowLock = true; DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 0.0; thisCoolingPLHP->running = true; - thisCoolingPLHP->setOperatingFlowRatesASHP(state); + thisCoolingPLHP->setOperatingFlowRatesASHP(*state); EXPECT_NEAR(0.0, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); @@ -2252,7 +2253,7 @@ TEST_F(EnergyPlusFixture, Initialization2_AirSource) DataPlant::PlantLoop(1).LoopSide(2).FlowLock = true; DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 0.2; thisCoolingPLHP->running = true; - thisCoolingPLHP->setOperatingFlowRatesASHP(state); + thisCoolingPLHP->setOperatingFlowRatesASHP(*state); EXPECT_NEAR(0.2, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(1.29, thisCoolingPLHP->sourceSideMassFlowRate, 0.1); @@ -2260,7 +2261,7 @@ TEST_F(EnergyPlusFixture, Initialization2_AirSource) DataPlant::PlantLoop(1).LoopSide(2).FlowLock = true; DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 0.0; thisCoolingPLHP->running = true; - thisCoolingPLHP->setOperatingFlowRatesASHP(state); + thisCoolingPLHP->setOperatingFlowRatesASHP(*state); EXPECT_NEAR(0.0, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(0.0, thisCoolingPLHP->sourceSideMassFlowRate, 0.001); @@ -2268,7 +2269,7 @@ TEST_F(EnergyPlusFixture, Initialization2_AirSource) DataPlant::PlantLoop(1).LoopSide(2).FlowLock = true; DataLoopNode::Node(thisCoolingPLHP->loadSideNodes.inlet).MassFlowRate = 0.14; thisCoolingPLHP->running = true; - thisCoolingPLHP->setOperatingFlowRatesASHP(state); + thisCoolingPLHP->setOperatingFlowRatesASHP(*state); EXPECT_NEAR(0.14, thisCoolingPLHP->loadSideMassFlowRate, 0.001); EXPECT_NEAR(1.29, thisCoolingPLHP->sourceSideMassFlowRate, 0.1); } @@ -2316,7 +2317,7 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_AirSourc ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(2u, heatPumps.size()); @@ -2372,11 +2373,11 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_AirSourc PlantLocation myHeatingLoadLocation = PlantLocation(1, 2, 1, 2); // set a couple global flags - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; // initialize so the components can find themselves on the plant - thisCoolingPLHP->onInitLoopEquip(state, myCoolingLoadLocation); - thisHeatingPLHP->onInitLoopEquip(state, myHeatingLoadLocation); + thisCoolingPLHP->onInitLoopEquip(*state, myCoolingLoadLocation); + thisHeatingPLHP->onInitLoopEquip(*state, myHeatingLoadLocation); DataPlant::PlantFinalSizesOkayToReport = true; DataPlant::PlantFirstSizesOkayToReport = true; @@ -2393,8 +2394,8 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_AirSourc Real64 expectedCapacity = expectedLoadRho * expectedLoadFlow * expectedLoadCp * plantSizingLoadDeltaT; Real64 expectedSourceLoad = expectedCapacity * (1 + 1 / COP); Real64 expectedSourceFlow = expectedSourceLoad / (expectedSourceCp * expectedSourceRho * plantSizingSrcDeltaT); - thisCoolingPLHP->sizeLoadSide(state); - thisCoolingPLHP->sizeSrcSideASHP(state); + thisCoolingPLHP->sizeLoadSide(*state); + thisCoolingPLHP->sizeSrcSideASHP(*state); EXPECT_NEAR(expectedLoadFlow, thisCoolingPLHP->loadSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(expectedSourceFlow, thisCoolingPLHP->sourceSideDesignVolFlowRate, 0.1); EXPECT_NEAR(expectedCapacity, thisCoolingPLHP->referenceCapacity, 0.0001); @@ -2402,7 +2403,7 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_AirSourc // with a sizing run complete, we can also go ahead and get the design capacities... // they should be nonzero for the load side of things Real64 tmpMin = -1.0, tmpMax = -1.0, tmpOpt = -1.0; - thisCoolingPLHP->getDesignCapacities(state, myCoolingLoadLocation, tmpMax, tmpMin, tmpOpt); + thisCoolingPLHP->getDesignCapacities(*state, myCoolingLoadLocation, tmpMax, tmpMin, tmpOpt); EXPECT_NEAR(0.0, tmpMin, 0.001); EXPECT_NEAR(expectedCapacity, tmpMax, 0.001); EXPECT_NEAR(expectedCapacity, tmpOpt, 0.001); @@ -2415,8 +2416,8 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_AirSourc thisCoolingPLHP->sourceSideDesignVolFlowRate = DataSizing::AutoSize; thisCoolingPLHP->referenceCapacity = DataSizing::AutoSize; DataSizing::PlantSizData(1).DesVolFlowRate = 0.0; - thisCoolingPLHP->sizeLoadSide(state); - thisCoolingPLHP->sizeSrcSideASHP(state); + thisCoolingPLHP->sizeLoadSide(*state); + thisCoolingPLHP->sizeSrcSideASHP(*state); EXPECT_NEAR(0.0, thisCoolingPLHP->loadSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(0.0, thisCoolingPLHP->sourceSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(0.0, thisCoolingPLHP->referenceCapacity, 0.0001); @@ -2430,8 +2431,8 @@ TEST_F(EnergyPlusFixture, TestSizing_FullyAutosizedCoolingWithCompanion_AirSourc expectedCapacity = expectedLoadRho * expectedLoadFlow * expectedLoadCp * plantSizingLoadDeltaT; expectedSourceLoad = expectedCapacity * (1 + 1 / COP); expectedSourceFlow = expectedSourceLoad / (expectedSourceCp * expectedSourceRho * plantSizingSrcDeltaT); - thisHeatingPLHP->sizeLoadSide(state); - thisHeatingPLHP->sizeSrcSideASHP(state); + thisHeatingPLHP->sizeLoadSide(*state); + thisHeatingPLHP->sizeSrcSideASHP(*state); EXPECT_NEAR(expectedLoadFlow, thisHeatingPLHP->loadSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(expectedSourceFlow, thisHeatingPLHP->sourceSideDesignVolFlowRate, 0.1); EXPECT_NEAR(expectedCapacity, thisHeatingPLHP->referenceCapacity, 0.0001); @@ -2480,7 +2481,7 @@ TEST_F(EnergyPlusFixture, TestSizing_HardsizedFlowAutosizedCoolingWithCompanion_ ASSERT_TRUE(process_idf(idf_objects)); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(2u, heatPumps.size()); @@ -2532,11 +2533,11 @@ TEST_F(EnergyPlusFixture, TestSizing_HardsizedFlowAutosizedCoolingWithCompanion_ PlantLocation myHeatingLoadLocation = PlantLocation(1, 2, 1, 2); // set a couple global flags - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; // initialize so the components can find themselves on the plant - thisCoolingPLHP->onInitLoopEquip(state, myCoolingLoadLocation); - thisHeatingPLHP->onInitLoopEquip(state, myHeatingLoadLocation); + thisCoolingPLHP->onInitLoopEquip(*state, myCoolingLoadLocation); + thisHeatingPLHP->onInitLoopEquip(*state, myHeatingLoadLocation); DataPlant::PlantFinalSizesOkayToReport = true; DataPlant::PlantFirstSizesOkayToReport = true; @@ -2550,8 +2551,8 @@ TEST_F(EnergyPlusFixture, TestSizing_HardsizedFlowAutosizedCoolingWithCompanion_ Real64 expectedLoadFlow = plantSizingLoadVolFlow; Real64 expectedCapacity = expectedLoadRho * expectedLoadFlow * expectedLoadCp * plantSizingLoadDeltaT; Real64 expectedSourceFlow = 2.0; - thisCoolingPLHP->sizeLoadSide(state); - thisCoolingPLHP->sizeSrcSideASHP(state); + thisCoolingPLHP->sizeLoadSide(*state); + thisCoolingPLHP->sizeSrcSideASHP(*state); EXPECT_NEAR(expectedLoadFlow, thisCoolingPLHP->loadSideDesignVolFlowRate, 0.0001); EXPECT_NEAR(expectedSourceFlow, thisCoolingPLHP->sourceSideDesignVolFlowRate, 0.1); EXPECT_NEAR(expectedCapacity, thisCoolingPLHP->referenceCapacity, 0.0001); @@ -2559,7 +2560,7 @@ TEST_F(EnergyPlusFixture, TestSizing_HardsizedFlowAutosizedCoolingWithCompanion_ // with a sizing run complete, we can also go ahead and get the design capacities... // they should be nonzero for the load side of things Real64 tmpMin = -1.0, tmpMax = -1.0, tmpOpt = -1.0; - thisCoolingPLHP->getDesignCapacities(state, myCoolingLoadLocation, tmpMax, tmpMin, tmpOpt); + thisCoolingPLHP->getDesignCapacities(*state, myCoolingLoadLocation, tmpMax, tmpMin, tmpOpt); EXPECT_NEAR(0.0, tmpMin, 0.001); EXPECT_NEAR(expectedCapacity, tmpMax, 0.001); EXPECT_NEAR(expectedCapacity, tmpOpt, 0.001); @@ -2667,7 +2668,7 @@ TEST_F(EnergyPlusFixture, Test_DoPhysics) PLHPPlantLoadSourceComp.TypeOf_Num = DataPlant::TypeOf_HeatPumpEIRCooling; // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(2u, heatPumps.size()); @@ -2709,7 +2710,7 @@ TEST_F(EnergyPlusFixture, Test_DoPhysics) thisCoolingPLHP->sourceSideMassFlowRate = 0.8; thisCoolingPLHP->loadSideInletTemp = 20; thisCoolingPLHP->sourceSideInletTemp = 20; - thisCoolingPLHP->doPhysics(state, curLoad); + thisCoolingPLHP->doPhysics(*state, curLoad); EXPECT_NEAR(thisCoolingPLHP->loadSideOutletTemp, 12.00, 0.1); EXPECT_NEAR(thisCoolingPLHP->sourceSideOutletTemp, 47.66, 0.1); @@ -2767,7 +2768,7 @@ TEST_F(EnergyPlusFixture, CoolingMetering) PlantLocation myLoadLocation = PlantLocation(1, 2, 1, 1); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRCooling, "HP COOLING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -2782,9 +2783,9 @@ TEST_F(EnergyPlusFixture, CoolingMetering) PLHPPlantLoadSourceComp.NodeNumIn = thisCoolingPLHP->sourceSideNodes.inlet; // call for all initialization - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataPlant::PlantFirstSizesOkayToFinalize = true; - thisCoolingPLHP->onInitLoopEquip(state, myLoadLocation); + thisCoolingPLHP->onInitLoopEquip(*state, myLoadLocation); int NumFound; @@ -2804,7 +2805,7 @@ TEST_F(EnergyPlusFixture, CoolingMetering) ResourceTypes.insert(std::pair(varN, DataGlobalConstants::ResourceType::None)); } - GetMeteredVariables(state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); + GetMeteredVariables(*state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); EXPECT_EQ(2, NumFound); EXPECT_EQ(ResourceTypes.at(1), DataGlobalConstants::ResourceType::EnergyTransfer); // ENERGYTRANSFER @@ -2867,7 +2868,7 @@ TEST_F(EnergyPlusFixture, HeatingMetering) PlantLocation myLoadLocation = PlantLocation(1, 2, 1, 1); // call the factory with a valid name to trigger reading inputs - EIRPlantLoopHeatPump::factory(state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); + EIRPlantLoopHeatPump::factory(*state, DataPlant::TypeOf_HeatPumpEIRHeating, "HP HEATING SIDE"); // verify the size of the vector and the processed condition EXPECT_EQ(1u, heatPumps.size()); @@ -2882,9 +2883,9 @@ TEST_F(EnergyPlusFixture, HeatingMetering) PLHPPlantLoadSourceComp.NodeNumIn = thisHeatingPLHP->sourceSideNodes.inlet; // call for all initialization - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataPlant::PlantFirstSizesOkayToFinalize = true; - thisHeatingPLHP->onInitLoopEquip(state, myLoadLocation); + thisHeatingPLHP->onInitLoopEquip(*state, myLoadLocation); int NumFound; @@ -2904,7 +2905,7 @@ TEST_F(EnergyPlusFixture, HeatingMetering) ResourceTypes.insert(std::pair(varN, DataGlobalConstants::ResourceType::None)); } - GetMeteredVariables(state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); + GetMeteredVariables(*state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); EXPECT_EQ(2, NumFound); EXPECT_EQ(ResourceTypes.at(1), DataGlobalConstants::ResourceType::EnergyTransfer); // ENERGYTRANSFER diff --git a/tst/EnergyPlus/unit/PlantManager.unit.cc b/tst/EnergyPlus/unit/PlantManager.unit.cc index 0081884cdd6..c260341a669 100644 --- a/tst/EnergyPlus/unit/PlantManager.unit.cc +++ b/tst/EnergyPlus/unit/PlantManager.unit.cc @@ -63,6 +63,7 @@ #include #include #include +#include namespace EnergyPlus { namespace PlantManager { @@ -81,7 +82,7 @@ namespace PlantManager { PlantLoop(1).CirculationTime = 2; PlantLoop(1).FluidType = NodeType_Water; PlantLoop(1).FluidIndex = 1; - SizePlantLoop(state, 1, true); + SizePlantLoop(*state, 1, true); int TestVolume = 600; EXPECT_EQ(TestVolume, PlantLoop(1).Volume); } @@ -208,7 +209,7 @@ namespace PlantManager { // get input and checks if there are two setpointmanagers // for a TwoWayCommonPipe and one of them setpoints can be // a SetpointManager:OutdoorAirReset type. - GetPlantLoopData(state); + GetPlantLoopData(*state); ASSERT_FALSE(ErrorsFound); // there two setpoint amanegrs in the loop EXPECT_EQ(1, NumSchSetPtMgrs); // SetpointManager:Scheduled diff --git a/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc b/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc index 041c87e9a03..d009e347d78 100644 --- a/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc +++ b/tst/EnergyPlus/unit/PlantPipingSystemsManager.unit.cc @@ -62,6 +62,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace PlantPipingSystemsManager; @@ -129,11 +130,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_CorrectInputs) { bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_FALSE(errorsFound); } @@ -198,11 +199,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadOSCMName) { bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -267,11 +268,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadSlabLocation) { bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -336,11 +337,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadSlabMaterialName) bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -405,11 +406,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadHorizInsSelection) bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -474,11 +475,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadHorizInsMaterialNa bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -543,11 +544,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadHorizInsExtentsSel bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -612,11 +613,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_PerimeterInsulationWi bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -681,11 +682,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadVertInsSelection) bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -750,11 +751,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadVertInsMaterialNam bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -819,11 +820,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlab_CheckInputs_BadVertInsDepth) { bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -888,11 +889,11 @@ TEST_F(EnergyPlusFixture, DISABLED_SiteGroundDomainSlab_CheckInputs_BadTimeStepS bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadZoneCoupledDomainInputs(state, 1, 1, errorsFound); + ReadZoneCoupledDomainInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -957,11 +958,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_CorrectInputs) { bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadBasementInputs(state, 1, 1, errorsFound); + ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_FALSE(errorsFound); } @@ -1026,11 +1027,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadOSCMName) { bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadBasementInputs(state, 1, 1, errorsFound); + ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -1095,11 +1096,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadHorizInsSelect bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadBasementInputs(state, 1, 1, errorsFound); + ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -1164,11 +1165,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadHorizInsMateri bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadBasementInputs(state, 1, 1, errorsFound); + ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -1233,11 +1234,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadHorizInsExtent bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadBasementInputs(state, 1, 1, errorsFound); + ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -1302,11 +1303,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadBasementDepth) bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadBasementInputs(state, 1, 1, errorsFound); + ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -1371,11 +1372,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadFloorOSCMName) bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadBasementInputs(state, 1, 1, errorsFound); + ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -1440,11 +1441,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadVertInsSelecti bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadBasementInputs(state, 1, 1, errorsFound); + ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -1509,11 +1510,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadVertInsName) { bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadBasementInputs(state, 1, 1, errorsFound); + ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -1578,11 +1579,11 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainBasement_CheckInputs_BadTimestepSelect bool errorsFound = false; // Other necessary inputs - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); PlantPipingSystemsManager::domains.resize(1); - ReadBasementInputs(state, 1, 1, errorsFound); + ReadBasementInputs(*state, 1, 1, errorsFound); EXPECT_TRUE(errorsFound); } @@ -1722,16 +1723,16 @@ TEST_F(EnergyPlusFixture, PipingSystemFullSimulation) { Surface.allocate(1); Surface(1).OSCMPtr = 1; Surface(1).Area = 100; - HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(state); + HeatBalanceSurfaceManager::AllocateSurfaceHeatBalArrays(*state); // Other necessary inputs bool errorsFound = false; - GetOSCMData(state, errorsFound); - GetMaterialData(state, errorsFound); + GetOSCMData(*state, errorsFound); + GetMaterialData(*state, errorsFound); // first call the factory, it will call GetInput bool initLoopEquip = true; - PlantComponent *thisCircuit = PlantPipingSystemsManager::Circuit::factory(state, DataPlant::TypeOf_PipingSystemPipeCircuit, + PlantComponent *thisCircuit = PlantPipingSystemsManager::Circuit::factory(*state, DataPlant::TypeOf_PipingSystemPipeCircuit, "MY PIPE CIRCUIT"); EXPECT_EQ(2u, PlantPipingSystemsManager::domains.size()); @@ -1750,12 +1751,12 @@ TEST_F(EnergyPlusFixture, PipingSystemFullSimulation) { initLoopEquip = false; EnergyPlus::PlantLocation myLocation = EnergyPlus::PlantLocation(1, 2, 1, 1); Real64 curLoad = 0.0; - thisCircuit->simulate(state, myLocation, true, curLoad, true); + thisCircuit->simulate(*state, myLocation, true, curLoad, true); // we can also try to call from the Domain side - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; - PlantPipingSystemsManager::SimulateGroundDomains(state, false); + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; + PlantPipingSystemsManager::SimulateGroundDomains(*state, false); } /* @@ -1875,7 +1876,7 @@ TEST_F(EnergyPlusFixture, PipingSystem_Check_Correct_Pipe_Diameters) { ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - PlantPipingSystemsManager::ReadPipeCircuitInputs(state, ErrorsFound); + PlantPipingSystemsManager::ReadPipeCircuitInputs(*state, ErrorsFound); EXPECT_TRUE(ErrorsFound); std::string error_string = delimited_string({ @@ -1900,7 +1901,7 @@ TEST_F(EnergyPlusFixture, PipingSystem_SiteGroundDomainUsingNoMassMatTest) { dataMaterial.Material(MaterialIndex).ROnly = false; Thickness = 0.01; ExpectedResult = false; - TestResult = SiteGroundDomainUsingNoMassMat(state, Thickness, MaterialIndex); + TestResult = SiteGroundDomainUsingNoMassMat(*state, Thickness, MaterialIndex); EXPECT_EQ(TestResult, ExpectedResult); @@ -1910,7 +1911,7 @@ TEST_F(EnergyPlusFixture, PipingSystem_SiteGroundDomainUsingNoMassMatTest) { dataMaterial.Material(MaterialIndex).ROnly = true; Thickness = 0.01; ExpectedResult = true; - TestResult = SiteGroundDomainUsingNoMassMat(state, Thickness, MaterialIndex); + TestResult = SiteGroundDomainUsingNoMassMat(*state, Thickness, MaterialIndex); EXPECT_EQ(TestResult, ExpectedResult); @@ -1920,7 +1921,7 @@ TEST_F(EnergyPlusFixture, PipingSystem_SiteGroundDomainUsingNoMassMatTest) { dataMaterial.Material(MaterialIndex).ROnly = false; Thickness = 0.0; ExpectedResult = true; - TestResult = SiteGroundDomainUsingNoMassMat(state, Thickness, MaterialIndex); + TestResult = SiteGroundDomainUsingNoMassMat(*state, Thickness, MaterialIndex); EXPECT_EQ(TestResult, ExpectedResult); @@ -1929,7 +1930,7 @@ TEST_F(EnergyPlusFixture, PipingSystem_SiteGroundDomainUsingNoMassMatTest) { dataMaterial.Material(MaterialIndex).ROnly = true; Thickness = 0.0; ExpectedResult = true; - TestResult = SiteGroundDomainUsingNoMassMat(state, Thickness, MaterialIndex); + TestResult = SiteGroundDomainUsingNoMassMat(*state, Thickness, MaterialIndex); EXPECT_EQ(TestResult, ExpectedResult); diff --git a/tst/EnergyPlus/unit/PlantUtilities.unit.cc b/tst/EnergyPlus/unit/PlantUtilities.unit.cc index 95c8c65fa4f..6b945da5355 100644 --- a/tst/EnergyPlus/unit/PlantUtilities.unit.cc +++ b/tst/EnergyPlus/unit/PlantUtilities.unit.cc @@ -58,6 +58,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::PlantUtilities; @@ -457,7 +458,7 @@ TEST_F(EnergyPlusFixture, TestScanPlantLoopsErrorFlagReturnType) { bool errorFlag = false; // test simple searching first - PlantUtilities::ScanPlantLoopsForObject(state, "comp_name", DataPlant::TypeOf_Boiler_Simple, loopNum, loopSideNum, branchNum, compNum, errorFlag); + PlantUtilities::ScanPlantLoopsForObject(*state, "comp_name", DataPlant::TypeOf_Boiler_Simple, loopNum, loopSideNum, branchNum, compNum, errorFlag); EXPECT_EQ(1, loopNum); EXPECT_EQ(1, loopSideNum); EXPECT_EQ(1, branchNum); @@ -465,7 +466,7 @@ TEST_F(EnergyPlusFixture, TestScanPlantLoopsErrorFlagReturnType) { EXPECT_FALSE(errorFlag); // then test to make sure errorFlag is passed by reference - PlantUtilities::ScanPlantLoopsForObject(state, "comp_name_not_here", DataPlant::TypeOf_Boiler_Simple, loopNum, loopSideNum, branchNum, compNum, errorFlag); + PlantUtilities::ScanPlantLoopsForObject(*state, "comp_name_not_here", DataPlant::TypeOf_Boiler_Simple, loopNum, loopSideNum, branchNum, compNum, errorFlag); EXPECT_TRUE(errorFlag); } diff --git a/tst/EnergyPlus/unit/PluginManager.unit.cc b/tst/EnergyPlus/unit/PluginManager.unit.cc index 95cd9279a57..f581dfebdb6 100644 --- a/tst/EnergyPlus/unit/PluginManager.unit.cc +++ b/tst/EnergyPlus/unit/PluginManager.unit.cc @@ -50,6 +50,7 @@ #include "Fixtures/EnergyPlusFixture.hh" #include +#include namespace EnergyPlus { @@ -59,16 +60,16 @@ TEST_F(EnergyPlusFixture, TestTrendVariable) // this file isn't included in the gtest source unless LINK_WITH_PYTHON is ON // create a plugin manager instance - EnergyPlus::PluginManagement::PluginManager pluginManager = EnergyPlus::PluginManagement::PluginManager(state); + EnergyPlus::PluginManagement::PluginManager pluginManager = EnergyPlus::PluginManagement::PluginManager(*state); // first create a plugin variable pluginManager.addGlobalVariable("my_var"); - int globalVarIndex = EnergyPlus::PluginManagement::PluginManager::getGlobalVariableHandle(state, "my_var", true); + int globalVarIndex = EnergyPlus::PluginManagement::PluginManager::getGlobalVariableHandle(*state, "my_var", true); EXPECT_EQ(0, globalVarIndex); // now create a trend variable to track it size_t const numValues = 4; - PluginManagement::trends.emplace_back(state, "TREND_VAR", numValues, globalVarIndex); + PluginManagement::trends.emplace_back(*state, "TREND_VAR", numValues, globalVarIndex); int trendVarIndex = EnergyPlus::PluginManagement::PluginManager::getTrendVariableHandle("trend_var"); EXPECT_EQ(0, trendVarIndex); @@ -81,8 +82,8 @@ TEST_F(EnergyPlusFixture, TestTrendVariable) // now pretend to run through a few simulation time steps, setting the value a few times and updating the trend std::vector fakeValues = {3.14, 2.78, 12.0}; for (int i = 0; i < 3; i++) { - EnergyPlus::PluginManagement::PluginManager::setGlobalVariableValue(state, globalVarIndex, fakeValues[i]); - EnergyPlus::PluginManagement::PluginManager::updatePluginValues(state); + EnergyPlus::PluginManagement::PluginManager::setGlobalVariableValue(*state, globalVarIndex, fakeValues[i]); + EnergyPlus::PluginManagement::PluginManager::updatePluginValues(*state); } // now check the values at the end, it should still be zero at the oldest (fourth) item, and 12.0 at the recent diff --git a/tst/EnergyPlus/unit/PoweredInductionUnits.unit.cc b/tst/EnergyPlus/unit/PoweredInductionUnits.unit.cc index 131e884c00e..8cd66e3c107 100644 --- a/tst/EnergyPlus/unit/PoweredInductionUnits.unit.cc +++ b/tst/EnergyPlus/unit/PoweredInductionUnits.unit.cc @@ -75,6 +75,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace SimulationManager; @@ -162,29 +163,29 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) ASSERT_TRUE(process_idf(idf_objects)); - 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 + 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 ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(state); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); + ScheduleManager::UpdateScheduleValues(*state); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - Fans::GetFanInput(state); - state.dataFans->GetFanInputFlag = false; - PoweredInductionUnits::GetPIUs(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + Fans::GetFanInput(*state); + state->dataFans->GetFanInputFlag = false; + PoweredInductionUnits::GetPIUs(*state); EXPECT_TRUE(compare_err_stream("")); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; @@ -210,11 +211,11 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) bool FirstHVACIteration = true; Real64 SecMaxMassFlow = 0.05 * DataEnvironment::StdRhoAir; // From inputs - state.dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru InitPIU for this terminal unit + state->dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru InitPIU for this terminal unit FirstHVACIteration = true; - PoweredInductionUnits::InitPIU(state, SysNum, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true - Fans::InitFan(state, 1, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + PoweredInductionUnits::InitPIU(*state, SysNum, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true + Fans::InitFan(*state, 1, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; // Note that the fan schedule is always off, so the PIU fan should only run if the night cycle turn on flag is true @@ -225,7 +226,7 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = false; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcParallelPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcParallelPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(0.0, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -235,7 +236,7 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = false; DataHVACGlobals::TurnZoneFansOnlyOn = true; - PoweredInductionUnits::CalcParallelPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcParallelPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(SecMaxMassFlow, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -245,7 +246,7 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = false; DataHVACGlobals::TurnZoneFansOnlyOn = true; - PoweredInductionUnits::CalcParallelPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcParallelPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(0.0, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -255,7 +256,7 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = true; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcParallelPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcParallelPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(0.0, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -265,7 +266,7 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = true; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcParallelPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcParallelPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(SecMaxMassFlow, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -277,7 +278,7 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = true; DataHVACGlobals::TurnFansOn = true; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcParallelPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcParallelPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(SecMaxMassFlow, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.2, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -289,7 +290,7 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = true; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcParallelPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcParallelPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(SecMaxMassFlow, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.2, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -301,7 +302,7 @@ TEST_F(EnergyPlusFixture, ParallelPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = true; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcParallelPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcParallelPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(SecMaxMassFlow, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(1.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -391,29 +392,29 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) ASSERT_TRUE(process_idf(idf_objects)); - 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 + 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 ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(state); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); + ScheduleManager::UpdateScheduleValues(*state); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - Fans::GetFanInput(state); - state.dataFans->GetFanInputFlag = false; - PoweredInductionUnits::GetPIUs(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + Fans::GetFanInput(*state); + state->dataFans->GetFanInputFlag = false; + PoweredInductionUnits::GetPIUs(*state); EXPECT_TRUE(compare_err_stream("")); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; @@ -438,11 +439,11 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) int PriNodeNum = PoweredInductionUnits::PIU(SysNum).PriAirInNode; bool FirstHVACIteration = true; - state.dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru InitPIU for this terminal unit + state->dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru InitPIU for this terminal unit FirstHVACIteration = true; - PoweredInductionUnits::InitPIU(state, SysNum, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true - Fans::InitFan(state, 1, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + PoweredInductionUnits::InitPIU(*state, SysNum, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true + Fans::InitFan(*state, 1, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; // From inputs @@ -460,7 +461,7 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = false; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcSeriesPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcSeriesPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(0.0, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -470,7 +471,7 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = false; DataHVACGlobals::TurnZoneFansOnlyOn = true; - PoweredInductionUnits::CalcSeriesPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcSeriesPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(SecMaxMassFlow, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -480,7 +481,7 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = false; DataHVACGlobals::TurnZoneFansOnlyOn = true; - PoweredInductionUnits::CalcSeriesPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcSeriesPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(0.0, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -490,7 +491,7 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = true; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcSeriesPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcSeriesPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(0.0, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -500,7 +501,7 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = true; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcSeriesPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcSeriesPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(SecMaxMassFlow, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -512,7 +513,7 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = true; DataHVACGlobals::TurnFansOn = true; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcSeriesPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcSeriesPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(SecMassFlowAtPrimMin, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(1.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -524,7 +525,7 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = true; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcSeriesPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcSeriesPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(SecMassFlowAtPrimMin, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(1.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -535,7 +536,7 @@ TEST_F(EnergyPlusFixture, SeriesPIUTest1) DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; DataHVACGlobals::TurnFansOn = true; DataHVACGlobals::TurnZoneFansOnlyOn = false; - PoweredInductionUnits::CalcSeriesPIU(state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::CalcSeriesPIU(*state, SysNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); EXPECT_EQ(SecMassFlowAtPrimMax, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(1.0, PoweredInductionUnits::PIU(SysNum).PriDamperPosition); @@ -591,7 +592,7 @@ TEST_F(EnergyPlusFixture, PIUArrayOutOfBounds) { DataSizing::TermUnitFinalZoneSizing(CurTermUnitSizingNum) = FinalZoneSizing(CurZoneEqNum); // Call the sizing routine now - PoweredInductionUnits::SizePIU(state, PIUNum); + PoweredInductionUnits::SizePIU(*state, PIUNum); EXPECT_TRUE(compare_err_stream("")); @@ -672,29 +673,29 @@ TEST_F(EnergyPlusFixture, SeriesPIUZoneOAVolumeFlowRateTest) ASSERT_TRUE(process_idf(idf_objects)); - 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 + 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 ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(state); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); + ScheduleManager::UpdateScheduleValues(*state); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - Fans::GetFanInput(state); - state.dataFans->GetFanInputFlag = false; - PoweredInductionUnits::GetPIUs(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + Fans::GetFanInput(*state); + state->dataFans->GetFanInputFlag = false; + PoweredInductionUnits::GetPIUs(*state); EXPECT_TRUE(compare_err_stream("")); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; @@ -712,11 +713,11 @@ TEST_F(EnergyPlusFixture, SeriesPIUZoneOAVolumeFlowRateTest) int PriNodeNum = thisSeriesAT.PriAirInNode; bool FirstHVACIteration = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; FirstHVACIteration = true; - PoweredInductionUnits::InitPIU(state, PIUNum, FirstHVACIteration); - Fans::InitFan(state, 1, FirstHVACIteration); - state.dataGlobal->BeginEnvrnFlag = false; + PoweredInductionUnits::InitPIU(*state, PIUNum, FirstHVACIteration); + Fans::InitFan(*state, 1, FirstHVACIteration); + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; DataHVACGlobals::TurnFansOn = true; DataHVACGlobals::TurnZoneFansOnlyOn = false; @@ -731,8 +732,8 @@ TEST_F(EnergyPlusFixture, SeriesPIUZoneOAVolumeFlowRateTest) // Needs an airloop, assume 20% outdoor air Real64 const AirLoopOAFraction = 0.20; thisSeriesAT.AirLoopNum = 1; - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirLoop->AirLoopFlow(thisSeriesAT.AirLoopNum).OAFrac = AirLoopOAFraction; + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow(thisSeriesAT.AirLoopNum).OAFrac = AirLoopOAFraction; DataZoneEquipment::ZoneEquipConfig(thisSeriesAT.CtrlZoneNum).InletNodeAirLoopNum(thisSeriesAT.ctrlZoneInNodeIndex) = 1; // set heating zone and AT unit inlet conditions @@ -749,8 +750,8 @@ TEST_F(EnergyPlusFixture, SeriesPIUZoneOAVolumeFlowRateTest) // test 1: Heating load, at 0.0 primary air flow rate DataLoopNode::Node(PriNodeNum).MassFlowRate = 0.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputRequired = 2000.0; - PoweredInductionUnits::CalcSeriesPIU(state, PIUNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); - PoweredInductionUnits::ReportPIU(state, PIUNum); + PoweredInductionUnits::CalcSeriesPIU(*state, PIUNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::ReportPIU(*state, PIUNum); Real64 expect_OutdoorAirFlowRate = (0.0 / DataEnvironment::StdRhoAir) * AirLoopOAFraction; EXPECT_EQ(SecMaxMassFlow, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(0.0, DataLoopNode::Node(PriNodeNum).MassFlowRate); @@ -761,8 +762,8 @@ TEST_F(EnergyPlusFixture, SeriesPIUZoneOAVolumeFlowRateTest) DataLoopNode::Node(PriNodeNum).MassFlowRateMaxAvail = PriMinMassFlow; DataLoopNode::Node(PriNodeNum).MassFlowRateMinAvail = PriMinMassFlow; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputRequired = 2000.0; - PoweredInductionUnits::CalcSeriesPIU(state, PIUNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); - PoweredInductionUnits::ReportPIU(state, PIUNum); + PoweredInductionUnits::CalcSeriesPIU(*state, PIUNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::ReportPIU(*state, PIUNum); expect_OutdoorAirFlowRate = (PriMinMassFlow / DataEnvironment::StdRhoAir) * AirLoopOAFraction; EXPECT_EQ(SecMassFlowAtPrimMin, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(PriMinMassFlow, DataLoopNode::Node(PriNodeNum).MassFlowRate); @@ -783,8 +784,8 @@ TEST_F(EnergyPlusFixture, SeriesPIUZoneOAVolumeFlowRateTest) DataLoopNode::Node(PriNodeNum).MassFlowRate = PriMaxMassFlow; DataLoopNode::Node(PriNodeNum).MassFlowRateMaxAvail = PriMaxMassFlow; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputRequired = -3000.0; - PoweredInductionUnits::CalcSeriesPIU(state, PIUNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); - PoweredInductionUnits::ReportPIU(state, PIUNum); + PoweredInductionUnits::CalcSeriesPIU(*state, PIUNum, ZoneNum, ZoneNodeNum, FirstHVACIteration); + PoweredInductionUnits::ReportPIU(*state, PIUNum); expect_OutdoorAirFlowRate = (PriMaxMassFlow / DataEnvironment::StdRhoAir) * AirLoopOAFraction; EXPECT_EQ(SecMassFlowAtPrimMax, DataLoopNode::Node(SecNodeNum).MassFlowRate); EXPECT_EQ(PriMaxMassFlow, DataLoopNode::Node(PriNodeNum).MassFlowRate); diff --git a/tst/EnergyPlus/unit/Psychrometrics.unit.cc b/tst/EnergyPlus/unit/Psychrometrics.unit.cc index fe764d61bbe..30d2c8c5943 100644 --- a/tst/EnergyPlus/unit/Psychrometrics.unit.cc +++ b/tst/EnergyPlus/unit/Psychrometrics.unit.cc @@ -52,6 +52,8 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include + using namespace EnergyPlus; using namespace EnergyPlus::Psychrometrics; @@ -63,78 +65,78 @@ TEST_F(EnergyPlusFixture, Psychrometrics_PsyTsatFnHPb_Test) // Test 1: TEMP. IS FROM 20 C TO 40 C Real64 H = 7.5223e4 - 1.78637e4; Real64 PB = 1.01325e5; - Real64 result = PsyTsatFnHPb_raw(state, H, PB); + Real64 result = PsyTsatFnHPb_raw(*state, H, PB); Real64 actual_result = 20.0; EXPECT_NEAR(actual_result, result, 0.001); // Test 2: Cache version of the function - first call - Real64 cache_miss_result = PsyTsatFnHPb(state, H, PB); + Real64 cache_miss_result = PsyTsatFnHPb(*state, H, PB); EXPECT_NEAR(actual_result, cache_miss_result, 0.001); // Test 3: TEMP. IS FROM 0 C TO 20 C H = 2.7298e4 - 1.78637e4; - result = PsyTsatFnHPb_raw(state, H, PB); + result = PsyTsatFnHPb_raw(*state, H, PB); actual_result = 0.0; EXPECT_NEAR(actual_result, result, 0.001); // Test 4: TEMP. IS FROM -20 C TO 0 C H = -6.7011e2 - 1.78637e4; - result = PsyTsatFnHPb_raw(state, H, PB); + result = PsyTsatFnHPb_raw(*state, H, PB); actual_result = -20.0; EXPECT_NEAR(actual_result, result, 0.001); // Test 5: TEMP. IS FROM -40 C TO -20 C H = -2.21379e4 - 1.78637e4; - result = PsyTsatFnHPb_raw(state, H, PB); + result = PsyTsatFnHPb_raw(*state, H, PB); actual_result = -40.0; EXPECT_NEAR(actual_result, result, 0.001); // Test 6: TEMP. IS FROM -60 C TO -40 C H = -4.2399e4 - 1.78637e4; - result = PsyTsatFnHPb_raw(state, H, PB); + result = PsyTsatFnHPb_raw(*state, H, PB); actual_result = -60.0; EXPECT_NEAR(actual_result, result, 0.1); // Test 7: TEMP. IS < -60 C H = -5.2399e4 - 1.78637e4; - result = PsyTsatFnHPb_raw(state, H, PB); + result = PsyTsatFnHPb_raw(*state, H, PB); actual_result = -60.0; EXPECT_NEAR(actual_result, result, 0.1); // Test 8: TEMP. IS FROM 40 C TO 60 C H = 1.8379e5 - 1.78637e4; - result = PsyTsatFnHPb_raw(state, H, PB); + result = PsyTsatFnHPb_raw(*state, H, PB); actual_result = 40.0; EXPECT_NEAR(actual_result, result, 0.001); // Test 9: Label90 - TEMP. IS FROM 60 C TO 80 C H = 4.7577e5 - 1.78637e4; - result = PsyTsatFnHPb_raw(state, H, PB); + result = PsyTsatFnHPb_raw(*state, H, PB); actual_result = 60.0; EXPECT_NEAR(actual_result, result, 0.001); // Test 10: Label100 - TEMP. IS FROM 80 C TO 90 C H = 1.5445e6 - 1.78637e4; - result = PsyTsatFnHPb_raw(state, H, PB); + result = PsyTsatFnHPb_raw(*state, H, PB); actual_result = 80.0; EXPECT_NEAR(actual_result, result, 0.001); // Test 11: Label110 - TEMP. IS FROM 90 C TO 100 C H = 3.8353e6 - 1.78637e4; - result = PsyTsatFnHPb_raw(state, H, PB); + result = PsyTsatFnHPb_raw(*state, H, PB); actual_result = 90.0; EXPECT_NEAR(actual_result, result, 0.001); // Test 12: TEMP > 100 C H = 4.5866e7 - 1.78637e4; - result = PsyTsatFnHPb_raw(state, H, PB); + result = PsyTsatFnHPb_raw(*state, H, PB); actual_result = 100.0; EXPECT_NEAR(actual_result, result, 1); // Test 13: PB != 1.0133e5 H = 7.5223e4 - 1.78637e4; PB = 0.91325e5; - result = PsyTsatFnHPb_raw(state, H, PB); + result = PsyTsatFnHPb_raw(*state, H, PB); actual_result = 18.819; EXPECT_NEAR(actual_result, result, 0.001); @@ -142,7 +144,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_PsyTsatFnHPb_Test) H = 7.5223e4 - 1.78637e4; PB = 1.0133e5; actual_result = 20.0; - Real64 cache_hit_result = PsyTsatFnHPb(state, H, PB); + Real64 cache_hit_result = PsyTsatFnHPb(*state, H, PB); EXPECT_NEAR(actual_result, cache_hit_result, 0.001); } @@ -153,30 +155,30 @@ TEST_F(EnergyPlusFixture, Psychrometrics_PsyTsatFnPb_Test) // Test 1: general Real64 PB = 101325.0; - Real64 result = PsyTsatFnPb_raw(state, PB); + Real64 result = PsyTsatFnPb_raw(*state, PB); Real64 actual_result = 99.974; EXPECT_NEAR(actual_result, result, 0.001); // Test 2: Cache version of the function - first call PB = 101325.0; - Real64 cache_result = PsyTsatFnPb(state, PB); + Real64 cache_result = PsyTsatFnPb(*state, PB); EXPECT_NEAR(actual_result, cache_result, 0.001); // Test 3: upper bound PB = 1555000.0; - result = PsyTsatFnPb_raw(state, PB); + result = PsyTsatFnPb_raw(*state, PB); actual_result = 200.0; EXPECT_DOUBLE_EQ(actual_result, result); // Test 4: lower bound PB = 0.0017; - result = PsyTsatFnPb_raw(state, PB); + result = PsyTsatFnPb_raw(*state, PB); actual_result = -100.0; EXPECT_DOUBLE_EQ(actual_result, result); // Test 5: zero PB = 611.1; - result = PsyTsatFnPb_raw(state, PB); + result = PsyTsatFnPb_raw(*state, PB); actual_result = 0.0; EXPECT_DOUBLE_EQ(actual_result, result); @@ -195,7 +197,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_PsyWFnTdpPb_Test) Real64 W; TDP = 99.0; - W = Psychrometrics::PsyWFnTdpPb(state, TDP, PB); + W = Psychrometrics::PsyWFnTdpPb(*state, TDP, PB); EXPECT_NEAR(17.5250143, W, 0.0001); @@ -208,7 +210,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_PsyWFnTdpPb_Test) }); TDP = 100.0; - W = Psychrometrics::PsyWFnTdpPb(state, TDP, PB); + W = Psychrometrics::PsyWFnTdpPb(*state, TDP, PB); EXPECT_NEAR(17.5250143, W, 0.0001); EXPECT_TRUE(compare_err_stream(error_string, true)); @@ -222,7 +224,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_PsyWFnTdpPb_Test) " ** ~~~ ** Instead, calculated Humidity Ratio at 93.0 (7 degree less) = 20.0794 will be used. Simulation continues.", }); Psychrometrics::iPsyErrIndex(5) = 0; - W = Psychrometrics::PsyWFnTdpPb(state, TDP, PB); + W = Psychrometrics::PsyWFnTdpPb(*state, TDP, PB); EXPECT_NEAR(20.07942181, W, 0.0001); EXPECT_TRUE(compare_err_stream(error_string1, true)); } @@ -395,7 +397,7 @@ TEST_F(EnergyPlusFixture, Psychrometrics_PsyTwbFnTdbWPb_Test) Real64 TDB = 1; // C Real64 W = 0.002; // Kg.water/Kg.dryair Real64 Pb = 101325.0; - Real64 result = PsyTwbFnTdbWPb(state, TDB, W, Pb); + Real64 result = PsyTwbFnTdbWPb(*state, TDB, W, Pb); Real64 expected_result = -2.200; // expected result from psychrometrics chart EXPECT_NEAR(result, expected_result, 0.001); diff --git a/tst/EnergyPlus/unit/Pumps.unit.cc b/tst/EnergyPlus/unit/Pumps.unit.cc index d3a4e433864..6fc55a78da5 100644 --- a/tst/EnergyPlus/unit/Pumps.unit.cc +++ b/tst/EnergyPlus/unit/Pumps.unit.cc @@ -55,6 +55,7 @@ #include #include #include +#include namespace EnergyPlus { @@ -88,8 +89,8 @@ TEST_F(EnergyPlusFixture, HeaderedVariableSpeedPumpSizingPowerTest) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 162.5, 0.0001); EXPECT_EQ(Pumps::PumpEquip(1).EndUseSubcategoryName, "Pump Energy"); } @@ -123,8 +124,8 @@ TEST_F(EnergyPlusFixture, HeaderedVariableSpeedPumpSizingPower22W_per_gpm) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 348.7011, 0.0001); } @@ -157,8 +158,8 @@ TEST_F(EnergyPlusFixture, HeaderedVariableSpeedPumpSizingPowerDefault) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 255.4872, 0.0001); } @@ -187,8 +188,8 @@ TEST_F(EnergyPlusFixture, HeaderedConstantSpeedPumpSizingPowerTest) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 162.5, 0.0001); EXPECT_EQ(Pumps::PumpEquip(1).EndUseSubcategoryName, "Pump Energy"); } @@ -217,8 +218,8 @@ TEST_F(EnergyPlusFixture, HeaderedConstantSpeedPumpSizingPower19W_per_gpm) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 301.1561, 0.0001); } @@ -246,8 +247,8 @@ TEST_F(EnergyPlusFixture, HeaderedConstantSpeedPumpSizingPowerDefault) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 255.4872, 0.0001); } @@ -289,9 +290,9 @@ TEST_F(EnergyPlusFixture, VariableSpeedPumpSizingMinVolFlowRate) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); + Pumps::GetPumpInput(*state); EXPECT_NEAR(Pumps::PumpEquip(1).MinVolFlowRate, DataSizing::AutoSize, 0.000001); - Pumps::SizePump(state, 1); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).MinVolFlowRate, 0.0003, 0.00001); EXPECT_EQ(Pumps::PumpEquip(1).EndUseSubcategoryName, "Pump Energy"); } @@ -333,8 +334,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedPumpSizingPowerPerPressureTest) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 162.5, 0.0001); } @@ -374,8 +375,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedPumpSizingPowerDefault) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 255.4872, 0.0001); } @@ -414,8 +415,8 @@ TEST_F(EnergyPlusFixture, VariableSpeedPumpSizingPower22W_per_GPM) "0.0; !- Design Minimum Flow Rate Sizing Factor", }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 348.7011, 0.0001); } @@ -445,8 +446,8 @@ TEST_F(EnergyPlusFixture, ConstantSpeedPumpSizingPower19W_per_gpm) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 301.1561, 0.0001); EXPECT_EQ(Pumps::PumpEquip(1).EndUseSubcategoryName, "Pump Energy"); } @@ -477,8 +478,8 @@ TEST_F(EnergyPlusFixture, ConstantSpeedPumpSizingPowerPerPressureTest) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 162.5, 0.0001); } @@ -508,8 +509,8 @@ TEST_F(EnergyPlusFixture, ConstantSpeedPumpSizingPowerDefaults) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 255.4872, 0.0001); } @@ -540,8 +541,8 @@ TEST_F(EnergyPlusFixture, CondensatePumpSizingPowerDefaults) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 153.3, 0.1); EXPECT_EQ(Pumps::PumpEquip(1).EndUseSubcategoryName, "Pump Energy"); } @@ -572,8 +573,8 @@ TEST_F(EnergyPlusFixture, CondensatePumpSizingPower19W_per_gpm) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 180.7, 0.1); } @@ -603,8 +604,8 @@ TEST_F(EnergyPlusFixture, CondensatePumpSizingPowerTest) }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); - Pumps::SizePump(state, 1); + Pumps::GetPumpInput(*state); + Pumps::SizePump(*state, 1); EXPECT_NEAR(Pumps::PumpEquip(1).NomPowerUse, 97.5, 0.1); } @@ -645,7 +646,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedPump_MinFlowGreaterThanMax) " ; !- Design Minimum Flow Rate Fraction", }); ASSERT_TRUE(process_idf(idf_objects)); - Pumps::GetPumpInput(state); + Pumps::GetPumpInput(*state); std::string const error_string = delimited_string({ " ** Warning ** GetPumpInput: Pump:VariableSpeed=\"SUPPLY INLET PUMP\", Invalid 'Design Minimum Flow Rate'", diff --git a/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc b/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc index a9c0d4088ab..2aa083afcb0 100644 --- a/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc +++ b/tst/EnergyPlus/unit/PurchasedAirManager.unit.cc @@ -71,6 +71,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace ObjexxFCL; @@ -189,7 +190,7 @@ TEST_F(EnergyPlusFixture, SizePurchasedAirTest_Test1) PurchAir(PurchAirNum).cObjectName = "ZONEHVAC:IDEALLOADSAIRSYSTEM"; PurchAir(PurchAirNum).Name = "Ideal Loads 1"; - SizePurchasedAir(state, PurchAirNum); + SizePurchasedAir(*state, PurchAirNum); EXPECT_DOUBLE_EQ(1.0, PurchAir(PurchAirNum).MaxHeatVolFlowRate); EXPECT_NEAR(50985.58, PurchAir(PurchAirNum).MaxHeatSensCap, 0.1); EXPECT_DOUBLE_EQ(2.0, PurchAir(PurchAirNum).MaxCoolVolFlowRate); @@ -243,7 +244,7 @@ TEST_F(EnergyPlusFixture, SizePurchasedAirTest_Test2) PurchAir(PurchAirNum).cObjectName = "ZONEHVAC:IDEALLOADSAIRSYSTEM"; PurchAir(PurchAirNum).Name = "Ideal Loads 1"; - SizePurchasedAir(state, PurchAirNum); + SizePurchasedAir(*state, PurchAirNum); EXPECT_DOUBLE_EQ(1.0, PurchAir(PurchAirNum).MaxHeatVolFlowRate); EXPECT_NEAR(63731.97, PurchAir(PurchAirNum).MaxHeatSensCap, 0.1); // larger than test 1 above EXPECT_DOUBLE_EQ(2.0, PurchAir(PurchAirNum).MaxCoolVolFlowRate); @@ -285,9 +286,9 @@ TEST_F(EnergyPlusFixture, IdealLoadsAirSystem_GetInput) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->DoWeathSim = true; + state->dataGlobal->DoWeathSim = true; - GetPurchasedAir(state); + GetPurchasedAir(*state); EXPECT_EQ(PurchasedAirManager::PurchAir.size(), 1u); EXPECT_EQ(PurchAir(1).Name, "ZONE 1 IDEAL LOADS"); @@ -385,20 +386,20 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_PlenumTest) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - state.dataGlobal->DoWeathSim = true; + state->dataGlobal->DoWeathSim = true; bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); Zone(1).SurfaceFirst = 1; Zone(1).SurfaceLast = 1; ScheduleManager::Schedule.allocate(1); - AllocateHeatBalArrays(state); + AllocateHeatBalArrays(*state); EXPECT_FALSE(ErrorsFound); // expect no errors bool FirstHVACIteration(true); bool SimZone(true); bool SimAir(false); - ManageZoneEquipment(state, + ManageZoneEquipment(*state, FirstHVACIteration, SimZone, SimAir); // read zone equipment configuration and list objects and simulate ideal loads air system @@ -407,13 +408,13 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_PlenumTest) // Ideal loads air system found the plenum it is attached to EXPECT_EQ(PurchAir(1).ReturnPlenumIndex, 1); // The ideal loads air system inlet air node is equal to the zone return plenum outlet node - EXPECT_EQ(PurchAir(1).PlenumExhaustAirNodeNum, state.dataZonePlenum->ZoneRetPlenCond(1).OutletNode); + EXPECT_EQ(PurchAir(1).PlenumExhaustAirNodeNum, state->dataZonePlenum->ZoneRetPlenCond(1).OutletNode); // The ideal loads air system ZoneSupplyAirNodeNum is equal to the zone air inlet node EXPECT_EQ(PurchAir(1).ZoneSupplyAirNodeNum, ZoneEquipConfig(1).InletNode(1)); // The ideal loads air system ZoneExhaustAirNodeNum is equal to the zone exhaust air node num EXPECT_EQ(PurchAir(1).ZoneExhaustAirNodeNum, ZoneEquipConfig(1).ExhaustNode(1)); // The zone exhaust air node is equal to the zone return plenum inlet air node - EXPECT_EQ(ZoneEquipConfig(1).ExhaustNode(1), state.dataZonePlenum->ZoneRetPlenCond(1).InletNode(1)); + EXPECT_EQ(ZoneEquipConfig(1).ExhaustNode(1), state->dataZonePlenum->ZoneRetPlenCond(1).InletNode(1)); // The ideal loads air system has a non-zero mass flow rate EXPECT_GT(PurchAir(1).SupplyAirMassFlowRate, 0.0); // The ideal loads air system mass flow rate is equal to all nodes attached to this system @@ -495,20 +496,20 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_ExhaustNodeTest) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - state.dataGlobal->DoWeathSim = true; + state->dataGlobal->DoWeathSim = true; bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); Zone(1).SurfaceFirst = 1; Zone(1).SurfaceLast = 1; ScheduleManager::Schedule.allocate(1); - AllocateHeatBalArrays(state); + AllocateHeatBalArrays(*state); EXPECT_FALSE(ErrorsFound); // expect no errors bool FirstHVACIteration(true); bool SimZone(true); bool SimAir(false); - ManageZoneEquipment(state, + ManageZoneEquipment(*state, FirstHVACIteration, SimZone, SimAir); // read zone equipment configuration and list objects and simulate ideal loads air system @@ -625,14 +626,14 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_EMSOverrideTest) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - state.dataGlobal->DoWeathSim = true; + state->dataGlobal->DoWeathSim = true; bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); Zone(1).SurfaceFirst = 1; Zone(1).SurfaceLast = 1; ScheduleManager::Schedule.allocate(1); - AllocateHeatBalArrays(state); + AllocateHeatBalArrays(*state); EXPECT_FALSE(ErrorsFound); // expect no errors ZoneEquipConfig.allocate(1); @@ -644,16 +645,16 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_EMSOverrideTest) ZoneEquipConfig(1).ExhaustNode.allocate(1); ZoneEquipConfig(1).NumExhaustNodes = 1; ZoneEquipConfig(1).ExhaustNode(1) = 2; - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZone = 0.25; - EMSManager::CheckIfAnyEMS(state); // get EMS input - EMSManager::GetEMSInput(state); + EMSManager::CheckIfAnyEMS(*state); // get EMS input + EMSManager::GetEMSInput(*state); EMSManager::FinishProcessingUserInput = true; bool FirstHVACIteration(true); if (GetPurchAirInputFlag) { - GetPurchasedAir(state); + GetPurchasedAir(*state); GetPurchAirInputFlag = false; } @@ -662,11 +663,11 @@ TEST_F(ZoneIdealLoadsTest, IdealLoads_EMSOverrideTest) DataLoopNode::Node(2).Temp = 25.0; DataLoopNode::Node(2).HumRat = 0.001; - InitPurchasedAir(state, 1, FirstHVACIteration, 1, 1); + InitPurchasedAir(*state, 1, FirstHVACIteration, 1, 1); Real64 SysOutputProvided; Real64 MoistOutputProvided; - CalcPurchAirLoads(state, 1, SysOutputProvided, MoistOutputProvided, 1, 1); + CalcPurchAirLoads(*state, 1, SysOutputProvided, MoistOutputProvided, 1, 1); EXPECT_EQ(PurchAir(1).EMSValueMassFlowRate, 0.0); EXPECT_EQ(PurchAir(1).EMSValueSupplyTemp, 0.0); diff --git a/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc b/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc index e0281c2ffe7..5bc90a0e7eb 100644 --- a/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc +++ b/tst/EnergyPlus/unit/ReportCoilSelection.unit.cc @@ -69,6 +69,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace ObjexxFCL; @@ -103,7 +104,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ChWCoil) Real64 airVdot(0.052); // air flow rate in m3/s bool isAutoSized(false); // true if autosized - coilSelectionReportObj->setCoilAirFlow(state, coil1Name, coil1Type, airVdot, isAutoSized); + coilSelectionReportObj->setCoilAirFlow(*state, coil1Name, coil1Type, airVdot, isAutoSized); auto &c1(coilSelectionReportObj->coilSelectionDataObjs[0]); EXPECT_EQ(coil1Name, c1->coilName_); EXPECT_EQ(coil1Type, c1->coilObjName); @@ -114,7 +115,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ChWCoil) Real64 waterVdot = 0.05; // First with no plant sizing objects defined isAutoSized = false; // true if autosized - coilSelectionReportObj->setCoilWaterFlowNodeNums(state, coil1Name, coil1Type, waterVdot, isAutoSized, chWInletNodeNum, chWOutletNodeNum, loopNum); + coilSelectionReportObj->setCoilWaterFlowNodeNums(*state, coil1Name, coil1Type, waterVdot, isAutoSized, chWInletNodeNum, chWOutletNodeNum, loopNum); EXPECT_EQ(-999, c1->pltSizNum); EXPECT_EQ(loopNum, c1->waterLoopNum); EXPECT_EQ(DataPlant::PlantLoop(1).Name, c1->plantLoopName); @@ -124,13 +125,13 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ChWCoil) EXPECT_EQ("No", c1->coilWaterFlowAutoMsg); // Exercise report writing with mostly defaults - coilSelectionReportObj->finishCoilSummaryReportTable(state); + coilSelectionReportObj->finishCoilSummaryReportTable(*state); // Use the other form for coil 2 std::string coil2Name("Coil 2"); // user-defined name of the coil std::string coil2Type("Coil:Cooling:Water"); // idf input object class name of coil int pltSizNum = -999; - coilSelectionReportObj->setCoilWaterFlowPltSizNum(state, coil2Name, coil2Type, waterVdot, isAutoSized, pltSizNum, loopNum); + coilSelectionReportObj->setCoilWaterFlowPltSizNum(*state, coil2Name, coil2Type, waterVdot, isAutoSized, pltSizNum, loopNum); auto &c2(coilSelectionReportObj->coilSelectionDataObjs[1]); EXPECT_EQ(-999, c2->pltSizNum); EXPECT_EQ(loopNum, c2->waterLoopNum); @@ -145,7 +146,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ChWCoil) DataSizing::PlantSizData.allocate(1); DataSizing::PlantSizData(1).PlantLoopName = "Chilled Water Loop"; isAutoSized = true; // true if autosized - coilSelectionReportObj->setCoilWaterFlowNodeNums(state, coil1Name, coil1Type, waterVdot, isAutoSized, chWInletNodeNum, chWOutletNodeNum, loopNum); + coilSelectionReportObj->setCoilWaterFlowNodeNums(*state, coil1Name, coil1Type, waterVdot, isAutoSized, chWInletNodeNum, chWOutletNodeNum, loopNum); auto &c1b(coilSelectionReportObj->coilSelectionDataObjs[0]); EXPECT_EQ(1, c1b->pltSizNum); EXPECT_EQ(loopNum, c1b->waterLoopNum); @@ -161,20 +162,20 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ChWCoil) int curSysNum = 1; int curZoneEqNum = 0; isAutoSized = true; // true if autosized - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(1).NumZonesHeated = 2; - state.dataAirLoop->AirToZoneNodeInfo(1).HeatCtrlZoneNums.allocate(state.dataAirLoop->AirToZoneNodeInfo(1).NumZonesHeated); - state.dataAirLoop->AirToZoneNodeInfo(1).HeatCtrlZoneNums(1) = 2; - state.dataAirLoop->AirToZoneNodeInfo(1).HeatCtrlZoneNums(2) = 3; - state.dataGlobal->NumOfZones = 3; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(1).NumZonesHeated = 2; + state->dataAirLoop->AirToZoneNodeInfo(1).HeatCtrlZoneNums.allocate(state->dataAirLoop->AirToZoneNodeInfo(1).NumZonesHeated); + state->dataAirLoop->AirToZoneNodeInfo(1).HeatCtrlZoneNums(1) = 2; + state->dataAirLoop->AirToZoneNodeInfo(1).HeatCtrlZoneNums(2) = 3; + state->dataGlobal->NumOfZones = 3; + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataHeatBalance::Zone(1).Name = "Zone 1"; DataHeatBalance::Zone(2).Name = "Zone 2"; DataHeatBalance::Zone(3).Name = "Zone 3"; // This triggers doAirLoopSetUp - coilSelectionReportObj->setCoilUA(state, coil2Name, coil2Type, uA, sizingCap, isAutoSized, curSysNum, curZoneEqNum); + coilSelectionReportObj->setCoilUA(*state, coil2Name, coil2Type, uA, sizingCap, isAutoSized, curSysNum, curZoneEqNum); EXPECT_EQ(uA, c2->coilUA); EXPECT_EQ(sizingCap, c2->coilTotCapAtPeak); EXPECT_EQ(curSysNum, c2->airloopNum); @@ -201,7 +202,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ChWCoil) curZoneEqNum = 0; isAutoSized = false; // true if autosized // This triggers doAirLoopSetUp - coilSelectionReportObj->setCoilUA(state, coil3Name, coil3Type, uA, sizingCap, isAutoSized, curSysNum, curZoneEqNum); + coilSelectionReportObj->setCoilUA(*state, coil3Name, coil3Type, uA, sizingCap, isAutoSized, curSysNum, curZoneEqNum); auto &c3(coilSelectionReportObj->coilSelectionDataObjs[2]); EXPECT_EQ(uA, c3->coilUA); EXPECT_EQ(sizingCap, c3->coilTotCapAtPeak); @@ -221,7 +222,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ChWCoil) EXPECT_EQ(200.0, c3->rmLatentAtPeak); // Exercise report writing again - coilSelectionReportObj->finishCoilSummaryReportTable(state); + coilSelectionReportObj->finishCoilSummaryReportTable(*state); } TEST_F(EnergyPlusFixture, ReportCoilSelection_SteamCoil) @@ -254,7 +255,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_SteamCoil) Real64 airVdot(0.052); // air flow rate in m3/s bool isAutoSized(false); // true if autosized - coilSelectionReportObj->setCoilAirFlow(state, coil1Name, coil1Type, airVdot, isAutoSized); + coilSelectionReportObj->setCoilAirFlow(*state, coil1Name, coil1Type, airVdot, isAutoSized); auto &c1(coilSelectionReportObj->coilSelectionDataObjs[0]); EXPECT_EQ(coil1Name, c1->coilName_); EXPECT_EQ(coil1Type, c1->coilObjName); @@ -265,7 +266,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_SteamCoil) Real64 waterVdot = 0.05; // First with no plant sizing objects defined isAutoSized = false; // true if autosized - coilSelectionReportObj->setCoilWaterFlowNodeNums(state, coil1Name, coil1Type, waterVdot, isAutoSized, wInletNodeNum, wOutletNodeNum, loopNum); + coilSelectionReportObj->setCoilWaterFlowNodeNums(*state, coil1Name, coil1Type, waterVdot, isAutoSized, wInletNodeNum, wOutletNodeNum, loopNum); EXPECT_EQ(-999, c1->pltSizNum); EXPECT_EQ(loopNum, c1->waterLoopNum); EXPECT_EQ(DataPlant::PlantLoop(1).Name, c1->plantLoopName); @@ -280,7 +281,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_SteamCoil) DataSizing::PlantSizData(1).PlantLoopName = "Steam Loop"; DataSizing::PlantSizData(1).LoopType = DataSizing::SteamLoop; isAutoSized = true; // true if autosized - coilSelectionReportObj->setCoilWaterFlowNodeNums(state, coil1Name, coil1Type, waterVdot, isAutoSized, wInletNodeNum, wOutletNodeNum, loopNum); + coilSelectionReportObj->setCoilWaterFlowNodeNums(*state, coil1Name, coil1Type, waterVdot, isAutoSized, wInletNodeNum, wOutletNodeNum, loopNum); auto &c1b(coilSelectionReportObj->coilSelectionDataObjs[0]); EXPECT_EQ(1, c1b->pltSizNum); EXPECT_EQ(loopNum, c1b->waterLoopNum); @@ -292,7 +293,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_SteamCoil) EXPECT_EQ("Yes", c1b->coilWaterFlowAutoMsg); // Exercise report writing again - coilSelectionReportObj->finishCoilSummaryReportTable(state); + coilSelectionReportObj->finishCoilSummaryReportTable(*state); } TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoil) @@ -300,8 +301,8 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoil) std::string coil1Name("Coil 1"); // user-defined name of the coil std::string coil1Type("Coil:Heating:Fuel"); // idf input object class name of coil - state.dataGlobal->NumOfZones = 3; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 3; + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataHeatBalance::Zone(1).Name = "Zone 1"; DataHeatBalance::Zone(2).Name = "Zone 2"; DataHeatBalance::Zone(3).Name = "Zone 3"; @@ -326,7 +327,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoil) Real64 airFlowRate = 0.11; Real64 waterFlowRate = 0.0; - coilSelectionReportObj->setCoilFinalSizes(state, coil1Name, coil1Type, totGrossCap, sensGrossCap, airFlowRate, waterFlowRate); + coilSelectionReportObj->setCoilFinalSizes(*state, coil1Name, coil1Type, totGrossCap, sensGrossCap, airFlowRate, waterFlowRate); auto &c1(coilSelectionReportObj->coilSelectionDataObjs[0]); EXPECT_EQ(totGrossCap, c1->coilTotCapFinal); EXPECT_EQ(sensGrossCap, c1->coilSensCapFinal); @@ -348,7 +349,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoil) Real64 RatedCoilEff = 0.8; // First without setting coil inlet/outlet conditions - coilSelectionReportObj->setRatedCoilConditions(state, coil1Name, + coilSelectionReportObj->setRatedCoilConditions(*state, coil1Name, coil1Type, RatedCoilTotCap, RatedCoilSensCap, @@ -385,7 +386,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoil) RatedCoilInHumRat = 0.008; RatedCoilOutDb = 40.0; RatedCoilOutHumRat = 0.009; - coilSelectionReportObj->setRatedCoilConditions(state, coil1Name, + coilSelectionReportObj->setRatedCoilConditions(*state, coil1Name, coil1Type, RatedCoilTotCap, RatedCoilSensCap, @@ -408,33 +409,33 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoil) EXPECT_NEAR(63371.3, c1->ratedCoilOutEnth, 0.1); Real64 entAirDryBulbTemp = 24.0; - coilSelectionReportObj->setCoilEntAirTemp(state, coil1Name, coil1Type, entAirDryBulbTemp, curSysNum, curZoneEqNum); + coilSelectionReportObj->setCoilEntAirTemp(*state, coil1Name, coil1Type, entAirDryBulbTemp, curSysNum, curZoneEqNum); EXPECT_EQ(entAirDryBulbTemp, c1->coilDesEntTemp); EXPECT_EQ(curSysNum, c1->airloopNum); EXPECT_EQ(curZoneEqNum, c1->zoneEqNum); Real64 entAirHumRat = 0.004; - coilSelectionReportObj->setCoilEntAirHumRat(state, coil1Name, coil1Type, entAirHumRat); + coilSelectionReportObj->setCoilEntAirHumRat(*state, coil1Name, coil1Type, entAirHumRat); EXPECT_EQ(entAirHumRat, c1->coilDesEntHumRat); Real64 entWaterTemp = 60.0; - coilSelectionReportObj->setCoilEntWaterTemp(state, coil1Name, coil1Type, entWaterTemp); + coilSelectionReportObj->setCoilEntWaterTemp(*state, coil1Name, coil1Type, entWaterTemp); EXPECT_EQ(entWaterTemp, c1->coilDesWaterEntTemp); Real64 lvgWaterTemp = 50.0; - coilSelectionReportObj->setCoilLvgWaterTemp(state, coil1Name, coil1Type, lvgWaterTemp); + coilSelectionReportObj->setCoilLvgWaterTemp(*state, coil1Name, coil1Type, lvgWaterTemp); EXPECT_EQ(lvgWaterTemp, c1->coilDesWaterLvgTemp); Real64 CoilWaterDeltaT = 50.0; - coilSelectionReportObj->setCoilWaterDeltaT(state, coil1Name, coil1Type, CoilWaterDeltaT); + coilSelectionReportObj->setCoilWaterDeltaT(*state, coil1Name, coil1Type, CoilWaterDeltaT); EXPECT_EQ(CoilWaterDeltaT, c1->coilDesWaterTempDiff); Real64 lvgAirDryBulbTemp = 12.0; - coilSelectionReportObj->setCoilLvgAirTemp(state, coil1Name, coil1Type, lvgAirDryBulbTemp); + coilSelectionReportObj->setCoilLvgAirTemp(*state, coil1Name, coil1Type, lvgAirDryBulbTemp); EXPECT_EQ(lvgAirDryBulbTemp, c1->coilDesLvgTemp); Real64 lvgAirHumRat = 0.006; - coilSelectionReportObj->setCoilLvgAirHumRat(state, coil1Name, coil1Type, lvgAirHumRat); + coilSelectionReportObj->setCoilLvgAirHumRat(*state, coil1Name, coil1Type, lvgAirHumRat); EXPECT_EQ(lvgAirHumRat, c1->coilDesLvgHumRat); int zoneNum = 1; @@ -449,7 +450,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoil) EXPECT_EQ(0.0, c1->rmLatentAtPeak); // Exercise report writing again - coilSelectionReportObj->finishCoilSummaryReportTable(state); + coilSelectionReportObj->finishCoilSummaryReportTable(*state); // Test coil reporting curZoneEqNum = 1; @@ -480,7 +481,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoil) DataSizing::DataFlowUsedForSizing = airFlowRate / DataEnvironment::StdRhoAir; // setCoilHeatingCapacity will not overwrite previously set temperature data - coilSelectionReportObj->setCoilHeatingCapacity(state, + coilSelectionReportObj->setCoilHeatingCapacity(*state, coil1Name, coil1Type, RatedCoilTotCap, @@ -495,9 +496,9 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoil) EXPECT_EQ(entAirDryBulbTemp, c1->coilDesEntTemp); entAirDryBulbTemp = 21.0; // change coil entering air temp - coilSelectionReportObj->setCoilEntAirTemp(state, coil1Name, coil1Type, entAirDryBulbTemp, curSysNum, curZoneEqNum); + coilSelectionReportObj->setCoilEntAirTemp(*state, coil1Name, coil1Type, entAirDryBulbTemp, curSysNum, curZoneEqNum); lvgAirDryBulbTemp = 30.0; - coilSelectionReportObj->setCoilLvgAirTemp(state, coil1Name, coil1Type, lvgAirDryBulbTemp); + coilSelectionReportObj->setCoilLvgAirTemp(*state, coil1Name, coil1Type, lvgAirDryBulbTemp); EXPECT_EQ(entAirDryBulbTemp, c1->coilDesEntTemp); EXPECT_EQ(lvgAirDryBulbTemp, c1->coilDesLvgTemp); @@ -508,7 +509,7 @@ TEST_F(EnergyPlusFixture, ReportCoilSelection_ZoneEqCoil) c1->coilDesEntHumRat = -999.0; c1->coilDesLvgTemp = -999.0; c1->coilDesLvgHumRat = -999.0; - coilSelectionReportObj->setCoilHeatingCapacity(state, + coilSelectionReportObj->setCoilHeatingCapacity(*state, coil1Name, coil1Type, RatedCoilTotCap, diff --git a/tst/EnergyPlus/unit/ResultsFramework.unit.cc b/tst/EnergyPlus/unit/ResultsFramework.unit.cc index 433836a84fa..cd6eba2d097 100644 --- a/tst/EnergyPlus/unit/ResultsFramework.unit.cc +++ b/tst/EnergyPlus/unit/ResultsFramework.unit.cc @@ -57,6 +57,7 @@ #include #include #include +#include // Fixture #include "Fixtures/ResultsFrameworkFixture.hh" @@ -78,7 +79,7 @@ TEST_F(ResultsFrameworkFixture, ResultsFramework_ParseJsonObject1) ASSERT_TRUE(process_idf(idf_objects)); - resultsFramework->setupOutputOptions(state); + resultsFramework->setupOutputOptions(*state); EXPECT_TRUE(resultsFramework->timeSeriesAndTabularEnabled()); } @@ -92,7 +93,7 @@ TEST_F(ResultsFrameworkFixture, ResultsFramework_ParseJsonObject2) ASSERT_TRUE(process_idf(idf_objects)); - resultsFramework->setupOutputOptions(state); + resultsFramework->setupOutputOptions(*state); EXPECT_TRUE(resultsFramework->timeSeriesEnabled()); compare_json_stream(""); @@ -231,10 +232,10 @@ TEST_F(ResultsFrameworkFixture, ResultsFramework_DataFrameInfo2) Variable var0("SALESFLOOR INLET NODE:System Node Temperature", ReportingFrequency::TimeStep, indexType, reportId, Unit::C); resultsFramework->RITimestepTSData.addVariable(var0); - resultsFramework->RITimestepTSData.newRow(state, 2, 25, 1, 45); // month,day,hour,minute - resultsFramework->RITimestepTSData.newRow(state, 2, 25, 1, 60); // month,day,hour,minute - resultsFramework->RITimestepTSData.newRow(state, 2, 25, 24, 45); // month,day,hour,minute - resultsFramework->RITimestepTSData.newRow(state, 2, 25, 24, 60); // month,day,hour,minute + resultsFramework->RITimestepTSData.newRow(*state, 2, 25, 1, 45); // month,day,hour,minute + resultsFramework->RITimestepTSData.newRow(*state, 2, 25, 1, 60); // month,day,hour,minute + resultsFramework->RITimestepTSData.newRow(*state, 2, 25, 24, 45); // month,day,hour,minute + resultsFramework->RITimestepTSData.newRow(*state, 2, 25, 24, 60); // month,day,hour,minute resultsFramework->RITimestepTSData.pushVariableValue(reportId, 1.0); resultsFramework->RITimestepTSData.pushVariableValue(reportId, 2.0); @@ -446,43 +447,43 @@ TEST_F(ResultsFrameworkFixture, ResultsFramework_convertToMonth) { std::string datetime; datetime = "01/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "January"); datetime = "02/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "February"); datetime = "03/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "March"); datetime = "04/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "April"); datetime = "05/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "May"); datetime = "06/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "June"); datetime = "07/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "July"); datetime = "08/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "August"); datetime = "09/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "September"); datetime = "10/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "October"); datetime = "11/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "November"); datetime = "12/01 24:00:00"; - convertToMonth(state, datetime); + convertToMonth(*state, datetime); EXPECT_EQ(datetime, "December"); datetime = "01/01 23:00:00"; - EXPECT_THROW(convertToMonth(state, datetime), FatalError); + EXPECT_THROW(convertToMonth(*state, datetime), FatalError); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc b/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc index 0c2493532e5..c0dfd01e3ed 100644 --- a/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirModelUserTempPattern.unit.cc @@ -54,6 +54,7 @@ #include "Fixtures/EnergyPlusFixture.hh" #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::RoomAirModelUserTempPattern; diff --git a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc index b2bf60f6109..c9b027bc921 100644 --- a/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc +++ b/tst/EnergyPlus/unit/RoomAirflowNetwork.unit.cc @@ -73,6 +73,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace DataEnvironment; @@ -103,15 +104,15 @@ class RoomAirflowNetworkTest : public EnergyPlusFixture CurZoneEqNum = 0; CurSysNum = 0; CurOASysNum = 0; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; NumOfNodes = 5; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; int NumOfSurfaces = 2; - RoomAirflowNetworkZoneInfo.allocate(state.dataGlobal->NumOfZones); - Zone.allocate(state.dataGlobal->NumOfZones); - ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); - ZoneEquipList.allocate(state.dataGlobal->NumOfZones); - ZoneIntGain.allocate(state.dataGlobal->NumOfZones); + RoomAirflowNetworkZoneInfo.allocate(state->dataGlobal->NumOfZones); + Zone.allocate(state->dataGlobal->NumOfZones); + ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); + ZoneEquipList.allocate(state->dataGlobal->NumOfZones); + ZoneIntGain.allocate(state->dataGlobal->NumOfZones); NodeID.allocate(NumOfNodes); Node.allocate(NumOfNodes); Surface.allocate(NumOfSurfaces); @@ -126,12 +127,12 @@ class RoomAirflowNetworkTest : public EnergyPlusFixture RhoVaporSurfIn.allocate(NumOfSurfaces); RhoVaporAirIn.allocate(NumOfSurfaces); HMassConvInFD.allocate(NumOfSurfaces); - MAT.allocate(state.dataGlobal->NumOfZones); + MAT.allocate(state->dataGlobal->NumOfZones); ZoneAirHumRat.allocate(1); AirflowNetwork::AirflowNetworkLinkageData.allocate(5); AirflowNetwork::AirflowNetworkNodeSimu.allocate(6); AirflowNetwork::AirflowNetworkLinkSimu.allocate(5); - RAFN.allocate(state.dataGlobal->NumOfZones); + RAFN.allocate(state->dataGlobal->NumOfZones); } virtual void TearDown() @@ -292,16 +293,16 @@ TEST_F(RoomAirflowNetworkTest, RAFNTest) TempSurfInTmp(2) = 30.0; RhoVaporAirIn(1) = PsyRhovFnTdbWPb(MAT(ZoneNum), ZoneAirHumRat(ZoneNum), OutBaroPress); RhoVaporAirIn(2) = PsyRhovFnTdbWPb(MAT(ZoneNum), ZoneAirHumRat(ZoneNum), OutBaroPress); - HMassConvInFD(1) = HConvIn(1) / ((PsyRhoAirFnPbTdbW(state, OutBaroPress, MAT(ZoneNum), ZoneAirHumRat(ZoneNum)) + RhoVaporAirIn(1)) * + HMassConvInFD(1) = HConvIn(1) / ((PsyRhoAirFnPbTdbW(*state, OutBaroPress, MAT(ZoneNum), ZoneAirHumRat(ZoneNum)) + RhoVaporAirIn(1)) * PsyCpAirFnW(ZoneAirHumRat(ZoneNum))); - HMassConvInFD(2) = HConvIn(2) / ((PsyRhoAirFnPbTdbW(state, OutBaroPress, MAT(ZoneNum), ZoneAirHumRat(ZoneNum)) + RhoVaporAirIn(2)) * + HMassConvInFD(2) = HConvIn(2) / ((PsyRhoAirFnPbTdbW(*state, OutBaroPress, MAT(ZoneNum), ZoneAirHumRat(ZoneNum)) + RhoVaporAirIn(2)) * PsyCpAirFnW(ZoneAirHumRat(ZoneNum))); RoomAirNode = 1; auto &thisRAFN(RAFN(ZoneNum)); thisRAFN.ZoneNum = ZoneNum; - thisRAFN.InitRoomAirModelAirflowNetwork(state, RoomAirNode); + thisRAFN.InitRoomAirModelAirflowNetwork(*state, RoomAirNode); EXPECT_NEAR(120.0, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumIntSensibleGain, 0.00001); EXPECT_NEAR(80.0, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumIntLatentGain, 0.00001); @@ -320,14 +321,14 @@ TEST_F(RoomAirflowNetworkTest, RAFNTest) EXPECT_NEAR(0.0009756833, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARa, 0.0000001); EXPECT_NEAR(9.0784549e-7, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARaW, 0.0000001); - thisRAFN.CalcRoomAirModelAirflowNetwork(state, RoomAirNode); + thisRAFN.CalcRoomAirModelAirflowNetwork(*state, RoomAirNode); EXPECT_NEAR(24.907085, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).AirTemp, 0.00001); EXPECT_NEAR(0.00189601, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).HumRat, 0.00001); EXPECT_NEAR(9.770445, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).RelHumidity, 0.00001); RoomAirNode = 2; - thisRAFN.InitRoomAirModelAirflowNetwork(state, RoomAirNode); + thisRAFN.InitRoomAirModelAirflowNetwork(*state, RoomAirNode); EXPECT_NEAR(180.0, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumIntSensibleGain, 0.00001); EXPECT_NEAR(120.0, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumIntLatentGain, 0.00001); @@ -346,13 +347,13 @@ TEST_F(RoomAirflowNetworkTest, RAFNTest) EXPECT_NEAR(0.0019191284, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARa, 0.0000001); EXPECT_NEAR(1.98975381e-6, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).SumHmARaW, 0.0000001); - thisRAFN.CalcRoomAirModelAirflowNetwork(state, RoomAirNode); + thisRAFN.CalcRoomAirModelAirflowNetwork(*state, RoomAirNode); EXPECT_NEAR(24.057841, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).AirTemp, 0.00001); EXPECT_NEAR(0.0028697086, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).HumRat, 0.00001); EXPECT_NEAR(15.53486185, RoomAirflowNetworkZoneInfo(ZoneNum).Node(RoomAirNode).RelHumidity, 0.00001); - thisRAFN.UpdateRoomAirModelAirflowNetwork(state); + thisRAFN.UpdateRoomAirModelAirflowNetwork(*state); EXPECT_NEAR(24.397538, Node(2).Temp, 0.00001); EXPECT_NEAR(0.0024802305, Node(2).HumRat, 0.000001); diff --git a/tst/EnergyPlus/unit/RootFinder.unit.cc b/tst/EnergyPlus/unit/RootFinder.unit.cc index f154a2f0818..b3930cf8cad 100644 --- a/tst/EnergyPlus/unit/RootFinder.unit.cc +++ b/tst/EnergyPlus/unit/RootFinder.unit.cc @@ -57,6 +57,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; @@ -69,12 +70,12 @@ TEST_F(EnergyPlusFixture, RootFinder_CheckConvergence) Real64 absoluteXTolerance = 1.0e-6; Real64 absoluteYTolerance = 1.0e-5; - RootFinder::SetupRootFinder(state, rootFinderData, slopeType, methodType, relativeXTolerance, absoluteXTolerance, absoluteYTolerance); + RootFinder::SetupRootFinder(*state, rootFinderData, slopeType, methodType, relativeXTolerance, absoluteXTolerance, absoluteYTolerance); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); Real64 xMin = 0.0; Real64 xMax = 100.0; - RootFinder::InitializeRootFinder(state, rootFinderData, xMin, xMax); + RootFinder::InitializeRootFinder(*state, rootFinderData, xMin, xMax); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); bool isDone = false; @@ -82,28 +83,28 @@ TEST_F(EnergyPlusFixture, RootFinder_CheckConvergence) // Set min point Real64 xValue = xMin; Real64 yValue = 100.0; - RootFinder::IterateRootFinder(state, rootFinderData, xValue, yValue, isDone); + RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); EXPECT_FALSE(isDone); // Set max point xValue = xMax; yValue = -100.0; - RootFinder::IterateRootFinder(state, rootFinderData, xValue, yValue, isDone); + RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); EXPECT_FALSE(isDone); // Set 3rd point xValue = 20.0; yValue = -1.0; - RootFinder::IterateRootFinder(state, rootFinderData, xValue, yValue, isDone); + RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); EXPECT_FALSE(isDone); // 4th point should converge xValue = rootFinderData.XCandidate; yValue = absoluteYTolerance / 2.0; - RootFinder::IterateRootFinder(state, rootFinderData, xValue, yValue, isDone); + RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusOK); EXPECT_TRUE(isDone); } @@ -117,12 +118,12 @@ TEST_F(EnergyPlusFixture, RootFinder_CheckBracketRoundOff) Real64 absoluteXTolerance = 1.0e-6; Real64 absoluteYTolerance = 1.0e-5; - RootFinder::SetupRootFinder(state, rootFinderData, slopeType, methodType, relativeXTolerance, absoluteXTolerance, absoluteYTolerance); + RootFinder::SetupRootFinder(*state, rootFinderData, slopeType, methodType, relativeXTolerance, absoluteXTolerance, absoluteYTolerance); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); Real64 xMin = 0.0; Real64 xMax = 100.0; - RootFinder::InitializeRootFinder(state, rootFinderData, xMin, xMax); + RootFinder::InitializeRootFinder(*state, rootFinderData, xMin, xMax); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); bool isDone = false; @@ -130,35 +131,35 @@ TEST_F(EnergyPlusFixture, RootFinder_CheckBracketRoundOff) // Set min point Real64 xValue = xMin; Real64 yValue = 100.0; - RootFinder::IterateRootFinder(state, rootFinderData, xValue, yValue, isDone); + RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); EXPECT_FALSE(isDone); // Set max point xValue = xMax; yValue = -100.0; - RootFinder::IterateRootFinder(state, rootFinderData, xValue, yValue, isDone); + RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); EXPECT_FALSE(isDone); // Set 3rd point (this will be the upper point) xValue = 20.0; yValue = -10.0; - RootFinder::IterateRootFinder(state, rootFinderData, xValue, yValue, isDone); + RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); EXPECT_FALSE(isDone); // Set 4th point slightly below 3rd point but with opposite sign for y (this will be the lower point) xValue = xValue - absoluteXTolerance / 3.0; yValue = 10.0; - RootFinder::IterateRootFinder(state, rootFinderData, xValue, yValue, isDone); + RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusNone); EXPECT_FALSE(isDone); // Set 5th point in between upper and lower, but non-convergent so it gets to the Increment check) xValue = rootFinderData.XCandidate; yValue = 5.0; - RootFinder::IterateRootFinder(state, rootFinderData, xValue, yValue, isDone); + RootFinder::IterateRootFinder(*state, rootFinderData, xValue, yValue, isDone); EXPECT_EQ(rootFinderData.StatusFlag, DataRootFinder::iStatusOKRoundOff); EXPECT_TRUE(isDone); } diff --git a/tst/EnergyPlus/unit/RunPeriod.unit.cc b/tst/EnergyPlus/unit/RunPeriod.unit.cc index 098bcfff716..97d83439c27 100644 --- a/tst/EnergyPlus/unit/RunPeriod.unit.cc +++ b/tst/EnergyPlus/unit/RunPeriod.unit.cc @@ -63,6 +63,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::WeatherManager; @@ -199,48 +200,48 @@ TEST_F(EnergyPlusFixture, RunPeriod_YearTests) ASSERT_TRUE(process_idf(idf_objects)); bool errors_in_input(false); int totalrps(7); - WeatherManager::GetRunPeriodData(state, totalrps, errors_in_input); + WeatherManager::GetRunPeriodData(*state, totalrps, errors_in_input); EXPECT_FALSE(errors_in_input); - EXPECT_EQ(WeatherManager::WeekDay::Monday, state.dataWeatherManager->RunPeriodInput[0].startWeekDay); - EXPECT_EQ(2016, state.dataWeatherManager->RunPeriodInput[0].startYear); - EXPECT_EQ(2457448, state.dataWeatherManager->RunPeriodInput[0].startJulianDate); - EXPECT_EQ(2457451, state.dataWeatherManager->RunPeriodInput[0].endJulianDate); - - EXPECT_EQ(WeatherManager::WeekDay::Wednesday, state.dataWeatherManager->RunPeriodInput[1].startWeekDay); - EXPECT_EQ(2012, state.dataWeatherManager->RunPeriodInput[1].startYear); - EXPECT_EQ(2455987, state.dataWeatherManager->RunPeriodInput[1].startJulianDate); - EXPECT_EQ(2455990, state.dataWeatherManager->RunPeriodInput[1].endJulianDate); - - EXPECT_EQ(WeatherManager::WeekDay::Thursday, state.dataWeatherManager->RunPeriodInput[2].startWeekDay); - EXPECT_EQ(2015, state.dataWeatherManager->RunPeriodInput[2].startYear); - EXPECT_EQ(2457024, state.dataWeatherManager->RunPeriodInput[2].startJulianDate); - EXPECT_EQ(2457388, state.dataWeatherManager->RunPeriodInput[2].endJulianDate); - - EXPECT_EQ(WeatherManager::WeekDay::Sunday, state.dataWeatherManager->RunPeriodInput[3].startWeekDay); - EXPECT_EQ(2017, state.dataWeatherManager->RunPeriodInput[3].startYear); - EXPECT_EQ(2457755, state.dataWeatherManager->RunPeriodInput[3].startJulianDate); - EXPECT_EQ(2458119, state.dataWeatherManager->RunPeriodInput[3].endJulianDate); + EXPECT_EQ(WeatherManager::WeekDay::Monday, state->dataWeatherManager->RunPeriodInput[0].startWeekDay); + EXPECT_EQ(2016, state->dataWeatherManager->RunPeriodInput[0].startYear); + EXPECT_EQ(2457448, state->dataWeatherManager->RunPeriodInput[0].startJulianDate); + EXPECT_EQ(2457451, state->dataWeatherManager->RunPeriodInput[0].endJulianDate); + + EXPECT_EQ(WeatherManager::WeekDay::Wednesday, state->dataWeatherManager->RunPeriodInput[1].startWeekDay); + EXPECT_EQ(2012, state->dataWeatherManager->RunPeriodInput[1].startYear); + EXPECT_EQ(2455987, state->dataWeatherManager->RunPeriodInput[1].startJulianDate); + EXPECT_EQ(2455990, state->dataWeatherManager->RunPeriodInput[1].endJulianDate); + + EXPECT_EQ(WeatherManager::WeekDay::Thursday, state->dataWeatherManager->RunPeriodInput[2].startWeekDay); + EXPECT_EQ(2015, state->dataWeatherManager->RunPeriodInput[2].startYear); + EXPECT_EQ(2457024, state->dataWeatherManager->RunPeriodInput[2].startJulianDate); + EXPECT_EQ(2457388, state->dataWeatherManager->RunPeriodInput[2].endJulianDate); + + EXPECT_EQ(WeatherManager::WeekDay::Sunday, state->dataWeatherManager->RunPeriodInput[3].startWeekDay); + EXPECT_EQ(2017, state->dataWeatherManager->RunPeriodInput[3].startYear); + EXPECT_EQ(2457755, state->dataWeatherManager->RunPeriodInput[3].startJulianDate); + EXPECT_EQ(2458119, state->dataWeatherManager->RunPeriodInput[3].endJulianDate); // This is the default, check that it works properly std::array startDays{ {1, 4, 4, 7, 2, 5, 7, 3, 6, 1, 4, 6} }; for (size_t i = 0; i < 12; ++i) { - EXPECT_EQ(startDays[i], state.dataWeatherManager->RunPeriodInput[3].monWeekDay[i]); + EXPECT_EQ(startDays[i], state->dataWeatherManager->RunPeriodInput[3].monWeekDay[i]); } - EXPECT_EQ(WeatherManager::WeekDay::Wednesday, state.dataWeatherManager->RunPeriodInput[4].startWeekDay); - EXPECT_EQ(2010, state.dataWeatherManager->RunPeriodInput[4].startYear); - EXPECT_EQ(2455427, state.dataWeatherManager->RunPeriodInput[4].startJulianDate); - EXPECT_EQ(2455562, state.dataWeatherManager->RunPeriodInput[4].endJulianDate); + EXPECT_EQ(WeatherManager::WeekDay::Wednesday, state->dataWeatherManager->RunPeriodInput[4].startWeekDay); + EXPECT_EQ(2010, state->dataWeatherManager->RunPeriodInput[4].startYear); + EXPECT_EQ(2455427, state->dataWeatherManager->RunPeriodInput[4].startJulianDate); + EXPECT_EQ(2455562, state->dataWeatherManager->RunPeriodInput[4].endJulianDate); - EXPECT_EQ(WeatherManager::WeekDay::Saturday, state.dataWeatherManager->RunPeriodInput[5].startWeekDay); - EXPECT_EQ(1992, state.dataWeatherManager->RunPeriodInput[5].startYear); - EXPECT_EQ(2448682, state.dataWeatherManager->RunPeriodInput[5].startJulianDate); - EXPECT_EQ(2448988, state.dataWeatherManager->RunPeriodInput[5].endJulianDate); + EXPECT_EQ(WeatherManager::WeekDay::Saturday, state->dataWeatherManager->RunPeriodInput[5].startWeekDay); + EXPECT_EQ(1992, state->dataWeatherManager->RunPeriodInput[5].startYear); + EXPECT_EQ(2448682, state->dataWeatherManager->RunPeriodInput[5].startJulianDate); + EXPECT_EQ(2448988, state->dataWeatherManager->RunPeriodInput[5].endJulianDate); - EXPECT_EQ(WeatherManager::WeekDay::Friday, state.dataWeatherManager->RunPeriodInput[6].startWeekDay); - EXPECT_EQ(2016, state.dataWeatherManager->RunPeriodInput[6].startYear); - EXPECT_EQ(2457389, state.dataWeatherManager->RunPeriodInput[6].startJulianDate); - EXPECT_EQ(2458940, state.dataWeatherManager->RunPeriodInput[6].endJulianDate); + EXPECT_EQ(WeatherManager::WeekDay::Friday, state->dataWeatherManager->RunPeriodInput[6].startWeekDay); + EXPECT_EQ(2016, state->dataWeatherManager->RunPeriodInput[6].startYear); + EXPECT_EQ(2457389, state->dataWeatherManager->RunPeriodInput[6].startJulianDate); + EXPECT_EQ(2458940, state->dataWeatherManager->RunPeriodInput[6].endJulianDate); } TEST_F(EnergyPlusFixture, RunPeriod_EndYearOnly) @@ -268,7 +269,7 @@ TEST_F(EnergyPlusFixture, RunPeriod_EndYearOnly) ASSERT_TRUE(process_idf(idf_objects)); bool errors_in_input(false); int totalrps(1); - WeatherManager::GetRunPeriodData(state, totalrps, errors_in_input); + WeatherManager::GetRunPeriodData(*state, totalrps, errors_in_input); EXPECT_TRUE(errors_in_input); } @@ -334,7 +335,7 @@ TEST_F(EnergyPlusFixture, RunPeriod_NameOfPeriodInWarning) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; int totalrps(1); - WeatherManager::GetRunPeriodData(state, totalrps, ErrorsFound); + WeatherManager::GetRunPeriodData(*state, totalrps, ErrorsFound); // This should just issue a warning EXPECT_FALSE(ErrorsFound); @@ -369,7 +370,7 @@ TEST_F(EnergyPlusFixture, RunPeriod_NameOfPeriodInWarning) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; int totalrps(1); - WeatherManager::GetRunPeriodData(state, totalrps, ErrorsFound); + WeatherManager::GetRunPeriodData(*state, totalrps, ErrorsFound); // This should issue a severe EXPECT_TRUE(ErrorsFound); @@ -406,7 +407,7 @@ TEST_F(EnergyPlusFixture, SizingPeriod_WeatherFile) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - WeatherManager::GetRunPeriodDesignData(state, ErrorsFound); + WeatherManager::GetRunPeriodDesignData(*state, ErrorsFound); // This should just issue a severe EXPECT_TRUE(ErrorsFound); @@ -443,21 +444,21 @@ TEST_F(EnergyPlusFixture, RunPeriod_BadLeapDayFlagLogic) ASSERT_TRUE(process_idf(idf_objects)); bool errors_in_input(false); int totalrps(1); - WeatherManager::GetRunPeriodData(state, totalrps, errors_in_input); + WeatherManager::GetRunPeriodData(*state, totalrps, errors_in_input); EXPECT_FALSE(errors_in_input); - state.dataWeatherManager->Environment.allocate(1); + state->dataWeatherManager->Environment.allocate(1); // These may already be set, but do it anyway DataEnvironment::TotDesDays = 0; - state.dataWeatherManager->TotRunPers = 1; - state.dataWeatherManager->TotRunDesPers = 0; + state->dataWeatherManager->TotRunPers = 1; + state->dataWeatherManager->TotRunDesPers = 0; - state.dataWeatherManager->WFAllowsLeapYears = true; // This was hitting a bad bit of logic - WeatherManager::SetupEnvironmentTypes(state); + state->dataWeatherManager->WFAllowsLeapYears = true; // This was hitting a bad bit of logic + WeatherManager::SetupEnvironmentTypes(*state); - EXPECT_FALSE(state.dataWeatherManager->Environment[0].IsLeapYear); - EXPECT_EQ(365, state.dataWeatherManager->Environment[0].TotalDays); + EXPECT_FALSE(state->dataWeatherManager->Environment[0].IsLeapYear); + EXPECT_EQ(365, state->dataWeatherManager->Environment[0].TotalDays); - state.dataWeatherManager->Environment.deallocate(); + state->dataWeatherManager->Environment.deallocate(); } diff --git a/tst/EnergyPlus/unit/RuntimeLanguageProcessor.unit.cc b/tst/EnergyPlus/unit/RuntimeLanguageProcessor.unit.cc index 478307d7bdb..5bb007048a2 100644 --- a/tst/EnergyPlus/unit/RuntimeLanguageProcessor.unit.cc +++ b/tst/EnergyPlus/unit/RuntimeLanguageProcessor.unit.cc @@ -56,14 +56,15 @@ #include #include #include +#include using namespace EnergyPlus; TEST_F(EnergyPlusFixture, ERLExpression_TestExponentials) { // set the program state so that errors can be thrown - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KickOffSimulation = false; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KickOffSimulation = false; EMSManager::FinishProcessingUserInput = false; bool errorsFound = false; @@ -75,37 +76,37 @@ TEST_F(EnergyPlusFixture, ERLExpression_TestExponentials) erlExpression.Operand.allocate(1); erlExpression.Operand(1).Number = -25; - auto response1 = RuntimeLanguageProcessor::EvaluateExpression(state, 1, errorsFound); + auto response1 = RuntimeLanguageProcessor::EvaluateExpression(*state, 1, errorsFound); EXPECT_FALSE(errorsFound); EXPECT_EQ(0, response1.Number); erlExpression.Operand(1).Number = -20; - auto response2 = RuntimeLanguageProcessor::EvaluateExpression(state, 1, errorsFound); + auto response2 = RuntimeLanguageProcessor::EvaluateExpression(*state, 1, errorsFound); EXPECT_FALSE(errorsFound); EXPECT_EQ(0, response2.Number); erlExpression.Operand(1).Number = -3; - auto response3 = RuntimeLanguageProcessor::EvaluateExpression(state, 1, errorsFound); + auto response3 = RuntimeLanguageProcessor::EvaluateExpression(*state, 1, errorsFound); EXPECT_FALSE(errorsFound); EXPECT_NEAR(0.05, response3.Number, 0.001); erlExpression.Operand(1).Number = 0; - auto response4 = RuntimeLanguageProcessor::EvaluateExpression(state, 1, errorsFound); + auto response4 = RuntimeLanguageProcessor::EvaluateExpression(*state, 1, errorsFound); EXPECT_FALSE(errorsFound); EXPECT_NEAR(1, response4.Number, 0.001); erlExpression.Operand(1).Number = 3; - auto response5 = RuntimeLanguageProcessor::EvaluateExpression(state, 1, errorsFound); + auto response5 = RuntimeLanguageProcessor::EvaluateExpression(*state, 1, errorsFound); EXPECT_FALSE(errorsFound); EXPECT_NEAR(20.08, response5.Number, 0.01); erlExpression.Operand(1).Number = 700; - auto response6 = RuntimeLanguageProcessor::EvaluateExpression(state, 1, errorsFound); + auto response6 = RuntimeLanguageProcessor::EvaluateExpression(*state, 1, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(0, response6.Number); erlExpression.Operand(1).Number = 710; - auto response7 = RuntimeLanguageProcessor::EvaluateExpression(state, 1, errorsFound); + auto response7 = RuntimeLanguageProcessor::EvaluateExpression(*state, 1, errorsFound); EXPECT_TRUE(errorsFound); EXPECT_EQ(0, response7.Number); } @@ -136,7 +137,7 @@ TEST_F(EnergyPlusFixture, TestOutOfRangeAlphaFields) " J;" }); ASSERT_TRUE(process_idf(idf_objects)); - RuntimeLanguageProcessor::GetRuntimeLanguageUserInput(state); + RuntimeLanguageProcessor::GetRuntimeLanguageUserInput(*state); } diff --git a/tst/EnergyPlus/unit/SQLite.unit.cc b/tst/EnergyPlus/unit/SQLite.unit.cc index c0d21f33cc6..2c171bb034a 100644 --- a/tst/EnergyPlus/unit/SQLite.unit.cc +++ b/tst/EnergyPlus/unit/SQLite.unit.cc @@ -55,6 +55,7 @@ #include #include "Fixtures/SQLiteFixture.hh" #include +#include namespace EnergyPlus { @@ -209,7 +210,7 @@ TEST_F(SQLiteFixture, SQLiteProcedures_informationalErrorRecords) // There needs to be a simulation record otherwise the foreign key constraint will fail EnergyPlus::sqlite->createSQLiteSimulationsRecord(1, "EnergyPlus Version", "Current Time"); - ShowMessage(state, "This is an informational message"); + ShowMessage(*state, "This is an informational message"); auto result = queryResult("SELECT * FROM Errors;", "Errors"); EnergyPlus::sqlite->sqliteCommit(); diff --git a/tst/EnergyPlus/unit/SZVAVModel.unit.cc b/tst/EnergyPlus/unit/SZVAVModel.unit.cc index bc9e61e3782..09fbb379f62 100644 --- a/tst/EnergyPlus/unit/SZVAVModel.unit.cc +++ b/tst/EnergyPlus/unit/SZVAVModel.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include "Fixtures/EnergyPlusFixture.hh" #include #include @@ -249,7 +250,7 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) CompSets(2).ParentCName = "AirSystem"; DataEnvironment::OutDryBulbTemp = 5.0; - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); Psychrometrics::InitializePsychRoutines(); createCoilSelectionReportObj(); @@ -265,7 +266,7 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) int CompressorOnFlag = 0; auto &SZVAVModel(PTUnit(1)); // first pass through will get objects and reset node data - SZVAVModel::calcSZVAVModel(state, + SZVAVModel::calcSZVAVModel(*state, SZVAVModel, UnitNum, FirstHVACIteration, CoolingLoad, HeatingLoad, QZnReq, OnOffAirFlowRatio, HXUnitOn, AirLoopNum, PLR, CompressorOnFlag); // set unit inlet node conditions for cooling @@ -274,7 +275,7 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) DataLoopNode::Node(1).Enthalpy = 52120.0; bool ErrorsFound = false; // set zone condition - NodeInputManager::GetOnlySingleNode(state, "ZoneNode", + NodeInputManager::GetOnlySingleNode(*state, "ZoneNode", ErrorsFound, "PTUnit", "PTUnit", @@ -291,7 +292,7 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) Schedule(1).CurrentValue = 1.0; PackagedTerminalHeatPump::CoolingLoad = CoolingLoad; PackagedTerminalHeatPump::HeatingLoad = HeatingLoad; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; // set fan inlet max avail so fan doesn't shut down flow DataLoopNode::Node(1).MassFlowRateMaxAvail = 0.2; DataEnvironment::StdRhoAir = 1.2; // fan used this to convert volume to mass flow rate @@ -299,7 +300,7 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) // second pass through will run model // Region 1 of control, low air flow rate, modulate coil capacity - SZVAVModel::calcSZVAVModel(state, + SZVAVModel::calcSZVAVModel(*state, SZVAVModel, UnitNum, FirstHVACIteration, CoolingLoad, HeatingLoad, QZnReq, OnOffAirFlowRatio, HXUnitOn, AirLoopNum, PLR, CompressorOnFlag); EXPECT_NEAR(DataLoopNode::Node(1).MassFlowRate, thisUnit.MaxNoCoolHeatAirMassFlow, 0.00000001); // low speed air flow rate @@ -314,7 +315,7 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) // Region 2 of control, modulate air flow rate, modulate coil capacity QZnReq = -1200.0; - SZVAVModel::calcSZVAVModel(state, + SZVAVModel::calcSZVAVModel(*state, SZVAVModel, UnitNum, FirstHVACIteration, CoolingLoad, HeatingLoad, QZnReq, OnOffAirFlowRatio, HXUnitOn, AirLoopNum, PLR, CompressorOnFlag); EXPECT_GT(DataLoopNode::Node(1).MassFlowRate, thisUnit.MaxNoCoolHeatAirMassFlow); // air flow higher than low speed @@ -331,7 +332,7 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) // Region 3 of control, high air flow rate, modulate coil capacity QZnReq = -2000.0; - SZVAVModel::calcSZVAVModel(state, + SZVAVModel::calcSZVAVModel(*state, SZVAVModel, UnitNum, FirstHVACIteration, CoolingLoad, HeatingLoad, QZnReq, OnOffAirFlowRatio, HXUnitOn, AirLoopNum, PLR, CompressorOnFlag); EXPECT_NEAR(DataLoopNode::Node(1).MassFlowRate, thisUnit.MaxCoolAirMassFlow, 0.00000001); // high speed air flow rate @@ -359,7 +360,7 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) // Region 1 of control, low air flow rate, modulate coil capacity QZnReq = 200.0; - SZVAVModel::calcSZVAVModel(state, + SZVAVModel::calcSZVAVModel(*state, SZVAVModel, UnitNum, FirstHVACIteration, CoolingLoad, HeatingLoad, QZnReq, OnOffAirFlowRatio, HXUnitOn, AirLoopNum, PLR, CompressorOnFlag); EXPECT_NEAR(DataLoopNode::Node(1).MassFlowRate, thisUnit.MaxNoCoolHeatAirMassFlow, 0.00000001); // high speed air flow rate @@ -375,7 +376,7 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) // Region 2 of control, modulate air flow rate, modulate coil capacity QZnReq = 1200.0; - SZVAVModel::calcSZVAVModel(state, + SZVAVModel::calcSZVAVModel(*state, SZVAVModel, UnitNum, FirstHVACIteration, CoolingLoad, HeatingLoad, QZnReq, OnOffAirFlowRatio, HXUnitOn, AirLoopNum, PLR, CompressorOnFlag); EXPECT_GT(DataLoopNode::Node(1).MassFlowRate, thisUnit.MaxNoCoolHeatAirMassFlow); // air flow higher than low speed @@ -392,7 +393,7 @@ TEST_F(EnergyPlusFixture, SZVAV_PTUnit_Testing) // Region 3 of control, high air flow rate, modulate coil capacity QZnReq = 2000.0; - SZVAVModel::calcSZVAVModel(state, + SZVAVModel::calcSZVAVModel(*state, SZVAVModel, UnitNum, FirstHVACIteration, CoolingLoad, HeatingLoad, QZnReq, OnOffAirFlowRatio, HXUnitOn, AirLoopNum, PLR, CompressorOnFlag); EXPECT_NEAR(DataLoopNode::Node(1).MassFlowRate, thisUnit.MaxHeatAirMassFlow, 0.00000001); // high speed air flow rate @@ -429,10 +430,10 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataSizing::CurZoneEqNum = 1; std::string const idf_objects = delimited_string({ @@ -556,18 +557,18 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataSizing::CurZoneEqNum = 1; InitializePsychRoutines(); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("WEST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanCoilUnits(state); + GetFanCoilUnits(*state); auto &thisFanCoil(FanCoil(1)); EXPECT_EQ("ASHRAE90VARIABLEFAN", thisFanCoil.CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", thisFanCoil.OAMixType); @@ -587,12 +588,12 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) DataLoopNode::Node(MixerOA.RetNode).MassFlowRateMax = MaxAirMassFlow; DataLoopNode::Node(MixerOA.RetNode).Temp = 20.0; DataLoopNode::Node(MixerOA.RetNode).Enthalpy = 36000; - DataLoopNode::Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(state, DataLoopNode::Node(MixerOA.RetNode).Temp, DataLoopNode::Node(MixerOA.RetNode).Enthalpy); + DataLoopNode::Node(MixerOA.RetNode).HumRat = PsyWFnTdbH(*state, DataLoopNode::Node(MixerOA.RetNode).Temp, DataLoopNode::Node(MixerOA.RetNode).Enthalpy); DataLoopNode::Node(MixerOA.InletNode).Temp = 10.0; DataLoopNode::Node(MixerOA.InletNode).Enthalpy = 18000; - DataLoopNode::Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(state, DataLoopNode::Node(MixerOA.InletNode).Temp, DataLoopNode::Node(MixerOA.InletNode).Enthalpy); + DataLoopNode::Node(MixerOA.InletNode).HumRat = PsyWFnTdbH(*state, DataLoopNode::Node(MixerOA.InletNode).Temp, DataLoopNode::Node(MixerOA.InletNode).Enthalpy); // chilled water coil - auto &CWCoil(state.dataWaterCoils->WaterCoil(1)); + auto &CWCoil(state->dataWaterCoils->WaterCoil(1)); CWCoil.UACoilTotal = 470.0; CWCoil.UACoilExternal = 611.0; CWCoil.UACoilInternal = 2010.0; @@ -631,32 +632,32 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) CWLoop.FluidIndex = 1; CWLoop.FluidName = "WATER"; CWLoop.LoopSide(1).Branch(1).Comp(1).Name = CWCoil.Name; - CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; + CWLoop.LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumIn = CWCoil.WaterInletNodeNum; CWLoop.LoopSide(1).Branch(1).Comp(1).NodeNumOut = CWCoil.WaterOutletNodeNum; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataGlobal->DoingSizing = true; - state.dataFans->LocalTurnFansOff = false; - state.dataFans->LocalTurnFansOn = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataGlobal->DoingSizing = true; + state->dataFans->LocalTurnFansOff = false; + state->dataFans->LocalTurnFansOn = true; ZoneSysEnergyDemand.allocate(1); auto &zSysEDemand(ZoneSysEnergyDemand(1)); DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - UpdateScheduleValues(state); + UpdateScheduleValues(*state); ZoneEqSizing.allocate(1); ZoneSizingRunDone = true; thisFanCoil.DesignHeatingCapacity = 10000.0; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->SysSizingCalc = true; FirstHVACIteration = true; zSysEDemand.RemainingOutputReqToCoolSP = 0.0; zSysEDemand.RemainingOutputReqToHeatSP = 0.0; @@ -665,8 +666,8 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) QUnitOut = 0.0; QLatOut = 0.0; // init - InitFanCoilUnits(state, FanCoilNum, ZoneNum, ZoneNum); - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); + InitFanCoilUnits(*state, FanCoilNum, ZoneNum, ZoneNum); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ZoneNum, FirstHVACIteration, QUnitOut, QLatOut); // heating mode tests CoolingLoad = false; HeatingLoad = true; @@ -685,9 +686,9 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) QUnitOut = 0.0; QLatOut = 0.0; PLR = 0.0; - SZVAVModel::calcSZVAVModel(state, + SZVAVModel::calcSZVAVModel(*state, SZVAVModel, FanCoilNum, FirstHVACIteration, CoolingLoad, HeatingLoad, QZnReq, OnOffAirFlowRatio, HXUnitOn, AirLoopNum, PLR, CompressorOnFlag); - Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut, PLR); + Calc4PipeFanCoil(*state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut, PLR); EXPECT_NEAR(PLR, 0.092, 0.001); EXPECT_NEAR(QUnitOut, 1000.0, 1.0); @@ -699,9 +700,9 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) QUnitOut = 0.0; QLatOut = 0.0; PLR = 0.0; - SZVAVModel::calcSZVAVModel(state, + SZVAVModel::calcSZVAVModel(*state, SZVAVModel, FanCoilNum, FirstHVACIteration, CoolingLoad, HeatingLoad, QZnReq, OnOffAirFlowRatio, HXUnitOn, AirLoopNum, PLR, CompressorOnFlag); - Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut, PLR); + Calc4PipeFanCoil(*state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut, PLR); EXPECT_NEAR(PLR, 0.492, 0.001); EXPECT_NEAR(QUnitOut, 5000.0, 1.0); @@ -713,9 +714,9 @@ TEST_F(EnergyPlusFixture, SZVAV_FanCoilUnit_Testing) QUnitOut = 0.0; QLatOut = 0.0; PLR = 0.0; - SZVAVModel::calcSZVAVModel(state, + SZVAVModel::calcSZVAVModel(*state, SZVAVModel, FanCoilNum, FirstHVACIteration, CoolingLoad, HeatingLoad, QZnReq, OnOffAirFlowRatio, HXUnitOn, AirLoopNum, PLR, CompressorOnFlag); - Calc4PipeFanCoil(state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut, PLR); + Calc4PipeFanCoil(*state, FanCoilNum, ZoneNum, FirstHVACIteration, QUnitOut, PLR); EXPECT_NEAR(PLR, 0.892, 0.001); EXPECT_NEAR(QUnitOut, 9000.0, 1.0); diff --git a/tst/EnergyPlus/unit/ScheduleManager.unit.cc b/tst/EnergyPlus/unit/ScheduleManager.unit.cc index 7cd0b67df18..38ced86700b 100644 --- a/tst/EnergyPlus/unit/ScheduleManager.unit.cc +++ b/tst/EnergyPlus/unit/ScheduleManager.unit.cc @@ -58,6 +58,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::ScheduleManager; @@ -97,7 +98,7 @@ TEST_F(EnergyPlusFixture, ScheduleManager_UpdateScheduleValues) WeekSchedule(1).DaySchedulePointer.allocate(12); WeekSchedule(2).DaySchedulePointer.allocate(12); WeekSchedule(3).DaySchedulePointer.allocate(12); - state.dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; DaySchedule.allocate(3); DaySchedule(1).TSValue.allocate(1, 24); DaySchedule(2).TSValue.allocate(1, 24); @@ -134,8 +135,8 @@ TEST_F(EnergyPlusFixture, ScheduleManager_UpdateScheduleValues) DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfWeek = 1; DataEnvironment::DayOfWeekTomorrow = 2; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; // check day schedules EXPECT_EQ(DaySchedule(1).TSValue(1, 1), 1.0); // day < 250 points to this schedule @@ -149,31 +150,31 @@ TEST_F(EnergyPlusFixture, ScheduleManager_UpdateScheduleValues) // schedule values are 1 through day 249, 2 for day 250, and 3 for remainder of year DataEnvironment::DayOfYear_Schedule = 1; - UpdateScheduleValues(state); + UpdateScheduleValues(*state); // expect 1.0 on day 1 EXPECT_EQ(Schedule(1).CurrentValue, 1.0); DataEnvironment::DayOfYear_Schedule = 250; - UpdateScheduleValues(state); + UpdateScheduleValues(*state); // expect 2.0 on day 250 EXPECT_EQ(Schedule(1).CurrentValue, 2.0); // test end of day 250 with daylight savings time active - state.dataGlobal->HourOfDay = 24; + state->dataGlobal->HourOfDay = 24; DataEnvironment::DSTIndicator = 1; - UpdateScheduleValues(state); + UpdateScheduleValues(*state); // expect a 3 on day 251, which on day 250 at midnight with DST of hour 1 of day 251 EXPECT_EQ(Schedule(1).CurrentValue, 3.0); - state.dataGlobal->HourOfDay = 2; + state->dataGlobal->HourOfDay = 2; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfYear_Schedule = 251; - UpdateScheduleValues(state); + UpdateScheduleValues(*state); // expect 3.0 for remainder of year regardless of DST EXPECT_EQ(Schedule(1).CurrentValue, 3.0); - state.dataGlobal->HourOfDay = 24; + state->dataGlobal->HourOfDay = 24; DataEnvironment::DSTIndicator = 1; - UpdateScheduleValues(state); + UpdateScheduleValues(*state); EXPECT_EQ(Schedule(1).CurrentValue, 3.0); } @@ -229,23 +230,23 @@ TEST_F(EnergyPlusFixture, ScheduleAnnualFullLoadHours_test) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 15; - int onSchedIndex = GetScheduleIndex(state, "ONSCHED"); - EXPECT_EQ(8760., ScheduleAnnualFullLoadHours(state, onSchedIndex, 1, false)); + int onSchedIndex = GetScheduleIndex(*state, "ONSCHED"); + EXPECT_EQ(8760., ScheduleAnnualFullLoadHours(*state, onSchedIndex, 1, false)); - int offSchedIndex = GetScheduleIndex(state, "OFFSCHED"); - EXPECT_EQ(0., ScheduleAnnualFullLoadHours(state, offSchedIndex, 1, false)); + int offSchedIndex = GetScheduleIndex(*state, "OFFSCHED"); + EXPECT_EQ(0., ScheduleAnnualFullLoadHours(*state, offSchedIndex, 1, false)); - int janOnSchedIndex = GetScheduleIndex(state, "JANONSCHED"); - EXPECT_EQ(744., ScheduleAnnualFullLoadHours(state, janOnSchedIndex, 1, false)); + int janOnSchedIndex = GetScheduleIndex(*state, "JANONSCHED"); + EXPECT_EQ(744., ScheduleAnnualFullLoadHours(*state, janOnSchedIndex, 1, false)); - int halfOnSchedIndex = GetScheduleIndex(state, "HALFONSCHED"); - EXPECT_EQ(4380., ScheduleAnnualFullLoadHours(state, halfOnSchedIndex, 1, false)); + int halfOnSchedIndex = GetScheduleIndex(*state, "HALFONSCHED"); + EXPECT_EQ(4380., ScheduleAnnualFullLoadHours(*state, halfOnSchedIndex, 1, false)); - int halfOnSched2Index = GetScheduleIndex(state, "HALFONSCHED2"); - EXPECT_EQ(4380., ScheduleAnnualFullLoadHours(state, halfOnSched2Index, 1, false)); + int halfOnSched2Index = GetScheduleIndex(*state, "HALFONSCHED2"); + EXPECT_EQ(4380., ScheduleAnnualFullLoadHours(*state, halfOnSched2Index, 1, false)); } TEST_F(EnergyPlusFixture, ScheduleAverageHoursPerWeek_test) @@ -300,23 +301,23 @@ TEST_F(EnergyPlusFixture, ScheduleAverageHoursPerWeek_test) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 15; - int onSchedIndex = GetScheduleIndex(state, "ONSCHED"); - EXPECT_EQ(168., ScheduleAverageHoursPerWeek(state, onSchedIndex, 1, false)); + int onSchedIndex = GetScheduleIndex(*state, "ONSCHED"); + EXPECT_EQ(168., ScheduleAverageHoursPerWeek(*state, onSchedIndex, 1, false)); - int offSchedIndex = GetScheduleIndex(state, "OFFSCHED"); - EXPECT_EQ(0., ScheduleAverageHoursPerWeek(state, offSchedIndex, 1, false)); + int offSchedIndex = GetScheduleIndex(*state, "OFFSCHED"); + EXPECT_EQ(0., ScheduleAverageHoursPerWeek(*state, offSchedIndex, 1, false)); - int janOnSchedIndex = GetScheduleIndex(state, "JANONSCHED"); - EXPECT_NEAR(14.3, ScheduleAverageHoursPerWeek(state, janOnSchedIndex, 1, false), 0.1); + int janOnSchedIndex = GetScheduleIndex(*state, "JANONSCHED"); + EXPECT_NEAR(14.3, ScheduleAverageHoursPerWeek(*state, janOnSchedIndex, 1, false), 0.1); - int halfOnSchedIndex = GetScheduleIndex(state, "HALFONSCHED"); - EXPECT_EQ(84., ScheduleAverageHoursPerWeek(state, halfOnSchedIndex, 1, false)); + int halfOnSchedIndex = GetScheduleIndex(*state, "HALFONSCHED"); + EXPECT_EQ(84., ScheduleAverageHoursPerWeek(*state, halfOnSchedIndex, 1, false)); - int halfOnSched2Index = GetScheduleIndex(state, "HALFONSCHED2"); - EXPECT_EQ(84., ScheduleAverageHoursPerWeek(state, halfOnSched2Index, 1, false)); + int halfOnSched2Index = GetScheduleIndex(*state, "HALFONSCHED2"); + EXPECT_EQ(84., ScheduleAverageHoursPerWeek(*state, halfOnSched2Index, 1, false)); } TEST_F(EnergyPlusFixture, ScheduleHoursGT1perc_test) @@ -379,27 +380,27 @@ TEST_F(EnergyPlusFixture, ScheduleHoursGT1perc_test) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 15; - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->TimeStepZone = 0.25; - int onSchedIndex = GetScheduleIndex(state, "ONSCHED"); - EXPECT_EQ(8760., ScheduleHoursGT1perc(state, onSchedIndex, 1, false)); + int onSchedIndex = GetScheduleIndex(*state, "ONSCHED"); + EXPECT_EQ(8760., ScheduleHoursGT1perc(*state, onSchedIndex, 1, false)); - int offSchedIndex = GetScheduleIndex(state, "OFFSCHED"); - EXPECT_EQ(0., ScheduleHoursGT1perc(state, offSchedIndex, 1, false)); + int offSchedIndex = GetScheduleIndex(*state, "OFFSCHED"); + EXPECT_EQ(0., ScheduleHoursGT1perc(*state, offSchedIndex, 1, false)); - int janOnSchedIndex = GetScheduleIndex(state, "JANONSCHED"); - EXPECT_EQ(744., ScheduleHoursGT1perc(state, janOnSchedIndex, 1, false)); + int janOnSchedIndex = GetScheduleIndex(*state, "JANONSCHED"); + EXPECT_EQ(744., ScheduleHoursGT1perc(*state, janOnSchedIndex, 1, false)); - int halfOnSchedIndex = GetScheduleIndex(state, "HALFONSCHED"); - EXPECT_EQ(4380., ScheduleHoursGT1perc(state, halfOnSchedIndex, 1, false)); + int halfOnSchedIndex = GetScheduleIndex(*state, "HALFONSCHED"); + EXPECT_EQ(4380., ScheduleHoursGT1perc(*state, halfOnSchedIndex, 1, false)); - int halfOnSched2Index = GetScheduleIndex(state, "HALFONSCHED2"); - EXPECT_EQ(8760., ScheduleHoursGT1perc(state, halfOnSched2Index, 1, false)); + int halfOnSched2Index = GetScheduleIndex(*state, "HALFONSCHED2"); + EXPECT_EQ(8760., ScheduleHoursGT1perc(*state, halfOnSched2Index, 1, false)); - int halfOnSched3Index = GetScheduleIndex(state, "HALFONSCHED3"); - EXPECT_EQ(4380., ScheduleHoursGT1perc(state, halfOnSched3Index, 1, false)); + int halfOnSched3Index = GetScheduleIndex(*state, "HALFONSCHED3"); + EXPECT_EQ(4380., ScheduleHoursGT1perc(*state, halfOnSched3Index, 1, false)); } TEST_F(EnergyPlusFixture, ScheduleDayInterval_SimpLinearInterp) @@ -454,71 +455,71 @@ TEST_F(EnergyPlusFixture, ScheduleDayInterval_SimpLinearInterp) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 15; - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->TimeStepZone = 0.25; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - int ASchedIndex = GetScheduleIndex(state, "SCHYR_A"); // interpolate Linear - EXPECT_NEAR(0.001, LookUpScheduleValue(state, ASchedIndex, 7, 4), 0.000001); + int ASchedIndex = GetScheduleIndex(*state, "SCHYR_A"); // interpolate Linear + EXPECT_NEAR(0.001, LookUpScheduleValue(*state, ASchedIndex, 7, 4), 0.000001); // interpolate over one hour - EXPECT_NEAR(25.001, LookUpScheduleValue(state, ASchedIndex, 8, 1), 0.000001); - EXPECT_NEAR(50.001, LookUpScheduleValue(state, ASchedIndex, 8, 2), 0.000001); - EXPECT_NEAR(75.001, LookUpScheduleValue(state, ASchedIndex, 8, 3), 0.000001); - EXPECT_NEAR(100.001, LookUpScheduleValue(state, ASchedIndex, 8, 4), 0.000001); + EXPECT_NEAR(25.001, LookUpScheduleValue(*state, ASchedIndex, 8, 1), 0.000001); + EXPECT_NEAR(50.001, LookUpScheduleValue(*state, ASchedIndex, 8, 2), 0.000001); + EXPECT_NEAR(75.001, LookUpScheduleValue(*state, ASchedIndex, 8, 3), 0.000001); + EXPECT_NEAR(100.001, LookUpScheduleValue(*state, ASchedIndex, 8, 4), 0.000001); // interpolate over two hours - EXPECT_NEAR(125.001, LookUpScheduleValue(state, ASchedIndex, 9, 1), 0.000001); - EXPECT_NEAR(150.001, LookUpScheduleValue(state, ASchedIndex, 9, 2), 0.000001); - EXPECT_NEAR(175.001, LookUpScheduleValue(state, ASchedIndex, 9, 3), 0.000001); - EXPECT_NEAR(200.001, LookUpScheduleValue(state, ASchedIndex, 9, 4), 0.000001); + EXPECT_NEAR(125.001, LookUpScheduleValue(*state, ASchedIndex, 9, 1), 0.000001); + EXPECT_NEAR(150.001, LookUpScheduleValue(*state, ASchedIndex, 9, 2), 0.000001); + EXPECT_NEAR(175.001, LookUpScheduleValue(*state, ASchedIndex, 9, 3), 0.000001); + EXPECT_NEAR(200.001, LookUpScheduleValue(*state, ASchedIndex, 9, 4), 0.000001); - EXPECT_NEAR(225.001, LookUpScheduleValue(state, ASchedIndex, 10, 1), 0.000001); - EXPECT_NEAR(250.001, LookUpScheduleValue(state, ASchedIndex, 10, 2), 0.000001); - EXPECT_NEAR(275.001, LookUpScheduleValue(state, ASchedIndex, 10, 3), 0.000001); - EXPECT_NEAR(300.001, LookUpScheduleValue(state, ASchedIndex, 10, 4), 0.000001); + EXPECT_NEAR(225.001, LookUpScheduleValue(*state, ASchedIndex, 10, 1), 0.000001); + EXPECT_NEAR(250.001, LookUpScheduleValue(*state, ASchedIndex, 10, 2), 0.000001); + EXPECT_NEAR(275.001, LookUpScheduleValue(*state, ASchedIndex, 10, 3), 0.000001); + EXPECT_NEAR(300.001, LookUpScheduleValue(*state, ASchedIndex, 10, 4), 0.000001); // interpolate over four hours - EXPECT_NEAR(325.001, LookUpScheduleValue(state, ASchedIndex, 11, 1), 0.000001); - EXPECT_NEAR(350.001, LookUpScheduleValue(state, ASchedIndex, 11, 2), 0.000001); - EXPECT_NEAR(375.001, LookUpScheduleValue(state, ASchedIndex, 11, 3), 0.000001); - EXPECT_NEAR(400.001, LookUpScheduleValue(state, ASchedIndex, 11, 4), 0.000001); + EXPECT_NEAR(325.001, LookUpScheduleValue(*state, ASchedIndex, 11, 1), 0.000001); + EXPECT_NEAR(350.001, LookUpScheduleValue(*state, ASchedIndex, 11, 2), 0.000001); + EXPECT_NEAR(375.001, LookUpScheduleValue(*state, ASchedIndex, 11, 3), 0.000001); + EXPECT_NEAR(400.001, LookUpScheduleValue(*state, ASchedIndex, 11, 4), 0.000001); - EXPECT_NEAR(525.001, LookUpScheduleValue(state, ASchedIndex, 13, 1), 0.000001); - EXPECT_NEAR(550.001, LookUpScheduleValue(state, ASchedIndex, 13, 2), 0.000001); - EXPECT_NEAR(575.001, LookUpScheduleValue(state, ASchedIndex, 13, 3), 0.000001); - EXPECT_NEAR(600.001, LookUpScheduleValue(state, ASchedIndex, 13, 4), 0.000001); + EXPECT_NEAR(525.001, LookUpScheduleValue(*state, ASchedIndex, 13, 1), 0.000001); + EXPECT_NEAR(550.001, LookUpScheduleValue(*state, ASchedIndex, 13, 2), 0.000001); + EXPECT_NEAR(575.001, LookUpScheduleValue(*state, ASchedIndex, 13, 3), 0.000001); + EXPECT_NEAR(600.001, LookUpScheduleValue(*state, ASchedIndex, 13, 4), 0.000001); // interpolate over one hour - decreasing - EXPECT_NEAR(675.001, LookUpScheduleValue(state, ASchedIndex, 15, 1), 0.000001); - EXPECT_NEAR(650.001, LookUpScheduleValue(state, ASchedIndex, 15, 2), 0.000001); - EXPECT_NEAR(625.001, LookUpScheduleValue(state, ASchedIndex, 15, 3), 0.000001); - EXPECT_NEAR(600.001, LookUpScheduleValue(state, ASchedIndex, 15, 4), 0.000001); + EXPECT_NEAR(675.001, LookUpScheduleValue(*state, ASchedIndex, 15, 1), 0.000001); + EXPECT_NEAR(650.001, LookUpScheduleValue(*state, ASchedIndex, 15, 2), 0.000001); + EXPECT_NEAR(625.001, LookUpScheduleValue(*state, ASchedIndex, 15, 3), 0.000001); + EXPECT_NEAR(600.001, LookUpScheduleValue(*state, ASchedIndex, 15, 4), 0.000001); // interpolate over four hours - decreasing - EXPECT_NEAR(375.001, LookUpScheduleValue(state, ASchedIndex, 18, 1), 0.000001); - EXPECT_NEAR(350.001, LookUpScheduleValue(state, ASchedIndex, 18, 2), 0.000001); - EXPECT_NEAR(325.001, LookUpScheduleValue(state, ASchedIndex, 18, 3), 0.000001); - EXPECT_NEAR(300.001, LookUpScheduleValue(state, ASchedIndex, 18, 4), 0.000001); + EXPECT_NEAR(375.001, LookUpScheduleValue(*state, ASchedIndex, 18, 1), 0.000001); + EXPECT_NEAR(350.001, LookUpScheduleValue(*state, ASchedIndex, 18, 2), 0.000001); + EXPECT_NEAR(325.001, LookUpScheduleValue(*state, ASchedIndex, 18, 3), 0.000001); + EXPECT_NEAR(300.001, LookUpScheduleValue(*state, ASchedIndex, 18, 4), 0.000001); - EXPECT_NEAR(275.001, LookUpScheduleValue(state, ASchedIndex, 19, 1), 0.000001); - EXPECT_NEAR(250.001, LookUpScheduleValue(state, ASchedIndex, 19, 2), 0.000001); - EXPECT_NEAR(225.001, LookUpScheduleValue(state, ASchedIndex, 19, 3), 0.000001); - EXPECT_NEAR(200.001, LookUpScheduleValue(state, ASchedIndex, 19, 4), 0.000001); + EXPECT_NEAR(275.001, LookUpScheduleValue(*state, ASchedIndex, 19, 1), 0.000001); + EXPECT_NEAR(250.001, LookUpScheduleValue(*state, ASchedIndex, 19, 2), 0.000001); + EXPECT_NEAR(225.001, LookUpScheduleValue(*state, ASchedIndex, 19, 3), 0.000001); + EXPECT_NEAR(200.001, LookUpScheduleValue(*state, ASchedIndex, 19, 4), 0.000001); } TEST_F(EnergyPlusFixture, ScheduleDayInterval_PartialHourLinearInterp) @@ -567,31 +568,31 @@ TEST_F(EnergyPlusFixture, ScheduleDayInterval_PartialHourLinearInterp) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 15; - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->TimeStepZone = 0.25; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - int ASchedIndex = GetScheduleIndex(state, "SCHYR_A"); // interpolate Linear - EXPECT_NEAR(0.001, LookUpScheduleValue(state, ASchedIndex, 7, 4), 0.000001); + int ASchedIndex = GetScheduleIndex(*state, "SCHYR_A"); // interpolate Linear + EXPECT_NEAR(0.001, LookUpScheduleValue(*state, ASchedIndex, 7, 4), 0.000001); // interpolate over first half hour - EXPECT_NEAR(25.001, LookUpScheduleValue(state, ASchedIndex, 8, 1), 0.000001); - EXPECT_NEAR(50.001, LookUpScheduleValue(state, ASchedIndex, 8, 2), 0.000001); + EXPECT_NEAR(25.001, LookUpScheduleValue(*state, ASchedIndex, 8, 1), 0.000001); + EXPECT_NEAR(50.001, LookUpScheduleValue(*state, ASchedIndex, 8, 2), 0.000001); // interpolate over second half hour - EXPECT_NEAR(75.001, LookUpScheduleValue(state, ASchedIndex, 8, 3), 0.000001); - EXPECT_NEAR(100.001, LookUpScheduleValue(state, ASchedIndex, 8, 4), 0.000001); + EXPECT_NEAR(75.001, LookUpScheduleValue(*state, ASchedIndex, 8, 3), 0.000001); + EXPECT_NEAR(100.001, LookUpScheduleValue(*state, ASchedIndex, 8, 4), 0.000001); } TEST_F(EnergyPlusFixture, ScheduleDayInterval_LinearInterpIntervalNotTimestep) @@ -640,31 +641,31 @@ TEST_F(EnergyPlusFixture, ScheduleDayInterval_LinearInterpIntervalNotTimestep) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 15; - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->TimeStepZone = 0.25; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - int ASchedIndex = GetScheduleIndex(state, "SCHYR_A"); // interpolate Linear - EXPECT_NEAR(0.0, LookUpScheduleValue(state, ASchedIndex, 7, 4), 0.000001); + int ASchedIndex = GetScheduleIndex(*state, "SCHYR_A"); // interpolate Linear + EXPECT_NEAR(0.0, LookUpScheduleValue(*state, ASchedIndex, 7, 4), 0.000001); // interpolate over first half hour - EXPECT_NEAR(25.0, LookUpScheduleValue(state, ASchedIndex, 8, 1), 0.000001); - EXPECT_NEAR(50.0, LookUpScheduleValue(state, ASchedIndex, 8, 2), 0.000001); + EXPECT_NEAR(25.0, LookUpScheduleValue(*state, ASchedIndex, 8, 1), 0.000001); + EXPECT_NEAR(50.0, LookUpScheduleValue(*state, ASchedIndex, 8, 2), 0.000001); // interpolate over second half hour - EXPECT_NEAR(75.0, LookUpScheduleValue(state, ASchedIndex, 8, 3), 0.000001); - EXPECT_NEAR(100.0, LookUpScheduleValue(state, ASchedIndex, 8, 4), 0.000001); + EXPECT_NEAR(75.0, LookUpScheduleValue(*state, ASchedIndex, 8, 3), 0.000001); + EXPECT_NEAR(100.0, LookUpScheduleValue(*state, ASchedIndex, 8, 4), 0.000001); } TEST_F(EnergyPlusFixture, ScheduleYearMaxItems) @@ -776,35 +777,35 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - state.dataGlobal->TimeStepZone = 0.25; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); + state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules DataEnvironment::Month = 5; DataEnvironment::DayOfMonth = 31; - state.dataGlobal->HourOfDay = 24; + state->dataGlobal->HourOfDay = 24; DataEnvironment::DayOfWeek = 4; DataEnvironment::DayOfWeekTomorrow = 5; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); DataEnvironment::DSTIndicator = 0; // DST IS OFF - ScheduleManager::UpdateScheduleValues(state); - EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + ScheduleManager::UpdateScheduleValues(*state); + EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); EXPECT_EQ(1.0, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(state, 1)); + EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); DataEnvironment::DSTIndicator = 1; // DST IS ON - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); // Since DST is on, you're actually on the next day, on 6/1 at 1:00 // so it **should** return 3.0 EXPECT_EQ(3.0, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(3.0, ScheduleManager::GetCurrentScheduleValue(state, 1)); - EXPECT_EQ(3.0, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + EXPECT_EQ(3.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); + EXPECT_EQ(3.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); } TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_SouthernHemisphere) @@ -825,35 +826,35 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_SouthernHemispher ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - state.dataGlobal->TimeStepZone = 0.25; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); + state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 31; - state.dataGlobal->HourOfDay = 24; + state->dataGlobal->HourOfDay = 24; DataEnvironment::DayOfWeek = 4; DataEnvironment::DayOfWeekTomorrow = 5; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); DataEnvironment::DSTIndicator = 0; // DST IS OFF - ScheduleManager::UpdateScheduleValues(state); - EXPECT_EQ(2.0, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + ScheduleManager::UpdateScheduleValues(*state); + EXPECT_EQ(2.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); EXPECT_EQ(2.0, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(2.0, ScheduleManager::GetCurrentScheduleValue(state, 1)); + EXPECT_EQ(2.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); DataEnvironment::DSTIndicator = 1; // DST IS ON - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); // Since DST is on, you're actually on the next day, which in this specific case should be 1/1 at 0:15 // so it **should** return 1.0 EXPECT_EQ(1.0, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(state, 1)); - EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); + EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); } @@ -886,11 +887,11 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_Leap) { // # 'FOR' => Number of additional day schedules // So we use 366 Week Schedules, all with one day (LeapYear) DataEnvironment::CurrentYearIsLeapYear = true; - state.dataWeatherManager->WFAllowsLeapYears = true; - state.dataWeatherManager->LeapYearAdd = 1; + state->dataWeatherManager->WFAllowsLeapYears = true; + state->dataWeatherManager->LeapYearAdd = 1; int nDays = 366; - state.dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->NumOfTimeStepInHour = 4; ScheduleManager::ScheduleInputProcessed = true; EXPECT_TRUE(ScheduleManager::ScheduleInputProcessed); @@ -911,7 +912,7 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_Leap) { } ScheduleManager::DaySchedule(day).TSValue.allocate(4, 24); for (int whichHour = 1; whichHour <= 24; whichHour++) { - for (int TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { + for (int TS = 1; TS <= state->dataGlobal->NumOfTimeStepInHour; ++TS) { ScheduleManager::DaySchedule(day).TSValue(TS, whichHour) = whichHour + (day-1) * 24; } } @@ -922,34 +923,34 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_Leap) { EXPECT_EQ(366, ScheduleManager::WeekSchedule(366).DaySchedulePointer(2)); EXPECT_EQ(8784.0, ScheduleManager::DaySchedule(366).TSValue(4, 24)); - state.dataGlobal->NumOfTimeStepInHour = state.dataGlobal->NumOfTimeStepInHour; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - state.dataGlobal->TimeStepZone = 0.25; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); + state->dataGlobal->NumOfTimeStepInHour = state->dataGlobal->NumOfTimeStepInHour; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 31; - state.dataGlobal->HourOfDay = 24; + state->dataGlobal->HourOfDay = 24; DataEnvironment::DayOfWeek = 2; DataEnvironment::DayOfWeekTomorrow = 3; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); EXPECT_EQ(366, DataEnvironment::DayOfYear_Schedule); DataEnvironment::DSTIndicator = 0; // DST IS OFF - ScheduleManager::UpdateScheduleValues(state); - EXPECT_EQ(8784.0, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + ScheduleManager::UpdateScheduleValues(*state); + EXPECT_EQ(8784.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); EXPECT_EQ(8784.0, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(8784.0, ScheduleManager::GetCurrentScheduleValue(state, 1)); + EXPECT_EQ(8784.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); DataEnvironment::DSTIndicator = 1; // DST IS ON - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); // Since DST is on, you're actually on the next day, which in this specific case should be 1/1 at 0:15 // so it **should** return 1.0 EXPECT_EQ(1.0, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(state, 1)); - EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); + EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); Array1D_int EndDayOfMonth(12, {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}); @@ -978,14 +979,14 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_Leap) { for (int hr = 1; hr <= 24; ++hr) { ++HourOfYear; - state.dataGlobal->HourOfDay = hr; + state->dataGlobal->HourOfDay = hr; for (int ts = 1; ts <= 4; ++ts) { - state.dataGlobal->TimeStep = ts; + state->dataGlobal->TimeStep = ts; - ScheduleManager::UpdateScheduleValues(state); - EXPECT_EQ(HourOfYear, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + ScheduleManager::UpdateScheduleValues(*state); + EXPECT_EQ(HourOfYear, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); EXPECT_EQ(HourOfYear, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(HourOfYear, ScheduleManager::GetCurrentScheduleValue(state, 1)); + EXPECT_EQ(HourOfYear, ScheduleManager::GetCurrentScheduleValue(*state, 1)); } } } @@ -1017,18 +1018,18 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_Leap) { for (int hr = 1; hr <= 24; ++hr) { ++HourOfYear; - state.dataGlobal->HourOfDay = hr; + state->dataGlobal->HourOfDay = hr; for (int ts = 1; ts <= 4; ++ts) { - state.dataGlobal->TimeStep = ts; + state->dataGlobal->TimeStep = ts; - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); int thisHourOfYear = HourOfYear + 1; if (thisHourOfYear > 8784.0) { thisHourOfYear = 1; } - EXPECT_EQ(thisHourOfYear, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + EXPECT_EQ(thisHourOfYear, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); EXPECT_EQ(thisHourOfYear, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(thisHourOfYear, ScheduleManager::GetCurrentScheduleValue(state, 1)); + EXPECT_EQ(thisHourOfYear, ScheduleManager::GetCurrentScheduleValue(*state, 1)); } } } @@ -1067,12 +1068,12 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_NoLeap) { // # 'FOR' => Number of additional day schedules // So we use 366 Week Schedules, all with one day (LeapYear) DataEnvironment::CurrentYearIsLeapYear = false; - state.dataWeatherManager->WFAllowsLeapYears = false; - state.dataWeatherManager->LeapYearAdd = 0; + state->dataWeatherManager->WFAllowsLeapYears = false; + state->dataWeatherManager->LeapYearAdd = 0; // ScheduleManager always assume LeapYear really. int nDays = 365; - state.dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->NumOfTimeStepInHour = 4; ScheduleManager::ScheduleInputProcessed = true; EXPECT_TRUE(ScheduleManager::ScheduleInputProcessed); @@ -1104,7 +1105,7 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_NoLeap) { } ScheduleManager::DaySchedule(dayOfYear).TSValue.allocate(4, 24); for (int whichHour = 1; whichHour <= 24; whichHour++) { - for (int TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { + for (int TS = 1; TS <= state->dataGlobal->NumOfTimeStepInHour; ++TS) { ScheduleManager::DaySchedule(dayOfYear).TSValue(TS, whichHour) = whichHour + (dayOfYear-1) * 24; } } @@ -1131,34 +1132,34 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_NoLeap) { EXPECT_EQ(365, ScheduleManager::WeekSchedule(366).DaySchedulePointer(1)); EXPECT_EQ(8760.0, ScheduleManager::DaySchedule(365).TSValue(4, 24)); - state.dataGlobal->NumOfTimeStepInHour = state.dataGlobal->NumOfTimeStepInHour; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - state.dataGlobal->TimeStepZone = 0.25; - state.dataGlobal->TimeStepZoneSec = state.dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); + state->dataGlobal->NumOfTimeStepInHour = state->dataGlobal->NumOfTimeStepInHour; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + state->dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->TimeStepZoneSec = state->dataGlobal->TimeStepZone * DataGlobalConstants::SecInHour(); DataEnvironment::Month = 12; DataEnvironment::DayOfMonth = 31; - state.dataGlobal->HourOfDay = 24; + state->dataGlobal->HourOfDay = 24; DataEnvironment::DayOfWeek = 1; DataEnvironment::DayOfWeekTomorrow = 2; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); EXPECT_EQ(366, DataEnvironment::DayOfYear_Schedule); DataEnvironment::DSTIndicator = 0; // DST IS OFF - ScheduleManager::UpdateScheduleValues(state); - EXPECT_EQ(8760.0, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + ScheduleManager::UpdateScheduleValues(*state); + EXPECT_EQ(8760.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); EXPECT_EQ(8760.0, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(8760.0, ScheduleManager::GetCurrentScheduleValue(state, 1)); + EXPECT_EQ(8760.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); DataEnvironment::DSTIndicator = 1; // DST IS ON - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); // Since DST is on, you're actually on the next day, which in this specific case should be 1/1 at 0:15 // so it **should** return 1.0 EXPECT_EQ(1.0, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(state, 1)); - EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + EXPECT_EQ(1.0, ScheduleManager::GetCurrentScheduleValue(*state, 1)); + EXPECT_EQ(1.0, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); { DataEnvironment::DSTIndicator = 0; // DST IS OFF @@ -1183,14 +1184,14 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_NoLeap) { for (int hr = 1; hr <= 24; ++hr) { ++HourOfYear; - state.dataGlobal->HourOfDay = hr; + state->dataGlobal->HourOfDay = hr; for (int ts = 1; ts <= 4; ++ts) { - state.dataGlobal->TimeStep = ts; + state->dataGlobal->TimeStep = ts; - ScheduleManager::UpdateScheduleValues(state); - EXPECT_EQ(HourOfYear, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + ScheduleManager::UpdateScheduleValues(*state); + EXPECT_EQ(HourOfYear, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); EXPECT_EQ(HourOfYear, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(HourOfYear, ScheduleManager::GetCurrentScheduleValue(state, 1)); + EXPECT_EQ(HourOfYear, ScheduleManager::GetCurrentScheduleValue(*state, 1)); } } } @@ -1222,18 +1223,18 @@ TEST_F(EnergyPlusFixture, Schedule_GetCurrentScheduleValue_DST_RampUp_NoLeap) { for (int hr = 1; hr <= 24; ++hr) { ++HourOfYear; - state.dataGlobal->HourOfDay = hr; + state->dataGlobal->HourOfDay = hr; for (int ts = 1; ts <= 4; ++ts) { - state.dataGlobal->TimeStep = ts; + state->dataGlobal->TimeStep = ts; - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); int thisHourOfYear = HourOfYear + 1; if (thisHourOfYear > 8760.0) { thisHourOfYear = 1; } - EXPECT_EQ(thisHourOfYear, ScheduleManager::LookUpScheduleValue(state, 1, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep)); + EXPECT_EQ(thisHourOfYear, ScheduleManager::LookUpScheduleValue(*state, 1, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep)); EXPECT_EQ(thisHourOfYear, ScheduleManager::Schedule(1).CurrentValue); - EXPECT_EQ(thisHourOfYear, ScheduleManager::GetCurrentScheduleValue(state, 1)); + EXPECT_EQ(thisHourOfYear, ScheduleManager::GetCurrentScheduleValue(*state, 1)); } } } diff --git a/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc b/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc index bbe2d8ee1ca..b4afef2935f 100644 --- a/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc +++ b/tst/EnergyPlus/unit/SecondaryDXCoils.unit.cc @@ -66,6 +66,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace DXCoils; @@ -93,7 +94,7 @@ TEST_F(EnergyPlusFixture, SecondaryDXCoolingCoilSingleSpeed_Test1) DXCoil(DXCoilNum).ElecCoolingPower = 500.0; DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; - CalcSecondaryDXCoils(state, DXCoilNum); + CalcSecondaryDXCoils(*state, DXCoilNum); EXPECT_DOUBLE_EQ(5500.0, DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); // cleanup @@ -114,7 +115,7 @@ TEST_F(EnergyPlusFixture, SecondaryDXCoolingCoilTwoSpeed_Test2) DXCoil(DXCoilNum).ElecCoolingPower = 500.0; DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; - CalcSecondaryDXCoils(state, DXCoilNum); + CalcSecondaryDXCoils(*state, DXCoilNum); EXPECT_DOUBLE_EQ(5500.0, DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); // cleanup @@ -135,7 +136,7 @@ TEST_F(EnergyPlusFixture, SecondaryDXCoolingCoilMultiSpeed_Test3) DXCoil(DXCoilNum).ElecCoolingPower = 500.0; DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate = 0.0; - CalcSecondaryDXCoils(state, DXCoilNum); + CalcSecondaryDXCoils(*state, DXCoilNum); EXPECT_DOUBLE_EQ(5500.0, DXCoil(DXCoilNum).SecCoilSensibleHeatGainRate); // cleanup @@ -173,7 +174,7 @@ TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilSingleSpeed_Test4) Node(DXCoil(DXCoilNum).AirInNode).Temp = 20.0; InitializePsychRoutines(); - CalcSecondaryDXCoils(state, DXCoilNum); + CalcSecondaryDXCoils(*state, DXCoilNum); EXPECT_DOUBLE_EQ(-5000.0, DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate); EXPECT_DOUBLE_EQ(1.0, DXCoil(DXCoilNum).SecCoilSHR); @@ -196,7 +197,7 @@ TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilSingleSpeed_Test4) // make the call SHRTest = - CalcSecondaryDXCoilsSHR(state, DXCoilNum, EvapAirMassFlow, TotalHeatRemovalRate, PartLoadRatio, SecCoilRatedSHR, EvapInletDryBulb, EvapInletHumRat, + CalcSecondaryDXCoilsSHR(*state, DXCoilNum, EvapAirMassFlow, TotalHeatRemovalRate, PartLoadRatio, SecCoilRatedSHR, EvapInletDryBulb, EvapInletHumRat, EvapInletWetBulb, EvapInletEnthalpy, CondInletDryBulb, SecCoilFlowFraction, SecCoilSHRFT, SecCoilSHRFF); EXPECT_DOUBLE_EQ(1.0, SHRTest); @@ -254,7 +255,7 @@ TEST_F(EnergyPlusFixture, SecondaryDXHeatingCoilMultiSpeed_Test5) Node(DXCoil(DXCoilNum).AirInNode).Temp = 20.0; InitializePsychRoutines(); - CalcSecondaryDXCoils(state, DXCoilNum); + CalcSecondaryDXCoils(*state, DXCoilNum); EXPECT_DOUBLE_EQ(-5000.0, DXCoil(DXCoilNum).SecCoilTotalHeatRemovalRate); EXPECT_DOUBLE_EQ(1.0, DXCoil(DXCoilNum).SecCoilSHR); diff --git a/tst/EnergyPlus/unit/SetPointManager.unit.cc b/tst/EnergyPlus/unit/SetPointManager.unit.cc index 19bbe003f7c..6b70c69a4c8 100644 --- a/tst/EnergyPlus/unit/SetPointManager.unit.cc +++ b/tst/EnergyPlus/unit/SetPointManager.unit.cc @@ -83,6 +83,7 @@ #include #include #include +#include using namespace EnergyPlus; @@ -121,7 +122,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineReturnWaterChWSetPointManager) // test 1: normal, in range DataLoopNode::Node(1).Temp = 11; DataLoopNode::Node(2).Temp = 7; - mySPM.calculate(state, DataLoopNode::Node(1), DataLoopNode::Node(2)); + mySPM.calculate(*state, DataLoopNode::Node(1), DataLoopNode::Node(2)); // on the first pass through it should detect the plant loop it manages EXPECT_EQ(1, mySPM.plantLoopIndex); // with a delta T of 4, and a target return of 12, it should produce 8 @@ -130,14 +131,14 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineReturnWaterChWSetPointManager) // test 2: hit the maximum reset range DataLoopNode::Node(1).Temp = 8; DataLoopNode::Node(2).Temp = 7; - mySPM.calculate(state, DataLoopNode::Node(1), DataLoopNode::Node(2)); + mySPM.calculate(*state, DataLoopNode::Node(1), DataLoopNode::Node(2)); // with a delta T of 1, and a target return of 12, it should try to produce 11, but be capped at 10 EXPECT_EQ(10, mySPM.currentSupplySetPt); // test 3: hit the minimum reset range DataLoopNode::Node(1).Temp = 13; DataLoopNode::Node(2).Temp = 7; - mySPM.calculate(state, DataLoopNode::Node(1), DataLoopNode::Node(2)); + mySPM.calculate(*state, DataLoopNode::Node(1), DataLoopNode::Node(2)); // with a delta T of 6, and a target return of 12, it should try to produce 6, but be capped at 7 EXPECT_EQ(7, mySPM.currentSupplySetPt); @@ -164,7 +165,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineReturnWaterChWSetPointManager) DataLoopNode::Node(2).MassFlowRate = 1.0; DataPlant::PlantLoop(1).LoopSide(2).NodeNumOut = 5; // Supply outlet, supply mySPM.plantLoopIndex = 0; - mySPM.calculate(state, DataLoopNode::Node(1), DataLoopNode::Node(2)); + mySPM.calculate(*state, DataLoopNode::Node(1), DataLoopNode::Node(2)); // this time it shouldn't detect which plant it was found on EXPECT_EQ(0, mySPM.plantLoopIndex); // with a delta T of 4, and a target return of 12, it should produce 8 @@ -211,7 +212,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineReturnWaterHWSetPointManager) // test 1: normal, in range DataLoopNode::Node(1).Temp = 56; - mySPM.calculate(state, DataLoopNode::Node(1), DataLoopNode::Node(2)); + mySPM.calculate(*state, DataLoopNode::Node(1), DataLoopNode::Node(2)); // on the first pass through it should detect the plant loop it manages EXPECT_EQ(1, mySPM.plantLoopIndex); // with a delta T of 4, and a target return of 55, it should produce 59 @@ -219,13 +220,13 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineReturnWaterHWSetPointManager) // test 2: hit the minimum reset range DataLoopNode::Node(1).Temp = 59; - mySPM.calculate(state, DataLoopNode::Node(1), DataLoopNode::Node(2)); + mySPM.calculate(*state, DataLoopNode::Node(1), DataLoopNode::Node(2)); // with a delta T of 1, and a target return of 55, it should try to produce 56, but be capped at 57 EXPECT_EQ(57, mySPM.currentSupplySetPt); // test 3: hit the maximum reset range DataLoopNode::Node(1).Temp = 54; - mySPM.calculate(state, DataLoopNode::Node(1), DataLoopNode::Node(2)); + mySPM.calculate(*state, DataLoopNode::Node(1), DataLoopNode::Node(2)); // with a delta T of 6, and a target return of 55, it should try to produce 61, but be capped at 60 EXPECT_EQ(60, mySPM.currentSupplySetPt); @@ -249,7 +250,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineReturnWaterHWSetPointManager) DataLoopNode::Node(2).MassFlowRate = 1.0; DataPlant::PlantLoop(1).LoopSide(2).NodeNumOut = 5; // Supply outlet, supply mySPM.plantLoopIndex = 0; - mySPM.calculate(state, DataLoopNode::Node(1), DataLoopNode::Node(2)); + mySPM.calculate(*state, DataLoopNode::Node(1), DataLoopNode::Node(2)); // this time it shouldn't detect which plant it was found on EXPECT_EQ(0, mySPM.plantLoopIndex); // with a delta T of 4, and a target return of 55, it should produce 59 @@ -334,14 +335,14 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineCondEntSetPointManager) "For: AllDays, !- Field 2", "Until: 24:00,30.0; !- Field 3"}); ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 60 / state.dataGlobal->NumOfTimeStepInHour; - ScheduleManager::ProcessScheduleInput(state); - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + ScheduleManager::ProcessScheduleInput(*state); + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DayOfWeek = 1; DataEnvironment::DayOfYear_Schedule = 1; - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); // a few constants for convenience int const evapOutletNodeNum = 1; @@ -379,10 +380,10 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineCondEntSetPointManager) DataLoopNode::Node(condInletNodeNum).Temp = 10; SetPointManager::DefineCondEntSetPointManager thisSPM; - thisSPM.MinTwrWbCurve = CurveManager::GetCurveIndex(state, "MINDSNWBCURVENAME"); - thisSPM.MinOaWbCurve = CurveManager::GetCurveIndex(state, "MINACTWBCURVENAME"); - thisSPM.OptCondEntCurve = CurveManager::GetCurveIndex(state, "OPTCONDENTCURVENAME"); - thisSPM.CondEntTempSchedPtr = ScheduleManager::GetScheduleIndex(state, "CONDENSER LOOP TEMP SCHEDULE"); + thisSPM.MinTwrWbCurve = CurveManager::GetCurveIndex(*state, "MINDSNWBCURVENAME"); + thisSPM.MinOaWbCurve = CurveManager::GetCurveIndex(*state, "MINACTWBCURVENAME"); + thisSPM.OptCondEntCurve = CurveManager::GetCurveIndex(*state, "OPTCONDENTCURVENAME"); + thisSPM.CondEntTempSchedPtr = ScheduleManager::GetScheduleIndex(*state, "CONDENSER LOOP TEMP SCHEDULE"); thisSPM.LoopIndexPlantSide = chwLoopIndex; thisSPM.ChillerIndexPlantSide = chillerBranchChW; thisSPM.BranchIndexPlantSide = chillerCompIndex; @@ -395,7 +396,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineCondEntSetPointManager) DataPlant::PlantLoop(1).CoolingDemand = 4700; // Now call and check - thisSPM.calculate(state); + thisSPM.calculate(*state); EXPECT_NEAR(designCondenserEnteringTemp + 1.0, thisSPM.SetPt, 0.001); // switch: Weighted ratio < 9 || etc... @@ -407,7 +408,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineCondEntSetPointManager) thisSPM.MinimumLiftTD = 2; // Now call and check - thisSPM.calculate(state); + thisSPM.calculate(*state); EXPECT_NEAR(32, thisSPM.SetPt, 0.001); // switch: ELSE @@ -416,7 +417,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineCondEntSetPointManager) thisSPM.MinimumLiftTD = 5; // Now call and check - thisSPM.calculate(state); + thisSPM.calculate(*state); EXPECT_NEAR(30, thisSPM.SetPt, 0.001); } @@ -543,37 +544,37 @@ TEST_F(EnergyPlusFixture, CalcScheduledTESSetPoint) "Schedule:Constant,MyScheduleOff,,0;", })); ASSERT_TRUE(process_idf(idf_contents)); - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 60 / state.dataGlobal->NumOfTimeStepInHour; - ScheduleManager::ProcessScheduleInput(state); - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + ScheduleManager::ProcessScheduleInput(*state); + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DayOfWeek = 1; DataEnvironment::DayOfYear_Schedule = 1; - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); SetPointManager::SchTESSetPtMgr(schManNum).CompOpType = CoolOpComp; SetPointManager::SchTESSetPtMgr(schManNum).SchedPtr = OnSched; - SetPointManager::SchTESSetPtMgr(schManNum).calculate(state); + SetPointManager::SchTESSetPtMgr(schManNum).calculate(*state); EXPECT_EQ(SetPointManager::SchTESSetPtMgr(schManNum).NonChargeCHWTemp, SetPointManager::SchTESSetPtMgr(schManNum).SetPt); SetPointManager::SchTESSetPtMgr(schManNum).SchedPtr = OffSched; SetPointManager::SchTESSetPtMgr(schManNum).SchedPtrCharge = OffSched; - SetPointManager::SchTESSetPtMgr(schManNum).calculate(state); + SetPointManager::SchTESSetPtMgr(schManNum).calculate(*state); EXPECT_EQ(SetPointManager::SchTESSetPtMgr(schManNum).NonChargeCHWTemp, SetPointManager::SchTESSetPtMgr(schManNum).SetPt); SetPointManager::SchTESSetPtMgr(schManNum).SchedPtr = OffSched; SetPointManager::SchTESSetPtMgr(schManNum).SchedPtrCharge = OnSched; - SetPointManager::SchTESSetPtMgr(schManNum).calculate(state); + SetPointManager::SchTESSetPtMgr(schManNum).calculate(*state); EXPECT_EQ(SetPointManager::SchTESSetPtMgr(schManNum).ChargeCHWTemp, SetPointManager::SchTESSetPtMgr(schManNum).SetPt); SetPointManager::SchTESSetPtMgr(schManNum).CompOpType = DualOpComp; - SetPointManager::SchTESSetPtMgr(schManNum).calculate(state); + SetPointManager::SchTESSetPtMgr(schManNum).calculate(*state); EXPECT_EQ(SetPointManager::SchTESSetPtMgr(schManNum).NonChargeCHWTemp, SetPointManager::SchTESSetPtMgr(schManNum).SetPt); } @@ -594,18 +595,18 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataHeatBalance::Zone(1).Name = "KITCHEN"; - state.dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow.allocate(1); DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataZoneEnergyDemands::DeadBandOrSetback.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).OASysOutletNodeNum = NodeInputManager::GetOnlySingleNode(state, "FAN INLET NODE", + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).OASysOutletNodeNum = NodeInputManager::GetOnlySingleNode(*state, "FAN INLET NODE", ErrorsFound, "FAN", "SZRHtest", @@ -614,7 +615,7 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) 1, DataLoopNode::ObjectIsNotParent, "AHU node"); - state.dataAirSystemsData->PrimaryAirSystems(1).OASysInletNodeNum = NodeInputManager::GetOnlySingleNode(state, "RETURN NODE", + state->dataAirSystemsData->PrimaryAirSystems(1).OASysInletNodeNum = NodeInputManager::GetOnlySingleNode(*state, "RETURN NODE", ErrorsFound, "OA MIXER", "SZRHtest", @@ -623,7 +624,7 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) 1, DataLoopNode::ObjectIsNotParent, "AHU node"); - state.dataAirSystemsData->PrimaryAirSystems(1).OAMixOAInNodeNum = NodeInputManager::GetOnlySingleNode(state, "OA INLET TO MIXER", + state->dataAirSystemsData->PrimaryAirSystems(1).OAMixOAInNodeNum = NodeInputManager::GetOnlySingleNode(*state, "OA INLET TO MIXER", ErrorsFound, "OA MIXER", "SZRHtest", @@ -632,13 +633,13 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) 1, DataLoopNode::ObjectIsNotParent, "AHU node"); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).InletBranchNum.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).InletBranchNum(1) = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).InletBranchNum.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).InletBranchNum(1) = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumIn = NodeInputManager::GetOnlySingleNode(state, "RETURN NODE", + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumIn = NodeInputManager::GetOnlySingleNode(*state, "RETURN NODE", ErrorsFound, "OAsysinlet", "SZRHtest", @@ -647,11 +648,11 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) 1, DataLoopNode::ObjectIsNotParent, "AHU node"); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "Fan:ConstantVolume"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "Fan:ConstantVolume"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).NodeNumIn = NodeInputManager::GetOnlySingleNode(state, "FAN INLET NODE", + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).NodeNumIn = NodeInputManager::GetOnlySingleNode(*state, "FAN INLET NODE", ErrorsFound, "FAN", "SZRHtest", @@ -661,7 +662,7 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) DataLoopNode::ObjectIsNotParent, "AHU node"); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).NodeNumOut = NodeInputManager::GetOnlySingleNode(state, "FAN OUTLET NODE", + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).NodeNumOut = NodeInputManager::GetOnlySingleNode(*state, "FAN OUTLET NODE", ErrorsFound, "FAN", "SZRHtest", @@ -678,7 +679,7 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).AirDistUnitCool.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).AirDistUnitHeat.allocate(1); - int zoneAirNode = NodeInputManager::GetOnlySingleNode(state, "KITCHEN AIR NODE", + int zoneAirNode = NodeInputManager::GetOnlySingleNode(*state, "KITCHEN AIR NODE", ErrorsFound, "Zone", "SZRHspmTest", @@ -688,7 +689,7 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) DataLoopNode::ObjectIsNotParent, "Test zone node"); DataZoneEquipment::ZoneEquipConfig(1).ZoneNode = zoneAirNode; - int zoneInletNode = NodeInputManager::GetOnlySingleNode(state, "KITCHEN DIRECT AIR INLET NODE NAME", + int zoneInletNode = NodeInputManager::GetOnlySingleNode(*state, "KITCHEN DIRECT AIR INLET NODE NAME", ErrorsFound, "Zone", "SZRHspmTest", @@ -700,17 +701,17 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) DataZoneEquipment::ZoneEquipConfig(1).InletNode(1) = zoneInletNode; DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum(1) = 1; - SetPointManager::GetSetPointManagerInputs(state); + SetPointManager::GetSetPointManagerInputs(*state); EXPECT_EQ(SetPointManager::SingZoneRhSetPtMgr(1).ControlZoneNum, 1); SetPointManager::SingZoneRhSetPtMgr(1).AirLoopNum = 1; DataZoneEquipment::ZoneEquipInputsFilled = true; - state.dataAirLoop->AirLoopInputsFilled = true; + state->dataAirLoop->AirLoopInputsFilled = true; - SetPointManager::InitSetPointManagers(state); + SetPointManager::InitSetPointManagers(*state); - state.dataAirLoop->AirLoopFlow(1).OAFrac = 1.0; - state.dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.8; + state->dataAirLoop->AirLoopFlow(1).OAFrac = 1.0; + state->dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.8; DataLoopNode::Node(zoneInletNode).MassFlowRate = 1.0; // set zone inlet mass flow DataLoopNode::Node(zoneInletNode).HumRat = 0.0008; @@ -737,8 +738,8 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) DataLoopNode::Node(3).Temp = 16.0; DataLoopNode::Node(3).Enthalpy = Psychrometrics::PsyHFnTdbW(DataLoopNode::Node(3).Temp, DataLoopNode::Node(3).HumRat); - SetPointManager::SimSetPointManagers(state); - SetPointManager::UpdateSetPointManagers(state); + SetPointManager::SimSetPointManagers(*state); + SetPointManager::UpdateSetPointManagers(*state); // node number table // 1 Fan Inlet Node OA system outlet @@ -751,17 +752,17 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) EXPECT_NEAR(DataLoopNode::Node(7).TempSetPoint, 18.0251495, 0.001); - state.dataAirLoop->AirLoopFlow(1).OAFrac = 0.8; - state.dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.8; + state->dataAirLoop->AirLoopFlow(1).OAFrac = 0.8; + state->dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.8; - SetPointManager::SimSetPointManagers(state); - SetPointManager::UpdateSetPointManagers(state); + SetPointManager::SimSetPointManagers(*state); + SetPointManager::UpdateSetPointManagers(*state); EXPECT_NEAR(DataLoopNode::Node(7).TempSetPoint, 18.20035, 0.001); // warmer day outside - state.dataAirLoop->AirLoopFlow(1).OAFrac = 1.0; - state.dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.8; + state->dataAirLoop->AirLoopFlow(1).OAFrac = 1.0; + state->dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.8; DataLoopNode::Node(3).HumRat = 0.0006; // OA intake DataLoopNode::Node(3).Temp = 26.0; @@ -770,16 +771,16 @@ TEST_F(EnergyPlusFixture, SZRHOAFractionImpact) DataLoopNode::Node(1).Temp = 26.0; DataLoopNode::Node(4).Temp = 27.0; // fan rise - SetPointManager::SimSetPointManagers(state); - SetPointManager::UpdateSetPointManagers(state); + SetPointManager::SimSetPointManagers(*state); + SetPointManager::UpdateSetPointManagers(*state); EXPECT_NEAR(DataLoopNode::Node(7).TempSetPoint, 27.0, 0.001); - state.dataAirLoop->AirLoopFlow(1).OAFrac = 0.8; - state.dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.8; + state->dataAirLoop->AirLoopFlow(1).OAFrac = 0.8; + state->dataAirLoop->AirLoopFlow(1).OAMinFrac = 0.8; - SetPointManager::SimSetPointManagers(state); - SetPointManager::UpdateSetPointManagers(state); + SetPointManager::SimSetPointManagers(*state); + SetPointManager::UpdateSetPointManagers(*state); EXPECT_NEAR(DataLoopNode::Node(7).TempSetPoint, 26.19976, 0.001); } @@ -832,7 +833,7 @@ TEST_F(EnergyPlusFixture, DefineMixedAirSetPointManager) DataLoopNode::Node(5).TempSetPoint = 13; DataLoopNode::Node(2).Temp = 24.2; DataLoopNode::Node(1).Temp = 24.0; - mySPM.calculate(state); + mySPM.calculate(*state); EXPECT_EQ(12.8, mySPM.SetPt); @@ -844,7 +845,7 @@ TEST_F(EnergyPlusFixture, DefineMixedAirSetPointManager) DataLoopNode::Node(5).Temp = 7.0; DataLoopNode::Node(3).Temp = 24.2; DataLoopNode::Node(4).Temp = 7.0; - mySPM.calculate(state); + mySPM.calculate(*state); EXPECT_EQ(24.2, mySPM.SetPt); @@ -855,7 +856,7 @@ TEST_F(EnergyPlusFixture, DefineMixedAirSetPointManager) DataLoopNode::Node(4).Temp = 7.0; DataLoopNode::Node(2).Temp = 7.2; DataLoopNode::Node(1).Temp = 7.0; - mySPM.calculate(state); + mySPM.calculate(*state); EXPECT_EQ(24.4, mySPM.SetPt); @@ -880,7 +881,7 @@ TEST_F(EnergyPlusFixture, MixedAirSetPointManager_SameRefAndSPNodeName) // GetInput should fail since reference and set point node names are the same bool ErrorsFound = false; - SetPointManager::GetSetPointManagerInputData(state, ErrorsFound); + SetPointManager::GetSetPointManagerInputData(*state, ErrorsFound); EXPECT_TRUE(ErrorsFound); std::string const error_string = delimited_string({ @@ -1192,33 +1193,33 @@ TEST_F(EnergyPlusFixture, ColdestSetPointMgrInSingleDuct) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ScheduleManager::ProcessScheduleInput(*state); - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // zones are specified in the idf snippet - DataZoneEquipment::GetZoneEquipmentData(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); - - MixedAir::GetOutsideAirSysInputs(state); - SplitterComponent::GetSplitterInput(state); - BranchInputManager::GetMixerInput(state); - BranchInputManager::ManageBranchInput(state); - - state.dataGlobal->SysSizingCalc = true; - SimAirServingZones::GetAirPathData(state); - SimAirServingZones::InitAirLoops(state, true); + DataZoneEquipment::GetZoneEquipmentData(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); + + MixedAir::GetOutsideAirSysInputs(*state); + SplitterComponent::GetSplitterInput(*state); + BranchInputManager::GetMixerInput(*state); + BranchInputManager::ManageBranchInput(*state); + + state->dataGlobal->SysSizingCalc = true; + SimAirServingZones::GetAirPathData(*state); + SimAirServingZones::InitAirLoops(*state, true); // check the number of zones served by single duct or dual duct system - EXPECT_EQ(1, state.dataAirLoop->AirToZoneNodeInfo(1).NumZonesCooled); // cooled and heated zone (served by single-duct) - EXPECT_EQ(0, state.dataAirLoop->AirToZoneNodeInfo(1).NumZonesHeated); // no heated only zone (served by dual-duct) + EXPECT_EQ(1, state->dataAirLoop->AirToZoneNodeInfo(1).NumZonesCooled); // cooled and heated zone (served by single-duct) + EXPECT_EQ(0, state->dataAirLoop->AirToZoneNodeInfo(1).NumZonesHeated); // no heated only zone (served by dual-duct) - SetPointManager::GetSetPointManagerInputs(state); + SetPointManager::GetSetPointManagerInputs(*state); SetPointManager::WarmestSetPtMgr(1).AirLoopNum = 1; SetPointManager::ColdestSetPtMgr(1).AirLoopNum = 1; - SetPointManager::InitSetPointManagers(state); + SetPointManager::InitSetPointManagers(*state); DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataZoneEnergyDemands::ZoneSysEnergyDemand(1).TotalOutputRequired = 10000.0; @@ -1230,8 +1231,8 @@ TEST_F(EnergyPlusFixture, ColdestSetPointMgrInSingleDuct) DataLoopNode::Node(2).Temp = 40.0; // zone inlet node air temperature, deg C DataLoopNode::Node(5).Temp = 21.0; // zone air node temperature set to 21.0 deg C - SetPointManager::SimSetPointManagers(state); - SetPointManager::UpdateSetPointManagers(state); + SetPointManager::SimSetPointManagers(*state); + SetPointManager::UpdateSetPointManagers(*state); EXPECT_EQ(DataLoopNode::NodeID(13), "VAV SYS 1 OUTLET NODE"); EXPECT_DOUBLE_EQ(16.0, SetPointManager::WarmestSetPtMgr(1).SetPt); // no cooling load, sets to maximum limit value @@ -1267,7 +1268,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_OutdoorAirResetMaxTempTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(ErrorsFound); // zones are specified in the idf snippet - SetPointManager::GetSetPointManagerInputs(state); + SetPointManager::GetSetPointManagerInputs(*state); // check Set Point Manager get inputs EXPECT_EQ(SetPointManager::OutAirSetPtMgr(1).CtrlVarType, "MAXIMUMTEMPERATURE"); EXPECT_EQ(SetPointManager::OutAirSetPtMgr(1).CtrlTypeMode, SetPointManager::iCtrlVarType_MaxTemp); @@ -1279,25 +1280,25 @@ TEST_F(EnergyPlusFixture, SetPointManager_OutdoorAirResetMaxTempTest) // set out door dry bukb temp DataEnvironment::OutDryBulbTemp = -20.0; // do init - SetPointManager::InitSetPointManagers(state); + SetPointManager::InitSetPointManagers(*state); // check OA Reset Set Point Manager run - SetPointManager::SimSetPointManagers(state); - SetPointManager::UpdateSetPointManagers(state); + SetPointManager::SimSetPointManagers(*state); + SetPointManager::UpdateSetPointManagers(*state); // check OA Reset Set Point Manager sim EXPECT_EQ(80.0, DataLoopNode::Node(1).TempSetPointHi); // change the low outdoor air setpoint reset value to 60.0C SetPointManager::OutAirSetPtMgr(1).OutLowSetPt1 = 60.0; // re simulate OA Reset Set Point Manager - SetPointManager::SimSetPointManagers(state); - SetPointManager::UpdateSetPointManagers(state); + SetPointManager::SimSetPointManagers(*state); + SetPointManager::UpdateSetPointManagers(*state); // check the new reset value is set EXPECT_EQ(60.0, DataLoopNode::Node(1).TempSetPointHi); // set out door dry bukb temp DataEnvironment::OutDryBulbTemp = 2.0; // check OA Reset Set Point Manager run - SetPointManager::SimSetPointManagers(state); - SetPointManager::UpdateSetPointManagers(state); + SetPointManager::SimSetPointManagers(*state); + SetPointManager::UpdateSetPointManagers(*state); // SetPt = SetTempAtOutLow - ((OutDryBulbTemp - OutLowTemp)/(OutHighTemp - OutLowTemp)) * (SetTempAtOutLow - SetTempAtOutHigh); Real64 SetPt = 60.0 - ((2.0 - -17.778) / (21.11 - -17.778)) * (60.0 - 40.0); // check OA Reset Set Point Manager sim @@ -1323,7 +1324,7 @@ TEST_F(EnergyPlusFixture, SetPointManager_OutdoorAirResetMinTempTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(ErrorsFound); // zones are specified in the idf snippet - SetPointManager::GetSetPointManagerInputs(state); + SetPointManager::GetSetPointManagerInputs(*state); // check Set Point Manager get inputs EXPECT_EQ(SetPointManager::OutAirSetPtMgr(1).CtrlVarType, "MINIMUMTEMPERATURE"); EXPECT_EQ(SetPointManager::OutAirSetPtMgr(1).CtrlTypeMode, SetPointManager::iCtrlVarType_MinTemp); @@ -1335,25 +1336,25 @@ TEST_F(EnergyPlusFixture, SetPointManager_OutdoorAirResetMinTempTest) // set out door dry bukb temp DataEnvironment::OutDryBulbTemp = 22.0; // do init - SetPointManager::InitSetPointManagers(state); + SetPointManager::InitSetPointManagers(*state); // check OA Reset Set Point Manager run - SetPointManager::SimSetPointManagers(state); - SetPointManager::UpdateSetPointManagers(state); + SetPointManager::SimSetPointManagers(*state); + SetPointManager::UpdateSetPointManagers(*state); // check OA Reset Set Point Manager sim EXPECT_EQ(40.0, DataLoopNode::Node(1).TempSetPointLo); // change the low outdoor air setpoint reset value to 60.0C SetPointManager::OutAirSetPtMgr(1).OutHighSetPt1 = 35.0; // re simulate OA Reset Set Point Manager - SetPointManager::SimSetPointManagers(state); - SetPointManager::UpdateSetPointManagers(state); + SetPointManager::SimSetPointManagers(*state); + SetPointManager::UpdateSetPointManagers(*state); // check the new reset value is set EXPECT_EQ(35.0, DataLoopNode::Node(1).TempSetPointLo); // set out door dry bulb temp DataEnvironment::OutDryBulbTemp = 2.0; // check OA Reset Set Point Manager run - SetPointManager::SimSetPointManagers(state); - SetPointManager::UpdateSetPointManagers(state); + SetPointManager::SimSetPointManagers(*state); + SetPointManager::UpdateSetPointManagers(*state); // SetPt = SetTempAtOutLow - ((OutDryBulbTemp - OutLowTemp)/(OutHighTemp - OutLowTemp)) * (SetTempAtOutLow - SetTempAtOutHigh); Real64 SetPt = 80.0 - ((2.0 - -17.778) / (21.11 - -17.778)) * (80.0 - 35.0); // check OA Reset Set Point Manager sim @@ -1376,9 +1377,9 @@ TEST_F(EnergyPlusFixture, SingZoneRhSetPtMgrZoneInletNodeTest) }); ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataHeatBalance::Zone(1).Name = "KITCHEN"; DataLoopNode::Node.allocate(3); @@ -1394,12 +1395,12 @@ TEST_F(EnergyPlusFixture, SingZoneRhSetPtMgrZoneInletNodeTest) DataZoneEquipment::ZoneEquipConfig(1).InletNode(1) = 4; DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum(1) = 1; - SetPointManager::GetSetPointManagerInputs(state); + SetPointManager::GetSetPointManagerInputs(*state); DataZoneEquipment::ZoneEquipInputsFilled = true; - state.dataAirLoop->AirLoopInputsFilled = true; + state->dataAirLoop->AirLoopInputsFilled = true; - ASSERT_THROW(SetPointManager::InitSetPointManagers(state), std::runtime_error); + ASSERT_THROW(SetPointManager::InitSetPointManagers(*state), std::runtime_error); std::string const error_string = delimited_string({ " ** Severe ** SetpointManager:SingleZone:Reheat=\"SUPAIRTEMP MNGRKITCHEN\", The zone inlet node of KITCHEN INLET NODE NAME", @@ -1415,7 +1416,7 @@ TEST_F(EnergyPlusFixture, SingZoneRhSetPtMgrZoneInletNodeTest) EXPECT_TRUE(compare_err_stream(error_string, true)); DataZoneEquipment::ZoneEquipInputsFilled = false; - state.dataAirLoop->AirLoopInputsFilled = false; + state->dataAirLoop->AirLoopInputsFilled = false; } TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrZoneInletNodeTest) { @@ -1443,9 +1444,9 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrZoneInletNodeTest) }); ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataHeatBalance::Zone(1).Name = "ZSF1"; DataLoopNode::Node.allocate(3); @@ -1461,12 +1462,12 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrZoneInletNodeTest) DataZoneEquipment::ZoneEquipConfig(1).InletNode(1) = 4; DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum(1) = 1; - SetPointManager::GetSetPointManagerInputs(state); + SetPointManager::GetSetPointManagerInputs(*state); DataZoneEquipment::ZoneEquipInputsFilled = true; - state.dataAirLoop->AirLoopInputsFilled = true; + state->dataAirLoop->AirLoopInputsFilled = true; - ASSERT_THROW(SetPointManager::InitSetPointManagers(state), std::runtime_error); + ASSERT_THROW(SetPointManager::InitSetPointManagers(*state), std::runtime_error); std::string const error_string = delimited_string({ " ** Severe ** SetpointManager:SingleZone:Heating=\"HEATING SUPPLY AIR TEMP MANAGER 1\", The zone inlet node of ZNF1 INLET NODE", @@ -1482,7 +1483,7 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrZoneInletNodeTest) EXPECT_TRUE(compare_err_stream(error_string, true)); DataZoneEquipment::ZoneEquipInputsFilled = false; - state.dataAirLoop->AirLoopInputsFilled = false; + state->dataAirLoop->AirLoopInputsFilled = false; } TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrSetPtTest) { @@ -1510,11 +1511,11 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrSetPtTest) }); ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataHeatBalance::Zone(1).Name = "ZSF1"; - SetPointManager::GetSetPointManagerInputs(state); + SetPointManager::GetSetPointManagerInputs(*state); DataZoneEquipment::ZoneEquipConfig.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).NumInletNodes = 1; @@ -1540,9 +1541,9 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrSetPtTest) DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToHeatingSP = 0.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToCoolingSP = 0.0; DataZoneEquipment::ZoneEquipInputsFilled = true; - state.dataAirLoop->AirLoopInputsFilled = true; + state->dataAirLoop->AirLoopInputsFilled = true; - SetPointManager::InitSetPointManagers(state); + SetPointManager::InitSetPointManagers(*state); EXPECT_FALSE(has_err_output(true)); // Case 1 - No load @@ -1550,7 +1551,7 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrSetPtTest) zoneNode.Temp = 20.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToHeatingSP = 0.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToCoolingSP = 0.0; - SetPointManager::ManageSetPoints(state); + SetPointManager::ManageSetPoints(*state); EXPECT_NEAR(coolSPNode.TempSetPoint, zoneNode.Temp, 0.001); EXPECT_NEAR(heatSPNode.TempSetPoint, zoneNode.Temp, 0.001); @@ -1559,7 +1560,7 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrSetPtTest) zoneNode.Temp = 20.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToCoolingSP = 100.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToHeatingSP = 50.0; - SetPointManager::ManageSetPoints(state); + SetPointManager::ManageSetPoints(*state); EXPECT_NEAR(coolSPNode.TempSetPoint, 20.994, 0.01); EXPECT_NEAR(heatSPNode.TempSetPoint, 20.497, 0.01); @@ -1568,7 +1569,7 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrSetPtTest) zoneNode.Temp = 20.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToCoolingSP = 10000.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToHeatingSP = 5000.0; - SetPointManager::ManageSetPoints(state); + SetPointManager::ManageSetPoints(*state); EXPECT_NEAR(coolSPNode.TempSetPoint, 99.0, 0.01); EXPECT_NEAR(heatSPNode.TempSetPoint, 45.0, 0.01); @@ -1577,7 +1578,7 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrSetPtTest) zoneNode.Temp = 20.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToCoolingSP = -50.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToHeatingSP = -100.0; - SetPointManager::ManageSetPoints(state); + SetPointManager::ManageSetPoints(*state); EXPECT_NEAR(coolSPNode.TempSetPoint, 19.50, 0.01); EXPECT_NEAR(heatSPNode.TempSetPoint, 19.01, 0.01); @@ -1586,7 +1587,7 @@ TEST_F(EnergyPlusFixture, SingZoneCoolHeatSetPtMgrSetPtTest) zoneNode.Temp = 20.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToCoolingSP = -5000.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).OutputRequiredToHeatingSP = -20000.0; - SetPointManager::ManageSetPoints(state); + SetPointManager::ManageSetPoints(*state); EXPECT_NEAR(coolSPNode.TempSetPoint, 14.0, 0.01); EXPECT_NEAR(heatSPNode.TempSetPoint, -99.0, 0.01); } diff --git a/tst/EnergyPlus/unit/SimAirServingZones.unit.cc b/tst/EnergyPlus/unit/SimAirServingZones.unit.cc index 7124897be00..64f75a6f240 100644 --- a/tst/EnergyPlus/unit/SimAirServingZones.unit.cc +++ b/tst/EnergyPlus/unit/SimAirServingZones.unit.cc @@ -71,6 +71,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace DataAirSystems; @@ -95,7 +96,7 @@ TEST_F(EnergyPlusFixture, SimAirServingZones_ReheatCoilSizing) CalcSysSizing.allocate(NumPrimaryAirSys); FinalSysSizing.allocate(NumPrimaryAirSys); FinalZoneSizing.allocate(NumPrimaryAirSys); - state.dataAirSystemsData->PrimaryAirSystems.allocate(NumPrimaryAirSys); + state->dataAirSystemsData->PrimaryAirSystems.allocate(NumPrimaryAirSys); // Inputs: system configurations: // (1) Central heating coils exist @@ -103,20 +104,20 @@ TEST_F(EnergyPlusFixture, SimAirServingZones_ReheatCoilSizing) // (3) No central heating coils, but OA heat-exchangers exist // (4) No central heating coils; No preheating coils or OA heat-exchangers - state.dataAirSystemsData->PrimaryAirSystems(1).CentralHeatCoilExists = true; - state.dataAirSystemsData->PrimaryAirSystems(2).CentralHeatCoilExists = false; - state.dataAirSystemsData->PrimaryAirSystems(3).CentralHeatCoilExists = false; - state.dataAirSystemsData->PrimaryAirSystems(4).CentralHeatCoilExists = false; + state->dataAirSystemsData->PrimaryAirSystems(1).CentralHeatCoilExists = true; + state->dataAirSystemsData->PrimaryAirSystems(2).CentralHeatCoilExists = false; + state->dataAirSystemsData->PrimaryAirSystems(3).CentralHeatCoilExists = false; + state->dataAirSystemsData->PrimaryAirSystems(4).CentralHeatCoilExists = false; - state.dataAirSystemsData->PrimaryAirSystems(1).NumOAHeatCoils = 0; - state.dataAirSystemsData->PrimaryAirSystems(2).NumOAHeatCoils = 1; - state.dataAirSystemsData->PrimaryAirSystems(3).NumOAHeatCoils = 0; - state.dataAirSystemsData->PrimaryAirSystems(4).NumOAHeatCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(1).NumOAHeatCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(2).NumOAHeatCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems(3).NumOAHeatCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(4).NumOAHeatCoils = 0; - state.dataAirSystemsData->PrimaryAirSystems(1).NumOAHXs = 0; - state.dataAirSystemsData->PrimaryAirSystems(2).NumOAHXs = 0; - state.dataAirSystemsData->PrimaryAirSystems(3).NumOAHXs = 1; - state.dataAirSystemsData->PrimaryAirSystems(4).NumOAHXs = 0; + state->dataAirSystemsData->PrimaryAirSystems(1).NumOAHXs = 0; + state->dataAirSystemsData->PrimaryAirSystems(2).NumOAHXs = 0; + state->dataAirSystemsData->PrimaryAirSystems(3).NumOAHXs = 1; + state->dataAirSystemsData->PrimaryAirSystems(4).NumOAHXs = 0; // Inputs: sizing parameters for (AirLoopNum = 1; AirLoopNum <= NumPrimaryAirSys; ++AirLoopNum) { @@ -138,8 +139,8 @@ TEST_F(EnergyPlusFixture, SimAirServingZones_ReheatCoilSizing) for (AirLoopNum = 1; AirLoopNum <= NumPrimaryAirSys; ++AirLoopNum) { CtrlZoneNum = AirLoopNum; - FinalZoneSizing(CtrlZoneNum).DesHeatCoilInTempTU = GetHeatingSATempForSizing(state, AirLoopNum); - FinalZoneSizing(CtrlZoneNum).DesHeatCoilInHumRatTU = GetHeatingSATempHumRatForSizing(state, AirLoopNum); + FinalZoneSizing(CtrlZoneNum).DesHeatCoilInTempTU = GetHeatingSATempForSizing(*state, AirLoopNum); + FinalZoneSizing(CtrlZoneNum).DesHeatCoilInHumRatTU = GetHeatingSATempHumRatForSizing(*state, AirLoopNum); } // Check @@ -156,7 +157,7 @@ TEST_F(EnergyPlusFixture, SimAirServingZones_ReheatCoilSizing) CalcSysSizing.deallocate(); FinalSysSizing.deallocate(); FinalZoneSizing.deallocate(); - state.dataAirSystemsData->PrimaryAirSystems.deallocate(); + state->dataAirSystemsData->PrimaryAirSystems.deallocate(); } TEST_F(EnergyPlusFixture, SimAirServingZones_LimitZoneVentEff) @@ -245,7 +246,7 @@ TEST_F(EnergyPlusFixture, SizingSystem_FlowPerCapacityMethodTest1) // scale cooling flow rate using user input capacity ScaledCoolDesignFlowRate = FinalSysSizing(AirLoopNum).ScaledCoolingCapacity * FinalSysSizing(AirLoopNum).FlowPerCoolingCapacity; // do scalable flow sizing - UpdateSysSizingForScalableInputs(state, AirLoopNum); + UpdateSysSizingForScalableInputs(*state, AirLoopNum); EXPECT_DOUBLE_EQ(0.755125, ScaledCoolDesignFlowRate); EXPECT_DOUBLE_EQ(0.755125, FinalSysSizing(AirLoopNum).InpDesCoolAirFlow); @@ -257,7 +258,7 @@ TEST_F(EnergyPlusFixture, SizingSystem_FlowPerCapacityMethodTest1) // scale heating flow rate using user input capacity ScaledHeatDesignFlowRate = FinalSysSizing(AirLoopNum).ScaledHeatingCapacity * FinalSysSizing(AirLoopNum).FlowPerHeatingCapacity; // do scalable flow sizing - UpdateSysSizingForScalableInputs(state, AirLoopNum); + UpdateSysSizingForScalableInputs(*state, AirLoopNum); EXPECT_DOUBLE_EQ(0.869904, ScaledHeatDesignFlowRate); EXPECT_DOUBLE_EQ(0.869904, FinalSysSizing(AirLoopNum).InpDesHeatAirFlow); } @@ -286,7 +287,7 @@ TEST_F(EnergyPlusFixture, SizingSystem_FlowPerCapacityMethodTest2) ScaledCoolDesignCapacity = FinalSysSizing(AirLoopNum).ScaledCoolingCapacity * FinalSysSizing(AirLoopNum).FloorAreaOnAirLoopCooled; ScaledCoolDesignFlowRate = FinalSysSizing(AirLoopNum).FlowPerCoolingCapacity * ScaledCoolDesignCapacity; // do scalable flow sizing - UpdateSysSizingForScalableInputs(state, AirLoopNum); + UpdateSysSizingForScalableInputs(*state, AirLoopNum); EXPECT_DOUBLE_EQ(0.038878893558427413, ScaledCoolDesignFlowRate); EXPECT_DOUBLE_EQ(0.038878893558427413, FinalSysSizing(AirLoopNum).InpDesCoolAirFlow); @@ -300,7 +301,7 @@ TEST_F(EnergyPlusFixture, SizingSystem_FlowPerCapacityMethodTest2) ScaledHeatDesignCapacity = FinalSysSizing(AirLoopNum).ScaledHeatingCapacity * FinalSysSizing(AirLoopNum).FloorAreaOnAirLoopCooled; ScaledHeatDesignFlowRate = FinalSysSizing(AirLoopNum).FlowPerHeatingCapacity * ScaledHeatDesignCapacity; // do scalable flow sizing - UpdateSysSizingForScalableInputs(state, AirLoopNum); + UpdateSysSizingForScalableInputs(*state, AirLoopNum); EXPECT_DOUBLE_EQ(0.11880981823487276, ScaledHeatDesignFlowRate); EXPECT_DOUBLE_EQ(0.11880981823487276, FinalSysSizing(AirLoopNum).InpDesHeatAirFlow); } @@ -464,12 +465,12 @@ TEST_F(EnergyPlusFixture, GetAirPathData_ControllerLockout1) ASSERT_TRUE(process_idf(idf_objects)); - SimAirServingZones::GetAirPathData(state); + SimAirServingZones::GetAirPathData(*state); // 2 controllers on this AHU for 2 water coils on the branch // CanBeLockedOutByEcono should be false for both controller in this test - EXPECT_FALSE(state.dataAirSystemsData->PrimaryAirSystems(1).CanBeLockedOutByEcono(1)); - EXPECT_FALSE(state.dataAirSystemsData->PrimaryAirSystems(1).CanBeLockedOutByEcono(2)); + EXPECT_FALSE(state->dataAirSystemsData->PrimaryAirSystems(1).CanBeLockedOutByEcono(1)); + EXPECT_FALSE(state->dataAirSystemsData->PrimaryAirSystems(1).CanBeLockedOutByEcono(2)); } TEST_F(EnergyPlusFixture, GetAirPathData_ControllerLockout2) @@ -624,13 +625,13 @@ TEST_F(EnergyPlusFixture, GetAirPathData_ControllerLockout2) ASSERT_TRUE(process_idf(idf_objects)); - SimAirServingZones::GetAirPathData(state); + SimAirServingZones::GetAirPathData(*state); // 2 controllers on this AHU for 2 water coils in the OA system // CanBeLockedOutByEcono should be false for the heating coil controller #1 in this test // CanBeLockedOutByEcono should be true for the cooling coil controller #2 in this test - EXPECT_FALSE(state.dataAirSystemsData->PrimaryAirSystems(1).CanBeLockedOutByEcono(1)); - EXPECT_TRUE(state.dataAirSystemsData->PrimaryAirSystems(1).CanBeLockedOutByEcono(2)); + EXPECT_FALSE(state->dataAirSystemsData->PrimaryAirSystems(1).CanBeLockedOutByEcono(1)); + EXPECT_TRUE(state->dataAirSystemsData->PrimaryAirSystems(1).CanBeLockedOutByEcono(2)); } TEST_F(EnergyPlusFixture, InitAirLoops_1AirLoop2ADU) @@ -776,24 +777,24 @@ TEST_F(EnergyPlusFixture, InitAirLoops_1AirLoop2ADU) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); EXPECT_TRUE(compare_err_stream("")); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - SingleDuct::GetSysInput(state); + SingleDuct::GetSysInput(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - SplitterComponent::GetSplitterInput(state); + SplitterComponent::GetSplitterInput(*state); EXPECT_TRUE(compare_err_stream("")); - SimAirServingZones::GetAirPathData(state); + SimAirServingZones::GetAirPathData(*state); // Expect warnings about no controllers, clear err_stream EXPECT_TRUE(has_err_output(true)); - SimAirServingZones::InitAirLoops(state, true); + SimAirServingZones::InitAirLoops(*state, true); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); // And finally, all of this gymnastics just to check if the airloopnums get set correctly @@ -1008,24 +1009,24 @@ TEST_F(EnergyPlusFixture, InitAirLoops_2AirLoop2ADU) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); EXPECT_TRUE(compare_err_stream("")); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - SingleDuct::GetSysInput(state); + SingleDuct::GetSysInput(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - SplitterComponent::GetSplitterInput(state); + SplitterComponent::GetSplitterInput(*state); EXPECT_TRUE(compare_err_stream("")); - SimAirServingZones::GetAirPathData(state); + SimAirServingZones::GetAirPathData(*state); // Expect warnings about no controllers, clear err_stream EXPECT_TRUE(has_err_output(true)); - SimAirServingZones::InitAirLoops(state, true); + SimAirServingZones::InitAirLoops(*state, true); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); // And finally, all of this gymnastics just to check if the airloopnums get set correctly @@ -1273,24 +1274,24 @@ TEST_F(EnergyPlusFixture, InitAirLoops_2AirLoop3ADUa) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); EXPECT_TRUE(compare_err_stream("")); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - SingleDuct::GetSysInput(state); + SingleDuct::GetSysInput(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - SplitterComponent::GetSplitterInput(state); + SplitterComponent::GetSplitterInput(*state); EXPECT_TRUE(compare_err_stream("")); - SimAirServingZones::GetAirPathData(state); + SimAirServingZones::GetAirPathData(*state); // Expect warnings about no controllers, clear err_stream EXPECT_TRUE(has_err_output(true)); - SimAirServingZones::InitAirLoops(state, true); + SimAirServingZones::InitAirLoops(*state, true); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); // And finally, all of this gymnastics just to check if the airloopnums get set correctly @@ -1539,24 +1540,24 @@ TEST_F(EnergyPlusFixture, InitAirLoops_2AirLoop3ADUb) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); EXPECT_TRUE(compare_err_stream("")); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - SingleDuct::GetSysInput(state); + SingleDuct::GetSysInput(*state); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); - SplitterComponent::GetSplitterInput(state); + SplitterComponent::GetSplitterInput(*state); EXPECT_TRUE(compare_err_stream("")); - SimAirServingZones::GetAirPathData(state); + SimAirServingZones::GetAirPathData(*state); // Expect warnings about no controllers, clear err_stream EXPECT_TRUE(has_err_output(true)); - SimAirServingZones::InitAirLoops(state, true); + SimAirServingZones::InitAirLoops(*state, true); EXPECT_TRUE(compare_err_stream("")); ASSERT_FALSE(ErrorsFound); // And finally, all of this gymnastics just to check if the airloopnums get set correctly diff --git a/tst/EnergyPlus/unit/SimulationManager.unit.cc b/tst/EnergyPlus/unit/SimulationManager.unit.cc index 3a24d5d176f..7ba90578c6e 100644 --- a/tst/EnergyPlus/unit/SimulationManager.unit.cc +++ b/tst/EnergyPlus/unit/SimulationManager.unit.cc @@ -57,6 +57,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace ObjexxFCL; @@ -94,7 +95,7 @@ TEST_F(EnergyPlusFixture, Test_PerformancePrecisionTradeoffs) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); // no error message from PerformancePrecisionTradeoffs objects EXPECT_TRUE(compare_err_stream("", true)); @@ -112,7 +113,7 @@ TEST_F(EnergyPlusFixture, Test_PerformancePrecisionTradeoffs_DirectSolution_Mess EXPECT_TRUE(process_idf(idf_objects, false)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); std::string const error_string = delimited_string({ " ** Warning ** PerformancePrecisionTradeoffs: Coil Direct Solution simulation is selected.", @@ -135,15 +136,15 @@ TEST_F(EnergyPlusFixture, Simulationmanager_writeIntialPerfLogValues) std::remove(DataStringGlobals::outputPerfLogFileName.c_str()); // make sure the static variables are cleared - UtilityRoutines::appendPerfLog(state, "RESET", "RESET"); + UtilityRoutines::appendPerfLog(*state, "RESET", "RESET"); DataStringGlobals::VerString = "EnergyPlus, Version 0.0.0-xxxx, August 14 1945"; // call the function to test - SimulationManager::writeIntialPerfLogValues(state, "MODE193"); + SimulationManager::writeIntialPerfLogValues(*state, "MODE193"); // force the file to be written - UtilityRoutines::appendPerfLog(state, "lastHeader", "lastValue", true); + UtilityRoutines::appendPerfLog(*state, "lastHeader", "lastValue", true); std::ifstream perfLogFile; std::stringstream perfLogStrSteam; @@ -174,7 +175,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); EXPECT_FALSE(DataReportingFlags::DebugOutput); EXPECT_FALSE(DataReportingFlags::EvenDuringWarmup); @@ -191,7 +192,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); EXPECT_TRUE(DataReportingFlags::DebugOutput); EXPECT_FALSE(DataReportingFlags::EvenDuringWarmup); @@ -208,7 +209,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); EXPECT_FALSE(DataReportingFlags::DebugOutput); EXPECT_TRUE(DataReportingFlags::EvenDuringWarmup); @@ -238,7 +239,7 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDebuggingData) EXPECT_TRUE(compare_err_stream(expectedError, true)); } - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); EXPECT_FALSE(DataReportingFlags::DebugOutput); EXPECT_TRUE(DataReportingFlags::EvenDuringWarmup); @@ -260,14 +261,14 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_DefaultState) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); - EXPECT_FALSE(state.dataGlobal->DisplayAllWarnings); - EXPECT_FALSE(state.dataGlobal->DisplayExtraWarnings); - EXPECT_FALSE(state.dataGlobal->DisplayUnusedObjects); - EXPECT_FALSE(state.dataGlobal->DisplayUnusedSchedules); - EXPECT_FALSE(state.dataGlobal->DisplayAdvancedReportVariables); - EXPECT_FALSE(state.dataGlobal->DisplayZoneAirHeatBalanceOffBalance); + EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); + EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); + EXPECT_FALSE(state->dataGlobal->DisplayUnusedObjects); + EXPECT_FALSE(state->dataGlobal->DisplayUnusedSchedules); + EXPECT_FALSE(state->dataGlobal->DisplayAdvancedReportVariables); + EXPECT_FALSE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); EXPECT_TRUE(DataReportingFlags::MakeMirroredDetachedShading); EXPECT_TRUE(DataReportingFlags::MakeMirroredAttachedShading); EXPECT_FALSE(DataSystemVariables::ReportDuringWarmup); @@ -296,14 +297,14 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_SimpleCase) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); - EXPECT_TRUE(state.dataGlobal->DisplayAllWarnings); - EXPECT_TRUE(state.dataGlobal->DisplayExtraWarnings); - EXPECT_TRUE(state.dataGlobal->DisplayUnusedObjects); - EXPECT_TRUE(state.dataGlobal->DisplayUnusedSchedules); - EXPECT_TRUE(state.dataGlobal->DisplayAdvancedReportVariables); - EXPECT_FALSE(state.dataGlobal->DisplayZoneAirHeatBalanceOffBalance); + EXPECT_TRUE(state->dataGlobal->DisplayAllWarnings); + EXPECT_TRUE(state->dataGlobal->DisplayExtraWarnings); + EXPECT_TRUE(state->dataGlobal->DisplayUnusedObjects); + EXPECT_TRUE(state->dataGlobal->DisplayUnusedSchedules); + EXPECT_TRUE(state->dataGlobal->DisplayAdvancedReportVariables); + EXPECT_FALSE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); EXPECT_TRUE(DataReportingFlags::MakeMirroredDetachedShading); EXPECT_TRUE(DataReportingFlags::MakeMirroredAttachedShading); EXPECT_FALSE(DataSystemVariables::ReportDuringWarmup); @@ -336,14 +337,14 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_AllKeys) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); - EXPECT_TRUE(state.dataGlobal->DisplayAllWarnings); - EXPECT_TRUE(state.dataGlobal->DisplayExtraWarnings); - EXPECT_TRUE(state.dataGlobal->DisplayUnusedObjects); - EXPECT_TRUE(state.dataGlobal->DisplayUnusedSchedules); - EXPECT_TRUE(state.dataGlobal->DisplayAdvancedReportVariables); - EXPECT_TRUE(state.dataGlobal->DisplayZoneAirHeatBalanceOffBalance); + EXPECT_TRUE(state->dataGlobal->DisplayAllWarnings); + EXPECT_TRUE(state->dataGlobal->DisplayExtraWarnings); + EXPECT_TRUE(state->dataGlobal->DisplayUnusedObjects); + EXPECT_TRUE(state->dataGlobal->DisplayUnusedSchedules); + EXPECT_TRUE(state->dataGlobal->DisplayAdvancedReportVariables); + EXPECT_TRUE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); EXPECT_FALSE(DataReportingFlags::MakeMirroredDetachedShading); EXPECT_FALSE(DataReportingFlags::MakeMirroredAttachedShading); EXPECT_TRUE(DataSystemVariables::ReportDuringWarmup); @@ -374,14 +375,14 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_Unicity) }); EXPECT_TRUE(compare_err_stream(expectedError, true)); } - SimulationManager::GetProjectData(state); - - EXPECT_FALSE(state.dataGlobal->DisplayAllWarnings); - EXPECT_FALSE(state.dataGlobal->DisplayExtraWarnings); - EXPECT_FALSE(state.dataGlobal->DisplayUnusedObjects); - EXPECT_FALSE(state.dataGlobal->DisplayUnusedSchedules); - EXPECT_TRUE(state.dataGlobal->DisplayAdvancedReportVariables); // Only first object has been processed - EXPECT_FALSE(state.dataGlobal->DisplayZoneAirHeatBalanceOffBalance); + SimulationManager::GetProjectData(*state); + + EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); + EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); + EXPECT_FALSE(state->dataGlobal->DisplayUnusedObjects); + EXPECT_FALSE(state->dataGlobal->DisplayUnusedSchedules); + EXPECT_TRUE(state->dataGlobal->DisplayAdvancedReportVariables); // Only first object has been processed + EXPECT_FALSE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); EXPECT_TRUE(DataReportingFlags::MakeMirroredDetachedShading); EXPECT_TRUE(DataReportingFlags::MakeMirroredAttachedShading); EXPECT_FALSE(DataSystemVariables::ReportDuringWarmup); @@ -419,14 +420,14 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_UndocumentedFlags) }); EXPECT_TRUE(compare_err_stream(expected_warning, true)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); - EXPECT_FALSE(state.dataGlobal->DisplayAllWarnings); - EXPECT_FALSE(state.dataGlobal->DisplayExtraWarnings); - EXPECT_FALSE(state.dataGlobal->DisplayUnusedObjects); - EXPECT_FALSE(state.dataGlobal->DisplayUnusedSchedules); - EXPECT_FALSE(state.dataGlobal->DisplayAdvancedReportVariables); - EXPECT_FALSE(state.dataGlobal->DisplayZoneAirHeatBalanceOffBalance); + EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); + EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); + EXPECT_FALSE(state->dataGlobal->DisplayUnusedObjects); + EXPECT_FALSE(state->dataGlobal->DisplayUnusedSchedules); + EXPECT_FALSE(state->dataGlobal->DisplayAdvancedReportVariables); + EXPECT_FALSE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); EXPECT_TRUE(DataReportingFlags::MakeMirroredDetachedShading); EXPECT_TRUE(DataReportingFlags::MakeMirroredAttachedShading); EXPECT_FALSE(DataSystemVariables::ReportDuringWarmup); @@ -456,16 +457,16 @@ TEST_F(EnergyPlusFixture, SimulationManager_OutputDiagnostics_HasEmpty) EXPECT_TRUE(process_idf(idf_objects)); - ASSERT_NO_THROW(SimulationManager::GetProjectData(state)); + ASSERT_NO_THROW(SimulationManager::GetProjectData(*state)); - EXPECT_FALSE(state.dataGlobal->DisplayAllWarnings); - EXPECT_FALSE(state.dataGlobal->DisplayExtraWarnings); - EXPECT_FALSE(state.dataGlobal->DisplayUnusedObjects); - EXPECT_FALSE(state.dataGlobal->DisplayUnusedSchedules); + EXPECT_FALSE(state->dataGlobal->DisplayAllWarnings); + EXPECT_FALSE(state->dataGlobal->DisplayExtraWarnings); + EXPECT_FALSE(state->dataGlobal->DisplayUnusedObjects); + EXPECT_FALSE(state->dataGlobal->DisplayUnusedSchedules); - EXPECT_TRUE(state.dataGlobal->DisplayAdvancedReportVariables); + EXPECT_TRUE(state->dataGlobal->DisplayAdvancedReportVariables); - EXPECT_FALSE(state.dataGlobal->DisplayZoneAirHeatBalanceOffBalance); + EXPECT_FALSE(state->dataGlobal->DisplayZoneAirHeatBalanceOffBalance); EXPECT_TRUE(DataReportingFlags::MakeMirroredDetachedShading); EXPECT_TRUE(DataReportingFlags::MakeMirroredAttachedShading); EXPECT_FALSE(DataSystemVariables::ReportDuringWarmup); @@ -494,10 +495,10 @@ TEST_F(EnergyPlusFixture, SimulationManager_HVACSizingSimulationChoiceTest) EXPECT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); - EXPECT_TRUE(state.dataGlobal->DoHVACSizingSimulation); + EXPECT_TRUE(state->dataGlobal->DoHVACSizingSimulation); // get a default value - EXPECT_EQ(state.dataGlobal->HVACSizingSimMaxIterations, 1); + EXPECT_EQ(state->dataGlobal->HVACSizingSimMaxIterations, 1); } diff --git a/tst/EnergyPlus/unit/SingleDuct.unit.cc b/tst/EnergyPlus/unit/SingleDuct.unit.cc index 980f0e1e4c1..d96da7474e5 100644 --- a/tst/EnergyPlus/unit/SingleDuct.unit.cc +++ b/tst/EnergyPlus/unit/SingleDuct.unit.cc @@ -73,6 +73,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace SimulationManager; @@ -124,27 +125,27 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) ASSERT_TRUE(process_idf(idf_objects)); - 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 + 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 ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(state); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); + ScheduleManager::UpdateScheduleValues(*state); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); EXPECT_TRUE(compare_err_stream("")); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; @@ -173,13 +174,13 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) SingleDuct::sd_airterminal(SysNum).SchedPtr = 1; DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMinMassFlow; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; - state.dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit + state->dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true - state.dataGlobal->BeginEnvrnFlag = false; + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); EXPECT_EQ(0.0, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRateMaxAvail); EXPECT_EQ(0.0, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -189,10 +190,10 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; SingleDuct::sd_airterminal(SysNum).SchedPtr = 2; FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); EXPECT_EQ(SysMaxMassFlow, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRateMaxAvail); EXPECT_EQ(SysMinMassFlow, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -203,13 +204,13 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) SingleDuct::sd_airterminal(SysNum).SchedPtr = 1; DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMinMassFlow; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; - state.dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit + state->dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true - state.dataGlobal->BeginEnvrnFlag = false; + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); EXPECT_EQ(0.0, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRateMaxAvail); EXPECT_EQ(0.0, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -219,10 +220,10 @@ TEST_F(EnergyPlusFixture, VAVNoReheatTerminalUnitSchedule) DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; SingleDuct::sd_airterminal(SysNum).SchedPtr = 2; FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); EXPECT_EQ(SysMaxMassFlow, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRateMaxAvail); EXPECT_EQ(SysMaxMassFlow, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -295,27 +296,27 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) ASSERT_TRUE(process_idf(idf_objects)); - 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 + 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 ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); - ScheduleManager::UpdateScheduleValues(state); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); + ScheduleManager::UpdateScheduleValues(*state); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); EXPECT_TRUE(compare_err_stream("")); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; @@ -345,13 +346,13 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) SingleDuct::sd_airterminal(SysNum).SchedPtr = 1; DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMinMassFlow; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; - state.dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit + state->dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true - state.dataGlobal->BeginEnvrnFlag = false; + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); EXPECT_EQ(0.0, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRateMaxAvail); EXPECT_EQ(0.0, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -361,10 +362,10 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; SingleDuct::sd_airterminal(SysNum).SchedPtr = 2; FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); EXPECT_EQ(SysMaxMassFlow, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRateMaxAvail); EXPECT_EQ(SysMinMassFlow, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -375,13 +376,13 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) SingleDuct::sd_airterminal(SysNum).SchedPtr = 1; DataLoopNode::Node(InletNodeNum).MassFlowRate = SysMinMassFlow; DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; - state.dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit + state->dataGlobal->BeginEnvrnFlag = true; // Must be true for initial pass thru SingleDuct::InitSys for this terminal unit FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true - state.dataGlobal->BeginEnvrnFlag = false; + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true + state->dataGlobal->BeginEnvrnFlag = false; FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); EXPECT_EQ(0.0, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRateMaxAvail); EXPECT_EQ(0.0, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -391,10 +392,10 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminalUnitSchedule) DataLoopNode::Node(InletNodeNum).MassFlowRateMaxAvail = SysMaxMassFlow; SingleDuct::sd_airterminal(SysNum).SchedPtr = 2; FirstHVACIteration = true; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init once with FirstHVACIteration set to true FirstHVACIteration = false; - SingleDuct::sd_airterminal(SysNum).InitSys(state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false - SingleDuct::sd_airterminal(SysNum).SimVAV(state, FirstHVACIteration, ZoneNum, ZoneNodeNum); + SingleDuct::sd_airterminal(SysNum).InitSys(*state, FirstHVACIteration); // Run thru init a second time with FirstHVACIteration set to false + SingleDuct::sd_airterminal(SysNum).SimVAV(*state, FirstHVACIteration, ZoneNum, ZoneNodeNum); EXPECT_EQ(SysMaxMassFlow, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRateMaxAvail); EXPECT_EQ(SysMaxMassFlow, SingleDuct::sd_airterminal(SysNum).sd_airterminalOutlet.AirMassFlowRate); @@ -1255,7 +1256,7 @@ TEST_F(EnergyPlusFixture, SingleDuct_ZeroFloorAreaTest) // OutputProcessor::TimeValue.allocate(2); - ManageSimulation(state); // run the design day over the warmup period (24 hrs, 25 days) + ManageSimulation(*state); // run the design day over the warmup period (24 hrs, 25 days) // compare_err_stream( "" ); // just for debugging @@ -1309,8 +1310,8 @@ TEST_F(EnergyPlusFixture, TestOAMassFlowRateUsingStdRhoAir) SingleDuct::sd_airterminal.allocate(1); Zone.allocate(1); DataZoneEquipment::ZoneEquipConfig.allocate(1); - state.dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); DataSizing::OARequirements.allocate(1); DataHeatBalance::ZoneIntGain.allocate(1); @@ -1323,8 +1324,8 @@ TEST_F(EnergyPlusFixture, TestOAMassFlowRateUsingStdRhoAir) DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum(1) = 1; - state.dataAirLoop->AirLoopFlow(1).OAFrac = 0.4; - state.dataAirLoop->AirLoopControlInfo(1).AirLoopDCVFlag = true; + state->dataAirLoop->AirLoopFlow(1).OAFrac = 0.4; + state->dataAirLoop->AirLoopControlInfo(1).AirLoopDCVFlag = true; DataSizing::OARequirements(1).Name = "CM DSOA WEST ZONE"; DataSizing::OARequirements(1).OAFlowMethod = DataSizing::OAFlowSum; @@ -1333,7 +1334,7 @@ TEST_F(EnergyPlusFixture, TestOAMassFlowRateUsingStdRhoAir) DataEnvironment::StdRhoAir = 1.20; DataHeatBalance::ZoneIntGain(1).NOFOCC = 0.1; - SingleDuct::sd_airterminal(1).CalcOAMassFlow(state, SAMassFlow, AirLoopOAFrac); + SingleDuct::sd_airterminal(1).CalcOAMassFlow(*state, SAMassFlow, AirLoopOAFrac); EXPECT_NEAR(0.0131547, SAMassFlow, 0.00001); EXPECT_NEAR(0.4, AirLoopOAFrac, 0.00001); @@ -1341,8 +1342,8 @@ TEST_F(EnergyPlusFixture, TestOAMassFlowRateUsingStdRhoAir) SingleDuct::sd_airterminal.deallocate(); Zone.deallocate(); DataZoneEquipment::ZoneEquipConfig.deallocate(); - state.dataAirLoop->AirLoopFlow.deallocate(); - state.dataAirLoop->AirLoopControlInfo.deallocate(); + state->dataAirLoop->AirLoopFlow.deallocate(); + state->dataAirLoop->AirLoopControlInfo.deallocate(); DataSizing::OARequirements.deallocate(); DataHeatBalance::ZoneIntGain.deallocate(); } @@ -2454,7 +2455,7 @@ TEST_F(EnergyPlusFixture, SingleDuct_VAVWaterCoilSizing) // OutputProcessor::TimeValue.allocate(2); - ManageSimulation(state); // run the design days + ManageSimulation(*state); // run the design days // size the reheat coil with no design zone heating load // DesZoneHeatLoad = 0 from simulating design days and forcing heating load = 0 @@ -2499,7 +2500,7 @@ TEST_F(EnergyPlusFixture, TerminalUnitMixerInitTest) SysATMixer.allocate(ATMixerNum); DataZoneEquipment::ZoneEquipConfig.allocate(1); - state.dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow.allocate(1); DataLoopNode::Node.allocate(3); DataSizing::OARequirements.allocate(1); Zone.allocate(1); @@ -2514,7 +2515,7 @@ TEST_F(EnergyPlusFixture, TerminalUnitMixerInitTest) SysATMixer(ATMixerNum).NoOAFlowInputFromUser = false; SysATMixer(ATMixerNum).OARequirementsPtr = 1; - state.dataAirLoop->AirLoopFlow(1).OAFrac = 1.0; + state->dataAirLoop->AirLoopFlow(1).OAFrac = 1.0; Zone(1).FloorArea = 10.0; OARequirements(1).OAFlowMethod = OAFlowSum; @@ -2534,17 +2535,17 @@ TEST_F(EnergyPlusFixture, TerminalUnitMixerInitTest) SysATMixer(1).OneTimeInitFlag2 = false; // Current occupancy SysATMixer(1).OAPerPersonMode = 1; - SysATMixer(1).InitATMixer(state, true); + SysATMixer(1).InitATMixer(*state, true); EXPECT_NEAR(DataLoopNode::Node(2).MassFlowRate, 0.72, 0.0001); // Design occupancy SysATMixer(1).OAPerPersonMode = 2; Zone(1).TotOccupants = 10; - SysATMixer(1).InitATMixer(state, true); + SysATMixer(1).InitATMixer(*state, true); EXPECT_NEAR(DataLoopNode::Node(2).MassFlowRate, 1.32, 0.0001); SysATMixer.deallocate(); DataZoneEquipment::ZoneEquipConfig.deallocate(); - state.dataAirLoop->AirLoopFlow.deallocate(); + state->dataAirLoop->AirLoopFlow.deallocate(); DataLoopNode::Node.deallocate(); DataSizing::OARequirements.deallocate(); Zone.deallocate(); @@ -2563,7 +2564,7 @@ TEST_F(EnergyPlusFixture, TerminalUnitMixerInitTest2) SysATMixer.allocate(ATMixerNum); DataZoneEquipment::ZoneEquipConfig.allocate(1); - state.dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow.allocate(1); DataLoopNode::Node.allocate(3); DataSizing::OARequirements.allocate(1); Zone.allocate(1); @@ -2581,7 +2582,7 @@ TEST_F(EnergyPlusFixture, TerminalUnitMixerInitTest2) DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum(1) = 1; - state.dataAirLoop->AirLoopFlow(1).OAFrac = 1.0; + state->dataAirLoop->AirLoopFlow(1).OAFrac = 1.0; Zone(1).FloorArea = 10.0; OARequirements(1).OAFlowMethod = OAFlowSum; @@ -2607,27 +2608,27 @@ TEST_F(EnergyPlusFixture, TerminalUnitMixerInitTest2) // InletSideMixer, Mixed air outlet mass flow > OA requirement, expect primary flow to equal OA requirement SysATMixer(1).MixerType = DataHVACGlobals::ATMixer_InletSide; DataLoopNode::Node(SysATMixer(1).MixedAirOutNode).MassFlowRate = 1.0; - SysATMixer(1).InitATMixer(state, true); + SysATMixer(1).InitATMixer(*state, true); EXPECT_NEAR(DataLoopNode::Node(SysATMixer(1).PriInNode).MassFlowRate, 0.5, 0.0001); // InletSideMixer, Mixed air outlet mass flow < OA requirement, expect primary flow to equal mixed air flow DataLoopNode::Node(SysATMixer(1).MixedAirOutNode).MassFlowRate = 0.10; - SysATMixer(1).InitATMixer(state, true); + SysATMixer(1).InitATMixer(*state, true); EXPECT_NEAR(DataLoopNode::Node(SysATMixer(1).PriInNode).MassFlowRate, 0.10, 0.0001); // SupplySideMixer, Mixed air outlet mass flow > OA requirement, expect primary flow to equal OA requirement SysATMixer(1).MixerType = DataHVACGlobals::ATMixer_SupplySide; DataLoopNode::Node(SysATMixer(1).MixedAirOutNode).MassFlowRate = 1.0; - SysATMixer(1).InitATMixer(state, true); + SysATMixer(1).InitATMixer(*state, true); EXPECT_NEAR(DataLoopNode::Node(SysATMixer(1).PriInNode).MassFlowRate, 0.5, 0.0001); // SupplySideMixer, Mixed air outlet mass flow < OA requirement, expect primary flow to equal OA requirement DataLoopNode::Node(SysATMixer(1).MixedAirOutNode).MassFlowRate = 0.10; - SysATMixer(1).InitATMixer(state, true); + SysATMixer(1).InitATMixer(*state, true); EXPECT_NEAR(DataLoopNode::Node(SysATMixer(1).PriInNode).MassFlowRate, 0.5, 0.0001); SysATMixer.deallocate(); DataZoneEquipment::ZoneEquipConfig.deallocate(); - state.dataAirLoop->AirLoopFlow.deallocate(); + state->dataAirLoop->AirLoopFlow.deallocate(); DataLoopNode::Node.deallocate(); DataSizing::OARequirements.deallocate(); Zone.deallocate(); @@ -2690,14 +2691,14 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminal_SizeMinFrac) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); DataSizing::TermUnitFinalZoneSizing.allocate(1); DataSizing::TermUnitSizing.allocate(1); DataSizing::FinalZoneSizing.allocate(1); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); EXPECT_TRUE(compare_err_stream("")); int SysNum = 1; @@ -2707,7 +2708,7 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminal_SizeMinFrac) CurZoneEqNum = 1; CurTermUnitSizingNum = 1; DataSizing::TermUnitFinalZoneSizing(1).DesCoolVolFlowMin = 0.5; - SingleDuct::sd_airterminal(SysNum).SizeSys(state); + SingleDuct::sd_airterminal(SysNum).SizeSys(*state); EXPECT_EQ(0.5, SingleDuct::sd_airterminal(SysNum).ZoneMinAirFracDes); // Second test - design min flow > max flow @@ -2716,7 +2717,7 @@ TEST_F(EnergyPlusFixture, VAVReheatTerminal_SizeMinFrac) CurTermUnitSizingNum = 1; SingleDuct::sd_airterminal(SysNum).ZoneMinAirFracDes = AutoSize; // need to reset this so it sizes again DataSizing::TermUnitFinalZoneSizing(1).DesCoolVolFlowMin = 1.5; - SingleDuct::sd_airterminal(SysNum).SizeSys(state); + SingleDuct::sd_airterminal(SysNum).SizeSys(*state); EXPECT_EQ(1.0, SingleDuct::sd_airterminal(SysNum).ZoneMinAirFracDes); } TEST_F(EnergyPlusFixture, setATMixerSizingProperties_Test) @@ -2751,11 +2752,11 @@ TEST_F(EnergyPlusFixture, setATMixerSizingProperties_Test) SingleDuct::SysATMixer(1).DesignPrimaryAirVolRate = FinalSysSizing(1).DesMainVolFlow; SingleDuct::SysATMixer(1).MixerType = DataHVACGlobals::ATMixer_InletSide; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).CentralCoolCoilExists = true; - state.dataAirSystemsData->PrimaryAirSystems(1).CentralHeatCoilExists = true; - state.dataAirSystemsData->PrimaryAirSystems(1).NumOAHeatCoils = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).NumOACoolCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).CentralCoolCoilExists = true; + state->dataAirSystemsData->PrimaryAirSystems(1).CentralHeatCoilExists = true; + state->dataAirSystemsData->PrimaryAirSystems(1).NumOAHeatCoils = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).NumOACoolCoils = 1; ZoneEqSizing.allocate(1); @@ -2763,7 +2764,7 @@ TEST_F(EnergyPlusFixture, setATMixerSizingProperties_Test) int ControlledZoneNum = 1; CurZoneEqNum = 1; // set ATMixer properties used for sizing - SingleDuct::setATMixerSizingProperties(state, ATMixerIndex, ControlledZoneNum, CurZoneEqNum); + SingleDuct::setATMixerSizingProperties(*state, ATMixerIndex, ControlledZoneNum, CurZoneEqNum); EXPECT_DOUBLE_EQ(ZoneEqSizing(1).ATMixerVolFlow, SingleDuct::SysATMixer(1).DesignPrimaryAirVolRate); EXPECT_DOUBLE_EQ(ZoneEqSizing(1).ATMixerCoolPriDryBulb, FinalSysSizing(1).CoolSupTemp); @@ -2771,10 +2772,10 @@ TEST_F(EnergyPlusFixture, setATMixerSizingProperties_Test) EXPECT_DOUBLE_EQ(ZoneEqSizing(1).ATMixerHeatPriDryBulb, FinalSysSizing(1).HeatSupTemp); EXPECT_DOUBLE_EQ(ZoneEqSizing(1).ATMixerHeatPriHumRat, FinalSysSizing(1).HeatSupHumRat); - state.dataAirSystemsData->PrimaryAirSystems(1).CentralCoolCoilExists = false; - state.dataAirSystemsData->PrimaryAirSystems(1).CentralHeatCoilExists = false; + state->dataAirSystemsData->PrimaryAirSystems(1).CentralCoolCoilExists = false; + state->dataAirSystemsData->PrimaryAirSystems(1).CentralHeatCoilExists = false; // set ATMixer properties used for sizing - SingleDuct::setATMixerSizingProperties(state, ATMixerIndex, ControlledZoneNum, CurZoneEqNum); + SingleDuct::setATMixerSizingProperties(*state, ATMixerIndex, ControlledZoneNum, CurZoneEqNum); EXPECT_DOUBLE_EQ(ZoneEqSizing(1).ATMixerCoolPriDryBulb, FinalSysSizing(1).PrecoolTemp); EXPECT_DOUBLE_EQ(ZoneEqSizing(1).ATMixerCoolPriHumRat, FinalSysSizing(1).PrecoolHumRat); @@ -2783,18 +2784,18 @@ TEST_F(EnergyPlusFixture, setATMixerSizingProperties_Test) // set ATMixer properties used for sizing SingleDuct::SysATMixer(1).DesignPrimaryAirVolRate /= 2.0; - SingleDuct::setATMixerSizingProperties(state, ATMixerIndex, ControlledZoneNum, CurZoneEqNum); + SingleDuct::setATMixerSizingProperties(*state, ATMixerIndex, ControlledZoneNum, CurZoneEqNum); EXPECT_NEAR(ZoneEqSizing(1).ATMixerCoolPriDryBulb, FinalSysSizing(1).PrecoolTemp, 0.0000001); EXPECT_NEAR(ZoneEqSizing(1).ATMixerCoolPriHumRat, FinalSysSizing(1).PrecoolHumRat, 0.0000001); EXPECT_NEAR(ZoneEqSizing(1).ATMixerHeatPriDryBulb, FinalSysSizing(1).PreheatTemp, 0.0000001); EXPECT_NEAR(ZoneEqSizing(1).ATMixerHeatPriHumRat, FinalSysSizing(1).PreheatHumRat, 0.0000001); - state.dataAirSystemsData->PrimaryAirSystems(1).NumOAHeatCoils = 0; - state.dataAirSystemsData->PrimaryAirSystems(1).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(1).NumOAHeatCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(1).NumOACoolCoils = 0; SingleDuct::SysATMixer(1).DesignPrimaryAirVolRate *= 2.0; - SingleDuct::setATMixerSizingProperties(state, ATMixerIndex, ControlledZoneNum, CurZoneEqNum); + SingleDuct::setATMixerSizingProperties(*state, ATMixerIndex, ControlledZoneNum, CurZoneEqNum); EXPECT_NEAR(ZoneEqSizing(1).ATMixerCoolPriDryBulb, FinalSysSizing(1).OutTempAtCoolPeak, 0.0000001); EXPECT_NEAR(ZoneEqSizing(1).ATMixerCoolPriHumRat, FinalSysSizing(1).OutHumRatAtCoolPeak, 0.0000001); diff --git a/tst/EnergyPlus/unit/SiteBuildingSurfaceGroundTemperatures.unit.cc b/tst/EnergyPlus/unit/SiteBuildingSurfaceGroundTemperatures.unit.cc index df4b0fc8d54..38b31baca51 100644 --- a/tst/EnergyPlus/unit/SiteBuildingSurfaceGroundTemperatures.unit.cc +++ b/tst/EnergyPlus/unit/SiteBuildingSurfaceGroundTemperatures.unit.cc @@ -55,6 +55,7 @@ #include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" #include "EnergyPlus/GroundTemperatureModeling/SiteBuildingSurfaceGroundTemperatures.hh" #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::GroundTemperatureManager; @@ -81,13 +82,13 @@ TEST_F(EnergyPlusFixture, SiteBuildingSurfaceGroundTempTest) std::string const CurrentModuleObject = CurrentModuleObjects(objectType_SiteBuildingSurfaceGroundTemp); - auto thisModel = GetGroundTempModelAndInit(state, CurrentModuleObject, "TEST"); + auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); - EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 1), 0.1); // January - EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 12), 0.1); // December - EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 14), 0.1); // Feb of next year + EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.1); // January + EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.1); // December + EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 14), 0.1); // Feb of next year - EXPECT_NEAR(23.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 6393600), 0.1); // March 15 - EXPECT_NEAR(29.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 22291200), 0.1); // Sept 15 - EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 35510400), 0.1); // Feb 15 of next year + EXPECT_NEAR(23.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 6393600), 0.1); // March 15 + EXPECT_NEAR(29.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 22291200), 0.1); // Sept 15 + EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 35510400), 0.1); // Feb 15 of next year } diff --git a/tst/EnergyPlus/unit/SiteDeepGroundTemperatures.unit.cc b/tst/EnergyPlus/unit/SiteDeepGroundTemperatures.unit.cc index c47f494733d..7b7ab0aeae5 100644 --- a/tst/EnergyPlus/unit/SiteDeepGroundTemperatures.unit.cc +++ b/tst/EnergyPlus/unit/SiteDeepGroundTemperatures.unit.cc @@ -55,6 +55,7 @@ #include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" #include "EnergyPlus/GroundTemperatureModeling/SiteDeepGroundTemperatures.hh" #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::GroundTemperatureManager; @@ -81,13 +82,13 @@ TEST_F(EnergyPlusFixture, SiteDeepGroundTempTest) std::string const CurrentModuleObject = CurrentModuleObjects(objectType_SiteDeepGroundTemp); - auto thisModel = GetGroundTempModelAndInit(state, CurrentModuleObject, "TEST"); + auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); - EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 1), 0.1); // January - EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 12), 0.1); // December - EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 14), 0.1); // Feb of next year + EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.1); // January + EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.1); // December + EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 14), 0.1); // Feb of next year - EXPECT_NEAR(23.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 6393600), 0.1); // March 15 - EXPECT_NEAR(29.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 22291200), 0.1); // Sept 15 - EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 35510400), 0.1); // Feb 15 of next year + EXPECT_NEAR(23.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 6393600), 0.1); // March 15 + EXPECT_NEAR(29.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 22291200), 0.1); // Sept 15 + EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 35510400), 0.1); // Feb 15 of next year } diff --git a/tst/EnergyPlus/unit/SiteFCFactorMethodGroundTemperatures.unit.cc b/tst/EnergyPlus/unit/SiteFCFactorMethodGroundTemperatures.unit.cc index e6d4299d4df..4d87988aef3 100644 --- a/tst/EnergyPlus/unit/SiteFCFactorMethodGroundTemperatures.unit.cc +++ b/tst/EnergyPlus/unit/SiteFCFactorMethodGroundTemperatures.unit.cc @@ -55,6 +55,7 @@ #include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" #include "EnergyPlus/GroundTemperatureModeling/SiteFCFactorMethodGroundTemperatures.hh" #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::GroundTemperatureManager; @@ -81,13 +82,13 @@ TEST_F(EnergyPlusFixture, SiteFCFactorMethodGroundTempTest) std::string const CurrentModuleObject = CurrentModuleObjects(objectType_SiteFCFactorMethodGroundTemp); - auto thisModel = GetGroundTempModelAndInit(state, CurrentModuleObject, "TEST"); + auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); - EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 1), 0.1); // January - EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 12), 0.1); // December - EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 14), 0.1); // Feb of next year + EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.1); // January + EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.1); // December + EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 14), 0.1); // Feb of next year - EXPECT_NEAR(23.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 6393600), 0.1); // March 15 - EXPECT_NEAR(29.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 22291200), 0.1); // Sept 15 - EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 35510400), 0.1); // Feb 15 of next year + EXPECT_NEAR(23.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 6393600), 0.1); // March 15 + EXPECT_NEAR(29.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 22291200), 0.1); // Sept 15 + EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 35510400), 0.1); // Feb 15 of next year } diff --git a/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc b/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc index 1351e25329d..81bc0e5a79a 100644 --- a/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc +++ b/tst/EnergyPlus/unit/SiteGroundDomain.unit.cc @@ -53,6 +53,8 @@ // EnergyPlus Headers #include "EnergyPlus/PlantPipingSystemsManager.hh" #include "Fixtures/EnergyPlusFixture.hh" +#include + using namespace EnergyPlus; using namespace PlantPipingSystemsManager; @@ -81,9 +83,9 @@ TEST_F(EnergyPlusFixture, SiteGroundDomainSlabAndBasementModelsIndexChecking) domains.resize(2); - domains[0].groundTempModel = GetGroundTempModelAndInit(state, "Site:GroundTemperature:Undisturbed:KusudaAchenbach", "KA1"); + domains[0].groundTempModel = GetGroundTempModelAndInit(*state, "Site:GroundTemperature:Undisturbed:KusudaAchenbach", "KA1"); - domains[1].groundTempModel = GetGroundTempModelAndInit(state, "Site:GroundTemperature:Undisturbed:KusudaAchenbach", "KA2"); + domains[1].groundTempModel = GetGroundTempModelAndInit(*state, "Site:GroundTemperature:Undisturbed:KusudaAchenbach", "KA2"); EXPECT_NE(domains[0].groundTempModel, domains[1].groundTempModel); } diff --git a/tst/EnergyPlus/unit/SiteShallowGroundTemperatures.unit.cc b/tst/EnergyPlus/unit/SiteShallowGroundTemperatures.unit.cc index caaebdb31df..c1f4eb1739a 100644 --- a/tst/EnergyPlus/unit/SiteShallowGroundTemperatures.unit.cc +++ b/tst/EnergyPlus/unit/SiteShallowGroundTemperatures.unit.cc @@ -55,6 +55,7 @@ #include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" #include "EnergyPlus/GroundTemperatureModeling/SiteShallowGroundTemperatures.hh" #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::GroundTemperatureManager; @@ -81,13 +82,13 @@ TEST_F(EnergyPlusFixture, SiteShallowGroundTempTest) std::string const CurrentModuleObject = CurrentModuleObjects(objectType_SiteShallowGroundTemp); - auto thisModel = GetGroundTempModelAndInit(state, CurrentModuleObject, "TEST"); + auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); - EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 1), 0.1); // January - EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 12), 0.1); // December - EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 14), 0.1); // Feb of next year + EXPECT_NEAR(21.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.1); // January + EXPECT_NEAR(32.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.1); // December + EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 14), 0.1); // Feb of next year - EXPECT_NEAR(23.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 6393600), 0.1); // March 15 - EXPECT_NEAR(29.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 22291200), 0.1); // Sept 15 - EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 35510400), 0.1); // Feb 15 of next year + EXPECT_NEAR(23.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 6393600), 0.1); // March 15 + EXPECT_NEAR(29.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 22291200), 0.1); // Sept 15 + EXPECT_NEAR(22.0, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 35510400), 0.1); // Feb 15 of next year } diff --git a/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc b/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc index 296487428a4..2d879a975e5 100644 --- a/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc +++ b/tst/EnergyPlus/unit/SizeWaterHeatingCoil.unit.cc @@ -74,6 +74,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace ObjexxFCL; using namespace EnergyPlus; @@ -232,8 +233,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils1) TotNumLoops = 1; PlantLoop.allocate(TotNumLoops); PlantSizData.allocate(1); - state.dataWaterCoils->MySizeFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); NumPltSizInput = 1; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -245,33 +246,33 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils1) loopsidebranch.TotalComponents = 1; loopsidebranch.Comp.allocate(1); } - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE1-1", Zone(1).Name); - GetOARequirements(state); // get the OA requirements object - GetZoneAirDistribution(state); // get zone air distribution objects - GetZoneSizingInput(state); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetOARequirements(*state); // get the OA requirements object + GetZoneAirDistribution(*state); // get zone air distribution objects + GetZoneSizingInput(*state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetZoneAirLoopEquipment(state); - GetWaterCoilInput(state); - state.dataWaterCoils->GetWaterCoilsInputFlag = false; - state.dataWaterCoils->MySizeFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; - GetSysInput(state); + GetZoneAirLoopEquipment(*state); + GetWaterCoilInput(*state); + state->dataWaterCoils->GetWaterCoilsInputFlag = false; + state->dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; + GetSysInput(*state); DataSizing::TermUnitSingDuct = true; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; sd_airterminal(1).HWLoopNum = 1; sd_airterminal(1).HWLoopSide = 1; sd_airterminal(1).HWBranchIndex = 1; @@ -316,10 +317,10 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils1) FinalZoneSizing(CurZoneEqNum).DesHeatMaxAirFlowFrac); TermUnitFinalZoneSizing(CurTermUnitSizingNum) = FinalZoneSizing(CurZoneEqNum); sd_airterminal(1).ZoneFloorArea = Zone(1).FloorArea; - OutputReportPredefined::SetPredefinedTables(state); - sd_airterminal(1).SizeSys(state); - SizeWaterCoil(state, 1); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).UACoil, 199.86, 0.01); + OutputReportPredefined::SetPredefinedTables(*state); + sd_airterminal(1).SizeSys(*state); + SizeWaterCoil(*state, 1); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).UACoil, 199.86, 0.01); Node.deallocate(); ZoneEquipConfig.deallocate(); @@ -332,8 +333,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils1) ZoneEqSizing.deallocate(); PlantLoop.deallocate(); PlantSizData.deallocate(); - state.dataWaterCoils->MySizeFlag.deallocate(); - state.dataWaterCoils->MyUAAndFlowCalcFlag.deallocate(); + state->dataWaterCoils->MySizeFlag.deallocate(); + state->dataWaterCoils->MyUAAndFlowCalcFlag.deallocate(); } TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils2) @@ -470,8 +471,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils2) TotNumLoops = 1; PlantLoop.allocate(TotNumLoops); PlantSizData.allocate(1); - state.dataWaterCoils->MySizeFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); NumPltSizInput = 1; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -483,33 +484,33 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils2) loopsidebranch.TotalComponents = 1; loopsidebranch.Comp.allocate(1); } - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE1-1", Zone(1).Name); - GetOARequirements(state); // get the OA requirements object - GetZoneAirDistribution(state); // get zone air distribution objects - GetZoneSizingInput(state); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetOARequirements(*state); // get the OA requirements object + GetZoneAirDistribution(*state); // get zone air distribution objects + GetZoneSizingInput(*state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetZoneAirLoopEquipment(state); - GetWaterCoilInput(state); - state.dataWaterCoils->GetWaterCoilsInputFlag = false; - state.dataWaterCoils->MySizeFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; - GetSysInput(state); + GetZoneAirLoopEquipment(*state); + GetWaterCoilInput(*state); + state->dataWaterCoils->GetWaterCoilsInputFlag = false; + state->dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; + GetSysInput(*state); DataSizing::TermUnitSingDuct = true; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; sd_airterminal(1).HWLoopNum = 1; sd_airterminal(1).HWLoopSide = 1; sd_airterminal(1).HWBranchIndex = 1; @@ -554,10 +555,10 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils2) TermUnitFinalZoneSizing(CurTermUnitSizingNum) = FinalZoneSizing(CurZoneEqNum); sd_airterminal(1).ZoneFloorArea = Zone(1).FloorArea; sd_airterminal(1).ZoneFloorArea = Zone(1).FloorArea; - sd_airterminal(1).SizeSys(state); - SizeWaterCoil(state, 1); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate, .0000850575, 0.000000001); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).UACoil, 85.97495, 0.01); + sd_airterminal(1).SizeSys(*state); + SizeWaterCoil(*state, 1); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate, .0000850575, 0.000000001); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).UACoil, 85.97495, 0.01); Node.deallocate(); ZoneEquipConfig.deallocate(); @@ -570,8 +571,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils2) ZoneEqSizing.deallocate(); PlantLoop.deallocate(); PlantSizData.deallocate(); - state.dataWaterCoils->MySizeFlag.deallocate(); - state.dataWaterCoils->MyUAAndFlowCalcFlag.deallocate(); + state->dataWaterCoils->MySizeFlag.deallocate(); + state->dataWaterCoils->MyUAAndFlowCalcFlag.deallocate(); } TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils3) @@ -707,8 +708,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils3) TotNumLoops = 1; PlantLoop.allocate(TotNumLoops); PlantSizData.allocate(1); - state.dataWaterCoils->MySizeFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); NumPltSizInput = 1; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -720,33 +721,33 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils3) loopsidebranch.TotalComponents = 1; loopsidebranch.Comp.allocate(1); } - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE1-1", Zone(1).Name); - GetOARequirements(state); // get the OA requirements object - GetZoneAirDistribution(state); // get zone air distribution objects - GetZoneSizingInput(state); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetOARequirements(*state); // get the OA requirements object + GetZoneAirDistribution(*state); // get zone air distribution objects + GetZoneSizingInput(*state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetZoneAirLoopEquipment(state); - GetWaterCoilInput(state); - state.dataWaterCoils->GetWaterCoilsInputFlag = false; - state.dataWaterCoils->MySizeFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; - GetSysInput(state); + GetZoneAirLoopEquipment(*state); + GetWaterCoilInput(*state); + state->dataWaterCoils->GetWaterCoilsInputFlag = false; + state->dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; + GetSysInput(*state); DataSizing::TermUnitSingDuct = true; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; sd_airterminal(1).HWLoopNum = 1; sd_airterminal(1).HWLoopSide = 1; sd_airterminal(1).HWBranchIndex = 1; @@ -790,10 +791,10 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils3) FinalZoneSizing(CurZoneEqNum).DesHeatMaxAirFlowFrac); TermUnitFinalZoneSizing(CurTermUnitSizingNum) = FinalZoneSizing(CurZoneEqNum); sd_airterminal(1).ZoneFloorArea = Zone(1).FloorArea; - sd_airterminal(1).SizeSys(state); - SizeWaterCoil(state, 1); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate, .0000850575, 0.000000001); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).UACoil, 85.97495, 0.01); + sd_airterminal(1).SizeSys(*state); + SizeWaterCoil(*state, 1); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate, .0000850575, 0.000000001); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).UACoil, 85.97495, 0.01); Node.deallocate(); ZoneEquipConfig.deallocate(); @@ -806,8 +807,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils3) ZoneEqSizing.deallocate(); PlantLoop.deallocate(); PlantSizData.deallocate(); - state.dataWaterCoils->MySizeFlag.deallocate(); - state.dataWaterCoils->MyUAAndFlowCalcFlag.deallocate(); + state->dataWaterCoils->MySizeFlag.deallocate(); + state->dataWaterCoils->MyUAAndFlowCalcFlag.deallocate(); } TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils4) @@ -944,8 +945,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils4) TotNumLoops = 1; PlantLoop.allocate(TotNumLoops); PlantSizData.allocate(1); - state.dataWaterCoils->MySizeFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); NumPltSizInput = 1; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -957,33 +958,33 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils4) loopsidebranch.TotalComponents = 1; loopsidebranch.Comp.allocate(1); } - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE1-1", Zone(1).Name); - GetOARequirements(state); // get the OA requirements object - GetZoneAirDistribution(state); // get zone air distribution objects - GetZoneSizingInput(state); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetOARequirements(*state); // get the OA requirements object + GetZoneAirDistribution(*state); // get zone air distribution objects + GetZoneSizingInput(*state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetZoneAirLoopEquipment(state); - GetWaterCoilInput(state); - state.dataWaterCoils->GetWaterCoilsInputFlag = false; - state.dataWaterCoils->MySizeFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; - GetSysInput(state); + GetZoneAirLoopEquipment(*state); + GetWaterCoilInput(*state); + state->dataWaterCoils->GetWaterCoilsInputFlag = false; + state->dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; + GetSysInput(*state); DataSizing::TermUnitSingDuct = true; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; sd_airterminal(1).HWLoopNum = 1; sd_airterminal(1).HWLoopSide = 1; sd_airterminal(1).HWBranchIndex = 1; @@ -1027,10 +1028,10 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils4) FinalZoneSizing(CurZoneEqNum).DesHeatMaxAirFlowFrac); TermUnitFinalZoneSizing(CurTermUnitSizingNum) = FinalZoneSizing(CurZoneEqNum); sd_airterminal(1).ZoneFloorArea = Zone(1).FloorArea; - sd_airterminal(1).SizeSys(state); - SizeWaterCoil(state, 1); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate, .0000850575, 0.000000001); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).UACoil, 300.00, 0.01); + sd_airterminal(1).SizeSys(*state); + SizeWaterCoil(*state, 1); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate, .0000850575, 0.000000001); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).UACoil, 300.00, 0.01); Node.deallocate(); ZoneEquipConfig.deallocate(); @@ -1043,8 +1044,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils4) ZoneEqSizing.deallocate(); PlantLoop.deallocate(); PlantSizData.deallocate(); - state.dataWaterCoils->MySizeFlag.deallocate(); - state.dataWaterCoils->MyUAAndFlowCalcFlag.deallocate(); + state->dataWaterCoils->MySizeFlag.deallocate(); + state->dataWaterCoils->MyUAAndFlowCalcFlag.deallocate(); } TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils5) @@ -1140,13 +1141,13 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils5) FinalSysSizing.allocate(1); UnitarySysEqSizing.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); TotNumLoops = 1; PlantLoop.allocate(TotNumLoops); PlantSizData.allocate(1); - state.dataWaterCoils->MySizeFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); NumPltSizInput = 1; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -1158,27 +1159,27 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils5) loopsidebranch.TotalComponents = 1; loopsidebranch.Comp.allocate(1); } - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE1-1", Zone(1).Name); - ProcessScheduleInput(state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetWaterCoilInput(state); - state.dataWaterCoils->GetWaterCoilsInputFlag = false; - state.dataWaterCoils->MySizeFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; + GetWaterCoilInput(*state); + state->dataWaterCoils->GetWaterCoilsInputFlag = false; + state->dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; DataSizing::TermUnitSingDuct = true; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; PlantSizData(1).DeltaT = 11.0; PlantSizData(1).ExitTemp = 82; PlantSizData(1).PlantLoopName = "HotWaterLoop"; @@ -1200,20 +1201,20 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils5) UnitarySysEqSizing(CurSysNum).CoolingCapacity = false; UnitarySysEqSizing(CurSysNum).HeatingCapacity = false; DataHVACGlobals::NumPrimaryAirSys = 1; - SizeWaterCoil(state, 1); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate, .258323, 0.00001); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).UACoil, 239.835, 0.01); + SizeWaterCoil(*state, 1); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate, .258323, 0.00001); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).UACoil, 239.835, 0.01); Node.deallocate(); Zone.deallocate(); PlantLoop.deallocate(); PlantSizData.deallocate(); - state.dataWaterCoils->MySizeFlag.deallocate(); - state.dataWaterCoils->MyUAAndFlowCalcFlag.deallocate(); + state->dataWaterCoils->MySizeFlag.deallocate(); + state->dataWaterCoils->MyUAAndFlowCalcFlag.deallocate(); FinalSysSizing.deallocate(); UnitarySysEqSizing.deallocate(); - state.dataAirSystemsData->PrimaryAirSystems.deallocate(); - state.dataAirLoop->AirLoopControlInfo.deallocate(); + state->dataAirSystemsData->PrimaryAirSystems.deallocate(); + state->dataAirLoop->AirLoopControlInfo.deallocate(); } TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils6) @@ -1356,8 +1357,8 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils6) TermUnitSizing.allocate(1); TotNumLoops = 1; PlantLoop.allocate(TotNumLoops); - state.dataWaterCoils->MySizeFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); loop.LoopSide.allocate(2); @@ -1368,33 +1369,33 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils6) loopsidebranch.TotalComponents = 1; loopsidebranch.Comp.allocate(1); } - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE1-1", Zone(1).Name); - GetOARequirements(state); // get the OA requirements object - GetZoneAirDistribution(state); // get zone air distribution objects - GetZoneSizingInput(state); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetOARequirements(*state); // get the OA requirements object + GetZoneAirDistribution(*state); // get zone air distribution objects + GetZoneSizingInput(*state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetZoneAirLoopEquipment(state); - GetWaterCoilInput(state); - state.dataWaterCoils->GetWaterCoilsInputFlag = false; - state.dataWaterCoils->MySizeFlag(1) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; - GetSysInput(state); + GetZoneAirLoopEquipment(*state); + GetWaterCoilInput(*state); + state->dataWaterCoils->GetWaterCoilsInputFlag = false; + state->dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = false; + GetSysInput(*state); DataSizing::TermUnitSingDuct = true; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; sd_airterminal(1).HWLoopNum = 1; sd_airterminal(1).HWLoopSide = 1; sd_airterminal(1).HWBranchIndex = 1; @@ -1404,22 +1405,22 @@ TEST_F(EnergyPlusFixture, TestSizingRoutineForHotWaterCoils6) Zone(1).FloorArea = 99.16; sd_airterminal(1).ZoneFloorArea = Zone(1).FloorArea; - OutputReportPredefined::SetPredefinedTables(state); - sd_airterminal(1).SizeSys(state); - state.dataGlobal->BeginEnvrnFlag = true; + OutputReportPredefined::SetPredefinedTables(*state); + sd_airterminal(1).SizeSys(*state); + state->dataGlobal->BeginEnvrnFlag = true; // water coil is user input for water flow and UA with performance input method = UFactorTimesAreaAndDesignWaterFlowRate and Rated Capacity = // autosize - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate, .0000850575, 0.000000001); // water flow rate input by user - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).UACoil, 300.00, 0.01); // Ua input by user - EXPECT_EQ(state.dataWaterCoils->WaterCoil(1).DesTotWaterCoilLoad, DataSizing::AutoSize); // Rated Capacity input by user - EXPECT_EQ(state.dataWaterCoils->WaterCoil(1).DesWaterHeatingCoilRate, 0.0); // model output not yet set + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate, .0000850575, 0.000000001); // water flow rate input by user + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).UACoil, 300.00, 0.01); // Ua input by user + EXPECT_EQ(state->dataWaterCoils->WaterCoil(1).DesTotWaterCoilLoad, DataSizing::AutoSize); // Rated Capacity input by user + EXPECT_EQ(state->dataWaterCoils->WaterCoil(1).DesWaterHeatingCoilRate, 0.0); // model output not yet set // sizing will be called and skipped with Init setting DesWaterHeatingCoilRate based on above inputs - InitWaterCoil(state, 1, false); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(1).DesWaterHeatingCoilRate, 7390.73, 0.01); + InitWaterCoil(*state, 1, false); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(1).DesWaterHeatingCoilRate, 7390.73, 0.01); // not set in Init for water heating coils and not used elsewhere other than sizing - EXPECT_EQ(state.dataWaterCoils->WaterCoil(1).DesTotWaterCoilLoad, DataSizing::AutoSize); + EXPECT_EQ(state->dataWaterCoils->WaterCoil(1).DesTotWaterCoilLoad, DataSizing::AutoSize); sd_airterminal.deallocate(); } diff --git a/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc b/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc index 898b5dcb8e5..976c31dfb10 100644 --- a/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc +++ b/tst/EnergyPlus/unit/SizingAnalysisObjects.unit.cc @@ -60,8 +60,9 @@ #include #include #include - +#include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace OutputProcessor; @@ -77,40 +78,40 @@ class SizingAnalysisObjectsTest : public EnergyPlusFixture { EnergyPlus::EnergyPlusFixture::SetUp(); - state.files.eio.open_as_stringstream(); + state->files.eio.open_as_stringstream(); // fill in test log data values lowLogVal = 50.0; midLogVal = 75.0; hiLogVal = 100.0; - state.dataGlobal->NumOfTimeStepInHour = 4; // in DataGlobals - state.dataGlobal->TimeStepZone = 0.25; + state->dataGlobal->NumOfTimeStepInHour = 4; // in DataGlobals + state->dataGlobal->TimeStepZone = 0.25; // setup weather manager state needed - state.dataWeatherManager->NumOfEnvrn = 2; - state.dataWeatherManager->Environment.allocate(state.dataWeatherManager->NumOfEnvrn); - state.dataWeatherManager->Environment(1).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; - state.dataWeatherManager->Environment(1).DesignDayNum = 1; + state->dataWeatherManager->NumOfEnvrn = 2; + state->dataWeatherManager->Environment.allocate(state->dataWeatherManager->NumOfEnvrn); + state->dataWeatherManager->Environment(1).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; + state->dataWeatherManager->Environment(1).DesignDayNum = 1; - state.dataWeatherManager->Environment(2).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; - state.dataWeatherManager->Environment(2).DesignDayNum = 2; + state->dataWeatherManager->Environment(2).KindOfEnvrn = DataGlobalConstants::KindOfSim::DesignDay; + state->dataWeatherManager->Environment(2).DesignDayNum = 2; averagingWindow = 1; - logIndex = sizingLoggerFrameObj.SetupVariableSizingLog(state, LogVal, averagingWindow); + logIndex = sizingLoggerFrameObj.SetupVariableSizingLog(*state, LogVal, averagingWindow); - state.dataWeatherManager->NumOfEnvrn = 4; - state.dataWeatherManager->Environment.redimension(state.dataWeatherManager->NumOfEnvrn); + state->dataWeatherManager->NumOfEnvrn = 4; + state->dataWeatherManager->Environment.redimension(state->dataWeatherManager->NumOfEnvrn); - state.dataWeatherManager->Environment(3).KindOfEnvrn = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; - state.dataWeatherManager->Environment(3).DesignDayNum = 1; - state.dataWeatherManager->Environment(3).SeedEnvrnNum = 1; + state->dataWeatherManager->Environment(3).KindOfEnvrn = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataWeatherManager->Environment(3).DesignDayNum = 1; + state->dataWeatherManager->Environment(3).SeedEnvrnNum = 1; - state.dataWeatherManager->Environment(4).KindOfEnvrn = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; - state.dataWeatherManager->Environment(4).DesignDayNum = 2; - state.dataWeatherManager->Environment(4).SeedEnvrnNum = 2; + state->dataWeatherManager->Environment(4).KindOfEnvrn = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataWeatherManager->Environment(4).DesignDayNum = 2; + state->dataWeatherManager->Environment(4).SeedEnvrnNum = 2; - OutputProcessor::SetupTimePointers(state, "ZONE", state.dataGlobal->TimeStepZone); - OutputProcessor::SetupTimePointers(state, "HVAC", DataHVACGlobals::TimeStepSys); + OutputProcessor::SetupTimePointers(*state, "ZONE", state->dataGlobal->TimeStepZone); + OutputProcessor::SetupTimePointers(*state, "HVAC", DataHVACGlobals::TimeStepSys); PlantSizData.allocate(1); @@ -130,7 +131,7 @@ class SizingAnalysisObjectsTest : public EnergyPlusFixture PlantLoop(1).MaxMassFlowRate = 2.0; PlantLoop(1).VolumeWasAutoSized = true; - SetPredefinedTables(state); + SetPredefinedTables(*state); } @@ -151,45 +152,45 @@ class SizingAnalysisObjectsTest : public EnergyPlusFixture TEST_F(SizingAnalysisObjectsTest, testZoneUpdateInLoggerFramework) { - ShowMessage(state, "Begin Test: SizingAnalysisObjectsTest, testZoneUpdateInLoggerFramework"); + ShowMessage(*state, "Begin Test: SizingAnalysisObjectsTest, testZoneUpdateInLoggerFramework"); // first step - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; - state.dataGlobal->DayOfSim = 1; - state.dataGlobal->HourOfDay = 1; - state.dataWeatherManager->Envrn = 3; - state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum = 1; - sizingLoggerFrameObj.SetupSizingLogsNewEnvironment(state); - state.dataGlobal->TimeStep = 1; + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->DayOfSim = 1; + state->dataGlobal->HourOfDay = 1; + state->dataWeatherManager->Envrn = 3; + state->dataWeatherManager->Environment(state->dataWeatherManager->Envrn).DesignDayNum = 1; + sizingLoggerFrameObj.SetupSizingLogsNewEnvironment(*state); + state->dataGlobal->TimeStep = 1; LogVal = lowLogVal; - sizingLoggerFrameObj.UpdateSizingLogValuesZoneStep(state); + sizingLoggerFrameObj.UpdateSizingLogValuesZoneStep(*state); EXPECT_DOUBLE_EQ(lowLogVal, sizingLoggerFrameObj.logObjs[logIndex].ztStepObj[0].logDataValue); // last step of first design day - state.dataGlobal->HourOfDay = 24; - state.dataGlobal->TimeStep = 4; + state->dataGlobal->HourOfDay = 24; + state->dataGlobal->TimeStep = 4; LogVal = hiLogVal; - sizingLoggerFrameObj.UpdateSizingLogValuesZoneStep(state); + sizingLoggerFrameObj.UpdateSizingLogValuesZoneStep(*state); EXPECT_DOUBLE_EQ(hiLogVal, sizingLoggerFrameObj.logObjs[logIndex].ztStepObj[95].logDataValue); // first step of second design day - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; - state.dataWeatherManager->Envrn = 4; - state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).DesignDayNum = 2; - sizingLoggerFrameObj.SetupSizingLogsNewEnvironment(state); + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + state->dataWeatherManager->Envrn = 4; + state->dataWeatherManager->Environment(state->dataWeatherManager->Envrn).DesignDayNum = 2; + sizingLoggerFrameObj.SetupSizingLogsNewEnvironment(*state); LogVal = midLogVal; - sizingLoggerFrameObj.UpdateSizingLogValuesZoneStep(state); + sizingLoggerFrameObj.UpdateSizingLogValuesZoneStep(*state); EXPECT_DOUBLE_EQ(midLogVal, sizingLoggerFrameObj.logObjs[logIndex].ztStepObj[96].logDataValue); } TEST_F(SizingAnalysisObjectsTest, BasicLogging4stepsPerHour) { - ShowMessage(state, "Begin Test: SizingAnalysisObjectsTest, BasicLogging4stepsPerHour"); + ShowMessage(*state, "Begin Test: SizingAnalysisObjectsTest, BasicLogging4stepsPerHour"); // basic test of method FillZoneStep and zone time stamp constructor // setup a log for 4 timesteps per hour and fill the first 4 steps, then check that values are there @@ -214,16 +215,16 @@ TEST_F(SizingAnalysisObjectsTest, BasicLogging4stepsPerHour) TestLogObj.ztStepObj.resize(TestLogObj.NumOfStepsInLogSet); // fill first step in log with zone step data - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; int Envrn(3); - state.dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSim = 1; int HourofDay(1); int timeStp(1); Real64 timeStepDuration(0.25); int numTimeStepsInHour(4); LogVal = lowLogVal; ZoneTimestepObject tmpztStepStamp1( // call constructor - state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); + state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); TestLogObj.FillZoneStep(tmpztStepStamp1); // fill second step log with zone step data @@ -231,21 +232,21 @@ TEST_F(SizingAnalysisObjectsTest, BasicLogging4stepsPerHour) timeStp = 2; LogVal = midLogVal; ZoneTimestepObject tmpztStepStamp2( // call constructor - state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); + state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); TestLogObj.FillZoneStep(tmpztStepStamp2); // fill third step log with zone step data timeStp = 3; LogVal = midLogVal; ZoneTimestepObject tmpztStepStamp3( // call constructor - state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); + state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); TestLogObj.FillZoneStep(tmpztStepStamp3); // fill fourth step log with zone step data timeStp = 4; LogVal = hiLogVal; ZoneTimestepObject tmpztStepStamp4( // call constructor - state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); + state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); TestLogObj.FillZoneStep(tmpztStepStamp4); // now check that the correct values were stored in the right spot @@ -259,7 +260,7 @@ TEST_F(SizingAnalysisObjectsTest, BasicLogging4stepsPerHour) TEST_F(SizingAnalysisObjectsTest, LoggingDDWrap1stepPerHour) { - ShowMessage(state, "Begin Test: SizingAnalysisObjectsTest, LoggingDDWrap1stepPerHour"); + ShowMessage(*state, "Begin Test: SizingAnalysisObjectsTest, LoggingDDWrap1stepPerHour"); // this test uses one timestep per hour and checks as for two design days @@ -282,9 +283,9 @@ TEST_F(SizingAnalysisObjectsTest, LoggingDDWrap1stepPerHour) TestLogObj.ztStepObj.resize(TestLogObj.NumOfStepsInLogSet); // fill first step in log with zone step data - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; int Envrn(3); - state.dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSim = 1; int HourofDay(1); int timeStp(1); Real64 timeStepDuration(1.0); @@ -294,7 +295,7 @@ TEST_F(SizingAnalysisObjectsTest, LoggingDDWrap1stepPerHour) for (int hr = 1; hr <= 24; ++hr) { HourofDay = hr; ZoneTimestepObject tmpztStepStamp1( // call constructor - state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); + state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); TestLogObj.FillZoneStep(tmpztStepStamp1); } @@ -303,7 +304,7 @@ TEST_F(SizingAnalysisObjectsTest, LoggingDDWrap1stepPerHour) for (int hr = 1; hr <= 24; ++hr) { HourofDay = hr; ZoneTimestepObject tmpztStepStamp1( // call constructor - state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); + state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); TestLogObj.FillZoneStep(tmpztStepStamp1); } @@ -317,7 +318,7 @@ TEST_F(SizingAnalysisObjectsTest, LoggingDDWrap1stepPerHour) TEST_F(SizingAnalysisObjectsTest, PlantCoincidentAnalyObjTest) { - ShowMessage(state, "Begin Test: SizingAnalysisObjectsTest, PlantCoincidentAnalyObjTest"); + ShowMessage(*state, "Begin Test: SizingAnalysisObjectsTest, PlantCoincidentAnalyObjTest"); std::string loopName; int loopNum; @@ -338,16 +339,16 @@ TEST_F(SizingAnalysisObjectsTest, PlantCoincidentAnalyObjTest) PlantCoinicidentAnalysis TestAnalysisObj(loopName, loopNum, nodeNum, density, cp, timestepsInAvg, plantSizingIndex); // fill first step in log with zone step data - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; int Envrn(4); - state.dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSim = 1; int HourofDay(1); int timeStp(1); Real64 timeStepDuration(0.25); int numTimeStepsInHour(4); ZoneTimestepObject tmpztStepStamp1( // call constructor - state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); + state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); LogVal = 1.5; // kg/s tmpztStepStamp1.runningAvgDataValue = 1.5; sizingLoggerFrameObj.logObjs[logIndex].FillZoneStep(tmpztStepStamp1); @@ -361,7 +362,7 @@ TEST_F(SizingAnalysisObjectsTest, PlantCoincidentAnalyObjTest) EXPECT_DOUBLE_EQ(0.002, PlantLoop(1).MaxVolFlowRate); // m3/s - TestAnalysisObj.ResolveDesignFlowRate(state, 1); + TestAnalysisObj.ResolveDesignFlowRate(*state, 1); EXPECT_DOUBLE_EQ(0.0015, PlantLoop(1).MaxVolFlowRate); // m3/s EXPECT_DOUBLE_EQ(1.5, PlantLoop(1).MaxMassFlowRate); // m3/s @@ -370,7 +371,7 @@ TEST_F(SizingAnalysisObjectsTest, PlantCoincidentAnalyObjTest) TEST_F(SizingAnalysisObjectsTest, LoggingSubStep4stepPerHour) { - ShowMessage(state, "Begin Test: SizingAnalysisObjectsTest, LoggingSubStep4stepPerHour"); + ShowMessage(*state, "Begin Test: SizingAnalysisObjectsTest, LoggingSubStep4stepPerHour"); // this test uses 4 zone timesteps per hour and 5 sub system time steps per zone timestep // tests FillSysStep over two design days @@ -393,9 +394,9 @@ TEST_F(SizingAnalysisObjectsTest, LoggingSubStep4stepPerHour) TestLogObj.ztStepObj.resize(TestLogObj.NumOfStepsInLogSet); - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; int Envrn(3); - state.dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSim = 1; int HourofDay(0); DataHVACGlobals::TimeStepSys = 1.0 / (4.0 * 5.0); // fractional hours, duration Real64 zoneTimeStepDuration(0.25); @@ -407,7 +408,7 @@ TEST_F(SizingAnalysisObjectsTest, LoggingSubStep4stepPerHour) for (int timeStp = 1; timeStp <= 4; ++timeStp) { // 15 minute zone timestep for (int subTimeStp = 1; subTimeStp <= 5; ++subTimeStp) { // 5 system substeps, so 3 minute system timestep Real64 const minutesPerHour(60.0); - ZoneTimestepObject tmpztStepStamp(state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, zoneTimeStepDuration, + ZoneTimestepObject tmpztStepStamp(state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, zoneTimeStepDuration, numTimeStepsInHour); // call constructor SystemTimestepObject tmpSysStepStamp; tmpSysStepStamp.CurMinuteEnd = (timeStp - 1) * (minutesPerHour * zoneTimeStepDuration) + @@ -420,7 +421,7 @@ TEST_F(SizingAnalysisObjectsTest, LoggingSubStep4stepPerHour) TestLogObj.FillSysStep(tmpztStepStamp, tmpSysStepStamp); } - ZoneTimestepObject tmpztStepStamp1(state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, zoneTimeStepDuration, + ZoneTimestepObject tmpztStepStamp1(state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, zoneTimeStepDuration, numTimeStepsInHour); // call constructor TestLogObj.FillZoneStep(tmpztStepStamp1); } @@ -433,7 +434,7 @@ TEST_F(SizingAnalysisObjectsTest, LoggingSubStep4stepPerHour) for (int timeStp = 1; timeStp <= 4; ++timeStp) { // 15 minute zone timestep for (int subTimeStp = 1; subTimeStp <= 5; ++subTimeStp) { // 5 system substeps, so 3 minute system timestep Real64 const minutesPerHour(60.0); - ZoneTimestepObject tmpztStepStamp(state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, zoneTimeStepDuration, + ZoneTimestepObject tmpztStepStamp(state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, zoneTimeStepDuration, numTimeStepsInHour); // call constructor SystemTimestepObject tmpSysStepStamp; tmpSysStepStamp.CurMinuteEnd = (timeStp - 1) * (minutesPerHour * zoneTimeStepDuration) + @@ -446,7 +447,7 @@ TEST_F(SizingAnalysisObjectsTest, LoggingSubStep4stepPerHour) TestLogObj.FillSysStep(tmpztStepStamp, tmpSysStepStamp); } - ZoneTimestepObject tmpztStepStamp1(state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, zoneTimeStepDuration, + ZoneTimestepObject tmpztStepStamp1(state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, zoneTimeStepDuration, numTimeStepsInHour); // call constructor TestLogObj.FillZoneStep(tmpztStepStamp1); } @@ -492,16 +493,16 @@ TEST_F(SizingAnalysisObjectsTest, PlantCoincidentAnalyObjTestNullMassFlowRateTim PlantCoinicidentAnalysis TestAnalysisObj(loopName, loopNum, nodeNum, density, cp, timestepsInAvg, plantSizingIndex); // fill first step in log with zone step data - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::HVACSizeDesignDay; int Envrn(4); - state.dataGlobal->DayOfSim = 1; + state->dataGlobal->DayOfSim = 1; int HourofDay(1); int timeStp(1); Real64 timeStepDuration(0.25); int numTimeStepsInHour(4); ZoneTimestepObject tmpztStepStamp1( // call full constructor - state.dataGlobal->KindOfSim, Envrn, state.dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); + state->dataGlobal->KindOfSim, Envrn, state->dataGlobal->DayOfSim, HourofDay, timeStp, timeStepDuration, numTimeStepsInHour); LogVal = 1.5; // kg/s tmpztStepStamp1.runningAvgDataValue = 1.5; sizingLoggerFrameObj.logObjs[logIndex].FillZoneStep(tmpztStepStamp1); @@ -517,7 +518,7 @@ TEST_F(SizingAnalysisObjectsTest, PlantCoincidentAnalyObjTestNullMassFlowRateTim EXPECT_DOUBLE_EQ(0.002, PlantLoop(1).MaxVolFlowRate); // m3/s - TestAnalysisObj.ResolveDesignFlowRate(state, 1); + TestAnalysisObj.ResolveDesignFlowRate(*state, 1); EXPECT_NEAR(0.00015, PlantLoop(1).MaxVolFlowRate, 0.00001); // m3/s EXPECT_NEAR(0.15, PlantLoop(1).MaxMassFlowRate, 0.001); // m3/s diff --git a/tst/EnergyPlus/unit/SizingManager.unit.cc b/tst/EnergyPlus/unit/SizingManager.unit.cc index 9027cc28567..e7b934cb80c 100644 --- a/tst/EnergyPlus/unit/SizingManager.unit.cc +++ b/tst/EnergyPlus/unit/SizingManager.unit.cc @@ -60,6 +60,7 @@ #include #include #include +#include using namespace EnergyPlus; @@ -103,7 +104,7 @@ TEST_F(EnergyPlusFixture, GetOARequirementsTest_DSOA1) Numbers(4) = 0.4; // Outdoor Air Flow Air Changes per Hour ErrorsFound = false; - ProcessInputOARequirements(state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, + ProcessInputOARequirements(*state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -124,7 +125,7 @@ TEST_F(EnergyPlusFixture, GetOARequirementsTest_DSOA1) Numbers(4) = 0.4; // Outdoor Air Flow Air Changes per Hour ErrorsFound = false; - ProcessInputOARequirements(state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, + ProcessInputOARequirements(*state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -145,7 +146,7 @@ TEST_F(EnergyPlusFixture, GetOARequirementsTest_DSOA1) Numbers(4) = 0.4; // Outdoor Air Flow Air Changes per Hour ErrorsFound = false; - ProcessInputOARequirements(state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, + ProcessInputOARequirements(*state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -166,7 +167,7 @@ TEST_F(EnergyPlusFixture, GetOARequirementsTest_DSOA1) Numbers(4) = 0.4; // Outdoor Air Flow Air Changes per Hour ErrorsFound = false; - ProcessInputOARequirements(state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, + ProcessInputOARequirements(*state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -187,7 +188,7 @@ TEST_F(EnergyPlusFixture, GetOARequirementsTest_DSOA1) Numbers(4) = 0.4; // Outdoor Air Flow Air Changes per Hour ErrorsFound = false; - ProcessInputOARequirements(state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, + ProcessInputOARequirements(*state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -208,7 +209,7 @@ TEST_F(EnergyPlusFixture, GetOARequirementsTest_DSOA1) Numbers(4) = 0.4; // Outdoor Air Flow Air Changes per Hour ErrorsFound = false; - ProcessInputOARequirements(state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, + ProcessInputOARequirements(*state, CurrentModuleObject, OAIndex, Alphas, NumAlphas, Numbers, NumNumbers, lNumericBlanks, lAlphaBlanks, cAlphaFields, cNumericFields, ErrorsFound); EXPECT_FALSE(ErrorsFound); @@ -228,25 +229,25 @@ TEST_F(EnergyPlusFixture, GetOARequirementsTest_DSOA1) TEST_F(EnergyPlusFixture, SizingManagerTest_TimeIndexToHrMinString_test) { - state.dataGlobal->MinutesPerTimeStep = 15; - - EXPECT_EQ("00:00:00", TimeIndexToHrMinString(state, 0)); - EXPECT_EQ("00:15:00", TimeIndexToHrMinString(state, 1)); - EXPECT_EQ("01:45:00", TimeIndexToHrMinString(state, 7)); - EXPECT_EQ("07:45:00", TimeIndexToHrMinString(state, 31)); - EXPECT_EQ("19:45:00", TimeIndexToHrMinString(state, 79)); - EXPECT_EQ("24:00:00", TimeIndexToHrMinString(state, 96)); - - state.dataGlobal->MinutesPerTimeStep = 3; - - EXPECT_EQ("00:00:00", TimeIndexToHrMinString(state, 0)); - EXPECT_EQ("00:03:00", TimeIndexToHrMinString(state, 1)); - EXPECT_EQ("00:21:00", TimeIndexToHrMinString(state, 7)); - EXPECT_EQ("01:33:00", TimeIndexToHrMinString(state, 31)); - EXPECT_EQ("03:57:00", TimeIndexToHrMinString(state, 79)); - EXPECT_EQ("04:48:00", TimeIndexToHrMinString(state, 96)); - EXPECT_EQ("16:39:00", TimeIndexToHrMinString(state, 333)); - EXPECT_EQ("24:00:00", TimeIndexToHrMinString(state, 480)); + state->dataGlobal->MinutesPerTimeStep = 15; + + EXPECT_EQ("00:00:00", TimeIndexToHrMinString(*state, 0)); + EXPECT_EQ("00:15:00", TimeIndexToHrMinString(*state, 1)); + EXPECT_EQ("01:45:00", TimeIndexToHrMinString(*state, 7)); + EXPECT_EQ("07:45:00", TimeIndexToHrMinString(*state, 31)); + EXPECT_EQ("19:45:00", TimeIndexToHrMinString(*state, 79)); + EXPECT_EQ("24:00:00", TimeIndexToHrMinString(*state, 96)); + + state->dataGlobal->MinutesPerTimeStep = 3; + + EXPECT_EQ("00:00:00", TimeIndexToHrMinString(*state, 0)); + EXPECT_EQ("00:03:00", TimeIndexToHrMinString(*state, 1)); + EXPECT_EQ("00:21:00", TimeIndexToHrMinString(*state, 7)); + EXPECT_EQ("01:33:00", TimeIndexToHrMinString(*state, 31)); + EXPECT_EQ("03:57:00", TimeIndexToHrMinString(*state, 79)); + EXPECT_EQ("04:48:00", TimeIndexToHrMinString(*state, 96)); + EXPECT_EQ("16:39:00", TimeIndexToHrMinString(*state, 333)); + EXPECT_EQ("24:00:00", TimeIndexToHrMinString(*state, 480)); } TEST_F(EnergyPlusFixture, SizingManager_DOASControlStrategyDefaultSpecificationTest) @@ -305,16 +306,16 @@ TEST_F(EnergyPlusFixture, SizingManager_DOASControlStrategyDefaultSpecificationT ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - SizingManager::GetOARequirements(state); - SizingManager::GetZoneSizingInput(state); + SizingManager::GetOARequirements(*state); + SizingManager::GetZoneSizingInput(*state); ASSERT_EQ(1, NumZoneSizingInput); ASSERT_EQ(DOANeutralSup, ZoneSizingInput(1).DOASControlStrategy); ASSERT_EQ(DataSizing::AutoSize, ZoneSizingInput(1).DOASLowSetpoint); ASSERT_EQ(DataSizing::AutoSize, ZoneSizingInput(1).DOASHighSetpoint); // set default DOAS control strategy setpoint values - ZoneEquipmentManager::AutoCalcDOASControlStrategy(state); + ZoneEquipmentManager::AutoCalcDOASControlStrategy(*state); // check default low and high set point values ASSERT_EQ(21.1, ZoneSizingInput(1).DOASLowSetpoint); ASSERT_EQ(23.9, ZoneSizingInput(1).DOASHighSetpoint); @@ -374,16 +375,16 @@ TEST_F(EnergyPlusFixture, SizingManager_DOASControlStrategyDefaultSpecificationT ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - SizingManager::GetOARequirements(state); - SizingManager::GetZoneSizingInput(state); + SizingManager::GetOARequirements(*state); + SizingManager::GetZoneSizingInput(*state); ASSERT_EQ(1, NumZoneSizingInput); ASSERT_EQ(DOANeutralSup, ZoneSizingInput(1).DOASControlStrategy); ASSERT_EQ(DataSizing::AutoSize, ZoneSizingInput(1).DOASLowSetpoint); ASSERT_EQ(DataSizing::AutoSize, ZoneSizingInput(1).DOASHighSetpoint); // set default DOAS control strategy setpoint values - ZoneEquipmentManager::AutoCalcDOASControlStrategy(state); + ZoneEquipmentManager::AutoCalcDOASControlStrategy(*state); // check default low and high set point values ASSERT_EQ(21.1, ZoneSizingInput(1).DOASLowSetpoint); ASSERT_EQ(23.9, ZoneSizingInput(1).DOASHighSetpoint); @@ -405,9 +406,9 @@ TEST_F(EnergyPlusFixture, SizingManager_CalcdoLoadComponentPulseNowTest) WarmupFlag = false; HourNum = 10; TimeStepNum = 1; - state.dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::RunPeriodDesign; - state.dataGlobal->DayOfSim = 2; - Answer = CalcdoLoadComponentPulseNow(state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state.dataGlobal->KindOfSim); + state->dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::RunPeriodDesign; + state->dataGlobal->DayOfSim = 2; + Answer = CalcdoLoadComponentPulseNow(*state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state->dataGlobal->KindOfSim); ASSERT_TRUE(Answer); //Test 16: Everything as it should be to set this to true-->result should be true @@ -415,9 +416,9 @@ TEST_F(EnergyPlusFixture, SizingManager_CalcdoLoadComponentPulseNowTest) WarmupFlag = false; HourNum = 10; TimeStepNum = 1; - state.dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::DesignDay; - state.dataGlobal->DayOfSim = 1; - Answer = CalcdoLoadComponentPulseNow(state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state.dataGlobal->KindOfSim); + state->dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::DesignDay; + state->dataGlobal->DayOfSim = 1; + Answer = CalcdoLoadComponentPulseNow(*state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state->dataGlobal->KindOfSim); ASSERT_TRUE(Answer); //Test 2: PulseSizing is false-->result should be false @@ -425,9 +426,9 @@ TEST_F(EnergyPlusFixture, SizingManager_CalcdoLoadComponentPulseNowTest) WarmupFlag = false; HourNum = 10; TimeStepNum = 1; - state.dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::RunPeriodDesign; - state.dataGlobal->DayOfSim = 1; - Answer = CalcdoLoadComponentPulseNow(state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state.dataGlobal->KindOfSim); + state->dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::RunPeriodDesign; + state->dataGlobal->DayOfSim = 1; + Answer = CalcdoLoadComponentPulseNow(*state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state->dataGlobal->KindOfSim); ASSERT_FALSE(Answer); //Test 3: Warmup is true-->result should be false @@ -435,9 +436,9 @@ TEST_F(EnergyPlusFixture, SizingManager_CalcdoLoadComponentPulseNowTest) WarmupFlag = true; HourNum = 10; TimeStepNum = 1; - state.dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::RunPeriodDesign; - state.dataGlobal->DayOfSim = 1; - Answer = CalcdoLoadComponentPulseNow(state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state.dataGlobal->KindOfSim); + state->dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::RunPeriodDesign; + state->dataGlobal->DayOfSim = 1; + Answer = CalcdoLoadComponentPulseNow(*state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state->dataGlobal->KindOfSim); ASSERT_FALSE(Answer); //Test 4: HourNum not 10-->result should be false @@ -445,9 +446,9 @@ TEST_F(EnergyPlusFixture, SizingManager_CalcdoLoadComponentPulseNowTest) WarmupFlag = false; HourNum = 7; TimeStepNum = 1; - state.dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::RunPeriodDesign; - state.dataGlobal->DayOfSim = 1; - Answer = CalcdoLoadComponentPulseNow(state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state.dataGlobal->KindOfSim); + state->dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::RunPeriodDesign; + state->dataGlobal->DayOfSim = 1; + Answer = CalcdoLoadComponentPulseNow(*state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state->dataGlobal->KindOfSim); ASSERT_FALSE(Answer); //Test 5: TimeStepNum not 1-->result should be false @@ -455,9 +456,9 @@ TEST_F(EnergyPlusFixture, SizingManager_CalcdoLoadComponentPulseNowTest) WarmupFlag = false; HourNum = 10; TimeStepNum = 2; - state.dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::RunPeriodDesign; - state.dataGlobal->DayOfSim = 1; - Answer = CalcdoLoadComponentPulseNow(state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state.dataGlobal->KindOfSim); + state->dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::RunPeriodDesign; + state->dataGlobal->DayOfSim = 1; + Answer = CalcdoLoadComponentPulseNow(*state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state->dataGlobal->KindOfSim); ASSERT_FALSE(Answer); //Test 6: DayOfSim not 1 and KindSim not weather file period --> result should be false @@ -465,9 +466,9 @@ TEST_F(EnergyPlusFixture, SizingManager_CalcdoLoadComponentPulseNowTest) WarmupFlag = false; HourNum = 10; TimeStepNum = 1; - state.dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::DesignDay; - state.dataGlobal->DayOfSim = 2; - Answer = CalcdoLoadComponentPulseNow(state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state.dataGlobal->KindOfSim); + state->dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::DesignDay; + state->dataGlobal->DayOfSim = 2; + Answer = CalcdoLoadComponentPulseNow(*state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state->dataGlobal->KindOfSim); ASSERT_FALSE(Answer); //Test 7: everything set to make the answer false @@ -475,9 +476,9 @@ TEST_F(EnergyPlusFixture, SizingManager_CalcdoLoadComponentPulseNowTest) WarmupFlag = true; HourNum = 2; TimeStepNum = 7; - state.dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::DesignDay; - state.dataGlobal->DayOfSim = 2; - Answer = CalcdoLoadComponentPulseNow(state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state.dataGlobal->KindOfSim); + state->dataGlobal->KindOfSim = EnergyPlus::DataGlobalConstants::KindOfSim::DesignDay; + state->dataGlobal->DayOfSim = 2; + Answer = CalcdoLoadComponentPulseNow(*state, PulseSizing, WarmupFlag, HourNum, TimeStepNum, state->dataGlobal->KindOfSim); ASSERT_FALSE(Answer); } diff --git a/tst/EnergyPlus/unit/SolarShading.unit.cc b/tst/EnergyPlus/unit/SolarShading.unit.cc index abb72db1af3..c46e1e87f05 100644 --- a/tst/EnergyPlus/unit/SolarShading.unit.cc +++ b/tst/EnergyPlus/unit/SolarShading.unit.cc @@ -69,6 +69,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::SolarShading; @@ -93,14 +94,14 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcPerSolarBeamTest) Real64 AvgCosSolarDeclin(0.0); // Average value of Cosine of Solar Declination for period int NumTimeSteps(6); - state.dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStep = 1; TotSurfaces = 3; MaxBkSurf = 3; SurfaceWindow.allocate(TotSurfaces); SunlitFracHR.allocate(24, TotSurfaces); SunlitFrac.allocate(NumTimeSteps, 24, TotSurfaces); SunlitFracWithoutReveal.allocate(NumTimeSteps, 24, TotSurfaces); - state.dataSolarShading->CTHETA.allocate(TotSurfaces); + state->dataSolarShading->CTHETA.allocate(TotSurfaces); CosIncAngHR.allocate(24, TotSurfaces); CosIncAng.allocate(NumTimeSteps, 24, TotSurfaces); SurfOpaqAO.allocate(TotSurfaces); @@ -116,7 +117,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcPerSolarBeamTest) } DetailedSolarTimestepIntegration = false; - CalcPerSolarBeam(state, AvgEqOfTime, AvgSinSolarDeclin, AvgCosSolarDeclin); + CalcPerSolarBeam(*state, AvgEqOfTime, AvgSinSolarDeclin, AvgCosSolarDeclin); for (int SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { for (int Hour = 1; Hour <= 24; ++Hour) { @@ -135,12 +136,12 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcPerSolarBeamTest) } DetailedSolarTimestepIntegration = true; - state.dataGlobal->HourOfDay = 23; - CalcPerSolarBeam(state, AvgEqOfTime, AvgSinSolarDeclin, AvgCosSolarDeclin); + state->dataGlobal->HourOfDay = 23; + CalcPerSolarBeam(*state, AvgEqOfTime, AvgSinSolarDeclin, AvgCosSolarDeclin); for (int SurfNum = 1; SurfNum <= TotSurfaces; ++SurfNum) { for (int Hour = 1; Hour <= 24; ++Hour) { - if (Hour == state.dataGlobal->HourOfDay) { + if (Hour == state->dataGlobal->HourOfDay) { EXPECT_EQ(1.0, SurfaceWindow(SurfNum).OutProjSLFracMult(Hour)); EXPECT_EQ(1.0, SurfaceWindow(SurfNum).InOutProjSLFracMult(Hour)); } else { @@ -155,7 +156,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CalcPerSolarBeamTest) SunlitFracHR.deallocate(); SunlitFrac.deallocate(); SunlitFracWithoutReveal.deallocate(); - state.dataSolarShading->CTHETA.deallocate(); + state->dataSolarShading->CTHETA.deallocate(); CosIncAngHR.deallocate(); CosIncAng.deallocate(); SurfOpaqAO.deallocate(); @@ -611,52 +612,52 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_FigureSolarBeamAtTimestep) ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); bool FoundError = false; - HeatBalanceManager::GetProjectControlData(state, FoundError); // read project control data + HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors - HeatBalanceManager::SetPreConstructionInputParameters(state); - ScheduleManager::ProcessScheduleInput(state); // read schedules + HeatBalanceManager::SetPreConstructionInputParameters(*state); + ScheduleManager::ProcessScheduleInput(*state); // read schedules - HeatBalanceManager::GetMaterialData(state, FoundError); + HeatBalanceManager::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetFrameAndDividerData(state, FoundError); + HeatBalanceManager::GetFrameAndDividerData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetConstructData(state, FoundError); + HeatBalanceManager::GetConstructData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetZoneData(state, FoundError); // Read Zone data from input file + HeatBalanceManager::GetZoneData(*state, FoundError); // Read Zone data from input file EXPECT_FALSE(FoundError); - SurfaceGeometry::GetGeometryParameters(state, FoundError); + SurfaceGeometry::GetGeometryParameters(*state, FoundError); EXPECT_FALSE(FoundError); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, FoundError); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, FoundError); // setup zone geometry and get zone data EXPECT_FALSE(FoundError); // expect no errors // compare_err_stream( "" ); // just for debugging - SurfaceGeometry::SetupZoneGeometry(state, FoundError); // this calls GetSurfaceData() + SurfaceGeometry::SetupZoneGeometry(*state, FoundError); // this calls GetSurfaceData() EXPECT_FALSE(FoundError); - SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(state); + SolarShading::AllocateModuleArrays(*state); + SolarShading::DetermineShadowingCombinations(*state); DataEnvironment::DayOfYear_Schedule = 168; DataEnvironment::DayOfWeek = 6; - state.dataGlobal->TimeStep = 4; - state.dataGlobal->HourOfDay = 9; + state->dataGlobal->TimeStep = 4; + state->dataGlobal->HourOfDay = 9; // compare_err_stream( "" ); // just for debugging @@ -664,12 +665,12 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_FigureSolarBeamAtTimestep) DataSystemVariables::DetailedSkyDiffuseAlgorithm = true; SolarDistribution = FullExterior; - state.dataSolarShading->CalcSkyDifShading = true; - SolarShading::InitSolarCalculations(state); - SolarShading::SkyDifSolarShading(state); - state.dataSolarShading->CalcSkyDifShading = false; + state->dataSolarShading->CalcSkyDifShading = true; + SolarShading::InitSolarCalculations(*state); + SolarShading::SkyDifSolarShading(*state); + state->dataSolarShading->CalcSkyDifShading = false; - FigureSolarBeamAtTimestep(state, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep); + FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); int windowSurfNum = UtilityRoutines::FindItemInList("ZN001:WALL-SOUTH:WIN001", DataSurfaces::Surface); EXPECT_NEAR(0.6504, DifShdgRatioIsoSkyHRTS(4, 9, windowSurfNum), 0.0001); @@ -1009,52 +1010,52 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_ExternalShadingIO) ASSERT_TRUE(process_idf(idf_objects)); - state.dataSolarShading->clear_state(); + state->dataSolarShading->clear_state(); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); bool FoundError = false; - HeatBalanceManager::GetProjectControlData(state, FoundError); // read project control data + HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors - HeatBalanceManager::SetPreConstructionInputParameters(state); - ScheduleManager::ProcessScheduleInput(state); // read schedules + HeatBalanceManager::SetPreConstructionInputParameters(*state); + ScheduleManager::ProcessScheduleInput(*state); // read schedules - HeatBalanceManager::GetMaterialData(state, FoundError); + HeatBalanceManager::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetFrameAndDividerData(state, FoundError); + HeatBalanceManager::GetFrameAndDividerData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetConstructData(state, FoundError); + HeatBalanceManager::GetConstructData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetZoneData(state, FoundError); // Read Zone data from input file + HeatBalanceManager::GetZoneData(*state, FoundError); // Read Zone data from input file EXPECT_FALSE(FoundError); - SurfaceGeometry::GetGeometryParameters(state, FoundError); + SurfaceGeometry::GetGeometryParameters(*state, FoundError); EXPECT_FALSE(FoundError); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; compare_err_stream(""); // just for debugging - SurfaceGeometry::SetupZoneGeometry(state, FoundError); // this calls GetSurfaceData() + SurfaceGeometry::SetupZoneGeometry(*state, FoundError); // this calls GetSurfaceData() EXPECT_FALSE(FoundError); - SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(state); + SolarShading::AllocateModuleArrays(*state); + SolarShading::DetermineShadowingCombinations(*state); DataEnvironment::DayOfYear_Schedule = 168; DataEnvironment::DayOfWeek = 6; - state.dataGlobal->TimeStep = 4; - state.dataGlobal->HourOfDay = 9; - state.dataGlobal->DoingSizing = false; - state.dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::RunPeriodWeather; + state->dataGlobal->TimeStep = 4; + state->dataGlobal->HourOfDay = 9; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->KindOfSim = DataGlobalConstants::KindOfSim::RunPeriodWeather; compare_err_stream(""); // just for debugging @@ -1063,23 +1064,23 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_ExternalShadingIO) DataSystemVariables::shadingMethod = DataSystemVariables::ShadingMethod::Scheduled; SolarDistribution = FullExterior; - state.dataSolarShading->CalcSkyDifShading = true; - SolarShading::InitSolarCalculations(state); - SolarShading::SkyDifSolarShading(state); - state.dataSolarShading->CalcSkyDifShading = false; + state->dataSolarShading->CalcSkyDifShading = true; + SolarShading::InitSolarCalculations(*state); + SolarShading::SkyDifSolarShading(*state); + state->dataSolarShading->CalcSkyDifShading = false; - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); DataBSDFWindow::SUNCOSTS(4, 9, 1) = 0.1; DataBSDFWindow::SUNCOSTS(4, 9, 2) = 0.1; DataBSDFWindow::SUNCOSTS(4, 9, 3) = 0.1; - FigureSolarBeamAtTimestep(state, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep); + FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); EXPECT_TRUE(DataSystemVariables::shadingMethod == DataSystemVariables::ShadingMethod::Scheduled); - EXPECT_DOUBLE_EQ(0.5432, ScheduleManager::LookUpScheduleValue(state, 2, 9, 4)); - EXPECT_FALSE(state.dataSolarShading->SUNCOS(3) < 0.00001); + EXPECT_DOUBLE_EQ(0.5432, ScheduleManager::LookUpScheduleValue(*state, 2, 9, 4)); + EXPECT_FALSE(state->dataSolarShading->SUNCOS(3) < 0.00001); EXPECT_DOUBLE_EQ(0.00001, DataEnvironment::SunIsUpValue); ; - EXPECT_FALSE(state.dataSolarShading->SUNCOS(3) < DataEnvironment::SunIsUpValue); + EXPECT_FALSE(state->dataSolarShading->SUNCOS(3) < DataEnvironment::SunIsUpValue); int surfNum = UtilityRoutines::FindItemInList("ZN001:WALL-SOUTH", DataSurfaces::Surface); EXPECT_DOUBLE_EQ(1, SunlitFrac(4, 9, surfNum)); @@ -1087,7 +1088,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_ExternalShadingIO) EXPECT_DOUBLE_EQ(1, SunlitFrac(4, 9, surfNum)); surfNum = UtilityRoutines::FindItemInList("ZN001:ROOF", DataSurfaces::Surface); EXPECT_DOUBLE_EQ(0.5432, SunlitFrac(4, 9, surfNum)); - state.dataSolarShading->clear_state(); + state->dataSolarShading->clear_state(); } TEST_F(EnergyPlusFixture, SolarShadingTest_DisableGroupSelfShading) @@ -1420,49 +1421,49 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_DisableGroupSelfShading) ASSERT_TRUE(process_idf(idf_objects)); - state.dataSolarShading->clear_state(); + state->dataSolarShading->clear_state(); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); bool FoundError = false; - HeatBalanceManager::GetProjectControlData(state, FoundError); // read project control data + HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors - HeatBalanceManager::SetPreConstructionInputParameters(state); - ScheduleManager::ProcessScheduleInput(state); // read schedules + HeatBalanceManager::SetPreConstructionInputParameters(*state); + ScheduleManager::ProcessScheduleInput(*state); // read schedules - HeatBalanceManager::GetMaterialData(state, FoundError); + HeatBalanceManager::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetFrameAndDividerData(state, FoundError); + HeatBalanceManager::GetFrameAndDividerData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetConstructData(state, FoundError); + HeatBalanceManager::GetConstructData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetZoneData(state, FoundError); // Read Zone data from input file + HeatBalanceManager::GetZoneData(*state, FoundError); // Read Zone data from input file EXPECT_FALSE(FoundError); - SurfaceGeometry::GetGeometryParameters(state, FoundError); + SurfaceGeometry::GetGeometryParameters(*state, FoundError); EXPECT_FALSE(FoundError); - SizingManager::GetZoneSizingInput(state); + SizingManager::GetZoneSizingInput(*state); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; compare_err_stream(""); // just for debugging - SurfaceGeometry::SetupZoneGeometry(state, FoundError); // this calls GetSurfaceData() + SurfaceGeometry::SetupZoneGeometry(*state, FoundError); // this calls GetSurfaceData() EXPECT_FALSE(FoundError); compare_err_stream(""); // just for debugging - SolarShading::GetShadowingInput(state); + SolarShading::GetShadowingInput(*state); for (int SurfNum = 1; SurfNum <= TotSurfaces; SurfNum++) { if (Surface(SurfNum).ExtBoundCond == 0 && Surface(SurfNum).Zone != 0) { @@ -1792,52 +1793,52 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonClippingDirect) ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); bool FoundError = false; - HeatBalanceManager::GetProjectControlData(state, FoundError); // read project control data + HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors - HeatBalanceManager::SetPreConstructionInputParameters(state); - ScheduleManager::ProcessScheduleInput(state); // read schedules + HeatBalanceManager::SetPreConstructionInputParameters(*state); + ScheduleManager::ProcessScheduleInput(*state); // read schedules - HeatBalanceManager::GetMaterialData(state, FoundError); + HeatBalanceManager::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetFrameAndDividerData(state, FoundError); + HeatBalanceManager::GetFrameAndDividerData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetConstructData(state, FoundError); + HeatBalanceManager::GetConstructData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetZoneData(state, FoundError); // Read Zone data from input file + HeatBalanceManager::GetZoneData(*state, FoundError); // Read Zone data from input file EXPECT_FALSE(FoundError); - SurfaceGeometry::GetGeometryParameters(state, FoundError); + SurfaceGeometry::GetGeometryParameters(*state, FoundError); EXPECT_FALSE(FoundError); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, FoundError); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, FoundError); // setup zone geometry and get zone data EXPECT_FALSE(FoundError); // expect no errors // compare_err_stream( "" ); // just for debugging - SurfaceGeometry::SetupZoneGeometry(state, FoundError); // this calls GetSurfaceData() + SurfaceGeometry::SetupZoneGeometry(*state, FoundError); // this calls GetSurfaceData() EXPECT_FALSE(FoundError); - SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(state); + SolarShading::AllocateModuleArrays(*state); + SolarShading::DetermineShadowingCombinations(*state); DataEnvironment::DayOfYear_Schedule = 168; DataEnvironment::DayOfWeek = 6; - state.dataGlobal->TimeStep = 4; - state.dataGlobal->HourOfDay = 9; + state->dataGlobal->TimeStep = 4; + state->dataGlobal->HourOfDay = 9; // compare_err_stream( "" ); // just for debugging EXPECT_FALSE(DataSystemVariables::SlaterBarsky); @@ -1847,12 +1848,12 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_PolygonClippingDirect) SolarDistribution = FullExterior; DataSystemVariables::SlaterBarsky = true; - state.dataSolarShading->CalcSkyDifShading = true; - SolarShading::InitSolarCalculations(state); - SolarShading::SkyDifSolarShading(state); - state.dataSolarShading->CalcSkyDifShading = false; + state->dataSolarShading->CalcSkyDifShading = true; + SolarShading::InitSolarCalculations(*state); + SolarShading::SkyDifSolarShading(*state); + state->dataSolarShading->CalcSkyDifShading = false; - FigureSolarBeamAtTimestep(state, state.dataGlobal->HourOfDay, state.dataGlobal->TimeStep); + FigureSolarBeamAtTimestep(*state, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep); int surfNum = UtilityRoutines::FindItemInList("ZN001:WALL-SOUTH:WIN001", DataSurfaces::Surface); EXPECT_NEAR(0.6504, DifShdgRatioIsoSkyHRTS(4, 9, surfNum), 0.0001); EXPECT_NEAR(0.9152, DifShdgRatioHorizHRTS(4, 9, surfNum), 0.0001); @@ -1900,7 +1901,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CHKBKS) { Surface(2).Name = "Surf_Recv"; Surface(2).ZoneName = "Zone1"; - CHKBKS(state, 1, 2); + CHKBKS(*state, 1, 2); EXPECT_TRUE(this->has_err_output(false)); @@ -1939,7 +1940,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_CHKBKS) { Surface(4).Name = "Surf_Recv2"; Surface(4).ZoneName = "Zone2"; - CHKBKS(state, 3, 4); + CHKBKS(*state, 3, 4); EXPECT_FALSE(this->has_err_output(true)); } @@ -2199,52 +2200,52 @@ WindowMaterial:SimpleGlazingSystem, ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); bool FoundError = false; - HeatBalanceManager::GetProjectControlData(state, FoundError); // read project control data + HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors - HeatBalanceManager::SetPreConstructionInputParameters(state); - ScheduleManager::ProcessScheduleInput(state); // read schedules + HeatBalanceManager::SetPreConstructionInputParameters(*state); + ScheduleManager::ProcessScheduleInput(*state); // read schedules - HeatBalanceManager::GetMaterialData(state, FoundError); + HeatBalanceManager::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetFrameAndDividerData(state, FoundError); + HeatBalanceManager::GetFrameAndDividerData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetConstructData(state, FoundError); + HeatBalanceManager::GetConstructData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetZoneData(state, FoundError); // Read Zone data from input file + HeatBalanceManager::GetZoneData(*state, FoundError); // Read Zone data from input file EXPECT_FALSE(FoundError); - SurfaceGeometry::GetGeometryParameters(state, FoundError); + SurfaceGeometry::GetGeometryParameters(*state, FoundError); EXPECT_FALSE(FoundError); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - SurfaceGeometry::GetSurfaceData(state, FoundError); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, FoundError); // setup zone geometry and get zone data EXPECT_FALSE(FoundError); // expect no errors // compare_err_stream( "" ); // just for debugging - SurfaceGeometry::SetupZoneGeometry(state, FoundError); // this calls GetSurfaceData() + SurfaceGeometry::SetupZoneGeometry(*state, FoundError); // this calls GetSurfaceData() EXPECT_FALSE(FoundError); - state.dataGlobal->BeginSimFlag = true; - HeatBalanceManager::InitHeatBalance(state); + state->dataGlobal->BeginSimFlag = true; + HeatBalanceManager::InitHeatBalance(*state); EXPECT_FALSE(FoundError); - SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(state); + SolarShading::AllocateModuleArrays(*state); + SolarShading::DetermineShadowingCombinations(*state); std::string error_string = delimited_string({"** Severe ** Problem in interior solar distribution calculation (CHKBKS)"}); @@ -2511,53 +2512,53 @@ WindowMaterial:SimpleGlazingSystem, ASSERT_TRUE(process_idf(idf_objects)); -SimulationManager::GetProjectData(state); +SimulationManager::GetProjectData(*state); bool FoundError = false; -HeatBalanceManager::GetProjectControlData(state, FoundError); // read project control data +HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors -HeatBalanceManager::SetPreConstructionInputParameters(state); -ScheduleManager::ProcessScheduleInput(state); // read schedules +HeatBalanceManager::SetPreConstructionInputParameters(*state); +ScheduleManager::ProcessScheduleInput(*state); // read schedules -HeatBalanceManager::GetMaterialData(state, FoundError); +HeatBalanceManager::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); -HeatBalanceManager::GetFrameAndDividerData(state, FoundError); +HeatBalanceManager::GetFrameAndDividerData(*state, FoundError); EXPECT_FALSE(FoundError); -HeatBalanceManager::GetConstructData(state, FoundError); +HeatBalanceManager::GetConstructData(*state, FoundError); EXPECT_FALSE(FoundError); -HeatBalanceManager::GetZoneData(state, FoundError); // Read Zone data from input file +HeatBalanceManager::GetZoneData(*state, FoundError); // Read Zone data from input file EXPECT_FALSE(FoundError); -SurfaceGeometry::GetGeometryParameters(state, FoundError); +SurfaceGeometry::GetGeometryParameters(*state, FoundError); EXPECT_FALSE(FoundError); -state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); -state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); +state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); +state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); -state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); -state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); -state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; -state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; +state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); +state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); +state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; +state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; -SurfaceGeometry::GetSurfaceData(state, FoundError); // setup zone geometry and get zone data +SurfaceGeometry::GetSurfaceData(*state, FoundError); // setup zone geometry and get zone data EXPECT_FALSE(FoundError); // expect no errors // compare_err_stream( "" ); // just for debugging -SurfaceGeometry::SetupZoneGeometry(state, FoundError); // this calls GetSurfaceData() +SurfaceGeometry::SetupZoneGeometry(*state, FoundError); // this calls GetSurfaceData() EXPECT_FALSE(FoundError); -state.dataGlobal->BeginSimFlag = true; -HeatBalanceManager::InitHeatBalance(state); +state->dataGlobal->BeginSimFlag = true; +HeatBalanceManager::InitHeatBalance(*state); EXPECT_FALSE(FoundError); -if (state.dataSolarShading->penumbra) { - SolarShading::AllocateModuleArrays(state); - SolarShading::DetermineShadowingCombinations(state); +if (state->dataSolarShading->penumbra) { + SolarShading::AllocateModuleArrays(*state); + SolarShading::DetermineShadowingCombinations(*state); std::string error_string = delimited_string({"** Severe ** Problem in interior solar distribution calculation (CHKBKS)"}); @@ -2579,7 +2580,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_selectActiveWindowShadingControl) int curSurface = 1; Surface(curSurface).windowShadingControlList.push_back(57); - int curIndexActiveWindowShadingControl = selectActiveWindowShadingControlIndex(state, curSurface); + int curIndexActiveWindowShadingControl = selectActiveWindowShadingControlIndex(*state, curSurface); int activeWindowShadingControl = DataSurfaces::Surface(curSurface).windowShadingControlList[curIndexActiveWindowShadingControl]; EXPECT_EQ(activeWindowShadingControl, 57); @@ -2598,7 +2599,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_selectActiveWindowShadingControl) ScheduleManager::Schedule(2).CurrentValue = 0; ScheduleManager::Schedule(3).CurrentValue = 1; - curIndexActiveWindowShadingControl = selectActiveWindowShadingControlIndex(state, curSurface); + curIndexActiveWindowShadingControl = selectActiveWindowShadingControlIndex(*state, curSurface); activeWindowShadingControl = DataSurfaces::Surface(curSurface).windowShadingControlList[curIndexActiveWindowShadingControl]; EXPECT_EQ(activeWindowShadingControl, 3); @@ -2606,7 +2607,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_selectActiveWindowShadingControl) ScheduleManager::Schedule(2).CurrentValue = 1; ScheduleManager::Schedule(3).CurrentValue = 0; - curIndexActiveWindowShadingControl = selectActiveWindowShadingControlIndex(state, curSurface); + curIndexActiveWindowShadingControl = selectActiveWindowShadingControlIndex(*state, curSurface); activeWindowShadingControl = DataSurfaces::Surface(curSurface).windowShadingControlList[curIndexActiveWindowShadingControl]; EXPECT_EQ(activeWindowShadingControl, 2); @@ -2614,7 +2615,7 @@ TEST_F(EnergyPlusFixture, SolarShadingTest_selectActiveWindowShadingControl) ScheduleManager::Schedule(2).CurrentValue = 0; ScheduleManager::Schedule(3).CurrentValue = 0; - curIndexActiveWindowShadingControl = selectActiveWindowShadingControlIndex(state, curSurface); + curIndexActiveWindowShadingControl = selectActiveWindowShadingControlIndex(*state, curSurface); activeWindowShadingControl = DataSurfaces::Surface(curSurface).windowShadingControlList[curIndexActiveWindowShadingControl]; EXPECT_EQ(activeWindowShadingControl, 1); } diff --git a/tst/EnergyPlus/unit/SortAndStringUtilities.unit.cc b/tst/EnergyPlus/unit/SortAndStringUtilities.unit.cc index a95fc2caf05..acc9cfe0d5c 100644 --- a/tst/EnergyPlus/unit/SortAndStringUtilities.unit.cc +++ b/tst/EnergyPlus/unit/SortAndStringUtilities.unit.cc @@ -59,6 +59,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::SortAndStringUtilities; diff --git a/tst/EnergyPlus/unit/StandardRatings.unit.cc b/tst/EnergyPlus/unit/StandardRatings.unit.cc index 29e94a3d0d2..7dc03398b73 100644 --- a/tst/EnergyPlus/unit/StandardRatings.unit.cc +++ b/tst/EnergyPlus/unit/StandardRatings.unit.cc @@ -52,6 +52,7 @@ // EnergyPlus Headers #include "Fixtures/EnergyPlusFixture.hh" +#include #include #include #include @@ -59,6 +60,7 @@ #include #include #include +#include using namespace EnergyPlus; using namespace EnergyPlus::StandardRatings; @@ -102,7 +104,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest) Coil.RatedEIR(1) = 1 / Coil.RatedCOP(1); Coil.RatedAirVolFlowRate(1) = 0.50; Coil.RatedAirMassFlowRate(1) = - Coil.RatedAirVolFlowRate(1) * PsyRhoAirFnPbTdbW(state, EnergyPlus::DataEnvironment::StdBaroPress, 21.11, 0.00881, "InitDXCoil"); + Coil.RatedAirVolFlowRate(1) * PsyRhoAirFnPbTdbW(*state, EnergyPlus::DataEnvironment::StdBaroPress, 21.11, 0.00881, "InitDXCoil"); Coil.FanPowerPerEvapAirFlowRate(1) = 773.3; Coil.MinOATCompressor = -10.0; Coil.CrankcaseHeaterCapacity = 0.0; @@ -116,12 +118,12 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest) Coil.RegionNum = 4; Coil.OATempCompressorOn = -5.0; Coil.OATempCompressorOnOffBlank = "true"; - state.dataCurveManager->NumCurves = 5; - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->NumCurves = 5; + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); PerformanceCurveData *pCurve; int const nCapfT = 1; - pCurve = &state.dataCurveManager->PerfCurve(nCapfT); + pCurve = &state->dataCurveManager->PerfCurve(nCapfT); pCurve->CurveType = CurveTypeEnum::Cubic; pCurve->NumDims = 1; pCurve->Name = "PTHPHeatingCAPFT"; @@ -135,7 +137,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest) Coil.CCapFTemp(1) = nCapfT; int const nCapfFF = 2; - pCurve = &state.dataCurveManager->PerfCurve(nCapfFF); + pCurve = &state->dataCurveManager->PerfCurve(nCapfFF); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->NumDims = 1; pCurve->Name = "HPHeatCapfFF"; @@ -149,7 +151,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest) Coil.CCapFFlow(1) = nCapfFF; int const nEIRfT = 3; - pCurve = &state.dataCurveManager->PerfCurve(nEIRfT); + pCurve = &state->dataCurveManager->PerfCurve(nEIRfT); pCurve->CurveType = CurveTypeEnum::Cubic; pCurve->NumDims = 1; pCurve->Name = "PTHPHeatingEIRFT"; @@ -162,7 +164,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest) Coil.EIRFTemp(1) = nEIRfT; int const nEIRfFF = 4; - pCurve = &state.dataCurveManager->PerfCurve(nEIRfFF); + pCurve = &state->dataCurveManager->PerfCurve(nEIRfFF); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->NumDims = 1; pCurve->Name = "HPHeatEIRfFF"; @@ -176,7 +178,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest) Coil.EIRFFlow(1) = nEIRfFF; int const nPLFfPLR = 5; - pCurve = &state.dataCurveManager->PerfCurve(nPLFfPLR); + pCurve = &state->dataCurveManager->PerfCurve(nPLFfPLR); pCurve->CurveType = CurveTypeEnum::Quadratic; pCurve->NumDims = 1; pCurve->Name = "HPHeatPLFfPLR"; @@ -189,8 +191,8 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest) pCurve->CurveMax = 1; Coil.PLFFPLR(1) = nPLFfPLR; - for (int CurveNum = 1; CurveNum <= state.dataCurveManager->NumCurves; ++CurveNum) { - PerformanceCurveData &rCurve = state.dataCurveManager->PerfCurve(CurveNum); + for (int CurveNum = 1; CurveNum <= state->dataCurveManager->NumCurves; ++CurveNum) { + PerformanceCurveData &rCurve = state->dataCurveManager->PerfCurve(CurveNum); if (rCurve.CurveType == CurveTypeEnum::Cubic) { rCurve.ObjectType = "Curve:Cubic"; } else if (rCurve.CurveType == CurveTypeEnum::Quadratic) { @@ -202,14 +204,14 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest) Real64 NetHeatingCapRatedLowTemp; Real64 HSPF; - SingleSpeedDXHeatingCoilStandardRatings(state, Coil.RatedTotCap(1), Coil.RatedCOP(1), Coil.CCapFFlow(1), Coil.CCapFTemp(1), Coil.EIRFFlow(1), + SingleSpeedDXHeatingCoilStandardRatings(*state, Coil.RatedTotCap(1), Coil.RatedCOP(1), Coil.CCapFFlow(1), Coil.CCapFTemp(1), Coil.EIRFFlow(1), Coil.EIRFTemp(1), Coil.RatedAirVolFlowRate(1), Coil.FanPowerPerEvapAirFlowRate(1), NetHeatingCapRatedHighTemp, NetHeatingCapRatedLowTemp, HSPF, Coil.RegionNum, Coil.MinOATCompressor, Coil.OATempCompressorOn, Coil.OATempCompressorOnOffBlank, Coil.DefrostControl); // evaluate capacity curves - Real64 TotCapTempModFacRated = CurveValue(state, Coil.CCapFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempRated); - Real64 TotCapFlowModFac = CurveValue(state, Coil.CCapFFlow(1), 1.0); + Real64 TotCapTempModFacRated = CurveValue(*state, Coil.CCapFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempRated); + Real64 TotCapFlowModFac = CurveValue(*state, Coil.CCapFFlow(1), 1.0); Real64 NetHeatingCapRated = Coil.RatedTotCap(1) * TotCapTempModFacRated * TotCapFlowModFac + Coil.RatedAirVolFlowRate(1) * Coil.FanPowerPerEvapAirFlowRate(1); // check curve values and heating capacity @@ -217,18 +219,18 @@ TEST_F(EnergyPlusFixture, SingleSpeedHeatingCoilCurveTest) EXPECT_DOUBLE_EQ(TotCapFlowModFac, 1.0); EXPECT_DOUBLE_EQ(NetHeatingCapRatedHighTemp, NetHeatingCapRated); // evaluate capacity curves - Real64 CapTempModFacH2Test = CurveValue(state, Coil.CCapFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempH2Test); + Real64 CapTempModFacH2Test = CurveValue(*state, Coil.CCapFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempH2Test); EXPECT_GT(CapTempModFacH2Test, 0.0); - Real64 CapTempModFacH3Test = CurveValue(state, Coil.CCapFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempH3Test); + Real64 CapTempModFacH3Test = CurveValue(*state, Coil.CCapFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempH3Test); // if CapTempModFacH3Test curves value is less than zero, NetHeatingCapRatedLowTemp is set to zero EXPECT_LT(CapTempModFacH3Test, 0.0); // check heating capacity at low temperature EXPECT_DOUBLE_EQ(NetHeatingCapRatedLowTemp, 0.0); // evaluate EIR curves - Real64 EIRTempModFacRated = CurveValue(state, Coil.EIRFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempRated); - Real64 EIRTempModFacH2Test = CurveValue(state, Coil.EIRFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempH2Test); - Real64 EIRTempModFacH3Test = CurveValue(state, Coil.EIRFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempH3Test); + Real64 EIRTempModFacRated = CurveValue(*state, Coil.EIRFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempRated); + Real64 EIRTempModFacH2Test = CurveValue(*state, Coil.EIRFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempH2Test); + Real64 EIRTempModFacH3Test = CurveValue(*state, Coil.EIRFTemp(1), StandardRatings::HeatingOutdoorCoilInletAirDBTempH3Test); // check EIR curve value EXPECT_LT(EIRTempModFacRated, 0.0); EXPECT_GT(EIRTempModFacH2Test, 0.0); @@ -244,81 +246,81 @@ TEST_F(EnergyPlusFixture, ChillerIPLVTest) using DataPlant::TypeOf_Chiller_ElectricEIR; // Setup an air-cooled Chiller:Electric:EIR chiller - state.dataChillerElectricEIR->ElectricEIRChiller.allocate(1); - state.dataChillerElectricEIR->ElectricEIRChiller(1).Name = "Air Cooled Chiller"; - state.dataChillerElectricEIR->ElectricEIRChiller(1).RefCap = 216000; // W - state.dataChillerElectricEIR->ElectricEIRChiller(1).RefCOP = 2.81673861898309; // W/W - state.dataChillerElectricEIR->ElectricEIRChiller(1).CondenserType = DataPlant::CondenserType::AIRCOOLED; - state.dataChillerElectricEIR->ElectricEIRChiller(1).MinUnloadRat = 0.15; + state->dataChillerElectricEIR->ElectricEIRChiller.allocate(1); + state->dataChillerElectricEIR->ElectricEIRChiller(1).Name = "Air Cooled Chiller"; + state->dataChillerElectricEIR->ElectricEIRChiller(1).RefCap = 216000; // W + state->dataChillerElectricEIR->ElectricEIRChiller(1).RefCOP = 2.81673861898309; // W/W + state->dataChillerElectricEIR->ElectricEIRChiller(1).CondenserType = DataPlant::CondenserType::AIRCOOLED; + state->dataChillerElectricEIR->ElectricEIRChiller(1).MinUnloadRat = 0.15; int CurveNum; - state.dataCurveManager->NumCurves = 3; - state.dataCurveManager->PerfCurve.allocate(state.dataCurveManager->NumCurves); + state->dataCurveManager->NumCurves = 3; + state->dataCurveManager->PerfCurve.allocate(state->dataCurveManager->NumCurves); // Cap=f(T) CurveNum = 1; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; - state.dataCurveManager->PerfCurve(CurveNum).NumDims = 2; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:BiQuadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Name = "AirCooledChillerScrewCmpCapfT"; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.98898813; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.036832851; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.000174006; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = -0.000275634; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = -0.000143667; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = -0.000246286; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 4.44; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 10; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 23.89; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 46.11; - state.dataChillerElectricEIR->ElectricEIRChiller(1).ChillerCapFTIndex = 1; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; + state->dataCurveManager->PerfCurve(CurveNum).NumDims = 2; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:BiQuadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Name = "AirCooledChillerScrewCmpCapfT"; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.98898813; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.036832851; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.000174006; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = -0.000275634; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = -0.000143667; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = -0.000246286; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 4.44; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 10; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 23.89; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 46.11; + state->dataChillerElectricEIR->ElectricEIRChiller(1).ChillerCapFTIndex = 1; // EIR=f(T) CurveNum = 2; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; - state.dataCurveManager->PerfCurve(CurveNum).NumDims = 2; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:BiQuadratic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Name = "AirCooledChillerScrewCmpEIRfT"; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.814058418; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.002335553; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.000817786; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = -0.017129784; - state.dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.000773288; - state.dataCurveManager->PerfCurve(CurveNum).Coeff6 = -0.000922024; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 4.44; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 10; - state.dataCurveManager->PerfCurve(CurveNum).Var2Min = 10; - state.dataCurveManager->PerfCurve(CurveNum).Var2Max = 46.11; - state.dataChillerElectricEIR->ElectricEIRChiller(1).ChillerEIRFTIndex = 2; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::BiQuadratic; + state->dataCurveManager->PerfCurve(CurveNum).NumDims = 2; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:BiQuadratic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Name = "AirCooledChillerScrewCmpEIRfT"; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = 0.814058418; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 0.002335553; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = 0.000817786; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = -0.017129784; + state->dataCurveManager->PerfCurve(CurveNum).Coeff5 = 0.000773288; + state->dataCurveManager->PerfCurve(CurveNum).Coeff6 = -0.000922024; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 4.44; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 10; + state->dataCurveManager->PerfCurve(CurveNum).Var2Min = 10; + state->dataCurveManager->PerfCurve(CurveNum).Var2Max = 46.11; + state->dataChillerElectricEIR->ElectricEIRChiller(1).ChillerEIRFTIndex = 2; // EIR=f(PLR) CurveNum = 3; - state.dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Cubic; - state.dataCurveManager->PerfCurve(CurveNum).NumDims = 1; - state.dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Cubic"; - state.dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; - state.dataCurveManager->PerfCurve(CurveNum).Name = "AirCooledChillerScrewCmpEIRfPLR"; - state.dataCurveManager->PerfCurve(CurveNum).Coeff1 = -0.08117804; - state.dataCurveManager->PerfCurve(CurveNum).Coeff2 = 1.433532026; - state.dataCurveManager->PerfCurve(CurveNum).Coeff3 = -0.762289434; - state.dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.412199944; - state.dataCurveManager->PerfCurve(CurveNum).Var1Min = 0; - state.dataCurveManager->PerfCurve(CurveNum).Var1Max = 1; - state.dataChillerElectricEIR->ElectricEIRChiller(1).ChillerEIRFPLRIndex = 3; + state->dataCurveManager->PerfCurve(CurveNum).CurveType = CurveTypeEnum::Cubic; + state->dataCurveManager->PerfCurve(CurveNum).NumDims = 1; + state->dataCurveManager->PerfCurve(CurveNum).ObjectType = "Curve:Cubic"; + state->dataCurveManager->PerfCurve(CurveNum).InterpolationType = InterpTypeEnum::EvaluateCurveToLimits; + state->dataCurveManager->PerfCurve(CurveNum).Name = "AirCooledChillerScrewCmpEIRfPLR"; + state->dataCurveManager->PerfCurve(CurveNum).Coeff1 = -0.08117804; + state->dataCurveManager->PerfCurve(CurveNum).Coeff2 = 1.433532026; + state->dataCurveManager->PerfCurve(CurveNum).Coeff3 = -0.762289434; + state->dataCurveManager->PerfCurve(CurveNum).Coeff4 = 0.412199944; + state->dataCurveManager->PerfCurve(CurveNum).Var1Min = 0; + state->dataCurveManager->PerfCurve(CurveNum).Var1Max = 1; + state->dataChillerElectricEIR->ElectricEIRChiller(1).ChillerEIRFPLRIndex = 3; Real64 IPLV; - CalcChillerIPLV(state, - state.dataChillerElectricEIR->ElectricEIRChiller(1).Name, + CalcChillerIPLV(*state, + state->dataChillerElectricEIR->ElectricEIRChiller(1).Name, TypeOf_Chiller_ElectricEIR, - state.dataChillerElectricEIR->ElectricEIRChiller(1).RefCap, - state.dataChillerElectricEIR->ElectricEIRChiller(1).RefCOP, - state.dataChillerElectricEIR->ElectricEIRChiller(1).CondenserType, - state.dataChillerElectricEIR->ElectricEIRChiller(1).ChillerCapFTIndex, - state.dataChillerElectricEIR->ElectricEIRChiller(1).ChillerEIRFTIndex, - state.dataChillerElectricEIR->ElectricEIRChiller(1).ChillerEIRFPLRIndex, - state.dataChillerElectricEIR->ElectricEIRChiller(1).MinUnloadRat, + state->dataChillerElectricEIR->ElectricEIRChiller(1).RefCap, + state->dataChillerElectricEIR->ElectricEIRChiller(1).RefCOP, + state->dataChillerElectricEIR->ElectricEIRChiller(1).CondenserType, + state->dataChillerElectricEIR->ElectricEIRChiller(1).ChillerCapFTIndex, + state->dataChillerElectricEIR->ElectricEIRChiller(1).ChillerEIRFTIndex, + state->dataChillerElectricEIR->ElectricEIRChiller(1).ChillerEIRFPLRIndex, + state->dataChillerElectricEIR->ElectricEIRChiller(1).MinUnloadRat, IPLV, Optional(), ObjexxFCL::Optional_int_const(), @@ -447,10 +449,10 @@ TEST_F(EnergyPlusFixture, SingleSpeedCoolingCoil_SEERValueTest) ASSERT_TRUE(process_idf(idf_objects)); - GetDXCoils(state); + GetDXCoils(*state); auto &thisCoil(DXCoils::DXCoil(1)); - auto &thisCoolPLFfPLR(state.dataCurveManager->PerfCurve(thisCoil.PLFFPLR(1))); + auto &thisCoolPLFfPLR(state->dataCurveManager->PerfCurve(thisCoil.PLFFPLR(1))); // ckeck user PLF curve coefficients EXPECT_EQ(0.90, thisCoolPLFfPLR.Coeff1); EXPECT_EQ(0.10, thisCoolPLFfPLR.Coeff2); @@ -459,7 +461,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedCoolingCoil_SEERValueTest) Real64 minEIRfLowPLRXInput(0.0); Real64 maxEIRfLowPLRXInput(0.0); // check user PLF curve PLR limits - CurveManager::GetCurveMinMaxValues(state, thisCoil.PLFFPLR(1), minEIRfLowPLRXInput, maxEIRfLowPLRXInput); + CurveManager::GetCurveMinMaxValues(*state, thisCoil.PLFFPLR(1), minEIRfLowPLRXInput, maxEIRfLowPLRXInput); EXPECT_EQ(0.0, minEIRfLowPLRXInput); EXPECT_EQ(1.0, maxEIRfLowPLRXInput); @@ -474,7 +476,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedCoolingCoil_SEERValueTest) thisCoil.RatedTotCap(1) = 25000.0; thisCoil.RatedAirVolFlowRate(1) = 1.300; // calculate standard ratings - SingleSpeedDXCoolingCoilStandardRatings(state, + SingleSpeedDXCoolingCoilStandardRatings(*state, thisCoil.Name, thisCoil.DXCoilType, thisCoil.CCapFTemp(1), @@ -509,7 +511,7 @@ TEST_F(EnergyPlusFixture, SingleSpeedCoolingCoil_SEERValueTest) IEER = 0.0; NetCoolingCapRated = 0.0; // rerun the standard ratings calculation - SingleSpeedDXCoolingCoilStandardRatings(state, + SingleSpeedDXCoolingCoilStandardRatings(*state, thisCoil.Name, thisCoil.DXCoilType, thisCoil.CCapFTemp(1), @@ -720,10 +722,10 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_SEERValueTest) ASSERT_TRUE(process_idf(idf_objects)); - GetDXCoils(state); + GetDXCoils(*state); auto &thisCoil(DXCoils::DXCoil(1)); - auto &thisCoolPLFfPLR(state.dataCurveManager->PerfCurve(thisCoil.MSPLFFPLR(1))); + auto &thisCoolPLFfPLR(state->dataCurveManager->PerfCurve(thisCoil.MSPLFFPLR(1))); // ckeck user PLF curve coefficients EXPECT_EQ(0.90, thisCoolPLFfPLR.Coeff1); EXPECT_EQ(0.10, thisCoolPLFfPLR.Coeff2); @@ -732,7 +734,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_SEERValueTest) Real64 minEIRfLowPLRXInput(0.0); Real64 maxEIRfLowPLRXInput(0.0); // check user PLF curve PLR limits - CurveManager::GetCurveMinMaxValues(state, thisCoil.MSPLFFPLR(1), minEIRfLowPLRXInput, maxEIRfLowPLRXInput); + CurveManager::GetCurveMinMaxValues(*state, thisCoil.MSPLFFPLR(1), minEIRfLowPLRXInput, maxEIRfLowPLRXInput); EXPECT_EQ(0.0, minEIRfLowPLRXInput); EXPECT_EQ(1.0, maxEIRfLowPLRXInput); @@ -742,7 +744,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_SEERValueTest) Real64 SEER_Standard(0.0); NetCoolingCapRated = 0.0; // calculate standard ratings for multispeed DX cooling coil - MultiSpeedDXCoolingCoilStandardRatings(state, + MultiSpeedDXCoolingCoilStandardRatings(*state, thisCoil.MSCCapFTemp, thisCoil.MSCCapFFlow, thisCoil.MSEIRFTemp, @@ -772,7 +774,7 @@ TEST_F(EnergyPlusFixture, MultiSpeedCoolingCoil_SEERValueTest) SEER_Standard = 0.0; NetCoolingCapRated = 0.0; // rerun the standard ratings calculation - MultiSpeedDXCoolingCoilStandardRatings(state, + MultiSpeedDXCoolingCoilStandardRatings(*state, thisCoil.MSCCapFTemp, thisCoil.MSCCapFFlow, thisCoil.MSEIRFTemp, diff --git a/tst/EnergyPlus/unit/StringUtilities.unit.cc b/tst/EnergyPlus/unit/StringUtilities.unit.cc index 5e4277235fb..07f00f21009 100644 --- a/tst/EnergyPlus/unit/StringUtilities.unit.cc +++ b/tst/EnergyPlus/unit/StringUtilities.unit.cc @@ -50,6 +50,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; diff --git a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc index a4d7eb742b6..0c22f4e603d 100644 --- a/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceGeometry.unit.cc @@ -63,6 +63,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::DataSurfaces; @@ -109,7 +110,7 @@ TEST_F(EnergyPlusFixture, BaseSurfaceRectangularTest) Surface(ThisSurf).Vertex(4).y = 0.0; Surface(ThisSurf).Vertex(4).z = 2.0; - ProcessSurfaceVertices(state, ThisSurf, ErrorsFound); + ProcessSurfaceVertices(*state, ThisSurf, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ(SurfaceShape::Rectangle, Surface(ThisSurf).Shape); @@ -136,7 +137,7 @@ TEST_F(EnergyPlusFixture, BaseSurfaceRectangularTest) Surface(ThisSurf).Vertex(4).y = 0.0; Surface(ThisSurf).Vertex(4).z = 2.0; - ProcessSurfaceVertices(state, ThisSurf, ErrorsFound); + ProcessSurfaceVertices(*state, ThisSurf, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ(SurfaceShape::Quadrilateral, Surface(ThisSurf).Shape); @@ -163,7 +164,7 @@ TEST_F(EnergyPlusFixture, BaseSurfaceRectangularTest) Surface(ThisSurf).Vertex(4).y = 0.0; Surface(ThisSurf).Vertex(4).z = 2.0; - ProcessSurfaceVertices(state, ThisSurf, ErrorsFound); + ProcessSurfaceVertices(*state, ThisSurf, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ(SurfaceShape::Quadrilateral, Surface(ThisSurf).Shape); @@ -186,7 +187,7 @@ TEST_F(EnergyPlusFixture, BaseSurfaceRectangularTest) Surface(ThisSurf).Vertex(3).y = 0.0; Surface(ThisSurf).Vertex(3).z = 2.0; - ProcessSurfaceVertices(state, ThisSurf, ErrorsFound); + ProcessSurfaceVertices(*state, ThisSurf, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ(SurfaceShape::Triangle, Surface(ThisSurf).Shape); @@ -217,7 +218,7 @@ TEST_F(EnergyPlusFixture, BaseSurfaceRectangularTest) Surface(ThisSurf).Vertex(5).y = 0.0; Surface(ThisSurf).Vertex(5).z = 3.0; - ProcessSurfaceVertices(state, ThisSurf, ErrorsFound); + ProcessSurfaceVertices(*state, ThisSurf, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ(SurfaceShape::Polygonal, Surface(ThisSurf).Shape); } @@ -467,32 +468,32 @@ TEST_F(EnergyPlusFixture, DataSurfaces_SurfaceShape) ASSERT_TRUE(process_idf(idf_objects)); - GetProjectControlData(state, ErrorsFound); // read project control data + GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); // expect no errors - GetMaterialData(state, ErrorsFound); // read material data + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors - GetConstructData(state, ErrorsFound); // read construction data + GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); // expect no errors - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - GetSurfaceData(state, ErrorsFound); // setup zone geometry and get zone data + GetSurfaceData(*state, ErrorsFound); // setup zone geometry and get zone data EXPECT_FALSE(ErrorsFound); // expect no errors // compare_err_stream( "" ); // just for debugging - SurfaceGeometry::AllocateModuleArrays(state); + SurfaceGeometry::AllocateModuleArrays(*state); // Adding additional surfaces will change the index of the following based on where the surfaces are added in the array. // If adding new tests, break here and look at EnergyPlus::DataSurfaces::Surface to see the order. @@ -500,61 +501,61 @@ TEST_F(EnergyPlusFixture, DataSurfaces_SurfaceShape) // enum surfaceShape:Triangle = 1 // "Surface 1 - Triangle" int surfNum = UtilityRoutines::FindItemInList("SURFACE 1 - TRIANGLE", DataSurfaces::Surface); - ProcessSurfaceVertices(state, surfNum, ErrorsFound); + ProcessSurfaceVertices(*state, surfNum, ErrorsFound); EXPECT_EQ(SurfaceShape::Triangle, Surface(surfNum).Shape); // enum surfaceShape:Quadrilateral = 2 // "Surface 2 - Quadrilateral" surfNum = UtilityRoutines::FindItemInList("SURFACE 2 - QUADRILATERAL", DataSurfaces::Surface); - ProcessSurfaceVertices(state, surfNum, ErrorsFound); + ProcessSurfaceVertices(*state, surfNum, ErrorsFound); EXPECT_EQ(SurfaceShape::Quadrilateral, Surface(surfNum).Shape); // enum surfaceShape:Rectangle = 3 // "Surface 3 - Rectangle" surfNum = UtilityRoutines::FindItemInList("SURFACE 3 - RECTANGLE", DataSurfaces::Surface); - ProcessSurfaceVertices(state, surfNum, ErrorsFound); + ProcessSurfaceVertices(*state, surfNum, ErrorsFound); EXPECT_EQ(SurfaceShape::Rectangle, Surface(surfNum).Shape); // enum surfaceShape:RectangularDoorWindow = 4 // "Surface 4 - RectangularDoorWindow" surfNum = UtilityRoutines::FindItemInList("SURFACE 4 - RECTANGULARDOORWINDOW", DataSurfaces::Surface); - ProcessSurfaceVertices(state, surfNum, ErrorsFound); + ProcessSurfaceVertices(*state, surfNum, ErrorsFound); EXPECT_EQ(SurfaceShape::RectangularDoorWindow, Surface(surfNum).Shape); // enum surfaceShape:RectangularOverhang = 5 // "Surface 5 - RectangularOverhang" surfNum = UtilityRoutines::FindItemInList("SURFACE 5 - RECTANGULAROVERHANG", DataSurfaces::Surface); - ProcessSurfaceVertices(state, surfNum, ErrorsFound); + ProcessSurfaceVertices(*state, surfNum, ErrorsFound); EXPECT_NE(SurfaceShape::RectangularOverhang, Surface(surfNum).Shape); // fins and overhangs will not get set to the proper surface shape. // enum surfaceShape:RectangularLeftFin = 6 // "Surface 6 - RectangularLeftFin" surfNum = UtilityRoutines::FindItemInList("SURFACE 6 - RECTANGULARLEFTFIN Left", DataSurfaces::Surface); - ProcessSurfaceVertices(state, surfNum, ErrorsFound); + ProcessSurfaceVertices(*state, surfNum, ErrorsFound); EXPECT_NE(SurfaceShape::RectangularLeftFin, Surface(surfNum).Shape); // fins and overhangs will not get set to the proper surface shape. // enum surfaceShape:RectangularRightFin = 7 // "Surface 7 - RectangularRightFin" surfNum = UtilityRoutines::FindItemInList("SURFACE 7 - RECTANGULARRIGHTFIN Right", DataSurfaces::Surface); - ProcessSurfaceVertices(state, surfNum, ErrorsFound); + ProcessSurfaceVertices(*state, surfNum, ErrorsFound); EXPECT_NE(SurfaceShape::RectangularRightFin, Surface(surfNum).Shape); // fins and overhangs will not get set to the proper surface shape. // enum surfaceShape:TriangularWindow = 8 // "Surface 8 - TriangularWindow" surfNum = UtilityRoutines::FindItemInList("SURFACE 8 - TRIANGULARWINDOW", DataSurfaces::Surface); - ProcessSurfaceVertices(state, surfNum, ErrorsFound); + ProcessSurfaceVertices(*state, surfNum, ErrorsFound); EXPECT_EQ(SurfaceShape::TriangularWindow, Surface(surfNum).Shape); // enum surfaceShape:TriangularDoor = 9 // "Surface 9 - TriangularDoor" surfNum = UtilityRoutines::FindItemInList("SURFACE 9 - TRIANGULARDOOR", DataSurfaces::Surface); - ProcessSurfaceVertices(state, surfNum, ErrorsFound); + ProcessSurfaceVertices(*state, surfNum, ErrorsFound); EXPECT_EQ(SurfaceShape::TriangularDoor, Surface(surfNum).Shape); // enum surfaceShape:Polygonal = 10 // "Surface 10 - Polygonal" surfNum = UtilityRoutines::FindItemInList("SURFACE 10 - POLYGONAL", DataSurfaces::Surface); - ProcessSurfaceVertices(state, surfNum, ErrorsFound); + ProcessSurfaceVertices(*state, surfNum, ErrorsFound); EXPECT_EQ(SurfaceShape::Polygonal, Surface(surfNum).Shape); } @@ -577,7 +578,7 @@ TEST_F(EnergyPlusFixture, ConfirmCheckSubSurfAzTiltNorm) SubSurface.NewellSurfaceNormalVector.x = 0.; SubSurface.NewellSurfaceNormalVector.y = 0.; SubSurface.NewellSurfaceNormalVector.z = 1.; - checkSubSurfAzTiltNorm(state, BaseSurface, SubSurface, surfaceError); + checkSubSurfAzTiltNorm(*state, BaseSurface, SubSurface, surfaceError); EXPECT_FALSE(surfaceError); EXPECT_FALSE(has_err_output()); @@ -588,7 +589,7 @@ TEST_F(EnergyPlusFixture, ConfirmCheckSubSurfAzTiltNorm) SubSurface.NewellSurfaceNormalVector.x = 1.; SubSurface.NewellSurfaceNormalVector.y = 0.; SubSurface.NewellSurfaceNormalVector.z = 0.; - checkSubSurfAzTiltNorm(state, BaseSurface, SubSurface, surfaceError); + checkSubSurfAzTiltNorm(*state, BaseSurface, SubSurface, surfaceError); EXPECT_TRUE(surfaceError); EXPECT_TRUE(has_err_output()); @@ -600,7 +601,7 @@ TEST_F(EnergyPlusFixture, ConfirmCheckSubSurfAzTiltNorm) SubSurface.NewellSurfaceNormalVector.y = 1.; // This doesn't match the tilt and azimuth, but want it to be different so tilt and azimuth tests are executed SubSurface.NewellSurfaceNormalVector.z = 1.; - checkSubSurfAzTiltNorm(state, BaseSurface, SubSurface, surfaceError); + checkSubSurfAzTiltNorm(*state, BaseSurface, SubSurface, surfaceError); EXPECT_FALSE(surfaceError); EXPECT_FALSE(has_err_output()); @@ -618,7 +619,7 @@ TEST_F(EnergyPlusFixture, ConfirmCheckSubSurfAzTiltNorm) SubSurface.NewellSurfaceNormalVector.x = 1.; SubSurface.NewellSurfaceNormalVector.y = 1.; SubSurface.NewellSurfaceNormalVector.z = 1.; - checkSubSurfAzTiltNorm(state, BaseSurface, SubSurface, surfaceError); + checkSubSurfAzTiltNorm(*state, BaseSurface, SubSurface, surfaceError); EXPECT_FALSE(surfaceError); EXPECT_TRUE(has_err_output()); } @@ -691,11 +692,11 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_MakeMirrorSurface) ASSERT_TRUE(process_idf(idf_objects)); bool FoundError = false; - GetMaterialData(state, FoundError); - GetConstructData(state, FoundError); - GetZoneData(state, FoundError); // Read Zone data from input file + GetMaterialData(*state, FoundError); + GetConstructData(*state, FoundError); + GetZoneData(*state, FoundError); // Read Zone data from input file DataHeatBalance::AnyCTF = true; - SetupZoneGeometry(state, FoundError); // this calls GetSurfaceData() + SetupZoneGeometry(*state, FoundError); // this calls GetSurfaceData() EXPECT_FALSE(FoundError); @@ -705,46 +706,46 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_MakeMirrorSurface) EXPECT_EQ(Surface(TotSurfaces).Name, "FRONT-1"); // move surface to SurfaceTmp since MakeMirrorSurface uses that array - state.dataSurfaceGeometry->SurfaceTmp.allocate(10); - state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces) = Surface(TotSurfaces); + state->dataSurfaceGeometry->SurfaceTmp.allocate(10); + state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces) = Surface(TotSurfaces); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Name, "FRONT-1"); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Name, "FRONT-1"); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).x, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).y, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).z, 2.4); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).x, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).y, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).z, 2.4); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).x, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).y, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).z, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).x, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).y, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).z, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).x, 30.5); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).y, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).z, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).x, 30.5); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).y, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).z, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).x, 30.5); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).y, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).z, 2.4); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).x, 30.5); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).y, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).z, 2.4); - MakeMirrorSurface(state, TotSurfaces); // This call increments TotSurfaces so the references after this are for the created mirror surface + MakeMirrorSurface(*state, TotSurfaces); // This call increments TotSurfaces so the references after this are for the created mirror surface - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Name, "Mir-FRONT-1"); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Name, "Mir-FRONT-1"); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).x, 30.5); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).y, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).z, 2.4); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).x, 30.5); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).y, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(1).z, 2.4); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).x, 30.5); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).y, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).z, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).x, 30.5); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).y, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(2).z, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).x, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).y, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).z, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).x, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).y, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(3).z, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).x, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).y, 0.); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).z, 2.4); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).x, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).y, 0.); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(TotSurfaces).Vertex(4).z, 2.4); } TEST_F(EnergyPlusFixture, SurfacesGeometry_CalcSurfaceCentroid_NonconvexRealisticZ) @@ -773,7 +774,7 @@ TEST_F(EnergyPlusFixture, SurfacesGeometry_CalcSurfaceCentroid_NonconvexRealisti Surface(1).Vertex(4).y = 0.; Surface(1).Vertex(4).z = 10.; - CalcSurfaceCentroid(state); + CalcSurfaceCentroid(*state); EXPECT_EQ(Surface(1).Centroid.x, 667.); EXPECT_EQ(Surface(1).Centroid.y, 0.); @@ -924,21 +925,21 @@ TEST_F(EnergyPlusFixture, MakeEquivalentRectangle) // Prepare data for the test ASSERT_TRUE(process_idf(idf_objects)); - GetMaterialData(state, ErrorsFound); // read material data + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); - GetConstructData(state, ErrorsFound); // read construction data + GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - GetProjectControlData(state, ErrorsFound); // read project control data + GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; - GetSurfaceData(state, ErrorsFound); // setup zone geometry and get zone data + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; + GetSurfaceData(*state, ErrorsFound); // setup zone geometry and get zone data EXPECT_FALSE(ErrorsFound); // expect no errors // For each surface Run the test then Check the result @@ -2492,9 +2493,9 @@ TEST_F(EnergyPlusFixture, SurfaceGeometryUnitTests_isEnclosedVolume_BoxWithSplit TEST_F(EnergyPlusFixture, CalculateZoneVolume_SimpleBox_test) { Array1D_bool enteredCeilingHeight; - state.dataGlobal->NumOfZones = 1; - enteredCeilingHeight.dimension(state.dataGlobal->NumOfZones, false); - Zone.dimension(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + enteredCeilingHeight.dimension(state->dataGlobal->NumOfZones, false); + Zone.dimension(state->dataGlobal->NumOfZones); Zone(1).HasFloor = true; Zone(1).SurfaceFirst = 1; Zone(1).SurfaceLast = 6; @@ -2555,16 +2556,16 @@ TEST_F(EnergyPlusFixture, CalculateZoneVolume_SimpleBox_test) Surface(6).Vertex(3) = Vector(10., 0., 3.); Surface(6).Vertex(4) = Vector(10., 8., 3.); - CalculateZoneVolume(state, enteredCeilingHeight); + CalculateZoneVolume(*state, enteredCeilingHeight); EXPECT_EQ(240., Zone(1).Volume); } TEST_F(EnergyPlusFixture, CalculateZoneVolume_BoxOneWallMissing_test) { Array1D_bool enteredCeilingHeight; - state.dataGlobal->NumOfZones = 1; - enteredCeilingHeight.dimension(state.dataGlobal->NumOfZones, false); - Zone.dimension(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + enteredCeilingHeight.dimension(state->dataGlobal->NumOfZones, false); + Zone.dimension(state->dataGlobal->NumOfZones); Zone(1).HasFloor = true; Zone(1).SurfaceFirst = 1; Zone(1).SurfaceLast = 5; @@ -2619,16 +2620,16 @@ TEST_F(EnergyPlusFixture, CalculateZoneVolume_BoxOneWallMissing_test) Zone(1).FloorArea = 80.; Zone(1).CeilingHeight = 3.; - CalculateZoneVolume(state, enteredCeilingHeight); + CalculateZoneVolume(*state, enteredCeilingHeight); EXPECT_EQ(240., Zone(1).Volume); } TEST_F(EnergyPlusFixture, CalculateZoneVolume_BoxNoCeiling_test) { Array1D_bool enteredCeilingHeight; - state.dataGlobal->NumOfZones = 1; - enteredCeilingHeight.dimension(state.dataGlobal->NumOfZones, false); - Zone.dimension(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + enteredCeilingHeight.dimension(state->dataGlobal->NumOfZones, false); + Zone.dimension(state->dataGlobal->NumOfZones); Zone(1).HasFloor = true; Zone(1).SurfaceFirst = 1; Zone(1).SurfaceLast = 5; @@ -2683,16 +2684,16 @@ TEST_F(EnergyPlusFixture, CalculateZoneVolume_BoxNoCeiling_test) Zone(1).FloorArea = 80.; Zone(1).CeilingHeight = 3.; - CalculateZoneVolume(state, enteredCeilingHeight); + CalculateZoneVolume(*state, enteredCeilingHeight); EXPECT_EQ(240., Zone(1).Volume); } TEST_F(EnergyPlusFixture, CalculateZoneVolume_BoxNoFloor_test) { Array1D_bool enteredCeilingHeight; - state.dataGlobal->NumOfZones = 1; - enteredCeilingHeight.dimension(state.dataGlobal->NumOfZones, false); - Zone.dimension(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + enteredCeilingHeight.dimension(state->dataGlobal->NumOfZones, false); + Zone.dimension(state->dataGlobal->NumOfZones); Zone(1).HasFloor = true; Zone(1).SurfaceFirst = 1; Zone(1).SurfaceLast = 5; @@ -2747,16 +2748,16 @@ TEST_F(EnergyPlusFixture, CalculateZoneVolume_BoxNoFloor_test) Zone(1).CeilingArea = 80.; Zone(1).CeilingHeight = 3.; - CalculateZoneVolume(state, enteredCeilingHeight); + CalculateZoneVolume(*state, enteredCeilingHeight); EXPECT_EQ(240., Zone(1).Volume); } TEST_F(EnergyPlusFixture, CalculateZoneVolume_BoxNoCeilingFloor_test) { Array1D_bool enteredCeilingHeight; - state.dataGlobal->NumOfZones = 1; - enteredCeilingHeight.dimension(state.dataGlobal->NumOfZones, false); - Zone.dimension(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + enteredCeilingHeight.dimension(state->dataGlobal->NumOfZones, false); + Zone.dimension(state->dataGlobal->NumOfZones); Zone(1).SurfaceFirst = 1; Zone(1).SurfaceLast = 4; @@ -2806,7 +2807,7 @@ TEST_F(EnergyPlusFixture, CalculateZoneVolume_BoxNoCeilingFloor_test) Surface(4).Vertex(3) = Vector(10., 8., 0.); Surface(4).Vertex(4) = Vector(10., 8., 3.); - CalculateZoneVolume(state, enteredCeilingHeight); + CalculateZoneVolume(*state, enteredCeilingHeight); EXPECT_EQ(240., Zone(1).Volume); } @@ -2815,110 +2816,110 @@ TEST_F(EnergyPlusFixture, MakeRectangularVertices) int surfNum = 1; int zoneNum = 1; - state.dataSurfaceGeometry->SurfaceTmp.allocate(surfNum); - state.dataSurfaceGeometry->SurfaceTmp(surfNum).Class = SurfaceClass::Wall; - state.dataSurfaceGeometry->SurfaceTmp(surfNum).Zone = zoneNum; - state.dataSurfaceGeometry->SurfaceTmp(surfNum).Azimuth = 0.; - state.dataSurfaceGeometry->SurfaceTmp(surfNum).Tilt = 90.; - state.dataSurfaceGeometry->SurfaceTmp(surfNum).Sides = 4; - state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex.allocate(4); + state->dataSurfaceGeometry->SurfaceTmp.allocate(surfNum); + state->dataSurfaceGeometry->SurfaceTmp(surfNum).Class = SurfaceClass::Wall; + state->dataSurfaceGeometry->SurfaceTmp(surfNum).Zone = zoneNum; + state->dataSurfaceGeometry->SurfaceTmp(surfNum).Azimuth = 0.; + state->dataSurfaceGeometry->SurfaceTmp(surfNum).Tilt = 90.; + state->dataSurfaceGeometry->SurfaceTmp(surfNum).Sides = 4; + state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex.allocate(4); Zone.allocate(zoneNum); Zone(zoneNum).RelNorth = 0.; - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(zoneNum); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(zoneNum); - state.dataSurfaceGeometry->CosZoneRelNorth(zoneNum) = std::cos(-Zone(zoneNum).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(zoneNum) = std::sin(-Zone(zoneNum).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(zoneNum); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(zoneNum); + state->dataSurfaceGeometry->CosZoneRelNorth(zoneNum) = std::cos(-Zone(zoneNum).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(zoneNum) = std::sin(-Zone(zoneNum).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; // facing north - MakeRectangularVertices(state, 1, 0., 0., 0., 5., 3., false); + MakeRectangularVertices(*state, 1, 0., 0., 0., 5., 3., false); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).y, 0.001); - EXPECT_NEAR(3., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).z, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).y, 0.001); + EXPECT_NEAR(3., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).z, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).y, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).z, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).y, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).z, 0.001); - EXPECT_NEAR(-5., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).y, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).z, 0.001); + EXPECT_NEAR(-5., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).y, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).z, 0.001); - EXPECT_NEAR(-5., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).y, 0.001); - EXPECT_NEAR(3., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).z, 0.001); + EXPECT_NEAR(-5., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).y, 0.001); + EXPECT_NEAR(3., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).z, 0.001); // facing east - state.dataSurfaceGeometry->SurfaceTmp(surfNum).Azimuth = 90.; + state->dataSurfaceGeometry->SurfaceTmp(surfNum).Azimuth = 90.; - MakeRectangularVertices(state, 1, 0., 0., 0., 5., 3., false); + MakeRectangularVertices(*state, 1, 0., 0., 0., 5., 3., false); - EXPECT_NEAR(0, state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).y, 0.001); - EXPECT_NEAR(3., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).z, 0.001); + EXPECT_NEAR(0, state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).y, 0.001); + EXPECT_NEAR(3., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).z, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).y, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).z, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).y, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).z, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).x, 0.001); - EXPECT_NEAR(5., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).y, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).z, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).x, 0.001); + EXPECT_NEAR(5., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).y, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).z, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).x, 0.001); - EXPECT_NEAR(5., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).y, 0.001); - EXPECT_NEAR(3., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).z, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).x, 0.001); + EXPECT_NEAR(5., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).y, 0.001); + EXPECT_NEAR(3., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).z, 0.001); // facing south - state.dataSurfaceGeometry->SurfaceTmp(surfNum).Azimuth = 180.; + state->dataSurfaceGeometry->SurfaceTmp(surfNum).Azimuth = 180.; - MakeRectangularVertices(state, 1, 0., 0., 0., 5., 3., false); + MakeRectangularVertices(*state, 1, 0., 0., 0., 5., 3., false); - EXPECT_NEAR(0, state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).y, 0.001); - EXPECT_NEAR(3., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).z, 0.001); + EXPECT_NEAR(0, state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).y, 0.001); + EXPECT_NEAR(3., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).z, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).y, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).z, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).y, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).z, 0.001); - EXPECT_NEAR(5., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).y, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).z, 0.001); + EXPECT_NEAR(5., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).y, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).z, 0.001); - EXPECT_NEAR(5., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).y, 0.001); - EXPECT_NEAR(3., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).z, 0.001); + EXPECT_NEAR(5., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).y, 0.001); + EXPECT_NEAR(3., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).z, 0.001); // facing west - state.dataSurfaceGeometry->SurfaceTmp(surfNum).Azimuth = 270.; + state->dataSurfaceGeometry->SurfaceTmp(surfNum).Azimuth = 270.; - MakeRectangularVertices(state, 1, 0., 0., 0., 5., 3., false); + MakeRectangularVertices(*state, 1, 0., 0., 0., 5., 3., false); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).y, 0.001); - EXPECT_NEAR(3., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).z, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).y, 0.001); + EXPECT_NEAR(3., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(1).z, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).x, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).y, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).z, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).x, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).y, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(2).z, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).x, 0.001); - EXPECT_NEAR(-5., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).y, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).z, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).x, 0.001); + EXPECT_NEAR(-5., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).y, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(3).z, 0.001); - EXPECT_NEAR(0., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).x, 0.001); - EXPECT_NEAR(-5., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).y, 0.001); - EXPECT_NEAR(3., state.dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).z, 0.001); + EXPECT_NEAR(0., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).x, 0.001); + EXPECT_NEAR(-5., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).y, 0.001); + EXPECT_NEAR(3., state->dataSurfaceGeometry->SurfaceTmp(surfNum).Vertex(4).z, 0.001); } TEST_F(EnergyPlusFixture, SurfaceGeometry_VertexNumberMismatchTest) @@ -2977,11 +2978,11 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_VertexNumberMismatchTest) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfZones = 2; + state->dataGlobal->NumOfZones = 2; Zone.allocate(2); Zone(1).Name = "ZONE 1"; Zone(2).Name = "ZONE 2"; - state.dataSurfaceGeometry->SurfaceTmp.allocate(2); + state->dataSurfaceGeometry->SurfaceTmp.allocate(2); int SurfNum = 0; int TotHTSurfs = 2; Array1D_string const BaseSurfCls(3, {"WALL", "FLOOR", "ROOF"}); @@ -2990,16 +2991,16 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_VertexNumberMismatchTest) DataSurfaces::SurfaceClass::Roof}); int NeedToAddSurfaces; - GetGeometryParameters(state, ErrorsFound); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(2); + GetGeometryParameters(*state, ErrorsFound); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->CosZoneRelNorth = 1.0; - state.dataSurfaceGeometry->SinZoneRelNorth = 0.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->CosZoneRelNorth = 1.0; + state->dataSurfaceGeometry->SinZoneRelNorth = 0.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; - GetHTSurfaceData(state, ErrorsFound, SurfNum, TotHTSurfs, 0, 0, 0, BaseSurfCls, BaseSurfIDs, NeedToAddSurfaces); + GetHTSurfaceData(*state, ErrorsFound, SurfNum, TotHTSurfs, 0, 0, 0, BaseSurfCls, BaseSurfIDs, NeedToAddSurfaces); EXPECT_EQ(2, SurfNum); std::string const error_string = @@ -3025,9 +3026,9 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckConvexityTest) ShadeV.allocate(TotSurfaces); Surface(1).Vertex.allocate(7); Surface(2).Vertex.allocate(9); - state.dataSurfaceGeometry->SurfaceTmp.allocate(TotSurfaces); - state.dataSurfaceGeometry->SurfaceTmp(1).Vertex.allocate(7); - state.dataSurfaceGeometry->SurfaceTmp(2).Vertex.allocate(9); + state->dataSurfaceGeometry->SurfaceTmp.allocate(TotSurfaces); + state->dataSurfaceGeometry->SurfaceTmp(1).Vertex.allocate(7); + state->dataSurfaceGeometry->SurfaceTmp(2).Vertex.allocate(9); int ThisSurf(0); @@ -3066,9 +3067,9 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckConvexityTest) Surface(ThisSurf).Vertex(7).y = 2.0; Surface(ThisSurf).Vertex(7).z = 3.0; - state.dataSurfaceGeometry->SurfaceTmp(ThisSurf) = Surface(ThisSurf); - CheckConvexity(state, ThisSurf, state.dataSurfaceGeometry->SurfaceTmp(ThisSurf).Sides); - Surface(ThisSurf) = state.dataSurfaceGeometry->SurfaceTmp(ThisSurf); + state->dataSurfaceGeometry->SurfaceTmp(ThisSurf) = Surface(ThisSurf); + CheckConvexity(*state, ThisSurf, state->dataSurfaceGeometry->SurfaceTmp(ThisSurf).Sides); + Surface(ThisSurf) = state->dataSurfaceGeometry->SurfaceTmp(ThisSurf); EXPECT_EQ(4, Surface(ThisSurf).Sides); EXPECT_EQ(10.0, Surface(ThisSurf).Vertex(2).x); EXPECT_EQ(6.0, Surface(ThisSurf).Vertex(2).y); @@ -3118,9 +3119,9 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckConvexityTest) Surface(ThisSurf).Vertex(9).y = 2.0; Surface(ThisSurf).Vertex(9).z = 0.0; - state.dataSurfaceGeometry->SurfaceTmp(ThisSurf) = Surface(ThisSurf); - CheckConvexity(state, ThisSurf, state.dataSurfaceGeometry->SurfaceTmp(ThisSurf).Sides); - Surface(ThisSurf) = state.dataSurfaceGeometry->SurfaceTmp(ThisSurf); + state->dataSurfaceGeometry->SurfaceTmp(ThisSurf) = Surface(ThisSurf); + CheckConvexity(*state, ThisSurf, state->dataSurfaceGeometry->SurfaceTmp(ThisSurf).Sides); + Surface(ThisSurf) = state->dataSurfaceGeometry->SurfaceTmp(ThisSurf); EXPECT_EQ(4, Surface(ThisSurf).Sides); EXPECT_EQ(10.0, Surface(ThisSurf).Vertex(2).x); EXPECT_EQ(8.0, Surface(ThisSurf).Vertex(2).y); @@ -3164,101 +3165,101 @@ TEST_F(EnergyPlusFixture, InitialAssociateWindowShadingControlFenestration_test) WindowShadingControl(3).FenestrationName(1) = "Fene-08"; WindowShadingControl(3).FenestrationName(2) = "Fene-09"; - state.dataConstruction->Construct.allocate(1); - state.dataConstruction->Construct(1).WindowTypeEQL = false; + state->dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct(1).WindowTypeEQL = false; - state.dataSurfaceGeometry->SurfaceTmp.allocate(9); + state->dataSurfaceGeometry->SurfaceTmp.allocate(9); - state.dataSurfaceGeometry->SurfaceTmp(1).Name = "Fene-04"; - state.dataSurfaceGeometry->SurfaceTmp(1).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(1).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(1).Name = "Fene-04"; + state->dataSurfaceGeometry->SurfaceTmp(1).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(1).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(2).Name = "Fene-05"; - state.dataSurfaceGeometry->SurfaceTmp(2).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(2).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(2).Name = "Fene-05"; + state->dataSurfaceGeometry->SurfaceTmp(2).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(2).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(3).Name = "Fene-06"; - state.dataSurfaceGeometry->SurfaceTmp(3).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(3).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(3).Name = "Fene-06"; + state->dataSurfaceGeometry->SurfaceTmp(3).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(3).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(4).Name = "Fene-01"; - state.dataSurfaceGeometry->SurfaceTmp(4).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(4).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(4).Name = "Fene-01"; + state->dataSurfaceGeometry->SurfaceTmp(4).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(4).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(5).Name = "Fene-02"; - state.dataSurfaceGeometry->SurfaceTmp(5).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(5).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(5).Name = "Fene-02"; + state->dataSurfaceGeometry->SurfaceTmp(5).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(5).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(6).Name = "Fene-03"; - state.dataSurfaceGeometry->SurfaceTmp(6).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(6).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(6).Name = "Fene-03"; + state->dataSurfaceGeometry->SurfaceTmp(6).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(6).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(7).Name = "Fene-07"; - state.dataSurfaceGeometry->SurfaceTmp(7).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(7).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(7).Name = "Fene-07"; + state->dataSurfaceGeometry->SurfaceTmp(7).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(7).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(8).Name = "Fene-08"; - state.dataSurfaceGeometry->SurfaceTmp(8).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(8).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(8).Name = "Fene-08"; + state->dataSurfaceGeometry->SurfaceTmp(8).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(8).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(9).Name = "Fene-09"; - state.dataSurfaceGeometry->SurfaceTmp(9).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(9).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(9).Name = "Fene-09"; + state->dataSurfaceGeometry->SurfaceTmp(9).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(9).ExtBoundCond = ExternalEnvironment; bool Err = false; int surfNum = 1; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 2); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 2); EXPECT_FALSE(Err); surfNum = 2; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 2); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 2); EXPECT_FALSE(Err); surfNum = 3; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 2); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 2); EXPECT_FALSE(Err); surfNum = 4; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 1); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 1); EXPECT_FALSE(Err); surfNum = 5; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 1); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 1); EXPECT_FALSE(Err); surfNum = 6; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 1); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 1); EXPECT_FALSE(Err); surfNum = 7; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 2); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 2); EXPECT_FALSE(Err); surfNum = 8; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 3); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 3); EXPECT_FALSE(Err); surfNum = 9; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 3); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).activeWindowShadingControl, 3); EXPECT_FALSE(Err); } @@ -3298,70 +3299,70 @@ TEST_F(EnergyPlusFixture, InitialAssociateWindowShadingControlFenestration_Multi WindowShadingControl(3).FenestrationName(1) = "Fene-03"; WindowShadingControl(3).FenestrationName(2) = "Fene-05"; - state.dataConstruction->Construct.allocate(1); - state.dataConstruction->Construct(1).WindowTypeEQL = false; + state->dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct(1).WindowTypeEQL = false; - state.dataSurfaceGeometry->SurfaceTmp.allocate(5); + state->dataSurfaceGeometry->SurfaceTmp.allocate(5); - state.dataSurfaceGeometry->SurfaceTmp(1).Name = "Fene-01"; - state.dataSurfaceGeometry->SurfaceTmp(1).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(1).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(1).Name = "Fene-01"; + state->dataSurfaceGeometry->SurfaceTmp(1).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(1).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(2).Name = "Fene-02"; - state.dataSurfaceGeometry->SurfaceTmp(2).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(2).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(2).Name = "Fene-02"; + state->dataSurfaceGeometry->SurfaceTmp(2).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(2).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(3).Name = "Fene-03"; - state.dataSurfaceGeometry->SurfaceTmp(3).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(3).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(3).Name = "Fene-03"; + state->dataSurfaceGeometry->SurfaceTmp(3).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(3).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(4).Name = "Fene-04"; - state.dataSurfaceGeometry->SurfaceTmp(4).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(4).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(4).Name = "Fene-04"; + state->dataSurfaceGeometry->SurfaceTmp(4).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(4).ExtBoundCond = ExternalEnvironment; - state.dataSurfaceGeometry->SurfaceTmp(5).Name = "Fene-05"; - state.dataSurfaceGeometry->SurfaceTmp(5).Construction = 1; - state.dataSurfaceGeometry->SurfaceTmp(5).ExtBoundCond = ExternalEnvironment; + state->dataSurfaceGeometry->SurfaceTmp(5).Name = "Fene-05"; + state->dataSurfaceGeometry->SurfaceTmp(5).Construction = 1; + state->dataSurfaceGeometry->SurfaceTmp(5).ExtBoundCond = ExternalEnvironment; bool Err = false; int surfNum = 1; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList.size(), 1u); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[0], 1); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList.size(), 1u); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[0], 1); EXPECT_FALSE(Err); surfNum = 2; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList.size(), 2u); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[0], 1); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[1], 2); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList.size(), 2u); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[0], 1); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[1], 2); EXPECT_FALSE(Err); surfNum = 3; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList.size(), 3u); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[0], 1); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[1], 2); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[2], 3); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList.size(), 3u); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[0], 1); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[1], 2); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[2], 3); EXPECT_FALSE(Err); surfNum = 4; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList.size(), 1u); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[0], 2); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList.size(), 1u); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[0], 2); EXPECT_FALSE(Err); surfNum = 5; - InitialAssociateWindowShadingControlFenestration(state, Err, surfNum); - EXPECT_TRUE(state.dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList.size(), 2u); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[0], 2); - EXPECT_EQ(state.dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[1], 3); + InitialAssociateWindowShadingControlFenestration(*state, Err, surfNum); + EXPECT_TRUE(state->dataSurfaceGeometry->SurfaceTmp(surfNum).HasShadeControl); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList.size(), 2u); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[0], 2); + EXPECT_EQ(state->dataSurfaceGeometry->SurfaceTmp(surfNum).windowShadingControlList[1], 3); EXPECT_FALSE(Err); } @@ -3445,7 +3446,7 @@ TEST_F(EnergyPlusFixture, FinalAssociateWindowShadingControlFenestration_test) bool Err = false; - FinalAssociateWindowShadingControlFenestration(state, Err); + FinalAssociateWindowShadingControlFenestration(*state, Err); EXPECT_FALSE(Err); EXPECT_EQ(WindowShadingControl(1).FenestrationIndex(1), 2); @@ -3625,11 +3626,11 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckWindowShadingControlSimilarForWin bool errorsOccurred = false; - CheckWindowShadingControlSimilarForWindow(state, errorsOccurred); + CheckWindowShadingControlSimilarForWindow(*state, errorsOccurred); EXPECT_FALSE(errorsOccurred); WindowShadingControl(2).SetPoint = 140; - CheckWindowShadingControlSimilarForWindow(state, errorsOccurred); + CheckWindowShadingControlSimilarForWindow(*state, errorsOccurred); EXPECT_TRUE(errorsOccurred); } @@ -3657,26 +3658,26 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_createAirMaterialFromDistance_Test) TEST_F(EnergyPlusFixture, SurfaceGeometry_createConstructionWithStorm_Test) { TotConstructs = 1; - state.dataConstruction->Construct.allocate(TotConstructs); + state->dataConstruction->Construct.allocate(TotConstructs); dataMaterial.Material.allocate(60); dataMaterial.Material(47).AbsorpThermalFront = 0.11; // Case 1a: Constructs with regular materials are a reverse of each other--material layers match in reverse (should get a "false" answer) - state.dataConstruction->Construct(TotConstructs).TotLayers = 3; - state.dataConstruction->Construct(TotConstructs).LayerPoint(1) = 11; - state.dataConstruction->Construct(TotConstructs).LayerPoint(2) = 22; - state.dataConstruction->Construct(TotConstructs).LayerPoint(3) = 33; + state->dataConstruction->Construct(TotConstructs).TotLayers = 3; + state->dataConstruction->Construct(TotConstructs).LayerPoint(1) = 11; + state->dataConstruction->Construct(TotConstructs).LayerPoint(2) = 22; + state->dataConstruction->Construct(TotConstructs).LayerPoint(3) = 33; - createConstructionWithStorm(state, 1, "construction_A", 47, 59); + createConstructionWithStorm(*state, 1, "construction_A", 47, 59); EXPECT_EQ(TotConstructs, 2); - EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).Name, "construction_A"); - EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).LayerPoint(1), 47); - EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).LayerPoint(2), 59); - EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).LayerPoint(3), 11); - EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).LayerPoint(4), 22); - EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).LayerPoint(5), 33); - EXPECT_EQ(state.dataConstruction->Construct(TotConstructs).OutsideAbsorpThermal, 0.11); + EXPECT_EQ(state->dataConstruction->Construct(TotConstructs).Name, "construction_A"); + EXPECT_EQ(state->dataConstruction->Construct(TotConstructs).LayerPoint(1), 47); + EXPECT_EQ(state->dataConstruction->Construct(TotConstructs).LayerPoint(2), 59); + EXPECT_EQ(state->dataConstruction->Construct(TotConstructs).LayerPoint(3), 11); + EXPECT_EQ(state->dataConstruction->Construct(TotConstructs).LayerPoint(4), 22); + EXPECT_EQ(state->dataConstruction->Construct(TotConstructs).LayerPoint(5), 33); + EXPECT_EQ(state->dataConstruction->Construct(TotConstructs).OutsideAbsorpThermal, 0.11); } @@ -3868,29 +3869,29 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_HeatTransferAlgorithmTest) ASSERT_TRUE(process_idf(idf_objects)); - GetProjectControlData(state, ErrorsFound); // read project control data + GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); // expect no errors - GetMaterialData(state, ErrorsFound); // read material data + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors - GetConstructData(state, ErrorsFound); // read construction data + GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); // expect no errors - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(2); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(2); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(2) = state.dataSurfaceGeometry->CosZoneRelNorth(1); - state.dataSurfaceGeometry->SinZoneRelNorth(2) = state.dataSurfaceGeometry->SinZoneRelNorth(1); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = state->dataSurfaceGeometry->CosZoneRelNorth(1); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = state->dataSurfaceGeometry->SinZoneRelNorth(1); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - GetSurfaceData(state, ErrorsFound); // setup zone geometry and get zone data + GetSurfaceData(*state, ErrorsFound); // setup zone geometry and get zone data EXPECT_FALSE(ErrorsFound); // expect no errors int surfNum = UtilityRoutines::FindItemInList("DATATELCOM_CEILING_1_0_0", DataSurfaces::Surface); @@ -3984,16 +3985,16 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_SurfaceReferencesNonExistingSurface) ASSERT_TRUE(process_idf(idf_objects)); // Read Material and Construction, and expect no errors - GetMaterialData(state, ErrorsFound); + GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - GetConstructData(state, ErrorsFound); + GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataGlobal->NumOfZones = 2; + state->dataGlobal->NumOfZones = 2; Zone.allocate(2); Zone(1).Name = "ZONE 1"; Zone(2).Name = "ZONE 2"; - state.dataSurfaceGeometry->SurfaceTmp.allocate(1); + state->dataSurfaceGeometry->SurfaceTmp.allocate(1); int SurfNum = 0; int TotHTSurfs = 1; Array1D_string const BaseSurfCls(3, {"WALL", "FLOOR", "ROOF"}); @@ -4002,16 +4003,16 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_SurfaceReferencesNonExistingSurface) DataSurfaces::SurfaceClass::Roof}); int NeedToAddSurfaces; - GetGeometryParameters(state, ErrorsFound); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + GetGeometryParameters(*state, ErrorsFound); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth = 1.0; - state.dataSurfaceGeometry->SinZoneRelNorth = 0.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->CosZoneRelNorth = 1.0; + state->dataSurfaceGeometry->SinZoneRelNorth = 0.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; - GetHTSurfaceData(state, ErrorsFound, SurfNum, TotHTSurfs, 0, 0, 0, BaseSurfCls, BaseSurfIDs, NeedToAddSurfaces); + GetHTSurfaceData(*state, ErrorsFound, SurfNum, TotHTSurfs, 0, 0, 0, BaseSurfCls, BaseSurfIDs, NeedToAddSurfaces); // We expect one surface, but an error since Surface B cannot be located EXPECT_EQ(1, SurfNum); @@ -4341,22 +4342,22 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_InternalMassSurfacesCount) ASSERT_TRUE(process_idf(idf_objects)); // Read Materials - GetMaterialData(state, ErrorsFound); + GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Construction - GetConstructData(state, ErrorsFound); + GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Read Zones - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); // Read InternalMass Object Count - int TotIntMass = inputProcessor->getNumObjectsFound(state, "InternalMass"); + int TotIntMass = inputProcessor->getNumObjectsFound(*state, "InternalMass"); // check the three internal mass objects EXPECT_EQ(3, TotIntMass); // Read InternalMass Surfaces Count - int TotalNumOfInternalMassSurfaces = GetNumIntMassSurfaces(state); + int TotalNumOfInternalMassSurfaces = GetNumIntMassSurfaces(*state); // check the 24 internal mass surfaces created from the three zoneLists EXPECT_EQ(24, TotalNumOfInternalMassSurfaces); } @@ -4679,28 +4680,28 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CreateInternalMassSurfaces) ASSERT_TRUE(process_idf(idf_objects)); // Read Materials - GetMaterialData(state, ErrorsFound); + GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Construction - GetConstructData(state, ErrorsFound); + GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Read Zones - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); // Read InternalMass Object Count - int TotIntMass = inputProcessor->getNumObjectsFound(state, "InternalMass"); + int TotIntMass = inputProcessor->getNumObjectsFound(*state, "InternalMass"); EXPECT_EQ(3, TotIntMass); // Read InternalMass Surfaces Count - int TotalNumOfInternalMassSurfaces = GetNumIntMassSurfaces(state); + int TotalNumOfInternalMassSurfaces = GetNumIntMassSurfaces(*state); EXPECT_EQ(24, TotalNumOfInternalMassSurfaces); DataSurfaces::TotSurfaces = TotalNumOfInternalMassSurfaces; - state.dataSurfaceGeometry->SurfaceTmp.allocate(TotSurfaces); + state->dataSurfaceGeometry->SurfaceTmp.allocate(TotSurfaces); int SurfNum = 0; - GetIntMassSurfaceData(state, ErrorsFound, SurfNum); + GetIntMassSurfaceData(*state, ErrorsFound, SurfNum); ASSERT_FALSE(ErrorsFound); // check internal mass surface count and object names @@ -4718,15 +4719,15 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CreateInternalMassSurfaces) // first zone in the ground floor ZoneList EXPECT_EQ("G SW APARTMENT", Zone(1).Name); EXPECT_EQ("GFLOORZONESINTMASS", DataSurfaces::IntMassObjects(1).Name); - EXPECT_EQ("G SW APARTMENT GFLOORZONESINTMASS", state.dataSurfaceGeometry->SurfaceTmp(1).Name); + EXPECT_EQ("G SW APARTMENT GFLOORZONESINTMASS", state->dataSurfaceGeometry->SurfaceTmp(1).Name); // first zone in the middle floor ZoneList EXPECT_EQ("M SW APARTMENT", Zone(9).Name); EXPECT_EQ("MFLOORZONESINTMASS", DataSurfaces::IntMassObjects(2).Name); - EXPECT_EQ("M SW APARTMENT MFLOORZONESINTMASS", state.dataSurfaceGeometry->SurfaceTmp(9).Name); + EXPECT_EQ("M SW APARTMENT MFLOORZONESINTMASS", state->dataSurfaceGeometry->SurfaceTmp(9).Name); // first zone in the top floor ZoneList EXPECT_EQ("T SW APARTMENT", Zone(17).Name); EXPECT_EQ("TFLOORZONESINTMASS", DataSurfaces::IntMassObjects(3).Name); - EXPECT_EQ("T SW APARTMENT TFLOORZONESINTMASS", state.dataSurfaceGeometry->SurfaceTmp(17).Name); + EXPECT_EQ("T SW APARTMENT TFLOORZONESINTMASS", state->dataSurfaceGeometry->SurfaceTmp(17).Name); } TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test1) @@ -4748,14 +4749,14 @@ TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test1) bool ErrorsFound(false); - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; Zone.allocate(1); Zone(1).Name = "ZONE 1"; Zone(1).OriginX = 0; Zone(1).OriginY = 0; Zone(1).OriginZ = 0; - GetGeometryParameters(state, ErrorsFound); + GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(has_err_output(true)); } @@ -4778,14 +4779,14 @@ TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test2) bool ErrorsFound(false); - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; Zone.allocate(1); Zone(1).Name = "ZONE 1"; Zone(1).OriginX = 0; Zone(1).OriginY = 0; Zone(1).OriginZ = 0; - GetGeometryParameters(state, ErrorsFound); + GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(has_err_output(true)); } @@ -4808,14 +4809,14 @@ TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test3) bool ErrorsFound(false); - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; Zone.allocate(1); Zone(1).Name = "ZONE 1"; Zone(1).OriginX = 6; Zone(1).OriginY = 6; Zone(1).OriginZ = 0; - GetGeometryParameters(state, ErrorsFound); + GetGeometryParameters(*state, ErrorsFound); EXPECT_TRUE(has_err_output(false)); std::string error_string = delimited_string({ @@ -4843,14 +4844,14 @@ TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test4) bool ErrorsFound(false); - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; Zone.allocate(1); Zone(1).Name = "ZONE 1"; Zone(1).OriginX = 6; Zone(1).OriginY = 6; Zone(1).OriginZ = 0; - GetGeometryParameters(state, ErrorsFound); + GetGeometryParameters(*state, ErrorsFound); EXPECT_TRUE(has_err_output(false)); std::string error_string = delimited_string({ @@ -4864,43 +4865,43 @@ TEST_F(EnergyPlusFixture, WorldCoord_with_RelativeRectSurfCoord_test4) TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) { bool RevLayerDiffs; - state.dataConstruction->Construct.allocate(6); + state->dataConstruction->Construct.allocate(6); dataMaterial.Material.allocate(7); // Case 1a: Constructs with regular materials are a reverse of each other--material layers match in reverse (should get a "false" answer) - state.dataConstruction->Construct(1).TotLayers = 3; - state.dataConstruction->Construct(1).LayerPoint(1) = 1; - state.dataConstruction->Construct(1).LayerPoint(2) = 2; - state.dataConstruction->Construct(1).LayerPoint(3) = 3; - state.dataConstruction->Construct(2).TotLayers = 3; - state.dataConstruction->Construct(2).LayerPoint(1) = 3; - state.dataConstruction->Construct(2).LayerPoint(2) = 2; - state.dataConstruction->Construct(2).LayerPoint(3) = 1; + state->dataConstruction->Construct(1).TotLayers = 3; + state->dataConstruction->Construct(1).LayerPoint(1) = 1; + state->dataConstruction->Construct(1).LayerPoint(2) = 2; + state->dataConstruction->Construct(1).LayerPoint(3) = 3; + state->dataConstruction->Construct(2).TotLayers = 3; + state->dataConstruction->Construct(2).LayerPoint(1) = 3; + state->dataConstruction->Construct(2).LayerPoint(2) = 2; + state->dataConstruction->Construct(2).LayerPoint(3) = 1; RevLayerDiffs = true; // ExpectResult = false; - CheckForReversedLayers(state, RevLayerDiffs, 1, 2, 3); + CheckForReversedLayers(*state, RevLayerDiffs, 1, 2, 3); EXPECT_FALSE(RevLayerDiffs); // Case 1a: Constructs with regular materials are not reverse of each other--material layers do not match in reverse (should get a "true" answer) - state.dataConstruction->Construct(2).LayerPoint(1) = 1; - state.dataConstruction->Construct(2).LayerPoint(3) = 3; + state->dataConstruction->Construct(2).LayerPoint(1) = 1; + state->dataConstruction->Construct(2).LayerPoint(3) = 3; dataMaterial.Material(1).Group = RegularMaterial; dataMaterial.Material(2).Group = RegularMaterial; dataMaterial.Material(3).Group = RegularMaterial; RevLayerDiffs = false; // ExpectResult = true; - CheckForReversedLayers(state, RevLayerDiffs, 1, 2, 3); + CheckForReversedLayers(*state, RevLayerDiffs, 1, 2, 3); EXPECT_TRUE(RevLayerDiffs); // Case 2a: Constructs are reverse of each other using WindowGlass, front/back properties properly switched (should get a "false" answer) - state.dataConstruction->Construct(3).TotLayers = 3; - state.dataConstruction->Construct(3).LayerPoint(1) = 4; - state.dataConstruction->Construct(3).LayerPoint(2) = 2; - state.dataConstruction->Construct(3).LayerPoint(3) = 5; - state.dataConstruction->Construct(4).TotLayers = 3; - state.dataConstruction->Construct(4).LayerPoint(1) = 4; - state.dataConstruction->Construct(4).LayerPoint(2) = 2; - state.dataConstruction->Construct(4).LayerPoint(3) = 5; + state->dataConstruction->Construct(3).TotLayers = 3; + state->dataConstruction->Construct(3).LayerPoint(1) = 4; + state->dataConstruction->Construct(3).LayerPoint(2) = 2; + state->dataConstruction->Construct(3).LayerPoint(3) = 5; + state->dataConstruction->Construct(4).TotLayers = 3; + state->dataConstruction->Construct(4).LayerPoint(1) = 4; + state->dataConstruction->Construct(4).LayerPoint(2) = 2; + state->dataConstruction->Construct(4).LayerPoint(3) = 5; dataMaterial.Material(4).Group = WindowGlass; dataMaterial.Material(4).Thickness = 0.15; dataMaterial.Material(4).ReflectSolBeamFront = 0.35; @@ -4933,7 +4934,7 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) dataMaterial.Material(5).PoissonsRatio = 1.11; RevLayerDiffs = true; // ExpectResult = false; - CheckForReversedLayers(state, RevLayerDiffs, 3, 4, 3); + CheckForReversedLayers(*state, RevLayerDiffs, 3, 4, 3); EXPECT_FALSE(RevLayerDiffs); // Case 2b: Constructs are reverse of each other using WindowGlass, front/back properties NOT properly switched (should get a "true" answer) @@ -4941,14 +4942,14 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) dataMaterial.Material(5).ReflectVisBeamBack = 0.24; // correct would be 0.34 RevLayerDiffs = false; // ExpectResult = true; - CheckForReversedLayers(state, RevLayerDiffs, 3, 4, 3); + CheckForReversedLayers(*state, RevLayerDiffs, 3, 4, 3); EXPECT_TRUE(RevLayerDiffs); // Case 3a: Single layer constructs using Equivalent Glass, front/back properties properly switched (should get a "false" answer) - state.dataConstruction->Construct(5).TotLayers = 1; - state.dataConstruction->Construct(5).LayerPoint(1) = 6; - state.dataConstruction->Construct(6).TotLayers = 1; - state.dataConstruction->Construct(6).LayerPoint(1) = 7; + state->dataConstruction->Construct(5).TotLayers = 1; + state->dataConstruction->Construct(5).LayerPoint(1) = 6; + state->dataConstruction->Construct(6).TotLayers = 1; + state->dataConstruction->Construct(6).LayerPoint(1) = 7; dataMaterial.Material(6).Group = GlassEquivalentLayer; dataMaterial.Material(6).TausFrontBeamBeam = 0.39; dataMaterial.Material(6).TausBackBeamBeam = 0.29; @@ -5005,14 +5006,14 @@ TEST_F(EnergyPlusFixture, SurfaceGeometry_CheckForReversedLayers) dataMaterial.Material(7).Resistance = 1.234; RevLayerDiffs = true; // ExpectResult = false; - CheckForReversedLayers(state, RevLayerDiffs, 5, 6, 1); + CheckForReversedLayers(*state, RevLayerDiffs, 5, 6, 1); EXPECT_FALSE(RevLayerDiffs); // Case 3a: Single layer constructs using Equivalent Glass, front/back properties NOT properly switched (should get a "true" answer) dataMaterial.Material(7).EmissThermalFront = 0.888; RevLayerDiffs = false; // ExpectResult = true; - CheckForReversedLayers(state, RevLayerDiffs, 5, 6, 1); + CheckForReversedLayers(*state, RevLayerDiffs, 5, 6, 1); EXPECT_TRUE(RevLayerDiffs); } @@ -5111,16 +5112,16 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_SetupEnclosuresNoAirBoundari ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - GetMaterialData(state, ErrorsFound); // read material data + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors - GetConstructData(state, ErrorsFound); // read construction data + GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); // expect no errors - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - SetupZoneGeometry(state, ErrorsFound); + SetupZoneGeometry(*state, ErrorsFound); // SetupZoneGeometry calls SurfaceGeometry::GetSurfaceData // SetupZoneGeometry calls SurfaceGeometry::SetupSolarEnclosuresAndAirBoundaries // SetupZoneGeometry calls SurfaceGeometry::SetupRadiantEnclosuresAndAirBoundaries @@ -5249,16 +5250,16 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_SetupEnclosuresWithAirBounda ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - GetMaterialData(state, ErrorsFound); // read material data + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors - GetConstructData(state, ErrorsFound); // read construction data + GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); // expect no errors - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - SetupZoneGeometry(state, ErrorsFound); + SetupZoneGeometry(*state, ErrorsFound); // SetupZoneGeometry calls SurfaceGeometry::GetSurfaceData // SetupZoneGeometry calls SurfaceGeometry::SetupSolarEnclosuresAndAirBoundaries // SetupZoneGeometry calls SurfaceGeometry::SetupRadiantEnclosuresAndAirBoundaries @@ -5390,16 +5391,16 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_SetupEnclosuresWithAirBounda ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - GetMaterialData(state, ErrorsFound); // read material data + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors - GetConstructData(state, ErrorsFound); // read construction data + GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); // expect no errors - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - SetupZoneGeometry(state, ErrorsFound); + SetupZoneGeometry(*state, ErrorsFound); // SetupZoneGeometry calls SurfaceGeometry::GetSurfaceData // SetupZoneGeometry calls SurfaceGeometry::SetupSolarEnclosuresAndAirBoundaries // SetupZoneGeometry calls SurfaceGeometry::SetupRadiantEnclosuresAndAirBoundaries @@ -5638,16 +5639,16 @@ TEST_F(EnergyPlusFixture, HeatBalanceIntRadExchange_SetupEnclosuresWithAirBounda ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - GetMaterialData(state, ErrorsFound); // read material data + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors - GetConstructData(state, ErrorsFound); // read construction data + GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); // expect no errors - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - SetupZoneGeometry(state, ErrorsFound); + SetupZoneGeometry(*state, ErrorsFound); // SetupZoneGeometry calls SurfaceGeometry::GetSurfaceData // SetupZoneGeometry calls SurfaceGeometry::SetupSolarEnclosuresAndAirBoundaries // SetupZoneGeometry calls SurfaceGeometry::SetupRadiantEnclosuresAndAirBoundaries @@ -6512,22 +6513,22 @@ TEST_F(EnergyPlusFixture, GetSurfaceData_SurfaceOrder) ASSERT_TRUE(process_idf(idf_objects)); - GetProjectControlData(state, ErrorsFound); // read project control data + GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); // expect no errors - GetMaterialData(state, ErrorsFound); // read material data + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors - GetConstructData(state, ErrorsFound); // read construction data + GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); // expect no errors - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - SetupZoneGeometry(state, ErrorsFound); + SetupZoneGeometry(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // expect no errors - GetSurfaceData(state, ErrorsFound); // setup zone geometry and get zone data + GetSurfaceData(*state, ErrorsFound); // setup zone geometry and get zone data EXPECT_FALSE(ErrorsFound); // expect no errors // compare_err_stream( "" ); // just for debugging diff --git a/tst/EnergyPlus/unit/SurfaceOctree.unit.cc b/tst/EnergyPlus/unit/SurfaceOctree.unit.cc index 61e99e67572..2348514e4f1 100644 --- a/tst/EnergyPlus/unit/SurfaceOctree.unit.cc +++ b/tst/EnergyPlus/unit/SurfaceOctree.unit.cc @@ -55,6 +55,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include // ObjexxFCL Headers #include @@ -431,7 +432,7 @@ TEST_F(EnergyPlusFixture, Composite) ++n; return n >= 8u; }; - cube.processSomeSurfaceRayIntersectsCube(state, a, dir, predicate); + cube.processSomeSurfaceRayIntersectsCube(*state, a, dir, predicate); EXPECT_EQ(8u, n); } diff --git a/tst/EnergyPlus/unit/SwimmingPool.unit.cc b/tst/EnergyPlus/unit/SwimmingPool.unit.cc index 446c3274541..3ba5426436a 100644 --- a/tst/EnergyPlus/unit/SwimmingPool.unit.cc +++ b/tst/EnergyPlus/unit/SwimmingPool.unit.cc @@ -59,6 +59,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include using namespace EnergyPlus; using namespace EnergyPlus::SwimmingPool; @@ -89,40 +90,40 @@ TEST_F(EnergyPlusFixture, SwimmingPool_CalcSwimmingPoolEvap) Real64 EvapRate; // Tests for CalcSwimmingPoolEvap--Evaporate Rate Calculation for Swimming Pools - state.dataSwimmingPools->clear_state(); + state->dataSwimmingPools->clear_state(); DataSurfaces::clear_state(); - state.dataSwimmingPools->NumSwimmingPools = 1; - state.dataSwimmingPools->Pool.allocate(1); + state->dataSwimmingPools->NumSwimmingPools = 1; + state->dataSwimmingPools->Pool.allocate(1); DataSurfaces::Surface.allocate(1); Surface(1).Area = 10.0; SurfNum = 1; PoolNum = 1; DataEnvironment::OutBaroPress = 101400.0; - auto &thisPool = state.dataSwimmingPools->Pool(PoolNum); + auto &thisPool = state->dataSwimmingPools->Pool(PoolNum); // Test 1 - state.dataSwimmingPools->Pool(PoolNum).PoolWaterTemp = 30.0; + state->dataSwimmingPools->Pool(PoolNum).PoolWaterTemp = 30.0; MAT = 20.0; HumRat = 0.005; - state.dataSwimmingPools->Pool(PoolNum).CurActivityFactor = 0.5; - state.dataSwimmingPools->Pool(PoolNum).CurCoverEvapFac = 0.3; - thisPool.calcSwimmingPoolEvap(state, EvapRate, SurfNum, MAT, HumRat); + state->dataSwimmingPools->Pool(PoolNum).CurActivityFactor = 0.5; + state->dataSwimmingPools->Pool(PoolNum).CurCoverEvapFac = 0.3; + thisPool.calcSwimmingPoolEvap(*state, EvapRate, SurfNum, MAT, HumRat); EXPECT_NEAR(0.000207, EvapRate, 0.000001); - EXPECT_NEAR(4250.0, state.dataSwimmingPools->Pool(PoolNum).SatPressPoolWaterTemp, 10.0); - EXPECT_NEAR(810.0, state.dataSwimmingPools->Pool(PoolNum).PartPressZoneAirTemp, 10.0); + EXPECT_NEAR(4250.0, state->dataSwimmingPools->Pool(PoolNum).SatPressPoolWaterTemp, 10.0); + EXPECT_NEAR(810.0, state->dataSwimmingPools->Pool(PoolNum).PartPressZoneAirTemp, 10.0); // Test 2 - state.dataSwimmingPools->Pool(PoolNum).PoolWaterTemp = 27.0; + state->dataSwimmingPools->Pool(PoolNum).PoolWaterTemp = 27.0; MAT = 22.0; HumRat = 0.010; - state.dataSwimmingPools->Pool(PoolNum).CurActivityFactor = 1.0; - state.dataSwimmingPools->Pool(PoolNum).CurCoverEvapFac = 1.0; - thisPool.calcSwimmingPoolEvap(state, EvapRate, SurfNum, MAT, HumRat); + state->dataSwimmingPools->Pool(PoolNum).CurActivityFactor = 1.0; + state->dataSwimmingPools->Pool(PoolNum).CurCoverEvapFac = 1.0; + thisPool.calcSwimmingPoolEvap(*state, EvapRate, SurfNum, MAT, HumRat); EXPECT_NEAR(0.000788, EvapRate, 0.000001); - EXPECT_NEAR(3570.0, state.dataSwimmingPools->Pool(PoolNum).SatPressPoolWaterTemp, 10.0); - EXPECT_NEAR(1600.0, state.dataSwimmingPools->Pool(PoolNum).PartPressZoneAirTemp, 10.0); + EXPECT_NEAR(3570.0, state->dataSwimmingPools->Pool(PoolNum).SatPressPoolWaterTemp, 10.0); + EXPECT_NEAR(1600.0, state->dataSwimmingPools->Pool(PoolNum).PartPressZoneAirTemp, 10.0); } TEST_F(EnergyPlusFixture, SwimmingPool_InitSwimmingPoolPlantLoopIndex) @@ -130,17 +131,17 @@ TEST_F(EnergyPlusFixture, SwimmingPool_InitSwimmingPoolPlantLoopIndex) bool MyPlantScanFlagPool; // Tests for InitSwimmingPoolPlantLoopIndex - state.dataSwimmingPools->clear_state(); + state->dataSwimmingPools->clear_state(); DataPlant::clear_state(); - state.dataSwimmingPools->NumSwimmingPools = 2; + state->dataSwimmingPools->NumSwimmingPools = 2; TotNumLoops = 2; - state.dataSwimmingPools->Pool.allocate(state.dataSwimmingPools->NumSwimmingPools); + state->dataSwimmingPools->Pool.allocate(state->dataSwimmingPools->NumSwimmingPools); MyPlantScanFlagPool = true; - state.dataSwimmingPools->Pool(1).Name = "FirstPool"; - state.dataSwimmingPools->Pool(2).Name = "SecondPool"; - state.dataSwimmingPools->Pool(1).WaterInletNode = 1; - state.dataSwimmingPools->Pool(2).WaterInletNode = 11; + state->dataSwimmingPools->Pool(1).Name = "FirstPool"; + state->dataSwimmingPools->Pool(2).Name = "SecondPool"; + state->dataSwimmingPools->Pool(1).WaterInletNode = 1; + state->dataSwimmingPools->Pool(2).WaterInletNode = 11; PlantLoop.allocate(TotNumLoops); PlantLoop(1).LoopSide.allocate(2); PlantLoop(2).LoopSide.allocate(2); @@ -170,20 +171,20 @@ TEST_F(EnergyPlusFixture, SwimmingPool_InitSwimmingPoolPlantLoopIndex) // Test 1 - state.dataSwimmingPools->Pool(1).initSwimmingPoolPlantLoopIndex(state); - EXPECT_EQ(state.dataSwimmingPools->Pool(1).HWLoopNum, 1); - EXPECT_EQ(state.dataSwimmingPools->Pool(1).HWLoopSide, 1); - EXPECT_EQ(state.dataSwimmingPools->Pool(1).HWBranchNum, 1); - EXPECT_EQ(state.dataSwimmingPools->Pool(1).HWCompNum, 1); + state->dataSwimmingPools->Pool(1).initSwimmingPoolPlantLoopIndex(*state); + EXPECT_EQ(state->dataSwimmingPools->Pool(1).HWLoopNum, 1); + EXPECT_EQ(state->dataSwimmingPools->Pool(1).HWLoopSide, 1); + EXPECT_EQ(state->dataSwimmingPools->Pool(1).HWBranchNum, 1); + EXPECT_EQ(state->dataSwimmingPools->Pool(1).HWCompNum, 1); EXPECT_EQ(MyPlantScanFlagPool, true); // Test 2 MyPlantScanFlagPool = true; - state.dataSwimmingPools->Pool(2).initSwimmingPoolPlantLoopIndex(state); - EXPECT_EQ(state.dataSwimmingPools->Pool(2).HWLoopNum, 2); - EXPECT_EQ(state.dataSwimmingPools->Pool(2).HWLoopSide, 2); - EXPECT_EQ(state.dataSwimmingPools->Pool(2).HWBranchNum, 1); - EXPECT_EQ(state.dataSwimmingPools->Pool(2).HWCompNum, 1); + state->dataSwimmingPools->Pool(2).initSwimmingPoolPlantLoopIndex(*state); + EXPECT_EQ(state->dataSwimmingPools->Pool(2).HWLoopNum, 2); + EXPECT_EQ(state->dataSwimmingPools->Pool(2).HWLoopSide, 2); + EXPECT_EQ(state->dataSwimmingPools->Pool(2).HWBranchNum, 1); + EXPECT_EQ(state->dataSwimmingPools->Pool(2).HWCompNum, 1); EXPECT_EQ(MyPlantScanFlagPool, true); } @@ -193,22 +194,22 @@ TEST_F(EnergyPlusFixture, SwimmingPool_InitSwimmingPoolPlantNodeFlow) int PoolNum; // Tests for InitSwimmingPoolPlantLoopIndex - state.dataSwimmingPools->clear_state(); + state->dataSwimmingPools->clear_state(); DataPlant::clear_state(); DataLoopNode::clear_state(); - state.dataSwimmingPools->NumSwimmingPools = 1; + state->dataSwimmingPools->NumSwimmingPools = 1; TotNumLoops = 1; - state.dataSwimmingPools->Pool.allocate(state.dataSwimmingPools->NumSwimmingPools); + state->dataSwimmingPools->Pool.allocate(state->dataSwimmingPools->NumSwimmingPools); MyPlantScanFlagPool = false; - state.dataSwimmingPools->Pool(1).Name = "FirstPool"; - state.dataSwimmingPools->Pool(1).WaterInletNode = 1; - state.dataSwimmingPools->Pool(1).WaterOutletNode = 2; - state.dataSwimmingPools->Pool(1).HWLoopNum = 1; - state.dataSwimmingPools->Pool(1).HWLoopSide = 1; - state.dataSwimmingPools->Pool(1).HWBranchNum = 1; - state.dataSwimmingPools->Pool(1).HWCompNum = 1; + state->dataSwimmingPools->Pool(1).Name = "FirstPool"; + state->dataSwimmingPools->Pool(1).WaterInletNode = 1; + state->dataSwimmingPools->Pool(1).WaterOutletNode = 2; + state->dataSwimmingPools->Pool(1).HWLoopNum = 1; + state->dataSwimmingPools->Pool(1).HWLoopSide = 1; + state->dataSwimmingPools->Pool(1).HWBranchNum = 1; + state->dataSwimmingPools->Pool(1).HWCompNum = 1; PlantLoop.allocate(TotNumLoops); PlantLoop(1).LoopSide.allocate(2); @@ -228,11 +229,11 @@ TEST_F(EnergyPlusFixture, SwimmingPool_InitSwimmingPoolPlantNodeFlow) // Test 1 PoolNum = 1; - auto &thisPool = state.dataSwimmingPools->Pool(PoolNum); + auto &thisPool = state->dataSwimmingPools->Pool(PoolNum); - state.dataSwimmingPools->Pool(1).WaterMassFlowRate = 0.75; - state.dataSwimmingPools->Pool(1).WaterMassFlowRateMax = 0.75; - state.dataSwimmingPools->Pool(1).WaterVolFlowMax = 0.00075; + state->dataSwimmingPools->Pool(1).WaterMassFlowRate = 0.75; + state->dataSwimmingPools->Pool(1).WaterMassFlowRateMax = 0.75; + state->dataSwimmingPools->Pool(1).WaterVolFlowMax = 0.00075; DataSizing::SaveNumPlantComps = 0; DataSizing::CompDesWaterFlow.deallocate(); DataLoopNode::Node(1).MassFlowRate = 0.0; @@ -244,9 +245,9 @@ TEST_F(EnergyPlusFixture, SwimmingPool_InitSwimmingPoolPlantNodeFlow) // Test 2 PoolNum = 1; - state.dataSwimmingPools->Pool(1).WaterMassFlowRate = 0.5; - state.dataSwimmingPools->Pool(1).WaterMassFlowRateMax = 2.0; - state.dataSwimmingPools->Pool(1).WaterVolFlowMax = 0.002; + state->dataSwimmingPools->Pool(1).WaterMassFlowRate = 0.5; + state->dataSwimmingPools->Pool(1).WaterMassFlowRateMax = 2.0; + state->dataSwimmingPools->Pool(1).WaterVolFlowMax = 0.002; DataSizing::SaveNumPlantComps = 0; DataSizing::CompDesWaterFlow.deallocate(); DataLoopNode::Node(1).MassFlowRate = 0.0; @@ -261,11 +262,11 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) { // Tests for InitSwimmingPoolPlantLoopIndex - state.dataSwimmingPools->clear_state(); - state.dataSwimmingPools->NumSwimmingPools = 1; - state.dataSwimmingPools->Pool.allocate(state.dataSwimmingPools->NumSwimmingPools); + state->dataSwimmingPools->clear_state(); + state->dataSwimmingPools->NumSwimmingPools = 1; + state->dataSwimmingPools->Pool.allocate(state->dataSwimmingPools->NumSwimmingPools); DataSurfaces::Surface.allocate(1); - state.dataConstruction->Construct.allocate(1); + state->dataConstruction->Construct.allocate(1); // testing variables static std::string const Alpha1("FirstString"); @@ -273,13 +274,13 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) static std::string const AlphaField2("cSecondString"); bool ErrFnd; - auto & poolReference = state.dataSwimmingPools->Pool(1); + auto & poolReference = state->dataSwimmingPools->Pool(1); // Test 1: SurfacePtr is zero--this is not allowed and should produce an error ErrFnd = false; poolReference.SurfacePtr = 0; - poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(*state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -288,7 +289,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) poolReference.SurfacePtr = 1; DataSurfaces::Surface(poolReference.SurfacePtr).IsRadSurfOrVentSlabOrPool = true; - poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(*state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -298,7 +299,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).IsRadSurfOrVentSlabOrPool = false; DataSurfaces::Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel_CondFD; - poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(*state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -309,7 +310,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel_CTF; DataSurfaces::Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass::Window; - poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(*state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -321,7 +322,7 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass::Floor; DataSurfaces::Surface(poolReference.SurfacePtr).MaterialMovInsulInt = 1; - poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(*state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -333,9 +334,9 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass::Floor; DataSurfaces::Surface(poolReference.SurfacePtr).MaterialMovInsulInt = 1; DataSurfaces::Surface(poolReference.SurfacePtr).Construction = 1; - state.dataConstruction->Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = true; + state->dataConstruction->Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = true; - poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(*state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -346,9 +347,9 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel_CTF; DataSurfaces::Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass::Wall; DataSurfaces::Surface(poolReference.SurfacePtr).MaterialMovInsulInt = 1; - state.dataConstruction->Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = false; + state->dataConstruction->Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = false; - poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(*state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_TRUE(ErrFnd); @@ -359,13 +360,13 @@ TEST_F(EnergyPlusFixture, SwimmingPool_ErrorCheckSetupPoolSurfaceTest) DataSurfaces::Surface(poolReference.SurfacePtr).HeatTransferAlgorithm = DataSurfaces::HeatTransferModel_CTF; DataSurfaces::Surface(poolReference.SurfacePtr).Class = DataSurfaces::SurfaceClass::Floor; DataSurfaces::Surface(poolReference.SurfacePtr).MaterialMovInsulInt = 0; - state.dataConstruction->Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = false; + state->dataConstruction->Construct(DataSurfaces::Surface(poolReference.SurfacePtr).Construction).SourceSinkPresent = false; DataSurfaces::Surface(poolReference.SurfacePtr).Zone = 7; DataSurfaces::Surface(poolReference.SurfacePtr).IsRadSurfOrVentSlabOrPool = false; DataSurfaces::Surface(poolReference.SurfacePtr).IsPool = false; poolReference.ZonePtr = 0; - poolReference.ErrorCheckSetupPoolSurface(state, Alpha1,Alpha2,AlphaField2,ErrFnd); + poolReference.ErrorCheckSetupPoolSurface(*state, Alpha1,Alpha2,AlphaField2,ErrFnd); EXPECT_FALSE(ErrFnd); EXPECT_TRUE(DataSurfaces::Surface(poolReference.SurfacePtr).IsRadSurfOrVentSlabOrPool); diff --git a/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc b/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc index c60d1f7fd78..611b041f6a6 100644 --- a/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc +++ b/tst/EnergyPlus/unit/SystemAvailabilityManager.unit.cc @@ -69,6 +69,7 @@ #include #include #include +#include using namespace EnergyPlus; @@ -205,69 +206,69 @@ TEST_F(EnergyPlusFixture, SysAvailManager_OptimumStart) DataHeatBalance::ZoneList(1).Zone(3) = 3; DataHVACGlobals::NumPrimaryAirSys = 3; - state.dataAirLoop->PriAirSysAvailMgr.allocate(3); - state.dataAirLoop->PriAirSysAvailMgr(1).NumAvailManagers = 1; - state.dataAirLoop->PriAirSysAvailMgr(2).NumAvailManagers = 1; - state.dataAirLoop->PriAirSysAvailMgr(3).NumAvailManagers = 1; - - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerType.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerName.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerNum.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr(2).AvailManagerType.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr(2).AvailManagerName.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr(2).AvailManagerNum.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr(3).AvailManagerType.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr(3).AvailManagerName.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr(3).AvailManagerNum.allocate(1); - - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerType(1) = 12; // cValidSysAvailManagerTypes( { ......., "AvailabilityManager:OptimumStart" } ); - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerName(1) = "OptStart Availability 1"; - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerNum(1) = 1; - state.dataAirLoop->PriAirSysAvailMgr(2).AvailManagerType(1) = 12; // cValidSysAvailManagerTypes( { ......., "AvailabilityManager:OptimumStart" } ); - state.dataAirLoop->PriAirSysAvailMgr(2).AvailManagerName(1) = "OptStart Availability 2"; - state.dataAirLoop->PriAirSysAvailMgr(2).AvailManagerNum(1) = 2; - state.dataAirLoop->PriAirSysAvailMgr(3).AvailManagerType(1) = 12; // cValidSysAvailManagerTypes( { ......., "AvailabilityManager:OptimumStart" } ); - state.dataAirLoop->PriAirSysAvailMgr(3).AvailManagerName(1) = "OptStart Availability 3"; - state.dataAirLoop->PriAirSysAvailMgr(3).AvailManagerNum(1) = 3; - - - state.dataAirLoop->AirToZoneNodeInfo.allocate(3); - state.dataAirLoop->AirToZoneNodeInfo(1).NumZonesCooled = 3; - state.dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums.allocate(3); - state.dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums(1) = 1; - state.dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums(2) = 2; - state.dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums(3) = 3; - - state.dataAirLoop->AirToZoneNodeInfo(2).NumZonesCooled = 2; - state.dataAirLoop->AirToZoneNodeInfo(2).CoolCtrlZoneNums.allocate(2); - state.dataAirLoop->AirToZoneNodeInfo(2).CoolCtrlZoneNums(1) = 4; - state.dataAirLoop->AirToZoneNodeInfo(2).CoolCtrlZoneNums(2) = 5; - - state.dataAirLoop->AirToZoneNodeInfo(3).NumZonesCooled = 1; - state.dataAirLoop->AirToZoneNodeInfo(3).CoolCtrlZoneNums.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(3).CoolCtrlZoneNums(1) = 6; - - state.dataGlobal->NumOfTimeStepInHour = 6; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 10; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(state); // read schedules + state->dataAirLoop->PriAirSysAvailMgr.allocate(3); + state->dataAirLoop->PriAirSysAvailMgr(1).NumAvailManagers = 1; + state->dataAirLoop->PriAirSysAvailMgr(2).NumAvailManagers = 1; + state->dataAirLoop->PriAirSysAvailMgr(3).NumAvailManagers = 1; + + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerType.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerName.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerNum.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr(2).AvailManagerType.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr(2).AvailManagerName.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr(2).AvailManagerNum.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr(3).AvailManagerType.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr(3).AvailManagerName.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr(3).AvailManagerNum.allocate(1); + + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerType(1) = 12; // cValidSysAvailManagerTypes( { ......., "AvailabilityManager:OptimumStart" } ); + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerName(1) = "OptStart Availability 1"; + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerNum(1) = 1; + state->dataAirLoop->PriAirSysAvailMgr(2).AvailManagerType(1) = 12; // cValidSysAvailManagerTypes( { ......., "AvailabilityManager:OptimumStart" } ); + state->dataAirLoop->PriAirSysAvailMgr(2).AvailManagerName(1) = "OptStart Availability 2"; + state->dataAirLoop->PriAirSysAvailMgr(2).AvailManagerNum(1) = 2; + state->dataAirLoop->PriAirSysAvailMgr(3).AvailManagerType(1) = 12; // cValidSysAvailManagerTypes( { ......., "AvailabilityManager:OptimumStart" } ); + state->dataAirLoop->PriAirSysAvailMgr(3).AvailManagerName(1) = "OptStart Availability 3"; + state->dataAirLoop->PriAirSysAvailMgr(3).AvailManagerNum(1) = 3; + + + state->dataAirLoop->AirToZoneNodeInfo.allocate(3); + state->dataAirLoop->AirToZoneNodeInfo(1).NumZonesCooled = 3; + state->dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums.allocate(3); + state->dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums(1) = 1; + state->dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums(2) = 2; + state->dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums(3) = 3; + + state->dataAirLoop->AirToZoneNodeInfo(2).NumZonesCooled = 2; + state->dataAirLoop->AirToZoneNodeInfo(2).CoolCtrlZoneNums.allocate(2); + state->dataAirLoop->AirToZoneNodeInfo(2).CoolCtrlZoneNums(1) = 4; + state->dataAirLoop->AirToZoneNodeInfo(2).CoolCtrlZoneNums(2) = 5; + + state->dataAirLoop->AirToZoneNodeInfo(3).NumZonesCooled = 1; + state->dataAirLoop->AirToZoneNodeInfo(3).CoolCtrlZoneNums.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(3).CoolCtrlZoneNums(1) = 6; + + state->dataGlobal->NumOfTimeStepInHour = 6; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 10; // must initialize this to get schedules initialized + ScheduleManager::ProcessScheduleInput(*state); // read schedules ScheduleManager::ScheduleInputProcessed = true; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->DayOfSim = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->DayOfSim = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 1; DataEnvironment::DayOfWeekTomorrow = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); DataZoneEquipment::ZoneEquipAvail.allocate(6); - state.dataGlobal->NumOfZones = 6; + state->dataGlobal->NumOfZones = 6; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); DataHeatBalance::Zone(1).Name = "ZONE 1"; DataHeatBalance::Zone(2).Name = "ZONE 2"; DataHeatBalance::Zone(3).Name = "ZONE 3"; @@ -275,7 +276,7 @@ TEST_F(EnergyPlusFixture, SysAvailManager_OptimumStart) DataHeatBalance::Zone(5).Name = "ZONE 5"; DataHeatBalance::Zone(6).Name = "ZONE 6"; - DataZoneEquipment::ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); DataZoneEquipment::ZoneEquipConfig(1).ZoneName = "Zone 1"; DataZoneEquipment::ZoneEquipConfig(1).ActualZoneNum = 1; @@ -323,63 +324,63 @@ TEST_F(EnergyPlusFixture, SysAvailManager_OptimumStart) DataZoneControls::OccRoomTSetPointHeat = 19.0; // all zones use same set point temperature DataZoneControls::OccRoomTSetPointCool = 24.0; - SystemAvailabilityManager::ManageSystemAvailability(state); // 1st time through just gets input + SystemAvailabilityManager::ManageSystemAvailability(*state); // 1st time through just gets input - state.dataGlobal->WarmupFlag = true; - state.dataGlobal->BeginDayFlag = true; // initialize optimum start data to beginning of day data - state.dataGlobal->CurrentTime = 1.0; // set the current time to 1 AM - SystemAvailabilityManager::ManageSystemAvailability(state); - EXPECT_EQ(3, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).ATGWCZoneNumLo); // zone 3 is farthest from heating set point + state->dataGlobal->WarmupFlag = true; + state->dataGlobal->BeginDayFlag = true; // initialize optimum start data to beginning of day data + state->dataGlobal->CurrentTime = 1.0; // set the current time to 1 AM + SystemAvailabilityManager::ManageSystemAvailability(*state); + EXPECT_EQ(3, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).ATGWCZoneNumLo); // zone 3 is farthest from heating set point EXPECT_EQ( - 1, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).ATGWCZoneNumHi); // zone 1 is default for cooling set point when heating load exists - EXPECT_EQ(-3.0, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).TempDiffLo); // zone 3 is 3C below set point - EXPECT_EQ(0.0, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).TempDiffHi); // cooling data did not get set so is 0 - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).AvailStatus); // avail manager should not yet be set + 1, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).ATGWCZoneNumHi); // zone 1 is default for cooling set point when heating load exists + EXPECT_EQ(-3.0, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).TempDiffLo); // zone 3 is 3C below set point + EXPECT_EQ(0.0, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).TempDiffHi); // cooling data did not get set so is 0 + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).AvailStatus); // avail manager should not yet be set EXPECT_EQ(DataHVACGlobals::NoAction, - state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(2).AvailStatus); // avail manager should not be set until 6 AM + state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(2).AvailStatus); // avail manager should not be set until 6 AM - state.dataGlobal->WarmupFlag = false; - state.dataGlobal->BeginDayFlag = false; // start processing temp data to find optimum start time - state.dataGlobal->CurrentTime = 2.0; // set the current time to 2 AM - SystemAvailabilityManager::ManageSystemAvailability(state); + state->dataGlobal->WarmupFlag = false; + state->dataGlobal->BeginDayFlag = false; // start processing temp data to find optimum start time + state->dataGlobal->CurrentTime = 2.0; // set the current time to 2 AM + SystemAvailabilityManager::ManageSystemAvailability(*state); // same data as before since zone temps are unchanged - EXPECT_EQ(3, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).ATGWCZoneNumLo); // zone 3 is farthest from heating set point + EXPECT_EQ(3, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).ATGWCZoneNumLo); // zone 3 is farthest from heating set point EXPECT_EQ( - 1, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).ATGWCZoneNumHi); // zone 1 is default for cooling set point when heating load exists - EXPECT_EQ(-3.0, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).TempDiffLo); // zone 3 is 3C below set point - EXPECT_EQ(0.0, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).TempDiffHi); // cooling data did not get set so is 0 - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).AvailStatus); // avail manager should not yet be set + 1, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).ATGWCZoneNumHi); // zone 1 is default for cooling set point when heating load exists + EXPECT_EQ(-3.0, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).TempDiffLo); // zone 3 is 3C below set point + EXPECT_EQ(0.0, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).TempDiffHi); // cooling data did not get set so is 0 + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).AvailStatus); // avail manager should not yet be set EXPECT_EQ(DataHVACGlobals::NoAction, - state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(2).AvailStatus); // avail manager should not be set until 6 AM + state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(2).AvailStatus); // avail manager should not be set until 6 AM - state.dataGlobal->CurrentTime = 7.0; // set the current time to 7 AM which is past time to pre-start HVAC - SystemAvailabilityManager::ManageSystemAvailability(state); + state->dataGlobal->CurrentTime = 7.0; // set the current time to 7 AM which is past time to pre-start HVAC + SystemAvailabilityManager::ManageSystemAvailability(*state); - EXPECT_EQ(DataHVACGlobals::CycleOn, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).AvailStatus); // avail manager should be set to cycle on - EXPECT_EQ(1.5, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).NumHoursBeforeOccupancy); // 1.5 hours = 3C from SP divided by 2C/hour + EXPECT_EQ(DataHVACGlobals::CycleOn, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).AvailStatus); // avail manager should be set to cycle on + EXPECT_EQ(1.5, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).NumHoursBeforeOccupancy); // 1.5 hours = 3C from SP divided by 2C/hour - EXPECT_EQ(DataHVACGlobals::CycleOn, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(2).AvailStatus); // avail manager should be set at 6 AM + EXPECT_EQ(DataHVACGlobals::CycleOn, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(2).AvailStatus); // avail manager should be set at 6 AM // #8013 - Check that the optimum start is available during the correct times when using a partial hour fan start - state.dataGlobal->CurrentTime = 5.00; // set the current time to 5:00 AM, before max optimum start time - SystemAvailabilityManager::ManageSystemAvailability(state); + state->dataGlobal->CurrentTime = 5.00; // set the current time to 5:00 AM, before max optimum start time + SystemAvailabilityManager::ManageSystemAvailability(*state); EXPECT_FALSE(DataHVACGlobals::OptStartData.OptStartFlag(6)); // avail manager should be set to no action for Zone 6 - state.dataGlobal->CurrentTime = 6.50; // set the current time to 6:30 AM when occupancy begins - SystemAvailabilityManager::ManageSystemAvailability(state); + state->dataGlobal->CurrentTime = 6.50; // set the current time to 6:30 AM when occupancy begins + SystemAvailabilityManager::ManageSystemAvailability(*state); EXPECT_TRUE(DataHVACGlobals::OptStartData.OptStartFlag(6)); // avail manager should be set to cycle on for Zone 6 // Check that the system restores setpoints to unoccupied setpoints and don't use occupied setpoints post-occupancy - ZoneTempPredictorCorrector::GetZoneAirSetPoints(state); - DataHeatBalFanSys::TempControlType.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::TempZoneThermostatSetPoint.allocate(state.dataGlobal->NumOfZones); + ZoneTempPredictorCorrector::GetZoneAirSetPoints(*state); + DataHeatBalFanSys::TempControlType.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::TempZoneThermostatSetPoint.allocate(state->dataGlobal->NumOfZones); - state.dataGlobal->CurrentTime = 19.0; // set the current time to 7 PM which is post-occupancy - SystemAvailabilityManager::ManageSystemAvailability(state); - ZoneTempPredictorCorrector::CalcZoneAirTempSetPoints(state); + state->dataGlobal->CurrentTime = 19.0; // set the current time to 7 PM which is post-occupancy + SystemAvailabilityManager::ManageSystemAvailability(*state); + ZoneTempPredictorCorrector::CalcZoneAirTempSetPoints(*state); - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).AvailStatus); // avail manager should be set to no action + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->OptStartSysAvailMgrData(1).AvailStatus); // avail manager should be set to no action EXPECT_EQ(15.0, DataHeatBalFanSys::ZoneThermostatSetPointLo(1)); // 15.0C is the unoccupied heating setpoint EXPECT_EQ(29.4, DataHeatBalFanSys::ZoneThermostatSetPointHi(1)); // 29.4C is the unoccupied cooling setpoint } @@ -441,137 +442,137 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycle_ZoneOutOfTolerance) TEST_F(EnergyPlusFixture, SysAvailManager_HybridVentilation_OT_CO2Control) { - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData.allocate(1); + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData.allocate(1); DataHVACGlobals::HybridVentSysAvailVentCtrl.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr.allocate(1); DataHeatBalance::Zone.allocate(1); DataHeatBalFanSys::MAT.allocate(1); DataHeatBalance::MRT.allocate(1); DataContaminantBalance::ZoneAirCO2.allocate(1); DataContaminantBalance::ZoneCO2SetPoint.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr.allocate(1); - state.dataSystemAvailabilityManager->SchedSysAvailMgrData.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr.allocate(1); + state->dataSystemAvailabilityManager->SchedSysAvailMgrData.allocate(1); ScheduleManager::Schedule.allocate(1); DataHVACGlobals::ZoneComp.allocate(DataZoneEquipment::NumValidSysAvailZoneComponents); DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempZoneThermostatSetPoint.allocate(1); - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).Name = "HybridControl"; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ActualZoneNum = 1; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).AirLoopNum = 1; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ControlModeSchedPtr = 1; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).UseRainIndicator = false; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MaxWindSpeed = 40.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinOutdoorTemp = 15.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MaxOutdoorTemp = 35.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinOutdoorEnth = 20000.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MaxOutdoorEnth = 30000.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinOutdoorDewPoint = 15.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MaxOutdoorDewPoint = 35.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinOASched = 2; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinOperTime = 10.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinVentTime = 10.0; - - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeVentDuration = 0.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeOperDuration = 0.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).Name = "HybridControl"; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ActualZoneNum = 1; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).AirLoopNum = 1; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ControlModeSchedPtr = 1; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).UseRainIndicator = false; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MaxWindSpeed = 40.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinOutdoorTemp = 15.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MaxOutdoorTemp = 35.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinOutdoorEnth = 20000.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MaxOutdoorEnth = 30000.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinOutdoorDewPoint = 15.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MaxOutdoorDewPoint = 35.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinOASched = 2; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinOperTime = 10.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).MinVentTime = 10.0; + + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeVentDuration = 0.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeOperDuration = 0.0; DataHeatBalance::Zone(1).OutDryBulbTemp = 20.0; DataHeatBalance::Zone(1).WindSpeed = 5.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ControlMode = 5; // 80% acceptance - state.dataThermalComforts->runningAverageASH = 20.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ControlMode = 5; // 80% acceptance + state->dataThermalComforts->runningAverageASH = 20.0; DataHeatBalFanSys::MAT(1) = 23.0; DataHeatBalance::MRT(1) = 27.0; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(1, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Vent open + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(1, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Vent open DataHeatBalFanSys::MAT(1) = 26.0; DataHeatBalance::MRT(1) = 30.0; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(2, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // System operation + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(2, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // System operation - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ControlMode = 6; // 90% acceptance + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ControlMode = 6; // 90% acceptance DataHeatBalFanSys::MAT(1) = 23.0; DataHeatBalance::MRT(1) = 27.0; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(1, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Vent open + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(1, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Vent open DataHeatBalFanSys::MAT(1) = 26.0; DataHeatBalance::MRT(1) = 30.0; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(2, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // System operation + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(2, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // System operation - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ControlMode = 7; // CO2 control with an AirLoop + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ControlMode = 7; // CO2 control with an AirLoop DataContaminantBalance::ZoneAirCO2(1) = 900.0; DataContaminantBalance::ZoneCO2SetPoint(1) = 800.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).HybridVentMgrConnectedToAirLoop = true; - state.dataAirLoop->PriAirSysAvailMgr(1).NumAvailManagers = 1; - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerType.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerName.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerNum.allocate(1); - state.dataAirLoop->PriAirSysAvailMgr(1).AvailStatus = 1; - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerType(1) = 1; // Scheduled - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerName(1) = "Avail 1"; - state.dataAirLoop->PriAirSysAvailMgr(1).AvailManagerNum(1) = 1; - state.dataSystemAvailabilityManager->SchedSysAvailMgrData(1).SchedPtr = 1; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).HybridVentMgrConnectedToAirLoop = true; + state->dataAirLoop->PriAirSysAvailMgr(1).NumAvailManagers = 1; + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerType.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerName.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerNum.allocate(1); + state->dataAirLoop->PriAirSysAvailMgr(1).AvailStatus = 1; + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerType(1) = 1; // Scheduled + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerName(1) = "Avail 1"; + state->dataAirLoop->PriAirSysAvailMgr(1).AvailManagerNum(1) = 1; + state->dataSystemAvailabilityManager->SchedSysAvailMgrData(1).SchedPtr = 1; ScheduleManager::Schedule(1).CurrentValue = 1; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(2, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // System operation + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(2, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // System operation ScheduleManager::Schedule(1).CurrentValue = 0; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(1, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Vent open + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(1, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Vent open DataContaminantBalance::ZoneAirCO2(1) = 500.0; DataContaminantBalance::ZoneCO2SetPoint(1) = 800.0; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(0, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // No action + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(0, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // No action DataHVACGlobals::ZoneComp(1).TotalNumComp = 1; // CO2 control with zone equipment DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs.allocate(1); DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).AvailStatus = 2; DataContaminantBalance::ZoneAirCO2(1) = 900.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).HybridVentMgrConnectedToAirLoop = false; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).SimHybridVentSysAvailMgr = true; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(2, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // System operation + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).HybridVentMgrConnectedToAirLoop = false; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).SimHybridVentSysAvailMgr = true; + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(2, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // System operation DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).AvailStatus = 1; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(1, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Vent open + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(1, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Vent open // time duration test DataHeatBalance::Zone(1).OutDryBulbTemp = 40.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ControlMode = 1; // Temperature control - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl = 1; // Open - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeOperDuration = 5.0; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(1, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // No change - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeOperDuration = 11.0; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(2, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Can change - - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl = 2; // close - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeOperDuration = 0.0; - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeVentDuration = 5.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).ControlMode = 1; // Temperature control + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl = 1; // Open + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeOperDuration = 5.0; + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(1, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // No change + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeOperDuration = 11.0; + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(2, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Can change + + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl = 2; // close + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeOperDuration = 0.0; + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeVentDuration = 5.0; DataHeatBalance::Zone(1).OutDryBulbTemp = 20.0; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(2, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // No change - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeVentDuration = 11.0; + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(2, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // No change + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).TimeVentDuration = 11.0; DataHeatBalFanSys::TempControlType(1) = 1; DataHeatBalFanSys::TempZoneThermostatSetPoint(1) = 25.0; - SystemAvailabilityManager::CalcHybridVentSysAvailMgr(state, 1, 1); - EXPECT_EQ(1, state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Can change + SystemAvailabilityManager::CalcHybridVentSysAvailMgr(*state, 1, 1); + EXPECT_EQ(1, state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData(1).VentilationCtrl); // Can change - state.dataSystemAvailabilityManager->HybridVentSysAvailMgrData.deallocate(); + state->dataSystemAvailabilityManager->HybridVentSysAvailMgrData.deallocate(); DataHVACGlobals::HybridVentSysAvailVentCtrl.deallocate(); - state.dataAirLoop->PriAirSysAvailMgr.deallocate(); + state->dataAirLoop->PriAirSysAvailMgr.deallocate(); DataHeatBalance::Zone.deallocate(); DataHeatBalFanSys::MAT.deallocate(); DataHeatBalance::MRT.deallocate(); DataContaminantBalance::ZoneAirCO2.deallocate(); DataContaminantBalance::ZoneCO2SetPoint.deallocate(); - state.dataAirLoop->PriAirSysAvailMgr.deallocate(); - state.dataSystemAvailabilityManager->SchedSysAvailMgrData.deallocate(); + state->dataAirLoop->PriAirSysAvailMgr.deallocate(); + state->dataSystemAvailabilityManager->SchedSysAvailMgrData.deallocate(); ScheduleManager::Schedule.deallocate(); DataHVACGlobals::ZoneComp.deallocate(); DataHeatBalFanSys::TempControlType.deallocate(); @@ -629,17 +630,17 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleGetInput) ASSERT_TRUE(process_idf(idf_objects)); - 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 + 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 ScheduleManager::ScheduleInputProcessed = true; // get system availability schedule - SystemAvailabilityManager::GetSysAvailManagerInputs(state); + SystemAvailabilityManager::GetSysAvailManagerInputs(*state); // check the three cycling run time control types - EXPECT_EQ(3, state.dataSystemAvailabilityManager->NumNCycSysAvailMgrs); - EXPECT_EQ(state.dataSystemAvailabilityManager->FixedRunTime, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType); - EXPECT_EQ(state.dataSystemAvailabilityManager->Thermostat, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(2).CycRunTimeCntrlType); - EXPECT_EQ(state.dataSystemAvailabilityManager->ThermostatWithMinimumRunTime, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(3).CycRunTimeCntrlType); + EXPECT_EQ(3, state->dataSystemAvailabilityManager->NumNCycSysAvailMgrs); + EXPECT_EQ(state->dataSystemAvailabilityManager->FixedRunTime, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType); + EXPECT_EQ(state->dataSystemAvailabilityManager->Thermostat, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(2).CycRunTimeCntrlType); + EXPECT_EQ(state->dataSystemAvailabilityManager->ThermostatWithMinimumRunTime, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(3).CycRunTimeCntrlType); } TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleZone_CalcNCycSysAvailMgr) @@ -651,7 +652,7 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleZone_CalcNCycSysAvailMgr) int const ZoneEquipType = 1; int const CompNum = 1; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataHeatBalance::Zone.allocate(NumZones); DataHeatBalance::Zone(1).Name = "SPACE1-1"; DataHVACGlobals::ZoneComp.allocate(1); @@ -666,108 +667,108 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleZone_CalcNCycSysAvailMgr) DataHeatBalFanSys::TempZoneThermostatSetPoint(1) = 25.0; DataHeatBalFanSys::TempTstatAir(1) = 25.1; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData.allocate(NumZones); - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).Name = "System Avail"; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlType = state.dataSystemAvailabilityManager->CycleOnAny; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).SchedPtr = 1; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).FanSchedPtr = 2; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).TempTolRange = 0.4; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CyclingTimeSteps = 4; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZoneListName = DataHeatBalance::Zone(1).Name; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).NumOfCtrlZones = NumZones; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZonePtrs.allocate(1); - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZonePtrs(1) = 1; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CoolingZoneListName = DataHeatBalance::Zone(1).Name; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).NumOfCoolingZones = NumZones; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CoolingZonePtrs = NumZones; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData.allocate(NumZones); + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).Name = "System Avail"; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlType = state->dataSystemAvailabilityManager->CycleOnAny; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).SchedPtr = 1; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).FanSchedPtr = 2; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).TempTolRange = 0.4; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CyclingTimeSteps = 4; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZoneListName = DataHeatBalance::Zone(1).Name; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).NumOfCtrlZones = NumZones; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZonePtrs.allocate(1); + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZonePtrs(1) = 1; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CoolingZoneListName = DataHeatBalance::Zone(1).Name; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).NumOfCoolingZones = NumZones; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CoolingZonePtrs = NumZones; ScheduleManager::Schedule.allocate(2); ScheduleManager::Schedule(1).CurrentValue = 1; ScheduleManager::Schedule(2).CurrentValue = 0; // Cycling Run Time Control Type = FixedRunTime // and current time is within the run time period, starting time is less than stopping time - state.dataGlobal->SimTimeSteps = 0; + state->dataGlobal->SimTimeSteps = 0; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StartTime = 0.0; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state.dataSystemAvailabilityManager->FixedRunTime; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state->dataSystemAvailabilityManager->FixedRunTime; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); // check that the system is cycling On - EXPECT_EQ(DataHVACGlobals::CycleOn, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::CycleOn, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // starting time is equal to stopping time - state.dataGlobal->SimTimeSteps = 4; + state->dataGlobal->SimTimeSteps = 4; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StartTime = 4.0; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); // check that the system is no action mode - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Cycling Run Time Control Type = Thermostat, Run Time has no effect // starting time is less than stopping time, control is driven by temp differential - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlType = state.dataSystemAvailabilityManager->CycleOnControlZone; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state.dataSystemAvailabilityManager->Thermostat; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; - state.dataGlobal->SimTimeSteps = 0; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlType = state->dataSystemAvailabilityManager->CycleOnControlZone; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state->dataSystemAvailabilityManager->Thermostat; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; + state->dataGlobal->SimTimeSteps = 0; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StartTime = 0.0; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StopTime = 4.0; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); // check that the system is cycling On, 25.1 > 25.0 + 0.05 - EXPECT_EQ(DataHVACGlobals::CycleOn, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::CycleOn, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Cycling Run Time Control Type = Thermostat, Run Time has no effect // starting time and stopping time are the same, control is driven by temp differential - state.dataGlobal->SimTimeSteps = 4; + state->dataGlobal->SimTimeSteps = 4; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StartTime = 4.0; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; // the unit still cycles on because of high zone air temp DataHeatBalFanSys::TempTstatAir(1) = 25.1; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); // Check that the system is cycling On, run time has no effect, // 25.1 > 25.0 + 0.05 - EXPECT_EQ(DataHVACGlobals::CycleOn, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::CycleOn, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Cycling Run Time Control Type = Thermostat, Run Time has no effect // Reduce zone air temperature, control is driven by temp differential - state.dataGlobal->SimTimeSteps = 4; + state->dataGlobal->SimTimeSteps = 4; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StartTime = 4.0; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; // Reduce zone air temperature within the tolerance (0.05) to turn off night cycling DataHeatBalFanSys::TempTstatAir(1) = 25.04; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); // Check that the system is no action mode, 25.04 < 25.0 + 0.05 - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Cycling Run Time Control Type = ThermostatWithMinimumRunTime and // current time is the end of run time period - state.dataGlobal->SimTimeSteps = 4; + state->dataGlobal->SimTimeSteps = 4; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StartTime = 4.0; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state.dataSystemAvailabilityManager->ThermostatWithMinimumRunTime; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state->dataSystemAvailabilityManager->ThermostatWithMinimumRunTime; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; DataHeatBalFanSys::TempTstatAir(1) = 25.1; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); // check that the system is cycling On, zone air temp is outside T tolerance limits of 0.05, 25.1 > 25.0 + 0.05 - EXPECT_EQ(DataHVACGlobals::CycleOn, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::CycleOn, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Cycling Run Time Control Type = ThermostatWithMinimumRunTime and // current time is the end of run time period - state.dataGlobal->SimTimeSteps = 4; + state->dataGlobal->SimTimeSteps = 4; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StartTime = 4.0; DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; // Reduce zone air temperature within the tolerance (0.05) to turn off night cycling DataHeatBalFanSys::TempTstatAir(1) = 25.04; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); // check that the system is no action mode, zone air temp is outside T tolerance limits of 0.05, 25.04 < 25.0 + 0.05 - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Test cycle time reset at beginning of day during warmup - state.dataGlobal->WarmupFlag = true; - state.dataGlobal->BeginDayFlag = true; - state.dataGlobal->SimTimeSteps = 96; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); - EXPECT_EQ(state.dataGlobal->SimTimeSteps, DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StartTime); - EXPECT_EQ(state.dataGlobal->SimTimeSteps, DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StopTime); + state->dataGlobal->WarmupFlag = true; + state->dataGlobal->BeginDayFlag = true; + state->dataGlobal->SimTimeSteps = 96; + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus, ZoneEquipType, CompNum); + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(state->dataGlobal->SimTimeSteps, DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StartTime); + EXPECT_EQ(state->dataGlobal->SimTimeSteps, DataHVACGlobals::ZoneComp(1).ZoneCompAvailMgrs(1).StopTime); } TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleSys_CalcNCycSysAvailMgr) @@ -777,9 +778,9 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleSys_CalcNCycSysAvailMgr) int PriAirSysNum = 1; int AvailStatus; - state.dataGlobal->NumOfZones = 1; - state.dataAirLoop->PriAirSysAvailMgr.allocate(PriAirSysNum); - state.dataSystemAvailabilityManager->NCycSysAvailMgrData.allocate(NumZones); + state->dataGlobal->NumOfZones = 1; + state->dataAirLoop->PriAirSysAvailMgr.allocate(PriAirSysNum); + state->dataSystemAvailabilityManager->NCycSysAvailMgrData.allocate(NumZones); DataHeatBalFanSys::TempControlType.allocate(NumZones); DataHeatBalFanSys::TempTstatAir.allocate(NumZones); DataHeatBalFanSys::TempZoneThermostatSetPoint.allocate(NumZones); @@ -789,119 +790,119 @@ TEST_F(EnergyPlusFixture, SysAvailManager_NightCycleSys_CalcNCycSysAvailMgr) DataHeatBalance::Zone.allocate(NumZones); DataHeatBalance::Zone(1).Name = "SPACE1-1"; - state.dataAirLoop->AirToZoneNodeInfo.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(1).NumZonesCooled = 1; - state.dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums.allocate(1); - state.dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums(1) = 1; - DataZoneEquipment::ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); + state->dataAirLoop->AirToZoneNodeInfo.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(1).NumZonesCooled = 1; + state->dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums.allocate(1); + state->dataAirLoop->AirToZoneNodeInfo(1).CoolCtrlZoneNums(1) = 1; + DataZoneEquipment::ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); DataZoneEquipment::ZoneEquipConfig(1).ZoneName = "SPACE1-1"; DataZoneEquipment::ZoneEquipConfig(1).ActualZoneNum = 1; DataZoneEquipment::ZoneEquipConfig(1).ZoneNode = 1; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).Name = "System Avail"; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlType = state.dataSystemAvailabilityManager->CycleOnAny; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).SchedPtr = 1; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).FanSchedPtr = 2; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).TempTolRange = 0.4; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CyclingTimeSteps = 4; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZoneListName = DataHeatBalance::Zone(1).Name; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).NumOfCtrlZones = NumZones; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZonePtrs.allocate(1); - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZonePtrs(1) = 1; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CoolingZoneListName = DataHeatBalance::Zone(1).Name; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).NumOfCoolingZones = NumZones; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CoolingZonePtrs = NumZones; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).Name = "System Avail"; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlType = state->dataSystemAvailabilityManager->CycleOnAny; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).SchedPtr = 1; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).FanSchedPtr = 2; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).TempTolRange = 0.4; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CyclingTimeSteps = 4; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZoneListName = DataHeatBalance::Zone(1).Name; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).NumOfCtrlZones = NumZones; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZonePtrs.allocate(1); + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlZonePtrs(1) = 1; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CoolingZoneListName = DataHeatBalance::Zone(1).Name; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).NumOfCoolingZones = NumZones; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CoolingZonePtrs = NumZones; ScheduleManager::Schedule.allocate(2); ScheduleManager::Schedule(1).CurrentValue = 1; ScheduleManager::Schedule(2).CurrentValue = 0; // Cycling Run Time Control Type = FixedRunTime // and current time is within the run time period, starting time is less than stopping time - state.dataGlobal->SimTimeSteps = 0; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 0.0; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state.dataSystemAvailabilityManager->FixedRunTime; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).PriorAvailStatus = 2; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus); + state->dataGlobal->SimTimeSteps = 0; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 0.0; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state->dataSystemAvailabilityManager->FixedRunTime; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).PriorAvailStatus = 2; + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus); // Check that the system is cycling On - EXPECT_EQ(DataHVACGlobals::CycleOn, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::CycleOn, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Starting time is equal to stopping time - state.dataGlobal->SimTimeSteps = 4; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 4.0; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state.dataSystemAvailabilityManager->FixedRunTime; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus); + state->dataGlobal->SimTimeSteps = 4; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 4.0; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state->dataSystemAvailabilityManager->FixedRunTime; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus); // Check that the system is no action mode because of run time limit - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Cycling Run Time Control Type = Thermostat, Run Time has no effect // starting time is less than stopping time, control is driven by temp differential - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlType = state.dataSystemAvailabilityManager->CycleOnControlZone; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state.dataSystemAvailabilityManager->Thermostat; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; - state.dataGlobal->SimTimeSteps = 0; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 0.0; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus); + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CtrlType = state->dataSystemAvailabilityManager->CycleOnControlZone; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state->dataSystemAvailabilityManager->Thermostat; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; + state->dataGlobal->SimTimeSteps = 0; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 0.0; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus); // Check that the system is cycling On, 25.1 > 25.0 + 0.05 - EXPECT_EQ(DataHVACGlobals::CycleOn, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::CycleOn, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Cycling Run Time Control Type = Thermostat, Run Time has no effect // starting time and stopping time are the same, control is driven by temp differential - state.dataGlobal->SimTimeSteps = 4; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 4.0; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; + state->dataGlobal->SimTimeSteps = 4; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 4.0; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; // reduce zone air temperature within the tolerance (0.05) to turn off night cycling DataHeatBalFanSys::TempTstatAir(1) = 25.1; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus); // Check that the system is cycling On, run time has no effect, // 25.1 > 25.0 + 0.05 - EXPECT_EQ(DataHVACGlobals::CycleOn, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::CycleOn, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Cycling Run Time Control Type = Thermostat, Run Time has no effect // starting time and stopping time are the same, control is driven by temp differential - state.dataGlobal->SimTimeSteps = 4; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 4.0; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; + state->dataGlobal->SimTimeSteps = 4; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 4.0; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; // Reduce zone air temperature within the tolerance (0.05) to turn off night cycling DataHeatBalFanSys::TempTstatAir(1) = 25.04; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus); // Check that the system is no action mode, 25.04 < 25.0 + 0.05 - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Cycling Run Time Control Type = ThermostatWithMinimumRunTime and // starting time and stopping time are the same, control is driven by temp differential - state.dataGlobal->SimTimeSteps = 4; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 4.0; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state.dataSystemAvailabilityManager->ThermostatWithMinimumRunTime; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; + state->dataGlobal->SimTimeSteps = 4; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 4.0; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).CycRunTimeCntrlType = state->dataSystemAvailabilityManager->ThermostatWithMinimumRunTime; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 0; DataHeatBalFanSys::TempTstatAir(1) = 25.1; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus); // Check that the system is cycling On, zone air temp is outside T tolerance limits of 0.05, 25.1 > 25.0 + 0.05 - EXPECT_EQ(DataHVACGlobals::CycleOn, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::CycleOn, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Cycling Run Time Control Type = ThermostatWithMinimumRunTime and // starting time and stopping time are the same, control is driven by temp differential - state.dataGlobal->SimTimeSteps = 4; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 4.0; - state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; - state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; + state->dataGlobal->SimTimeSteps = 4; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime = 4.0; + state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime = 4.0; + state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus = 2; // Reduce zone air temperature within the tolerance (0.05) to turn off night cycling DataHeatBalFanSys::TempTstatAir(1) = 25.04; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus); + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus); // Check that the system is no action mode, zone air temp is within T tolerance limits of 0.05, 25.04 < 25.0 + 0.05 - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); // Test cycle time reset at beginning of day during warmup - state.dataGlobal->WarmupFlag = true; - state.dataGlobal->BeginDayFlag = true; - state.dataGlobal->SimTimeSteps = 96; - SystemAvailabilityManager::CalcNCycSysAvailMgr(state, SysAvailNum, PriAirSysNum, AvailStatus); - EXPECT_EQ(DataHVACGlobals::NoAction, state.dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); - EXPECT_EQ(state.dataGlobal->SimTimeSteps, state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime); - EXPECT_EQ(state.dataGlobal->SimTimeSteps, state.dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime); + state->dataGlobal->WarmupFlag = true; + state->dataGlobal->BeginDayFlag = true; + state->dataGlobal->SimTimeSteps = 96; + SystemAvailabilityManager::CalcNCycSysAvailMgr(*state, SysAvailNum, PriAirSysNum, AvailStatus); + EXPECT_EQ(DataHVACGlobals::NoAction, state->dataSystemAvailabilityManager->NCycSysAvailMgrData(1).AvailStatus); + EXPECT_EQ(state->dataGlobal->SimTimeSteps, state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StartTime); + EXPECT_EQ(state->dataGlobal->SimTimeSteps, state->dataAirLoop->PriAirSysAvailMgr(PriAirSysNum).StopTime); } diff --git a/tst/EnergyPlus/unit/SystemReports.unit.cc b/tst/EnergyPlus/unit/SystemReports.unit.cc index 28256cd79d9..46cab715f89 100644 --- a/tst/EnergyPlus/unit/SystemReports.unit.cc +++ b/tst/EnergyPlus/unit/SystemReports.unit.cc @@ -51,6 +51,8 @@ #include // EnergyPlus Headers +#include +#include #include #include #include @@ -71,7 +73,7 @@ namespace EnergyPlus { TEST_F(EnergyPlusFixture, SeparateGasOutputVariables) { DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); DataLoopNode::Node.allocate(2); bool CompLoadFlag(false); @@ -81,31 +83,31 @@ TEST_F(EnergyPlusFixture, SeparateGasOutputVariables) Real64 CompLoad(150.0); Real64 CompEnergyUse(100.0); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 2; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumOut = 1; - - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(2); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "Main Gas Humidifier"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "HUMIDIFIER:STEAM:GAS"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).NodeNumIn = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).NodeNumOut = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).NumMeteredVars = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).EndUse_CompMode = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).CurMeterReading = 100.0; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).ResourceType = AssignResourceTypeNum("NaturalGas"); - - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).Name = "Main Gas Heating Coil"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).TypeOf = "COIL:HEATING:DESUPERHEATER"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).NodeNumIn = 2; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).NodeNumOut = 2; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).NumMeteredVars = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).EndUse_CompMode = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).CurMeterReading = 100.0; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).ResourceType = AssignResourceTypeNum("NaturalGas"); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 2; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).NodeNumOut = 1; + + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(2); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "Main Gas Humidifier"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "HUMIDIFIER:STEAM:GAS"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).NodeNumIn = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).NodeNumOut = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).NumMeteredVars = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).EndUse_CompMode = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).CurMeterReading = 100.0; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).ResourceType = AssignResourceTypeNum("NaturalGas"); + + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).Name = "Main Gas Heating Coil"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).TypeOf = "COIL:HEATING:DESUPERHEATER"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).NodeNumIn = 2; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).NodeNumOut = 2; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).NumMeteredVars = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).EndUse_CompMode = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).CurMeterReading = 100.0; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).ResourceType = AssignResourceTypeNum("NaturalGas"); DataLoopNode::Node(1).MassFlowRate = 1.0; DataLoopNode::Node(2).MassFlowRate = 1.0; @@ -123,21 +125,21 @@ TEST_F(EnergyPlusFixture, SeparateGasOutputVariables) //Calculate SysHumidNaturalGas ("Air System Humidifier NaturalGas Energy" Output Variable) CalcSystemEnergyUse( - state, + *state, CompLoadFlag, AirLoopNum, - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf, - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).ResourceType, + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf, + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).ResourceType, CompLoad, CompEnergyUse); // Calculate SysHCCompNaturalGas ("Air System Heating Coil NaturalGas Energy" Output Variable) CalcSystemEnergyUse( - state, + *state, CompLoadFlag, AirLoopNum, - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).TypeOf, - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).ResourceType, + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).TypeOf, + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).ResourceType, CompLoad, CompEnergyUse); @@ -175,7 +177,7 @@ TEST_F(EnergyPlusFixture, SeparateGasOutputVariables) SysHCCompH2OHOT.allocate(1); // Calculate SysTotNaturalGas ("Air System NaturalGas Energy") - ReportSystemEnergyUse(state); + ReportSystemEnergyUse(*state); EXPECT_EQ(SysTotNaturalGas(1), 200); // Initialization for propane cases @@ -183,24 +185,24 @@ TEST_F(EnergyPlusFixture, SeparateGasOutputVariables) SysHCCompNaturalGas(1) = 0; SysTotNaturalGas(1) = 0; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).ResourceType = AssignResourceTypeNum("Propane"); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).ResourceType = AssignResourceTypeNum("Propane"); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).ResourceType = AssignResourceTypeNum("Propane"); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).ResourceType = AssignResourceTypeNum("Propane"); // Calculate SysHumidPropane ("Air System Humidifier Propane Energy" Output Variable) - CalcSystemEnergyUse(state, + CalcSystemEnergyUse(*state, CompLoadFlag, AirLoopNum, - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf, - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).ResourceType, + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf, + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).MeteredVar(1).ResourceType, CompLoad, CompEnergyUse); // Calculate SysHCCompPropane ("Air System Heating Coil Propane Energy" Output Variable) - CalcSystemEnergyUse(state, + CalcSystemEnergyUse(*state, CompLoadFlag, AirLoopNum, - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).TypeOf, - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).ResourceType, + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).TypeOf, + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(2).MeteredVar(1).ResourceType, CompLoad, CompEnergyUse); @@ -208,7 +210,7 @@ TEST_F(EnergyPlusFixture, SeparateGasOutputVariables) EXPECT_EQ(SysHCCompPropane(1), 100); // Calculate SysTotPropane ("Air System Propane Energy") - ReportSystemEnergyUse(state); + ReportSystemEnergyUse(*state); EXPECT_EQ(SysTotPropane(1), 200); } } // namespace EnergyPlus diff --git a/tst/EnergyPlus/unit/ThermalChimney.unit.cc b/tst/EnergyPlus/unit/ThermalChimney.unit.cc index 8149c5aaa5d..47fac9c0259 100644 --- a/tst/EnergyPlus/unit/ThermalChimney.unit.cc +++ b/tst/EnergyPlus/unit/ThermalChimney.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include "Fixtures/EnergyPlusFixture.hh" #include #include @@ -1094,24 +1095,24 @@ TEST_F(EnergyPlusFixture, ThermalChimney_EMSAirflow_Test) bool localErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(state, localErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); - HeatBalanceManager::GetZoneData(state, localErrorsFound); + HeatBalanceManager::GetZoneData(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(state, localErrorsFound); + HeatBalanceManager::GetWindowGlassSpectralData(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); - HeatBalanceManager::GetMaterialData(state, localErrorsFound); + HeatBalanceManager::GetMaterialData(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); - HeatBalanceManager::GetConstructData(state, localErrorsFound); + HeatBalanceManager::GetConstructData(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, localErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, localErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::GetSurfaceData(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); - ScheduleManager::ProcessScheduleInput(state); + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; DataHeatBalance::Zone(2).HasWindow = true; @@ -1128,27 +1129,27 @@ TEST_F(EnergyPlusFixture, ThermalChimney_EMSAirflow_Test) DataHeatBalSurface::TempSurfIn(surfNum) = 26.99; surfNum = UtilityRoutines::FindItemInList("ZN004:WALL001:WIN001", DataSurfaces::Surface); DataHeatBalSurface::TempSurfIn(surfNum) = 22.99; - DataHeatBalFanSys::MAT.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneAirHumRat.allocate(state.dataGlobal->NumOfZones); + DataHeatBalFanSys::MAT.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneAirHumRat.allocate(state->dataGlobal->NumOfZones); DataHeatBalFanSys::MAT = 23.0; DataHeatBalFanSys::ZoneAirHumRat = 0.01; DataEnvironment::OutBaroPress = 101325.0; - StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); - DataHeatBalFanSys::MCPThermChim.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ThermChimAMFL.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MCPTThermChim.allocate(state.dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPThermChim.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ThermChimAMFL.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPTThermChim.allocate(state->dataGlobal->NumOfZones); ScheduleManager::Schedule(1).CurrentValue = 1.0; - DataHeatBalance::ZnAirRpt.allocate(state.dataGlobal->NumOfZones); + DataHeatBalance::ZnAirRpt.allocate(state->dataGlobal->NumOfZones); // No EMS - ThermalChimney::GetThermalChimney(state, localErrorsFound); + ThermalChimney::GetThermalChimney(*state, localErrorsFound); EXPECT_FALSE(localErrorsFound); - ThermalChimney::CalcThermalChimney(state); - EXPECT_NEAR(state.dataThermalChimneys->ThermalChimneyReport(1).OverallTCVolumeFlow, 0.015668, 0.0001); + ThermalChimney::CalcThermalChimney(*state); + EXPECT_NEAR(state->dataThermalChimneys->ThermalChimneyReport(1).OverallTCVolumeFlow, 0.015668, 0.0001); // EMS Override - state.dataThermalChimneys->ThermalChimneySys(1).EMSOverrideOn = true; - state.dataThermalChimneys->ThermalChimneySys(1).EMSAirFlowRateValue = 0.01; - ThermalChimney::CalcThermalChimney(state); - EXPECT_NEAR(state.dataThermalChimneys->ThermalChimneyReport(1).OverallTCVolumeFlow, 0.01, 0.0001); + state->dataThermalChimneys->ThermalChimneySys(1).EMSOverrideOn = true; + state->dataThermalChimneys->ThermalChimneySys(1).EMSAirFlowRateValue = 0.01; + ThermalChimney::CalcThermalChimney(*state); + EXPECT_NEAR(state->dataThermalChimneys->ThermalChimneyReport(1).OverallTCVolumeFlow, 0.01, 0.0001); } diff --git a/tst/EnergyPlus/unit/ThermalComfort.unit.cc b/tst/EnergyPlus/unit/ThermalComfort.unit.cc index 4d56ebd232c..48212e2bbeb 100644 --- a/tst/EnergyPlus/unit/ThermalComfort.unit.cc +++ b/tst/EnergyPlus/unit/ThermalComfort.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -84,19 +85,19 @@ using DataZoneEnergyDemands::ZoneSysEnergyDemand; TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) { - state.dataGlobal->NumOfZones = 1; - ZoneSysEnergyDemand.allocate(state.dataGlobal->NumOfZones); - state.dataThermalComforts->ThermalComfortSetPoint.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + ZoneSysEnergyDemand.allocate(state->dataGlobal->NumOfZones); + state->dataThermalComforts->ThermalComfortSetPoint.allocate(state->dataGlobal->NumOfZones); TempControlType.allocate(1); - AirModel.allocate(state.dataGlobal->NumOfZones); + AirModel.allocate(state->dataGlobal->NumOfZones); AirModel(1).AirModelType = RoomAirModel_Mixing; - ZTAV.allocate(state.dataGlobal->NumOfZones); - ZoneThermostatSetPointLo.allocate(state.dataGlobal->NumOfZones); - ZoneThermostatSetPointHi.allocate(state.dataGlobal->NumOfZones); - state.dataGlobal->TimeStepZone = 0.25; - state.dataThermalComforts->ThermalComfortInASH55.allocate(state.dataGlobal->NumOfZones); - state.dataThermalComforts->ThermalComfortInASH55(1).ZoneIsOccupied = true; - Zone.allocate(state.dataGlobal->NumOfZones); + ZTAV.allocate(state->dataGlobal->NumOfZones); + ZoneThermostatSetPointLo.allocate(state->dataGlobal->NumOfZones); + ZoneThermostatSetPointHi.allocate(state->dataGlobal->NumOfZones); + state->dataGlobal->TimeStepZone = 0.25; + state->dataThermalComforts->ThermalComfortInASH55.allocate(state->dataGlobal->NumOfZones); + state->dataThermalComforts->ThermalComfortInASH55(1).ZoneIsOccupied = true; + Zone.allocate(state->dataGlobal->NumOfZones); // SingleHeatingSetPoint thermostat @@ -106,21 +107,21 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) ZTAV(1) = 21.1; // 70F ZoneThermostatSetPointLo(1) = 22.2; // 72F ZoneSysEnergyDemand(1).TotalOutputRequired = 500.0; // must be greater than zero - CalcIfSetPointMet(state); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); + CalcIfSetPointMet(*state); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); // cooling ZTAV(1) = 25.0; // 77F ZoneThermostatSetPointHi(1) = 23.9; // 75F ZoneSysEnergyDemand(1).TotalOutputRequired = -500.0; // must be less than zero - CalcIfSetPointMet(state); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); + CalcIfSetPointMet(*state); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); // SingleCoolingSetPoint thermostat @@ -130,21 +131,21 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) ZTAV(1) = 21.1; // 70F ZoneThermostatSetPointLo(1) = 22.2; // 72F ZoneSysEnergyDemand(1).TotalOutputRequired = 500.0; // must be greater than zero - CalcIfSetPointMet(state); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); + CalcIfSetPointMet(*state); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); // cooling ZTAV(1) = 25.0; // 77F ZoneThermostatSetPointHi(1) = 23.9; // 75F ZoneSysEnergyDemand(1).TotalOutputRequired = -500.0; // must be less than zero - CalcIfSetPointMet(state); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); + CalcIfSetPointMet(*state); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); // SingleHeatCoolSetPoint thermostat @@ -154,21 +155,21 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) ZTAV(1) = 21.1; // 70F ZoneThermostatSetPointLo(1) = 22.2; // 72F ZoneSysEnergyDemand(1).TotalOutputRequired = 500.0; // must be greater than zero - CalcIfSetPointMet(state); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); + CalcIfSetPointMet(*state); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); // cooling ZTAV(1) = 25.0; // 77F ZoneThermostatSetPointHi(1) = 23.9; // 75F ZoneSysEnergyDemand(1).TotalOutputRequired = -500.0; // must be less than zero - CalcIfSetPointMet(state); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); + CalcIfSetPointMet(*state); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); // DualSetPointWithDeadBand thermostat @@ -178,21 +179,21 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetTest1) ZTAV(1) = 21.1; // 70F ZoneThermostatSetPointLo(1) = 22.2; // 72F ZoneSysEnergyDemand(1).TotalOutputRequired = 500.0; // must be greater than zero - CalcIfSetPointMet(state); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); + CalcIfSetPointMet(*state); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); // cooling ZTAV(1) = 25.0; // 77F ZoneThermostatSetPointHi(1) = 23.9; // 75F ZoneSysEnergyDemand(1).TotalOutputRequired = -500.0; // must be less than zero - CalcIfSetPointMet(state); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); + CalcIfSetPointMet(*state); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); } TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger) @@ -702,9 +703,9 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - state.dataGlobal->DDOnlySimulation = true; + state->dataGlobal->DDOnlySimulation = true; - ManageSimulation(state); + ManageSimulation(*state); // compare_err_stream( "" ); @@ -712,37 +713,37 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortFanger) MRT(1) = 26.0; ZoneAirHumRatAvgComf(1) = 0.00529; // 0.002 to 0.006 - CalcThermalComfortFanger(state); + CalcThermalComfortFanger(*state); - EXPECT_NEAR(state.dataThermalComforts->ThermalComfortData(1).FangerPMV, -1.262, 0.005); - EXPECT_NEAR(state.dataThermalComforts->ThermalComfortData(1).FangerPPD, 38.3, 0.1); + EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).FangerPMV, -1.262, 0.005); + EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).FangerPPD, 38.3, 0.1); ZTAVComf(1) = 26.0; MRT(1) = 27.0; ZoneAirHumRatAvgComf(1) = 0.00529; // 0.002 to 0.006 - CalcThermalComfortFanger(state); + CalcThermalComfortFanger(*state); - EXPECT_NEAR(state.dataThermalComforts->ThermalComfortData(1).FangerPMV, -0.860, 0.005); - EXPECT_NEAR(state.dataThermalComforts->ThermalComfortData(1).FangerPPD, 20.6, 0.1); + EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).FangerPMV, -0.860, 0.005); + EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).FangerPPD, 20.6, 0.1); ZTAVComf(1) = 27.0; MRT(1) = 28.0; ZoneAirHumRatAvgComf(1) = 0.00529; // 0.002 to 0.006 - CalcThermalComfortFanger(state); + CalcThermalComfortFanger(*state); - EXPECT_NEAR(state.dataThermalComforts->ThermalComfortData(1).FangerPMV, -0.460, 0.005); - EXPECT_NEAR(state.dataThermalComforts->ThermalComfortData(1).FangerPPD, 9.4, 0.1); + EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).FangerPMV, -0.460, 0.005); + EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).FangerPPD, 9.4, 0.1); ZTAVComf(1) = 25.0; MRT(1) = 26.0; ZoneAirHumRatAvgComf(1) = 0.00629; // 0.002 to 0.006 - CalcThermalComfortFanger(state); + CalcThermalComfortFanger(*state); - EXPECT_NEAR(state.dataThermalComforts->ThermalComfortData(1).FangerPMV, -1.201, 0.005); - EXPECT_NEAR(state.dataThermalComforts->ThermalComfortData(1).FangerPPD, 35.3, 0.1); + EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).FangerPMV, -1.201, 0.005); + EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).FangerPPD, 35.3, 0.1); } TEST_F(EnergyPlusFixture, ThermalComfort_CalcSurfaceWeightedMRT) @@ -755,12 +756,12 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcSurfaceWeightedMRT) TH.deallocate(); Surface.deallocate(); Zone.deallocate(); - state.dataThermalComforts->AngleFactorList.allocate(1); + state->dataThermalComforts->AngleFactorList.allocate(1); TotSurfaces = 3; - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; TH.allocate(2, 2, TotSurfaces); Surface.allocate(TotSurfaces); - state.dataConstruction->Construct.allocate(TotSurfaces); + state->dataConstruction->Construct.allocate(TotSurfaces); Zone.allocate(1); Surface(1).Area = 20.0; @@ -772,9 +773,9 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcSurfaceWeightedMRT) Surface(1).Construction = 1; Surface(2).Construction = 2; Surface(3).Construction = 3; - state.dataConstruction->Construct(1).InsideAbsorpThermal = 1.0; - state.dataConstruction->Construct(2).InsideAbsorpThermal = 0.9; - state.dataConstruction->Construct(3).InsideAbsorpThermal = 0.8; + state->dataConstruction->Construct(1).InsideAbsorpThermal = 1.0; + state->dataConstruction->Construct(2).InsideAbsorpThermal = 0.9; + state->dataConstruction->Construct(3).InsideAbsorpThermal = 0.8; Surface(1).Zone = 1; Surface(2).Zone = 1; Surface(3).Zone = 1; @@ -785,18 +786,18 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcSurfaceWeightedMRT) TH(2, 1, 3) = 10.0; SurfNum = 1; - state.dataThermalComforts->clear_state(); - RadTemp = CalcSurfaceWeightedMRT(state, ZoneNum, SurfNum); + state->dataThermalComforts->clear_state(); + RadTemp = CalcSurfaceWeightedMRT(*state, ZoneNum, SurfNum); EXPECT_NEAR(RadTemp, 16.6, 0.1); SurfNum = 2; - state.dataThermalComforts->clear_state(); - RadTemp = CalcSurfaceWeightedMRT(state, ZoneNum, SurfNum); + state->dataThermalComforts->clear_state(); + RadTemp = CalcSurfaceWeightedMRT(*state, ZoneNum, SurfNum); EXPECT_NEAR(RadTemp, 16.1, 0.1); SurfNum = 3; - state.dataThermalComforts->clear_state(); - RadTemp = CalcSurfaceWeightedMRT(state, ZoneNum, SurfNum); + state->dataThermalComforts->clear_state(); + RadTemp = CalcSurfaceWeightedMRT(*state, ZoneNum, SurfNum); EXPECT_NEAR(RadTemp, 14.0, 0.1); } @@ -805,25 +806,25 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcAngleFactorMRT) Real64 RadTemp; - state.dataThermalComforts->AngleFactorList.allocate(1); - state.dataThermalComforts->AngleFactorList(1).TotAngleFacSurfaces = 3; - state.dataThermalComforts->AngleFactorList(1).SurfacePtr.allocate(state.dataThermalComforts->AngleFactorList(1).TotAngleFacSurfaces); - state.dataThermalComforts->AngleFactorList(1).AngleFactor.allocate(state.dataThermalComforts->AngleFactorList(1).TotAngleFacSurfaces); + state->dataThermalComforts->AngleFactorList.allocate(1); + state->dataThermalComforts->AngleFactorList(1).TotAngleFacSurfaces = 3; + state->dataThermalComforts->AngleFactorList(1).SurfacePtr.allocate(state->dataThermalComforts->AngleFactorList(1).TotAngleFacSurfaces); + state->dataThermalComforts->AngleFactorList(1).AngleFactor.allocate(state->dataThermalComforts->AngleFactorList(1).TotAngleFacSurfaces); - state.dataThermalComforts->AngleFactorList(1).SurfacePtr(1) = 1; - state.dataThermalComforts->AngleFactorList(1).SurfacePtr(2) = 2; - state.dataThermalComforts->AngleFactorList(1).SurfacePtr(3) = 3; - state.dataThermalComforts->AngleFactorList(1).AngleFactor(1) = 0.5; - state.dataThermalComforts->AngleFactorList(1).AngleFactor(2) = 0.3; - state.dataThermalComforts->AngleFactorList(1).AngleFactor(3) = 0.2; + state->dataThermalComforts->AngleFactorList(1).SurfacePtr(1) = 1; + state->dataThermalComforts->AngleFactorList(1).SurfacePtr(2) = 2; + state->dataThermalComforts->AngleFactorList(1).SurfacePtr(3) = 3; + state->dataThermalComforts->AngleFactorList(1).AngleFactor(1) = 0.5; + state->dataThermalComforts->AngleFactorList(1).AngleFactor(2) = 0.3; + state->dataThermalComforts->AngleFactorList(1).AngleFactor(3) = 0.2; TH.deallocate(); - TotSurfaces = state.dataThermalComforts->AngleFactorList(1).TotAngleFacSurfaces; + TotSurfaces = state->dataThermalComforts->AngleFactorList(1).TotAngleFacSurfaces; TH.allocate(2, 2, TotSurfaces); Surface.deallocate(); - state.dataConstruction->Construct.deallocate(); + state->dataConstruction->Construct.deallocate(); Surface.allocate(TotSurfaces); - state.dataConstruction->Construct.allocate(TotSurfaces); + state->dataConstruction->Construct.allocate(TotSurfaces); TH(2, 1, 1) = 20.0; TH(2, 1, 2) = 15.0; @@ -831,76 +832,76 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcAngleFactorMRT) Surface(1).Construction = 1; Surface(2).Construction = 2; Surface(3).Construction = 3; - state.dataConstruction->Construct(1).InsideAbsorpThermal = 1.0; - state.dataConstruction->Construct(2).InsideAbsorpThermal = 0.9; - state.dataConstruction->Construct(3).InsideAbsorpThermal = 0.8; + state->dataConstruction->Construct(1).InsideAbsorpThermal = 1.0; + state->dataConstruction->Construct(2).InsideAbsorpThermal = 0.9; + state->dataConstruction->Construct(3).InsideAbsorpThermal = 0.8; - RadTemp = CalcAngleFactorMRT(state, 1); + RadTemp = CalcAngleFactorMRT(*state, 1); EXPECT_NEAR(RadTemp, 16.9, 0.1); } TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortAdaptiveASH55Test) { // 5381 - state.dataThermalComforts->useEpwData = true; - - state.dataThermalComforts->DailyAveOutTemp(1) = 8.704166667; - state.dataThermalComforts->DailyAveOutTemp(2) = 9.895833333; - state.dataThermalComforts->DailyAveOutTemp(3) = 12.2; - state.dataThermalComforts->DailyAveOutTemp(4) = 8.445833333; - state.dataThermalComforts->DailyAveOutTemp(5) = 7.8; - state.dataThermalComforts->DailyAveOutTemp(6) = 7.158333333; - state.dataThermalComforts->DailyAveOutTemp(7) = 8.0125; - state.dataThermalComforts->DailyAveOutTemp(8) = 8.279166667; - state.dataThermalComforts->DailyAveOutTemp(9) = 8.166666667; - state.dataThermalComforts->DailyAveOutTemp(10) = 7.141666667; - state.dataThermalComforts->DailyAveOutTemp(11) = 7.433333333; - state.dataThermalComforts->DailyAveOutTemp(12) = 9.0625; - state.dataThermalComforts->DailyAveOutTemp(13) = 9.741666667; - state.dataThermalComforts->DailyAveOutTemp(14) = 9.545833333; - state.dataThermalComforts->DailyAveOutTemp(15) = 11.43333333; - state.dataThermalComforts->DailyAveOutTemp(16) = 12.375; - state.dataThermalComforts->DailyAveOutTemp(17) = 12.59583333; - state.dataThermalComforts->DailyAveOutTemp(18) = 12.6625; - state.dataThermalComforts->DailyAveOutTemp(19) = 13.50833333; - state.dataThermalComforts->DailyAveOutTemp(20) = 12.99583333; - state.dataThermalComforts->DailyAveOutTemp(21) = 11.58333333; - state.dataThermalComforts->DailyAveOutTemp(22) = 11.72083333; - state.dataThermalComforts->DailyAveOutTemp(23) = 9.1875; - state.dataThermalComforts->DailyAveOutTemp(24) = 6.8; - state.dataThermalComforts->DailyAveOutTemp(25) = 9.391666667; - state.dataThermalComforts->DailyAveOutTemp(26) = 8.1125; - state.dataThermalComforts->DailyAveOutTemp(27) = 8.4; - state.dataThermalComforts->DailyAveOutTemp(28) = 8.475; - state.dataThermalComforts->DailyAveOutTemp(29) = 7.941666667; - state.dataThermalComforts->DailyAveOutTemp(30) = 9.316666667; - - state.dataGlobal->BeginDayFlag = true; - - CalcThermalComfortAdaptiveASH55(state, false); - EXPECT_NEAR(state.dataThermalComforts->runningAverageASH, 9.29236111, 0.001); - state.dataThermalComforts->useEpwData = false; - state.dataGlobal->BeginDayFlag = false; + state->dataThermalComforts->useEpwData = true; + + state->dataThermalComforts->DailyAveOutTemp(1) = 8.704166667; + state->dataThermalComforts->DailyAveOutTemp(2) = 9.895833333; + state->dataThermalComforts->DailyAveOutTemp(3) = 12.2; + state->dataThermalComforts->DailyAveOutTemp(4) = 8.445833333; + state->dataThermalComforts->DailyAveOutTemp(5) = 7.8; + state->dataThermalComforts->DailyAveOutTemp(6) = 7.158333333; + state->dataThermalComforts->DailyAveOutTemp(7) = 8.0125; + state->dataThermalComforts->DailyAveOutTemp(8) = 8.279166667; + state->dataThermalComforts->DailyAveOutTemp(9) = 8.166666667; + state->dataThermalComforts->DailyAveOutTemp(10) = 7.141666667; + state->dataThermalComforts->DailyAveOutTemp(11) = 7.433333333; + state->dataThermalComforts->DailyAveOutTemp(12) = 9.0625; + state->dataThermalComforts->DailyAveOutTemp(13) = 9.741666667; + state->dataThermalComforts->DailyAveOutTemp(14) = 9.545833333; + state->dataThermalComforts->DailyAveOutTemp(15) = 11.43333333; + state->dataThermalComforts->DailyAveOutTemp(16) = 12.375; + state->dataThermalComforts->DailyAveOutTemp(17) = 12.59583333; + state->dataThermalComforts->DailyAveOutTemp(18) = 12.6625; + state->dataThermalComforts->DailyAveOutTemp(19) = 13.50833333; + state->dataThermalComforts->DailyAveOutTemp(20) = 12.99583333; + state->dataThermalComforts->DailyAveOutTemp(21) = 11.58333333; + state->dataThermalComforts->DailyAveOutTemp(22) = 11.72083333; + state->dataThermalComforts->DailyAveOutTemp(23) = 9.1875; + state->dataThermalComforts->DailyAveOutTemp(24) = 6.8; + state->dataThermalComforts->DailyAveOutTemp(25) = 9.391666667; + state->dataThermalComforts->DailyAveOutTemp(26) = 8.1125; + state->dataThermalComforts->DailyAveOutTemp(27) = 8.4; + state->dataThermalComforts->DailyAveOutTemp(28) = 8.475; + state->dataThermalComforts->DailyAveOutTemp(29) = 7.941666667; + state->dataThermalComforts->DailyAveOutTemp(30) = 9.316666667; + + state->dataGlobal->BeginDayFlag = true; + + CalcThermalComfortAdaptiveASH55(*state, false); + EXPECT_NEAR(state->dataThermalComforts->runningAverageASH, 9.29236111, 0.001); + state->dataThermalComforts->useEpwData = false; + state->dataGlobal->BeginDayFlag = false; } TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetWithCutoutTest) { - state.dataGlobal->NumOfZones = 1; - ZoneSysEnergyDemand.allocate(state.dataGlobal->NumOfZones); - state.dataThermalComforts->ThermalComfortSetPoint.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + ZoneSysEnergyDemand.allocate(state->dataGlobal->NumOfZones); + state->dataThermalComforts->ThermalComfortSetPoint.allocate(state->dataGlobal->NumOfZones); TempControlType.allocate(1); - AirModel.allocate(state.dataGlobal->NumOfZones); + AirModel.allocate(state->dataGlobal->NumOfZones); AirModel(1).AirModelType = RoomAirModel_Mixing; - ZTAV.allocate(state.dataGlobal->NumOfZones); - ZoneThermostatSetPointLo.allocate(state.dataGlobal->NumOfZones); - ZoneThermostatSetPointHi.allocate(state.dataGlobal->NumOfZones); - ZoneThermostatSetPointLoAver.allocate(state.dataGlobal->NumOfZones); - ZoneThermostatSetPointHiAver.allocate(state.dataGlobal->NumOfZones); - state.dataThermalComforts->ThermalComfortInASH55.allocate(state.dataGlobal->NumOfZones); - state.dataThermalComforts->ThermalComfortInASH55(1).ZoneIsOccupied = true; - state.dataGlobal->TimeStepZone = 0.25; - Zone.allocate(state.dataGlobal->NumOfZones); - state.dataZoneTempPredictorCorrector->NumOnOffCtrZone = 1; + ZTAV.allocate(state->dataGlobal->NumOfZones); + ZoneThermostatSetPointLo.allocate(state->dataGlobal->NumOfZones); + ZoneThermostatSetPointHi.allocate(state->dataGlobal->NumOfZones); + ZoneThermostatSetPointLoAver.allocate(state->dataGlobal->NumOfZones); + ZoneThermostatSetPointHiAver.allocate(state->dataGlobal->NumOfZones); + state->dataThermalComforts->ThermalComfortInASH55.allocate(state->dataGlobal->NumOfZones); + state->dataThermalComforts->ThermalComfortInASH55(1).ZoneIsOccupied = true; + state->dataGlobal->TimeStepZone = 0.25; + Zone.allocate(state->dataGlobal->NumOfZones); + state->dataZoneTempPredictorCorrector->NumOnOffCtrZone = 1; TempControlType(1) = DualSetPointWithDeadBand; @@ -909,35 +910,35 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcIfSetPointMetWithCutoutTest) ZoneThermostatSetPointLo(1) = 22.2; // 72F ZoneThermostatSetPointLoAver(1) = 22.2; // 72F ZoneSysEnergyDemand(1).TotalOutputRequired = 500.0; // must be greater than zero - CalcIfSetPointMet(state); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); - EXPECT_EQ(0., state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); + CalcIfSetPointMet(*state); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); + EXPECT_EQ(0., state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); // cooling ZTAV(1) = 25.0; // 77F ZoneThermostatSetPointHi(1) = 23.9; // 75F ZoneThermostatSetPointHiAver(1) = 23.9; // 75F ZoneSysEnergyDemand(1).TotalOutputRequired = -500.0; // must be less than zero - CalcIfSetPointMet(state); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); + CalcIfSetPointMet(*state); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); // no cooling or heating ZTAV(1) = 23.0; // 73F ZoneSysEnergyDemand(1).TotalOutputRequired = 0.0; // must be zero - CalcIfSetPointMet(state); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); - EXPECT_EQ(0, state.dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).totalNotMetHeating); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).totalNotMetHeatingOccupied); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).totalNotMetCooling); - EXPECT_EQ(state.dataGlobal->TimeStepZone, state.dataThermalComforts->ThermalComfortSetPoint(1).totalNotMetCoolingOccupied); + CalcIfSetPointMet(*state); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeating); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetHeatingOccupied); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCooling); + EXPECT_EQ(0, state->dataThermalComforts->ThermalComfortSetPoint(1).notMetCoolingOccupied); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).totalNotMetHeating); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).totalNotMetHeatingOccupied); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).totalNotMetCooling); + EXPECT_EQ(state->dataGlobal->TimeStepZone, state->dataThermalComforts->ThermalComfortSetPoint(1).totalNotMetCoolingOccupied); } @@ -947,19 +948,19 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortPierceSET) // Set the data for the test TotPeople = 1; People.allocate(TotPeople); - state.dataThermalComforts->ThermalComfortData.allocate(TotPeople); - state.dataGlobal->NumOfZones = 1; - Zone.allocate(state.dataGlobal->NumOfZones); - ZTAVComf.allocate(state.dataGlobal->NumOfZones); - MRT.allocate(state.dataGlobal->NumOfZones); - ZoneAirHumRatAvgComf.allocate(state.dataGlobal->NumOfZones); - IsZoneDV.allocate(state.dataGlobal->NumOfZones); - IsZoneUI.allocate(state.dataGlobal->NumOfZones); - QHTRadSysToPerson.allocate(state.dataGlobal->NumOfZones); - QCoolingPanelToPerson.allocate(state.dataGlobal->NumOfZones); - QHWBaseboardToPerson.allocate(state.dataGlobal->NumOfZones); - QSteamBaseboardToPerson.allocate(state.dataGlobal->NumOfZones); - QElecBaseboardToPerson.allocate(state.dataGlobal->NumOfZones); + state->dataThermalComforts->ThermalComfortData.allocate(TotPeople); + state->dataGlobal->NumOfZones = 1; + Zone.allocate(state->dataGlobal->NumOfZones); + ZTAVComf.allocate(state->dataGlobal->NumOfZones); + MRT.allocate(state->dataGlobal->NumOfZones); + ZoneAirHumRatAvgComf.allocate(state->dataGlobal->NumOfZones); + IsZoneDV.allocate(state->dataGlobal->NumOfZones); + IsZoneUI.allocate(state->dataGlobal->NumOfZones); + QHTRadSysToPerson.allocate(state->dataGlobal->NumOfZones); + QCoolingPanelToPerson.allocate(state->dataGlobal->NumOfZones); + QHWBaseboardToPerson.allocate(state->dataGlobal->NumOfZones); + QSteamBaseboardToPerson.allocate(state->dataGlobal->NumOfZones); + QElecBaseboardToPerson.allocate(state->dataGlobal->NumOfZones); People(1).ZonePtr = 1; People(1).NumberOfPeoplePtr = -1; @@ -991,9 +992,9 @@ TEST_F(EnergyPlusFixture, ThermalComfort_CalcThermalComfortPierceSET) QSteamBaseboardToPerson(1) = 0.0; QElecBaseboardToPerson(1) = 0.0; - CalcThermalComfortPierce(state); + CalcThermalComfortPierce(*state); - EXPECT_NEAR(state.dataThermalComforts->ThermalComfortData(1).PiercePMVSET, -3.350, 0.005); - EXPECT_NEAR(state.dataThermalComforts->ThermalComfortData(1).PierceSET, 23.62, 0.01); + EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).PiercePMVSET, -3.350, 0.005); + EXPECT_NEAR(state->dataThermalComforts->ThermalComfortData(1).PierceSET, 23.62, 0.01); } diff --git a/tst/EnergyPlus/unit/TranspiredCollector.unit.cc b/tst/EnergyPlus/unit/TranspiredCollector.unit.cc index 2b4c707a68f..244c331b69d 100644 --- a/tst/EnergyPlus/unit/TranspiredCollector.unit.cc +++ b/tst/EnergyPlus/unit/TranspiredCollector.unit.cc @@ -55,6 +55,7 @@ // EnergyPlus Headers #include +#include #include #include @@ -199,34 +200,34 @@ TEST_F(EnergyPlusFixture, TranspiredCollectors_InitTranspiredCollectorTest) }); ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; - ScheduleManager::ProcessScheduleInput(state); + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; + ScheduleManager::ProcessScheduleInput(*state); - GetProjectControlData(state, ErrorsFound); // read project control data + GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); - GetZoneData(state, ErrorsFound); - GetZoneEquipmentData(state); + GetZoneData(*state, ErrorsFound); + GetZoneEquipmentData(*state); - GetMaterialData(state, ErrorsFound); // read material data + GetMaterialData(*state, ErrorsFound); // read material data EXPECT_FALSE(ErrorsFound); // expect no errors - GetConstructData(state, ErrorsFound); // read construction data + GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); // expect no errors - GetZoneData(state, ErrorsFound); // read zone data + GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(1); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(1); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - GetSurfaceData(state, ErrorsFound); // setup zone geometry and get zone data + GetSurfaceData(*state, ErrorsFound); // setup zone geometry and get zone data EXPECT_FALSE(ErrorsFound); // expect no errors DataEnvironment::OutDryBulbTemp = 20.0; @@ -236,17 +237,17 @@ TEST_F(EnergyPlusFixture, TranspiredCollectors_InitTranspiredCollectorTest) InitializePsychRoutines(); - GetTranspiredCollectorInput(state); + GetTranspiredCollectorInput(*state); EXPECT_FALSE(ErrorsFound); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; OutBaroPress = 101325.0; SkyTemp = 24.0; IsRain = false; - InitTranspiredCollector(state, UTSCNum); + InitTranspiredCollector(*state, UTSCNum); - EXPECT_DOUBLE_EQ(22.0, state.dataTranspiredCollector->UTSC(UTSCNum).Tcoll); - EXPECT_DOUBLE_EQ(22.5, state.dataTranspiredCollector->UTSC(UTSCNum).Tplen); - EXPECT_NEAR(19.990, state.dataTranspiredCollector->UTSC(UTSCNum).TairHX, 0.001); + EXPECT_DOUBLE_EQ(22.0, state->dataTranspiredCollector->UTSC(UTSCNum).Tcoll); + EXPECT_DOUBLE_EQ(22.5, state->dataTranspiredCollector->UTSC(UTSCNum).Tplen); + EXPECT_NEAR(19.990, state->dataTranspiredCollector->UTSC(UTSCNum).TairHX, 0.001); } diff --git a/tst/EnergyPlus/unit/UnitHeater.unit.cc b/tst/EnergyPlus/unit/UnitHeater.unit.cc index 0335f62496e..d6b31f4d1ff 100644 --- a/tst/EnergyPlus/unit/UnitHeater.unit.cc +++ b/tst/EnergyPlus/unit/UnitHeater.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -1098,60 +1099,60 @@ TEST_F(EnergyPlusFixture, UnitHeater_HWHeatingCoilUAAutoSizingTest) }); ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedule data + state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedule data ErrorsFound = false; - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); // OutputProcessor::TimeValue.allocate(2); - state.dataGlobal->DDOnlySimulation = true; + state->dataGlobal->DDOnlySimulation = true; - GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); - SetPreConstructionInputParameters(state); // establish array bounds for constructions early + GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); + SetPreConstructionInputParameters(*state); // establish array bounds for constructions early - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->ZoneSizingCalc = true; createFacilityElectricPowerServiceObject(); - SizingManager::ManageSizing(state); + SizingManager::ManageSizing(*state); EXPECT_FALSE(ErrorsFound); - EXPECT_EQ(1, state.dataUnitHeaters->NumOfUnitHeats); - EXPECT_EQ("ZONE2UNITHEAT", state.dataUnitHeaters->UnitHeat(1).Name); + EXPECT_EQ(1, state->dataUnitHeaters->NumOfUnitHeats); + EXPECT_EQ("ZONE2UNITHEAT", state->dataUnitHeaters->UnitHeat(1).Name); ErrorsFound = false; ZoneEqUnitHeater = true; DataSizing::CurZoneEqNum = 1; - InitUnitHeater(state, UnitHeatNum, ZoneNum, FirstHVACIteration); - InitWaterCoil(state, CoilNum, FirstHVACIteration); // init hot water heating coil + InitUnitHeater(*state, UnitHeatNum, ZoneNum, FirstHVACIteration); + InitWaterCoil(*state, CoilNum, FirstHVACIteration); // init hot water heating coil - PltSizHeatNum = PlantUtilities::MyPlantSizingIndex(state, + PltSizHeatNum = PlantUtilities::MyPlantSizingIndex(*state, "Coil:Heating:Water", - state.dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum, - state.dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum, + state->dataUnitHeaters->UnitHeat(UnitHeatNum).HCoilName, + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum, + state->dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HWMaxVolFlowRate = state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate; - HWDensity = GetDensityGlycol(state, PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidName, + HWMaxVolFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate; + HWDensity = GetDensityGlycol(*state, PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidName, DataGlobalConstants::HWInitConvTemp(), - PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidIndex, + PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidIndex, "xxx"); - CpHW = GetSpecificHeatGlycol(state, PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidName, + CpHW = GetSpecificHeatGlycol(*state, PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidName, DataGlobalConstants::HWInitConvTemp(), - PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidIndex, + PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidIndex, "xxx"); HWPlantDeltaTDesign = PlantSizData(PltSizHeatNum).DeltaT; // calculate hot water coil design capacity HWCoilDesignCapacity = HWMaxVolFlowRate * HWDensity * CpHW * HWPlantDeltaTDesign; - EXPECT_NEAR(HWCoilDesignCapacity, state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate, 1.0); - EXPECT_NEAR(189.06, state.dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.02); + EXPECT_NEAR(HWCoilDesignCapacity, state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate, 1.0); + EXPECT_NEAR(189.06, state->dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.02); } TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) @@ -1273,32 +1274,32 @@ TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) }); ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedule data + state->dataGlobal->NumOfTimeStepInHour = 4; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 15; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedule data ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); ErrorsFound = false; - GetZoneEquipmentData(state); + GetZoneEquipmentData(*state); EXPECT_FALSE(ErrorsFound); ErrorsFound = false; - GetWaterCoilInput(state); + GetWaterCoilInput(*state); EXPECT_FALSE(ErrorsFound); - state.dataWaterCoils->GetWaterCoilsInputFlag = false; + state->dataWaterCoils->GetWaterCoilsInputFlag = false; ErrorsFound = false; - GetFanInput(state); + GetFanInput(*state); EXPECT_FALSE(ErrorsFound); ErrorsFound = false; - GetUnitHeaterInput(state); // get unit heaters data + GetUnitHeaterInput(*state); // get unit heaters data EXPECT_FALSE(ErrorsFound); - EXPECT_EQ(1, state.dataUnitHeaters->NumOfUnitHeats); - EXPECT_EQ("ZONE2UNITHEAT", state.dataUnitHeaters->UnitHeat(1).Name); + EXPECT_EQ(1, state->dataUnitHeaters->NumOfUnitHeats); + EXPECT_EQ("ZONE2UNITHEAT", state->dataUnitHeaters->UnitHeat(1).Name); ErrorsFound = false; ZoneEqUnitHeater = true; @@ -1322,10 +1323,10 @@ TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; ZoneSysEnergyDemand.allocate(1); ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = 2000.0; @@ -1333,7 +1334,7 @@ TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) ZoneSizingRunDone = true; ZoneEqSizing.allocate(1); ZoneEqSizing(CurZoneEqNum).DesignSizeFromParent = false; - state.dataGlobal->DoingSizing = true; + state->dataGlobal->DoingSizing = true; ZoneCompTurnFansOn = true; ZoneCompTurnFansOff = false; @@ -1343,36 +1344,36 @@ TEST_F(EnergyPlusFixture, UnitHeater_SimUnitHeaterTest) CurDeadBandOrSetback(ZoneNum) = false; Node(Fan(1).InletNodeNum).Temp = 16.6; - Node(Fan(1).InletNodeNum).HumRat = PsyWFnTdbRhPb(state, 16.6, 0.5, 101325.0, "UnitTest"); + Node(Fan(1).InletNodeNum).HumRat = PsyWFnTdbRhPb(*state, 16.6, 0.5, 101325.0, "UnitTest"); Node(Fan(1).InletNodeNum).Enthalpy = Psychrometrics::PsyHFnTdbW(Node(Fan(1).InletNodeNum).Temp, Node(Fan(1).InletNodeNum).HumRat); - DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); + DataEnvironment::StdRhoAir = PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); - WCWaterInletNode = state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; - WCWaterOutletNode = state.dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum; + WCWaterInletNode = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; + WCWaterOutletNode = state->dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum; Node(WCWaterInletNode).Temp = 60.0; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->SysSizingCalc = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->SysSizingCalc = true; - UHAirInletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode; - UHAirOutletNode = state.dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; + UHAirInletNode = state->dataUnitHeaters->UnitHeat(UnitHeatNum).AirInNode; + UHAirOutletNode = state->dataUnitHeaters->UnitHeat(UnitHeatNum).AirOutNode; - SimUnitHeater(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, ZoneNum, FirstHVACIteration, SysOutputProvided, LatOutputProvided, CurZoneEqNum); + SimUnitHeater(*state, state->dataUnitHeaters->UnitHeat(UnitHeatNum).Name, ZoneNum, FirstHVACIteration, SysOutputProvided, LatOutputProvided, CurZoneEqNum); // SimUnitHeater does not converge on the first call: the unit heater deliveres more than required heating load. But it meets // on the second call (iteration). I suspect it may be an initialization issue related to ControlCompOutput routine - SimUnitHeater(state, state.dataUnitHeaters->UnitHeat(UnitHeatNum).Name, ZoneNum, FirstHVACIteration, SysOutputProvided, LatOutputProvided, CurZoneEqNum); + SimUnitHeater(*state, state->dataUnitHeaters->UnitHeat(UnitHeatNum).Name, ZoneNum, FirstHVACIteration, SysOutputProvided, LatOutputProvided, CurZoneEqNum); // verify the total heat rate deleivered by the unit heater UHAirMassFlowRate = Node(UHAirInletNode).MassFlowRate; UHEnteringAirEnthalpy = PsyHFnTdbW(Node(UHAirInletNode).Temp, Node(UHAirInletNode).HumRat); UHLeavingAirEnthalpy = PsyHFnTdbW(Node(UHAirOutletNode).Temp, Node(UHAirOutletNode).HumRat); UHHeatingRate = UHAirMassFlowRate * (UHLeavingAirEnthalpy - UHEnteringAirEnthalpy); - EXPECT_NEAR(UHHeatingRate, state.dataUnitHeaters->UnitHeat(UnitHeatNum).HeatPower, ConvTol); + EXPECT_NEAR(UHHeatingRate, state->dataUnitHeaters->UnitHeat(UnitHeatNum).HeatPower, ConvTol); // verify the heat rate delivered by the hot water heating coil - HWMassFlowRate = state.dataWaterCoils->WaterCoil(CoilNum).InletWaterMassFlowRate; - CpHW = GetSpecificHeatGlycol(state, - PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidName, 60.0, PlantLoop(state.dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidIndex, "UnitTest"); + HWMassFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).InletWaterMassFlowRate; + CpHW = GetSpecificHeatGlycol(*state, + PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidName, 60.0, PlantLoop(state->dataUnitHeaters->UnitHeat(UnitHeatNum).HWLoopNum).FluidIndex, "UnitTest"); HWCoilHeatingRate = HWMassFlowRate * CpHW * (Node(WCWaterInletNode).Temp - Node(WCWaterOutletNode).Temp); - EXPECT_NEAR(HWCoilHeatingRate, state.dataWaterCoils->WaterCoil(CoilNum).TotWaterHeatingCoilRate, ConvTol); + EXPECT_NEAR(HWCoilHeatingRate, state->dataWaterCoils->WaterCoil(CoilNum).TotWaterHeatingCoilRate, ConvTol); } TEST_F(EnergyPlusFixture, UnitHeater_SecondPriorityZoneEquipment) @@ -2419,18 +2420,18 @@ TEST_F(EnergyPlusFixture, UnitHeater_SecondPriorityZoneEquipment) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - state.dataGlobal->DDOnlySimulation = true; + state->dataGlobal->DDOnlySimulation = true; - ManageSimulation(state); + ManageSimulation(*state); EXPECT_EQ(ZoneEquipList(1).NumOfEquipTypes, 2); // first priority zone equipment is zone ADU - EXPECT_EQ(state.dataZoneEquipmentManager->PrioritySimOrder(1).EquipType, "ZONEHVAC:AIRDISTRIBUTIONUNIT"); - EXPECT_EQ(state.dataZoneEquipmentManager->PrioritySimOrder(1).EquipName, "MAIN ZONE ATU"); + EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(1).EquipType, "ZONEHVAC:AIRDISTRIBUTIONUNIT"); + EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(1).EquipName, "MAIN ZONE ATU"); EXPECT_EQ(HeatingCoils::HeatingCoil(1).Name, "MAIN ZONE REHEAT COIL"); // second priority zone equipment is unit heater - EXPECT_EQ(state.dataZoneEquipmentManager->PrioritySimOrder(2).EquipType, "ZONEHVAC:UNITHEATER"); - EXPECT_EQ(state.dataZoneEquipmentManager->PrioritySimOrder(2).EquipName, "UNITHEATER"); + EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(2).EquipType, "ZONEHVAC:UNITHEATER"); + EXPECT_EQ(state->dataZoneEquipmentManager->PrioritySimOrder(2).EquipName, "UNITHEATER"); EXPECT_EQ(HeatingCoils::HeatingCoil(2).Name, "UNITHEATER_ELECTRICHEATER"); // check the reheat coil output EXPECT_NEAR(HeatingCoils::HeatingCoil(1).HeatingCoilRate, 7028.9, 1.0); @@ -2438,9 +2439,9 @@ TEST_F(EnergyPlusFixture, UnitHeater_SecondPriorityZoneEquipment) EXPECT_EQ(HeatingCoils::HeatingCoil(2).HeatingCoilRate, 0.0); // re-set the hour of the day - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 24; - state.dataGlobal->CurrentTime = 24.0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 24; + state->dataGlobal->CurrentTime = 24.0; // set zone air node condition Node(ZoneEquipConfig(1).ZoneNode).Temp = 20.0; Node(ZoneEquipConfig(1).ZoneNode).HumRat = 0.005; @@ -2455,7 +2456,7 @@ TEST_F(EnergyPlusFixture, UnitHeater_SecondPriorityZoneEquipment) bool SimAirLoops = true; bool FirstHVACIteration = false; // re-simulate the zone HVAC equipment per the priority order - ZoneEquipmentManager::ManageZoneEquipment(state, FirstHVACIteration, SimZoneEquipment, SimAirLoops); + ZoneEquipmentManager::ManageZoneEquipment(*state, FirstHVACIteration, SimZoneEquipment, SimAirLoops); // check the reheat coil nominal capacity EXPECT_NEAR(HeatingCoils::HeatingCoil(1).NominalCapacity, 17542.3, 1.0); // check the reheat coil outputis the full capacity diff --git a/tst/EnergyPlus/unit/UnitVentilator.unit.cc b/tst/EnergyPlus/unit/UnitVentilator.unit.cc index cc37a6de6b8..f2a5594e9d4 100644 --- a/tst/EnergyPlus/unit/UnitVentilator.unit.cc +++ b/tst/EnergyPlus/unit/UnitVentilator.unit.cc @@ -49,6 +49,7 @@ // Google Test Headers #include +#include #include "Fixtures/EnergyPlusFixture.hh" #include @@ -70,17 +71,17 @@ TEST_F(EnergyPlusFixture, UnitVentilatorSetOAMassFlowRateForCoolingVariablePerce Real64 UnitVentNum; DataLoopNode::clear_state(); - state.dataUnitVentilators->clear_state(); + state->dataUnitVentilators->clear_state(); DataLoopNode::Node.allocate(4); - state.dataUnitVentilators->UnitVent.allocate(1); + state->dataUnitVentilators->UnitVent.allocate(1); - state.dataUnitVentilators->UnitVent(1).ATMixerExists = false; - state.dataUnitVentilators->UnitVent(1).ATMixerType = DataHVACGlobals::ATMixer_InletSide; - state.dataUnitVentilators->UnitVent(1).FanOutletNode = 1; - state.dataUnitVentilators->UnitVent(1).OAMixerOutNode = 2; - state.dataUnitVentilators->UnitVent(1).ATMixerOutNode = 3; - state.dataUnitVentilators->UnitVent(1).AirInNode = 4; + state->dataUnitVentilators->UnitVent(1).ATMixerExists = false; + state->dataUnitVentilators->UnitVent(1).ATMixerType = DataHVACGlobals::ATMixer_InletSide; + state->dataUnitVentilators->UnitVent(1).FanOutletNode = 1; + state->dataUnitVentilators->UnitVent(1).OAMixerOutNode = 2; + state->dataUnitVentilators->UnitVent(1).ATMixerOutNode = 3; + state->dataUnitVentilators->UnitVent(1).AirInNode = 4; DataLoopNode::Node(1).Enthalpy = 0.0; DataLoopNode::Node(2).Enthalpy = 0.0; DataLoopNode::Node(3).Enthalpy = 0.0; @@ -93,10 +94,10 @@ TEST_F(EnergyPlusFixture, UnitVentilatorSetOAMassFlowRateForCoolingVariablePerce MinOA = 0.1; MaxOA = 0.9; MassFlowRate = 1.234; - state.dataUnitVentilators->QZnReq = 2345.6; + state->dataUnitVentilators->QZnReq = 2345.6; DataEnvironment::OutHumRat = 0.008; - OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); + OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(*state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); ExpectedOAMassFlowRate = 0.1234; EXPECT_NEAR(ExpectedOAMassFlowRate,OAMassFlowRate, 0.0001); @@ -107,10 +108,10 @@ TEST_F(EnergyPlusFixture, UnitVentilatorSetOAMassFlowRateForCoolingVariablePerce MinOA = 0.1; MaxOA = 0.9; MassFlowRate = 1.234; - state.dataUnitVentilators->QZnReq = 1.5678; + state->dataUnitVentilators->QZnReq = 1.5678; DataEnvironment::OutHumRat = 0.008; - OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); + OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(*state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); ExpectedOAMassFlowRate = 0.1234; EXPECT_NEAR(ExpectedOAMassFlowRate,OAMassFlowRate, 0.0001); @@ -121,10 +122,10 @@ TEST_F(EnergyPlusFixture, UnitVentilatorSetOAMassFlowRateForCoolingVariablePerce MinOA = 0.1; MaxOA = 0.9; MassFlowRate = 1.234; - state.dataUnitVentilators->QZnReq = 4567.89; + state->dataUnitVentilators->QZnReq = 4567.89; DataEnvironment::OutHumRat = 0.010; - OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); + OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(*state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); ExpectedOAMassFlowRate = 1.1106; EXPECT_NEAR(ExpectedOAMassFlowRate,OAMassFlowRate, 0.0001); @@ -135,10 +136,10 @@ TEST_F(EnergyPlusFixture, UnitVentilatorSetOAMassFlowRateForCoolingVariablePerce MinOA = 0.1; MaxOA = 0.9; MassFlowRate = 1.234; - state.dataUnitVentilators->QZnReq = 15678.9; + state->dataUnitVentilators->QZnReq = 15678.9; DataEnvironment::OutHumRat = 0.010; - OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); + OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(*state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); ExpectedOAMassFlowRate = 1.02133; EXPECT_NEAR(ExpectedOAMassFlowRate,OAMassFlowRate, 0.0001); @@ -149,14 +150,14 @@ TEST_F(EnergyPlusFixture, UnitVentilatorSetOAMassFlowRateForCoolingVariablePerce MinOA = 0.1; MaxOA = 0.9; MassFlowRate = 1.234; - state.dataUnitVentilators->QZnReq = 15678.9-12.34; + state->dataUnitVentilators->QZnReq = 15678.9-12.34; DataEnvironment::OutHumRat = 0.010; DataLoopNode::Node(1).Enthalpy = 11.0; DataLoopNode::Node(2).Enthalpy = 1.0; DataLoopNode::Node(3).Enthalpy = 0.0; DataLoopNode::Node(4).Enthalpy = 0.0; - OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); + OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(*state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); ExpectedOAMassFlowRate = 1.02133; EXPECT_NEAR(ExpectedOAMassFlowRate,OAMassFlowRate, 0.0001); @@ -167,16 +168,16 @@ TEST_F(EnergyPlusFixture, UnitVentilatorSetOAMassFlowRateForCoolingVariablePerce MinOA = 0.1; MaxOA = 0.9; MassFlowRate = 1.234; - state.dataUnitVentilators->QZnReq = 15678.9-12.34; + state->dataUnitVentilators->QZnReq = 15678.9-12.34; DataEnvironment::OutHumRat = 0.010; DataLoopNode::Node(1).Enthalpy = 11.0; DataLoopNode::Node(2).Enthalpy = 0.0; DataLoopNode::Node(3).Enthalpy = 1.0; DataLoopNode::Node(4).Enthalpy = 0.0; - state.dataUnitVentilators->UnitVent(1).ATMixerExists = true; - state.dataUnitVentilators->UnitVent(1).ATMixerType = DataHVACGlobals::ATMixer_InletSide; + state->dataUnitVentilators->UnitVent(1).ATMixerExists = true; + state->dataUnitVentilators->UnitVent(1).ATMixerType = DataHVACGlobals::ATMixer_InletSide; - OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); + OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(*state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); ExpectedOAMassFlowRate = 1.02133; EXPECT_NEAR(ExpectedOAMassFlowRate,OAMassFlowRate, 0.0001); @@ -187,16 +188,16 @@ TEST_F(EnergyPlusFixture, UnitVentilatorSetOAMassFlowRateForCoolingVariablePerce MinOA = 0.1; MaxOA = 0.9; MassFlowRate = 1.234; - state.dataUnitVentilators->QZnReq = 15678.9-12.34; + state->dataUnitVentilators->QZnReq = 15678.9-12.34; DataEnvironment::OutHumRat = 0.010; DataLoopNode::Node(1).Enthalpy = 11.0; DataLoopNode::Node(2).Enthalpy = 0.0; DataLoopNode::Node(3).Enthalpy = 0.0; DataLoopNode::Node(4).Enthalpy = 1.0; - state.dataUnitVentilators->UnitVent(1).ATMixerExists = true; - state.dataUnitVentilators->UnitVent(1).ATMixerType = DataHVACGlobals::ATMixer_SupplySide; + state->dataUnitVentilators->UnitVent(1).ATMixerExists = true; + state->dataUnitVentilators->UnitVent(1).ATMixerType = DataHVACGlobals::ATMixer_SupplySide; - OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); + OAMassFlowRate = UnitVentilator::SetOAMassFlowRateForCoolingVariablePercent(*state, UnitVentNum, MinOA,MassFlowRate,MaxOA,Tinlet,Toutdoor); ExpectedOAMassFlowRate = 1.02133; EXPECT_NEAR(ExpectedOAMassFlowRate,OAMassFlowRate, 0.0001); @@ -214,9 +215,9 @@ TEST_F(EnergyPlusFixture, UnitVentilatorCalcMdotCCoilCycFanTest) Real64 ExpectedResult; UnitVentNum = 1; - state.dataUnitVentilators->UnitVent.allocate(UnitVentNum); - state.dataUnitVentilators->UnitVent(UnitVentNum).FanOutletNode = 1; - state.dataUnitVentilators->UnitVent(UnitVentNum).AirInNode = 2; + state->dataUnitVentilators->UnitVent.allocate(UnitVentNum); + state->dataUnitVentilators->UnitVent(UnitVentNum).FanOutletNode = 1; + state->dataUnitVentilators->UnitVent(UnitVentNum).AirInNode = 2; DataLoopNode::Node.allocate(2); DataLoopNode::Node(2).HumRat = 0.006; DataLoopNode::Node(2).Temp = 23.0; @@ -224,49 +225,49 @@ TEST_F(EnergyPlusFixture, UnitVentilatorCalcMdotCCoilCycFanTest) DataLoopNode::Node(1).MassFlowRate = 1.0; // Test 1: QZnReq is greater than zero (heating) so mdot should be zero after the call - state.dataUnitVentilators->UnitVent(1).MaxColdWaterFlow = 0.1234; + state->dataUnitVentilators->UnitVent(1).MaxColdWaterFlow = 0.1234; mdot = -0.9999; QCoilReq = 5678.9; QZnReq = 5678.9; PartLoadRatio = 1.0; ExpectedResult = 0.0; - UnitVentilator::CalcMdotCCoilCycFan(state, mdot,QCoilReq,QZnReq,UnitVentNum, PartLoadRatio); + UnitVentilator::CalcMdotCCoilCycFan(*state, mdot,QCoilReq,QZnReq,UnitVentNum, PartLoadRatio); EXPECT_NEAR(ExpectedResult,mdot,0.0001); EXPECT_NEAR(ExpectedResult,QCoilReq,0.0001); // Test 2: QZnReq is zero (no conditioning) so mdot should be zero after the call - state.dataUnitVentilators->UnitVent(1).MaxColdWaterFlow = 0.1234; + state->dataUnitVentilators->UnitVent(1).MaxColdWaterFlow = 0.1234; mdot = -0.9999; QCoilReq = 0.0; QZnReq = 0.0; PartLoadRatio = 1.0; ExpectedResult = 0.0; - UnitVentilator::CalcMdotCCoilCycFan(state, mdot,QCoilReq,QZnReq,UnitVentNum, PartLoadRatio); + UnitVentilator::CalcMdotCCoilCycFan(*state, mdot,QCoilReq,QZnReq,UnitVentNum, PartLoadRatio); EXPECT_NEAR(ExpectedResult,mdot,0.0001); EXPECT_NEAR(ExpectedResult,QCoilReq,0.0001); // Test 3a: QZnReq is less than zero (cooling) so mdot should be non-zero, calculated based on the other variables - state.dataUnitVentilators->UnitVent(1).MaxColdWaterFlow = 0.1234; + state->dataUnitVentilators->UnitVent(1).MaxColdWaterFlow = 0.1234; mdot = -0.9999; QCoilReq = -5678.9; QZnReq = -5678.9; PartLoadRatio = 1.0; ExpectedResult = 0.1234; - UnitVentilator::CalcMdotCCoilCycFan(state, mdot,QCoilReq,QZnReq,UnitVentNum, PartLoadRatio); + UnitVentilator::CalcMdotCCoilCycFan(*state, mdot,QCoilReq,QZnReq,UnitVentNum, PartLoadRatio); EXPECT_NEAR(ExpectedResult,mdot,0.0001); EXPECT_NEAR(QCoilReq,QZnReq,0.1); // Test 3b: QZnReq is less than zero (cooling) so mdot should be non-zero, calculated based on the other variables - state.dataUnitVentilators->UnitVent(1).MaxColdWaterFlow = 1.6; + state->dataUnitVentilators->UnitVent(1).MaxColdWaterFlow = 1.6; mdot = -0.9999; QCoilReq = -5678.9; QZnReq = -5678.9; PartLoadRatio = 0.5; ExpectedResult = 0.8; - UnitVentilator::CalcMdotCCoilCycFan(state, mdot,QCoilReq,QZnReq,UnitVentNum, PartLoadRatio); + UnitVentilator::CalcMdotCCoilCycFan(*state, mdot,QCoilReq,QZnReq,UnitVentNum, PartLoadRatio); EXPECT_NEAR(ExpectedResult,mdot,0.0001); EXPECT_NEAR(QCoilReq,QZnReq,0.1); diff --git a/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc b/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc index bcbfbfd5700..953f3a7851a 100644 --- a/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc +++ b/tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc @@ -49,6 +49,7 @@ #include // EnergyPlus Headers +#include #include "Fixtures/EnergyPlusFixture.hh" #include #include @@ -148,45 +149,45 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) ASSERT_TRUE(process_idf(string)); // setup environment bool ErrorsFound(false); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); // Initialize schedule values - state.dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStep = 1; DataHVACGlobals::TimeStepSys = 1; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataEnvironment::Month = 1; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; - state.dataGlobal->WarmupFlag = false; + state->dataGlobal->WarmupFlag = false; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(Month, DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); // Initialize zone areas and volumes - too many other things need to be set up to do these in the normal routines DataHeatBalance::Zone(1).FloorArea = 232.26; DataEnvironment::StdRhoAir = 1.225; DataEnvironment::OutBaroPress = 101325; DataHeatBalance::ZoneIntGain.allocate(1); - SizingManager::GetOARequirements(state); - GetOAControllerInputs(state); + SizingManager::GetOARequirements(*state); + GetOAControllerInputs(*state); using DataZoneEquipment::CalcDesignSpecificationOutdoorAir; // Setup performance tables using namespace EnergyPlus::DataEnvironment; // process schedules - ProcessScheduleInput(state); // read schedules - UpdateScheduleValues(state); + ProcessScheduleInput(*state); // read schedules + UpdateScheduleValues(*state); // Get Unitary system - GetInputZoneHybridUnitaryAirConditioners(state, ErrorsFound); + GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); // All to get OA requirements - GetOARequirements(state); + GetOARequirements(*state); EXPECT_FALSE(ErrorsFound); // Initialize unit - InitZoneHybridUnitaryAirConditioners(state, 1, 1); + InitZoneHybridUnitaryAirConditioners(*state, 1, 1); Model *pZoneHybridUnitaryAirConditioner = &HybridUnitaryAirConditioners::ZoneHybridUnitaryAirConditioner(1); // setup local variables for model inputs Real64 Tosa, Tra, Wra, Wosa, RHosa, RHra, DesignMinVR, Requestedheating, RequestedCooling, Requested_Humidification, Requested_Dehumidification; @@ -203,16 +204,16 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) Tosa = 26.67733333; // Zone Hybrid Unitary HVAC Outside Air Temperature RHra = 17.3042157; // Zone Hybrid Unitary HVAC Return Air Relative Humidity RHosa = 13.1602401; // Zone Hybrid Unitary HVAC Outside Air Relative Humidity - Wra = PsyWFnTdbRhPb(state, Tra, RHra / 100, 101325); - Wosa = PsyWFnTdbRhPb(state, Tosa, RHosa / 100, 101325); + Wra = PsyWFnTdbRhPb(*state, Tra, RHra / 100, 101325); + Wosa = PsyWFnTdbRhPb(*state, Tosa, RHosa / 100, 101325); pZoneHybridUnitaryAirConditioner->InletTemp = Tra; pZoneHybridUnitaryAirConditioner->InletHumRat = Wra; - pZoneHybridUnitaryAirConditioner->InletEnthalpy = PsyHFnTdbRhPb(state, Tra, RHra / 100, 101325, "test"); + pZoneHybridUnitaryAirConditioner->InletEnthalpy = PsyHFnTdbRhPb(*state, Tra, RHra / 100, 101325, "test"); pZoneHybridUnitaryAirConditioner->InletPressure = 101325; pZoneHybridUnitaryAirConditioner->InletRH = RHra / 100; pZoneHybridUnitaryAirConditioner->SecInletTemp = Tosa; pZoneHybridUnitaryAirConditioner->SecInletHumRat = Wosa; - pZoneHybridUnitaryAirConditioner->SecInletEnthalpy = PsyHFnTdbRhPb(state, Tosa, RHosa / 100, 101325, "test"); + pZoneHybridUnitaryAirConditioner->SecInletEnthalpy = PsyHFnTdbRhPb(*state, Tosa, RHosa / 100, 101325, "test"); pZoneHybridUnitaryAirConditioner->SecInletPressure = 101325; pZoneHybridUnitaryAirConditioner->SecInletRH = RHosa / 100; @@ -222,7 +223,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) RequestedCooling = -58469.99445; // Watts (Zone Predicted Sensible Load to Cooling Setpoint Heat Transfer Rate pZoneHybridUnitaryAirConditioner->Initialize(1); pZoneHybridUnitaryAirConditioner->InitializeModelParams(); - pZoneHybridUnitaryAirConditioner->doStep(state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); + pZoneHybridUnitaryAirConditioner->doStep(*state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); // output results Real64 NormalizationDivisor = 3.0176; @@ -253,7 +254,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) pZoneHybridUnitaryAirConditioner->ScalingFactor = pZoneHybridUnitaryAirConditioner->ScalingFactor * 2; pZoneHybridUnitaryAirConditioner->ScaledSystemMaximumSupplyAirMassFlowRate = pZoneHybridUnitaryAirConditioner->ScaledSystemMaximumSupplyAirMassFlowRate * 2; - pZoneHybridUnitaryAirConditioner->doStep(state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); + pZoneHybridUnitaryAirConditioner->doStep(*state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); // output results modenumber = pZoneHybridUnitaryAirConditioner->PrimaryMode; @@ -282,7 +283,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) pZoneHybridUnitaryAirConditioner->ScaledSystemMaximumSupplyAirMassFlowRate / 2; // reset back to original values pZoneHybridUnitaryAirConditioner->SecInletTemp = 150; pZoneHybridUnitaryAirConditioner->SecInletHumRat = 0; - pZoneHybridUnitaryAirConditioner->doStep(state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); + pZoneHybridUnitaryAirConditioner->doStep(*state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); // output results modenumber = pZoneHybridUnitaryAirConditioner->PrimaryMode; @@ -300,7 +301,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) pZoneHybridUnitaryAirConditioner->InitializeModelParams(); pZoneHybridUnitaryAirConditioner->SecInletTemp = Tosa; pZoneHybridUnitaryAirConditioner->SecInletHumRat = Wosa; - pZoneHybridUnitaryAirConditioner->doStep(state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); + pZoneHybridUnitaryAirConditioner->doStep(*state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); // output results modenumber = pZoneHybridUnitaryAirConditioner->PrimaryMode; @@ -325,7 +326,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) pZoneHybridUnitaryAirConditioner->InitializeModelParams(); pZoneHybridUnitaryAirConditioner->SecInletTemp = Tosa; pZoneHybridUnitaryAirConditioner->SecInletHumRat = Wosa; - pZoneHybridUnitaryAirConditioner->doStep(state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); + pZoneHybridUnitaryAirConditioner->doStep(*state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); // output results modenumber = pZoneHybridUnitaryAirConditioner->PrimaryMode; @@ -347,7 +348,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) pZoneHybridUnitaryAirConditioner->InitializeModelParams(); pZoneHybridUnitaryAirConditioner->SecInletTemp = Tosa; pZoneHybridUnitaryAirConditioner->SecInletHumRat = Wosa; - pZoneHybridUnitaryAirConditioner->doStep(state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); + pZoneHybridUnitaryAirConditioner->doStep(*state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); // output results @@ -363,7 +364,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) pZoneHybridUnitaryAirConditioner->InitializeModelParams(); pZoneHybridUnitaryAirConditioner->SecInletTemp = Tosa; pZoneHybridUnitaryAirConditioner->SecInletHumRat = Wosa; - pZoneHybridUnitaryAirConditioner->doStep(state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); + pZoneHybridUnitaryAirConditioner->doStep(*state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); // output results Tsa = pZoneHybridUnitaryAirConditioner->OutletTemp; @@ -378,7 +379,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) pZoneHybridUnitaryAirConditioner->SecInletTemp = Tosa; pZoneHybridUnitaryAirConditioner->SecInletHumRat = Wosa; pZoneHybridUnitaryAirConditioner->AvailStatus = 1; - pZoneHybridUnitaryAirConditioner->doStep(state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); + pZoneHybridUnitaryAirConditioner->doStep(*state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); // output results modenumber = pZoneHybridUnitaryAirConditioner->PrimaryMode; @@ -393,44 +394,44 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) EXPECT_NEAR(Electricpower, 244 / NormalizationDivisor, 1); // Scenario 7: Check ventilation load is being accounted for - state.dataGlobal->NumOfZones = 1; - ZoneSysEnergyDemand.allocate(state.dataGlobal->NumOfZones); - DeadBandOrSetback.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + ZoneSysEnergyDemand.allocate(state->dataGlobal->NumOfZones); + DeadBandOrSetback.allocate(state->dataGlobal->NumOfZones); - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData(state); // read zone equipment SystemReports::ReportMaxVentilationLoads(); + DataZoneEquipment::GetZoneEquipmentData(*state); // read zone equipment SystemReports::ReportMaxVentilationLoads(); DataZoneEquipment::ZoneEquipInputsFilled = true; - ZoneOAMassFlow.allocate(state.dataGlobal->NumOfZones); - ZoneOAMass.allocate(state.dataGlobal->NumOfZones); - ZoneOAVolFlowStdRho.allocate(state.dataGlobal->NumOfZones); - ZoneOAVolFlowCrntRho.allocate(state.dataGlobal->NumOfZones); - ZoneOAVolStdRho.allocate(state.dataGlobal->NumOfZones); - ZoneOAVolCrntRho.allocate(state.dataGlobal->NumOfZones); - ZoneMechACH.allocate(state.dataGlobal->NumOfZones); - MAT.allocate(state.dataGlobal->NumOfZones); - ZoneAirHumRatAvg.allocate(state.dataGlobal->NumOfZones); - MaxHeatingLoadMetByVent.allocate(state.dataGlobal->NumOfZones); - MaxOverheatingByVent.allocate(state.dataGlobal->NumOfZones); - MaxCoolingLoadMetByVent.allocate(state.dataGlobal->NumOfZones); - MaxOvercoolingByVent.allocate(state.dataGlobal->NumOfZones); + ZoneOAMassFlow.allocate(state->dataGlobal->NumOfZones); + ZoneOAMass.allocate(state->dataGlobal->NumOfZones); + ZoneOAVolFlowStdRho.allocate(state->dataGlobal->NumOfZones); + ZoneOAVolFlowCrntRho.allocate(state->dataGlobal->NumOfZones); + ZoneOAVolStdRho.allocate(state->dataGlobal->NumOfZones); + ZoneOAVolCrntRho.allocate(state->dataGlobal->NumOfZones); + ZoneMechACH.allocate(state->dataGlobal->NumOfZones); + MAT.allocate(state->dataGlobal->NumOfZones); + ZoneAirHumRatAvg.allocate(state->dataGlobal->NumOfZones); + MaxHeatingLoadMetByVent.allocate(state->dataGlobal->NumOfZones); + MaxOverheatingByVent.allocate(state->dataGlobal->NumOfZones); + MaxCoolingLoadMetByVent.allocate(state->dataGlobal->NumOfZones); + MaxOvercoolingByVent.allocate(state->dataGlobal->NumOfZones); ZoneSysEnergyDemand(1).TotalOutputRequired = 58469.99445; DeadBandOrSetback(1) = false; ZoneEquipList(ZoneEquipConfig(1).EquipListIndex).EquipIndex(1) = 1; - CreateEnergyReportStructure(state); + CreateEnergyReportStructure(*state); - SizingManager::GetOARequirements(state); + SizingManager::GetOARequirements(*state); using DataZoneEquipment::CalcDesignSpecificationOutdoorAir; // Setup performance tables using namespace EnergyPlus::DataEnvironment; // process schedules - ProcessScheduleInput(state); // read schedules - UpdateScheduleValues(state); + ProcessScheduleInput(*state); // read schedules + UpdateScheduleValues(*state); // Get Unitary system - GetInputZoneHybridUnitaryAirConditioners(state, ErrorsFound); + GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); // All to get OA requirements - GetOARequirements(state); + GetOARequirements(*state); Requestedheating = -122396.255; // Watts (Zone Predicted Sensible Load to Heating Setpoint Heat Transfer Rate RequestedCooling = -58469.99445; // Watts (Zone Predicted Sensible Load to Cooling Setpoint Heat Transfer Rate @@ -439,10 +440,10 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) pZoneHybridUnitaryAirConditioner->InletTemp = Tra; pZoneHybridUnitaryAirConditioner->SecInletTemp = Tosa; pZoneHybridUnitaryAirConditioner->SecInletMassFlowRate = DesignMinVR; - pZoneHybridUnitaryAirConditioner->doStep(state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); + pZoneHybridUnitaryAirConditioner->doStep(*state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); ReportZoneHybridUnitaryAirConditioners(1); - SystemReports::ReportMaxVentilationLoads(state); + SystemReports::ReportMaxVentilationLoads(*state); // output results Real64 zone_oa_mass_flow = ZoneOAMassFlow(1); // OA flow reported to the zone from the unitary hybrid system @@ -469,7 +470,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_Unittest) ResourceTypes.insert(std::pair(varN, DataGlobalConstants::ResourceType::None)); } - GetMeteredVariables(state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, + GetMeteredVariables(*state, TypeOfComp, NameOfComp, VarIndexes, VarTypes, IndexTypes, unitsForVar, ResourceTypes, EndUses, Groups, Names, NumFound); // output results @@ -577,8 +578,8 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ValidateFieldsParsing ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - GetInputZoneHybridUnitaryAirConditioners(state, ErrorsFound); - InitZoneHybridUnitaryAirConditioners(state, 1, 1); + GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); + InitZoneHybridUnitaryAirConditioners(*state, 1, 1); Model *pZoneHybridUnitaryAirConditioner = &HybridUnitaryAirConditioners::ZoneHybridUnitaryAirConditioner(1); pZoneHybridUnitaryAirConditioner->Initialize(1); pZoneHybridUnitaryAirConditioner->InitializeModelParams(); @@ -621,8 +622,8 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ValidateMinimumIdfInp ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - GetInputZoneHybridUnitaryAirConditioners(state, ErrorsFound); - InitZoneHybridUnitaryAirConditioners(state, 1, 1); + GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); + InitZoneHybridUnitaryAirConditioners(*state, 1, 1); Model *pZoneHybridUnitaryAirConditioner = &HybridUnitaryAirConditioners::ZoneHybridUnitaryAirConditioner(1); pZoneHybridUnitaryAirConditioner->Initialize(1); pZoneHybridUnitaryAirConditioner->InitializeModelParams(); @@ -819,16 +820,16 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_CalculateCurveVal) ASSERT_TRUE(process_idf(idf_objects)); - CurveManager::GetCurveInput(state); - state.dataCurveManager->GetCurvesInputFlag = false; - EXPECT_EQ(4, state.dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + EXPECT_EQ(4, state->dataCurveManager->NumCurves); bool ErrorsFound(false); - GetInputZoneHybridUnitaryAirConditioners(state, ErrorsFound); - GetOARequirements(state); + GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); + GetOARequirements(*state); EXPECT_FALSE(ErrorsFound); - InitZoneHybridUnitaryAirConditioners(state, 1, 1); + InitZoneHybridUnitaryAirConditioners(*state, 1, 1); Model *pZoneHybridUnitaryAirConditioner = &HybridUnitaryAirConditioners::ZoneHybridUnitaryAirConditioner(1); pZoneHybridUnitaryAirConditioner->Initialize(1); pZoneHybridUnitaryAirConditioner->InitializeModelParams(); @@ -856,7 +857,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_CalculateCurveVal) // SUPPLY_FAN_POWER = 3; for (std::size_t i=0; iGetCurvesInputFlag = false; - EXPECT_EQ(8, state.dataCurveManager->NumCurves); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; + EXPECT_EQ(8, state->dataCurveManager->NumCurves); bool ErrorsFound(false); - GetInputZoneHybridUnitaryAirConditioners(state, ErrorsFound); - GetOARequirements(state); + GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); + GetOARequirements(*state); EXPECT_FALSE(ErrorsFound); - InitZoneHybridUnitaryAirConditioners(state, 1, 2); + InitZoneHybridUnitaryAirConditioners(*state, 1, 2); Model *pZoneHybridUnitaryAirConditioner = &HybridUnitaryAirConditioners::ZoneHybridUnitaryAirConditioner(1); @@ -1237,16 +1238,16 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ModelOperatingSetting Real64 Tosa = 26.67733333; // Zone Hybrid Unitary HVAC Outside Air Temperature Real64 RHra = 17.3042157; // Zone Hybrid Unitary HVAC Return Air Relative Humidity Real64 RHosa = 13.1602401; // Zone Hybrid Unitary HVAC Outside Air Relative Humidity - Real64 Wra = PsyWFnTdbRhPb(state, Tra, RHra / 100, 101325); + Real64 Wra = PsyWFnTdbRhPb(*state, Tra, RHra / 100, 101325); Real64 Wosa = 0.001; pZoneHybridUnitaryAirConditioner->InletTemp = Tra; pZoneHybridUnitaryAirConditioner->InletHumRat = Wra; - pZoneHybridUnitaryAirConditioner->InletEnthalpy = PsyHFnTdbRhPb(state, Tra, RHra / 100, 101325, "test"); + pZoneHybridUnitaryAirConditioner->InletEnthalpy = PsyHFnTdbRhPb(*state, Tra, RHra / 100, 101325, "test"); pZoneHybridUnitaryAirConditioner->InletPressure = 101325; pZoneHybridUnitaryAirConditioner->InletRH = RHra / 100; pZoneHybridUnitaryAirConditioner->SecInletTemp = Tosa / 1000; pZoneHybridUnitaryAirConditioner->SecInletHumRat = Wosa; - pZoneHybridUnitaryAirConditioner->SecInletEnthalpy = PsyHFnTdbRhPb(state, Tosa, RHosa / 100, 101325, "test"); + pZoneHybridUnitaryAirConditioner->SecInletEnthalpy = PsyHFnTdbRhPb(*state, Tosa, RHosa / 100, 101325, "test"); pZoneHybridUnitaryAirConditioner->SecInletPressure = 101325; pZoneHybridUnitaryAirConditioner->SecInletRH = RHosa / 1000; @@ -1257,7 +1258,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ModelOperatingSetting pZoneHybridUnitaryAirConditioner->Initialize(1); pZoneHybridUnitaryAirConditioner->InitializeModelParams(); - pZoneHybridUnitaryAirConditioner->doStep(state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); + pZoneHybridUnitaryAirConditioner->doStep(*state, RequestedCooling, Requestedheating, Requested_Humidification, Requested_Dehumidification, DesignMinVR); for(size_t i = 0; i < pZoneHybridUnitaryAirConditioner->Settings.size(); i++){ int MassFlowSolutionSize = pZoneHybridUnitaryAirConditioner->Settings[i].oMode.sol.MassFlowRatio.size(); @@ -1380,7 +1381,7 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ValidateOptionalError ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - GetInputZoneHybridUnitaryAirConditioners(state, ErrorsFound); + GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound); // Design Specification Outdoor Air Object Name 'SZ DSOA SPACE2-1' is not defined in this model, thus an error is thrown std::string const error_string = delimited_string({ " ** Severe ** GetInputZoneHybridUnitaryAirConditioners: ZoneHVAC:HybridUnitaryHVAC = MUNTERSEPX5000 invalid data", diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index cc0796eb5f9..97f46628d4e 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include "Fixtures/EnergyPlusFixture.hh" #include #include @@ -114,13 +115,13 @@ class ZoneUnitarySysTest : public EnergyPlusFixture { EnergyPlusFixture::SetUp(); // Sets up the base fixture first. - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); // initialize StdRhoAir + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize StdRhoAir DataEnvironment::OutBaroPress = 101325.0; - state.dataGlobal->NumOfZones = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); - DataZoneEquipment::ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); - DataZoneEquipment::ZoneEquipList.allocate(state.dataGlobal->NumOfZones); - DataZoneEquipment::ZoneEquipAvail.dimension(state.dataGlobal->NumOfZones, DataHVACGlobals::NoAction); + state->dataGlobal->NumOfZones = 1; + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipList.allocate(state->dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipAvail.dimension(state->dataGlobal->NumOfZones, DataHVACGlobals::NoAction); DataHeatBalance::Zone(1).Name = "EAST ZONE"; DataZoneEquipment::NumOfZoneEquipLists = 1; DataHeatBalance::Zone(1).IsControlled = true; @@ -251,11 +252,11 @@ class AirloopUnitarySysTest : public EnergyPlusFixture DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 0; DataSizing::CurOASysNum = 0; - state.dataWaterCoils->NumWaterCoils = 2; - state.dataWaterCoils->WaterCoil.allocate(state.dataWaterCoils->NumWaterCoils); - state.dataWaterCoils->WaterCoilNumericFields.allocate(state.dataWaterCoils->NumWaterCoils); - for (int i = 1; i <= state.dataWaterCoils->NumWaterCoils; ++i) { - state.dataWaterCoils->WaterCoilNumericFields(i).FieldNames.allocate(17); // max N fields for water coil + state->dataWaterCoils->NumWaterCoils = 2; + state->dataWaterCoils->WaterCoil.allocate(state->dataWaterCoils->NumWaterCoils); + state->dataWaterCoils->WaterCoilNumericFields.allocate(state->dataWaterCoils->NumWaterCoils); + for (int i = 1; i <= state->dataWaterCoils->NumWaterCoils; ++i) { + state->dataWaterCoils->WaterCoilNumericFields(i).FieldNames.allocate(17); // max N fields for water coil } DataPlant::TotNumLoops = 2; DataPlant::PlantLoop.allocate(DataPlant::TotNumLoops); @@ -275,8 +276,8 @@ class AirloopUnitarySysTest : public EnergyPlusFixture DataSizing::FinalSysSizing.allocate(1); DataSizing::FinalZoneSizing.allocate(1); DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); Psychrometrics::InitializePsychRoutines(); DataLoopNode::Node.allocate(30); } @@ -285,9 +286,9 @@ class AirloopUnitarySysTest : public EnergyPlusFixture { EnergyPlusFixture::TearDown(); // Remember to tear down the base fixture after cleaning up derived fixture! - state.dataWaterCoils->NumWaterCoils = 0; - state.dataWaterCoils->WaterCoil.clear(); - state.dataWaterCoils->WaterCoilNumericFields.clear(); + state->dataWaterCoils->NumWaterCoils = 0; + state->dataWaterCoils->WaterCoil.clear(); + state->dataWaterCoils->WaterCoilNumericFields.clear(); DataPlant::PlantLoop.clear(); DataSizing::PlantSizData.clear(); DataSizing::ZoneEqSizing.clear(); @@ -298,8 +299,8 @@ class AirloopUnitarySysTest : public EnergyPlusFixture DataSizing::FinalSysSizing.clear(); DataSizing::SysSizPeakDDNum.clear(); DataHVACGlobals::NumPrimaryAirSys = 0; - state.dataAirSystemsData->PrimaryAirSystems.clear(); - state.dataAirLoop->AirLoopControlInfo.clear(); + state->dataAirSystemsData->PrimaryAirSystems.clear(); + state->dataAirLoop->AirLoopControlInfo.clear(); Psychrometrics::cached_Twb.clear(); Psychrometrics::cached_Psat.clear(); DataLoopNode::Node.clear(); @@ -313,7 +314,7 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) // test against sizing of same water coils in UntarySystem DataEnvironment::OutBaroPress = 101325.0; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); // set up sizing flags DataSizing::SysSizingRunDone = true; @@ -360,28 +361,28 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) // set up water coil int CoilNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Cooling Coil"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Cooling; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_Cooling; - state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = DataSizing::AutoSize; - - state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(3) = "Maximum Flow Rate"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum = 2; - state.dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum = 3; - state.dataWaterCoils->WaterCoil(CoilNum).AirOutletNodeNum = 4; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Cooling Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Cooling; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = DataSizing::AutoSize; + + state->dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(3) = "Maximum Flow Rate"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum = 2; + state->dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum = 3; + state->dataWaterCoils->WaterCoil(CoilNum).AirOutletNodeNum = 4; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 1; @@ -392,75 +393,75 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) DataSizing::PlantSizData(1).ExitTemp = 5.7; DataSizing::PlantSizData(1).DeltaT = 5.0; DataSizing::FinalSysSizing(1).MassFlowAtCoolPeak = DataSizing::FinalSysSizing(1).DesMainVolFlow * DataEnvironment::StdRhoAir; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(CoilNum).Name; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(CoilNum).Name; DataSizing::DataWaterLoopNum = 1; FluidProperties::NumOfGlycols = 1; createCoilSelectionReportObj(); - WaterCoils::SizeWaterCoil(state, CoilNum); + WaterCoils::SizeWaterCoil(*state, CoilNum); - EXPECT_DOUBLE_EQ(0.159, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); - EXPECT_NEAR(6779.0, state.dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate, 1.0); - EXPECT_EQ(20.0, state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp); // coil inlet does not include fan heat + EXPECT_DOUBLE_EQ(0.159, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + EXPECT_NEAR(6779.0, state->dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate, 1.0); + EXPECT_EQ(20.0, state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp); // coil inlet does not include fan heat // save coil capacity for comparison to UnitarySyste - Real64 coil1CoolingCoilRate = state.dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate; + Real64 coil1CoolingCoilRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate; // save cooling coil air flow rate for use in fan heat calculation - Real64 coil1CoolingAirFlowRate = state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate; + Real64 coil1CoolingAirFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate; // reset coil sizing for next test - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = DataSizing::AutoSize; // size heating coil CoilNum = 2; DataSizing::FinalSysSizing(1).MassFlowAtCoolPeak = DataSizing::FinalSysSizing(1).DesMainVolFlow * DataEnvironment::StdRhoAir; - state.dataAirLoop->AirLoopControlInfo(1).UnitarySys = true; - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 5; - state.dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum = 6; - state.dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum = 7; - state.dataWaterCoils->WaterCoil(CoilNum).AirOutletNodeNum = 8; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Heating Coil"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 2; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = DataSizing::AutoSize; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(CoilNum).Name; + state->dataAirLoop->AirLoopControlInfo(1).UnitarySys = true; + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 5; + state->dataWaterCoils->WaterCoil(CoilNum).WaterOutletNodeNum = 6; + state->dataWaterCoils->WaterCoil(CoilNum).AirInletNodeNum = 7; + state->dataWaterCoils->WaterCoil(CoilNum).AirOutletNodeNum = 8; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Heating Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 2; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = DataSizing::AutoSize; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(CoilNum).Name; DataSizing::DataWaterLoopNum = 2; DataSizing::PlantSizData(2).DeltaT = 5.0; - WaterCoils::SizeWaterCoil(state, CoilNum); + WaterCoils::SizeWaterCoil(*state, CoilNum); // heating flow rate adjusted by FinalSysSizing(1).SysAirMinFlowRat = 0.3 - EXPECT_NEAR(0.159 * heatFlowRat, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate, 0.00001); - EXPECT_NEAR(1154.0, state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate, 1.0); - Real64 coil2HeatingCoilRate = state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate; + EXPECT_NEAR(0.159 * heatFlowRat, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate, 0.00001); + EXPECT_NEAR(1154.0, state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate, 1.0); + Real64 coil2HeatingCoilRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate; // reset coil sizing for next test - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = DataSizing::AutoSize; // resize cooling coil with fan on branch CoilNum = 1; @@ -470,28 +471,28 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) Fans::Fan(1).MotEff = 0.7; Fans::Fan(1).MotInAirFrac = 1.0; - state.dataAirSystemsData->PrimaryAirSystems(1).supFanModelTypeEnum = DataAirSystems::structArrayLegacyFanModels; - state.dataAirSystemsData->PrimaryAirSystems(1).supFanVecIndex = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).SupFanNum = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).supFanLocation = DataAirSystems::fanPlacement::BlowThru; - Real64 FanCoolLoad = Fans::FanDesHeatGain(state, state.dataAirSystemsData->PrimaryAirSystems(1).SupFanNum, coil1CoolingAirFlowRate); - WaterCoils::SizeWaterCoil(state, CoilNum); + state->dataAirSystemsData->PrimaryAirSystems(1).supFanModelTypeEnum = DataAirSystems::structArrayLegacyFanModels; + state->dataAirSystemsData->PrimaryAirSystems(1).supFanVecIndex = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).SupFanNum = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).supFanLocation = DataAirSystems::fanPlacement::BlowThru; + Real64 FanCoolLoad = Fans::FanDesHeatGain(*state, state->dataAirSystemsData->PrimaryAirSystems(1).SupFanNum, coil1CoolingAirFlowRate); + WaterCoils::SizeWaterCoil(*state, CoilNum); EXPECT_NEAR(FanCoolLoad, 106.0, 1.0); // make sure there is enough fan heat to change results - EXPECT_NEAR(6779.0 + FanCoolLoad, state.dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate, 1.0); - EXPECT_NEAR(20.541, state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp, 0.001); // coil inlet does include fan heat + EXPECT_NEAR(6779.0 + FanCoolLoad, state->dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate, 1.0); + EXPECT_NEAR(20.541, state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp, 0.001); // coil inlet does include fan heat // reset coil sizing for next test - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = DataSizing::AutoSize; // reset primary air system fan type and location as if is doesn't exist - state.dataAirSystemsData->PrimaryAirSystems(1).supFanModelTypeEnum = DataAirSystems::fanModelTypeNotYetSet; - state.dataAirSystemsData->PrimaryAirSystems(1).supFanLocation = DataAirSystems::fanPlacement::fanPlaceNotSet; + state->dataAirSystemsData->PrimaryAirSystems(1).supFanModelTypeEnum = DataAirSystems::fanModelTypeNotYetSet; + state->dataAirSystemsData->PrimaryAirSystems(1).supFanLocation = DataAirSystems::fanPlacement::fanPlaceNotSet; // size same coils in UnitarySystem int AirLoopNum(1); @@ -510,38 +511,38 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) mySys->m_CoolingCoilName = "Test Water Cooling Coil"; mySys->m_HeatingCoilType_Num = DataHVACGlobals::Coil_HeatingWater; mySys->m_HeatingCoilName = "Test Water Heating Coil"; - state.dataWaterCoils->GetWaterCoilsInputFlag = false; // don't overwrite these coil data - state.dataWaterCoils->MySizeFlag = true; // need to size again for UnitarySystem - state.dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate = 0.0; // reset these to be sure they get recalculated - state.dataWaterCoils->WaterCoil(2).DesWaterHeatingCoilRate = 0.0; - OutputReportPredefined::SetPredefinedTables(state); - state.dataGlobal->DoingSizing = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = false; // don't overwrite these coil data + state->dataWaterCoils->MySizeFlag = true; // need to size again for UnitarySystem + state->dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate = 0.0; // reset these to be sure they get recalculated + state->dataWaterCoils->WaterCoil(2).DesWaterHeatingCoilRate = 0.0; + OutputReportPredefined::SetPredefinedTables(*state); + state->dataGlobal->DoingSizing = true; - mySys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + mySys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); // Show coil sizes in UnitarySystem, cooling coil does not include fan heat // Same sizes as coil on branch without fan heat - EXPECT_NEAR(6672.0, state.dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate, 1.0); - EXPECT_EQ(20.0, state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp); // coil inlet does not include fan heat + EXPECT_NEAR(6672.0, state->dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate, 1.0); + EXPECT_EQ(20.0, state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp); // coil inlet does not include fan heat // heating coil in UnitarySystem sized at higher air flow rate, i.e., not using SysAirMinFlowRat - EXPECT_NEAR(3848.0, state.dataWaterCoils->WaterCoil(2).DesWaterHeatingCoilRate, 1.0); + EXPECT_NEAR(3848.0, state->dataWaterCoils->WaterCoil(2).DesWaterHeatingCoilRate, 1.0); // note size of heating coil on branch is smaller than heating coil in UnitarySystem minus 10 W EXPECT_LT(coil2HeatingCoilRate, 3838.0); // heating flow rate of coil in UnitarySystem NOT adjusted by FinalSysSizing(1).SysAirMinFlowRat = 0.3 - EXPECT_NEAR(0.159, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate, 0.00001); + EXPECT_NEAR(0.159, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate, 0.00001); // the water cooling coil sizes are only different by the air density used in capacity calculation // water coils use StdRhoAir and UnitarySystem coils use actual air density Real64 CoilInTemp = DataSizing::FinalSysSizing(1).MixTempAtCoolPeak; Real64 CoilInHumRat = DataSizing::FinalSysSizing(1).MixHumRatAtCoolPeak; - Real64 rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::StdBaroPress, CoilInTemp, CoilInHumRat); + Real64 rhoair = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::StdBaroPress, CoilInTemp, CoilInHumRat); // this is the ratio of UnitarySystem cooling coil size to coil-on-branch water cooling coil size Real64 rhoRatio = DataEnvironment::StdRhoAir / rhoair; - EXPECT_NEAR(coil1CoolingCoilRate, rhoRatio * state.dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate, 1.0); + EXPECT_NEAR(coil1CoolingCoilRate, rhoRatio * state->dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate, 1.0); EXPECT_NEAR(coil1CoolingCoilRate, rhoRatio * mySys->m_DesignCoolingCapacity, 1.0); // the heating coils are sized differently since SysAirMinFlowRat is not accounted for - EXPECT_LT(coil2HeatingCoilRate, state.dataWaterCoils->WaterCoil(2).DesWaterHeatingCoilRate); + EXPECT_LT(coil2HeatingCoilRate, state->dataWaterCoils->WaterCoil(2).DesWaterHeatingCoilRate); EXPECT_LT(coil2HeatingCoilRate, mySys->m_DesignHeatingCapacity); // add fan to UnitarySystem @@ -558,35 +559,35 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing) // pretend this is first call and UnitarySystem doesn't know the coil index mySys->m_CoolingCoilIndex = 0; mySys->m_HeatingCoilIndex = 0; - state.dataWaterCoils->MySizeFlag = true; - state.dataWaterCoils->WaterCoil(1).DesAirVolFlowRate = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(1).DesInletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(1).DesOutletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(1).DesInletWaterTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(1).DesInletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(1).DesOutletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(2).DesAirVolFlowRate = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(2).DesInletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(2).DesOutletAirTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(2).DesInletWaterTemp = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(2).DesInletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(2).DesOutletAirHumRat = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(2).MaxWaterVolFlowRate = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(2).MaxWaterVolFlowRate = DataSizing::AutoSize; - state.dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate = 0.0; // reset these to be sure they get recalculated - state.dataWaterCoils->WaterCoil(2).DesWaterHeatingCoilRate = 0.0; - - mySys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + state->dataWaterCoils->MySizeFlag = true; + state->dataWaterCoils->WaterCoil(1).DesAirVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(1).DesInletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(1).DesOutletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(1).DesInletWaterTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(1).DesInletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(1).DesOutletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(2).DesAirVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(2).DesInletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(2).DesOutletAirTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(2).DesInletWaterTemp = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(2).DesInletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(2).DesOutletAirHumRat = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(2).MaxWaterVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(2).MaxWaterVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate = 0.0; // reset these to be sure they get recalculated + state->dataWaterCoils->WaterCoil(2).DesWaterHeatingCoilRate = 0.0; + + mySys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); // Show coil sizes in UnitarySystem, cooling coil now includes fan heat // Same sizes as coil on branch with fan heat - EXPECT_NEAR(6672.0 + FanCoolLoad, state.dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate, 1.0); + EXPECT_NEAR(6672.0 + FanCoolLoad, state->dataWaterCoils->WaterCoil(1).DesWaterCoolingCoilRate, 1.0); EXPECT_NEAR(6672.0 + FanCoolLoad, mySys->m_DesignCoolingCapacity, 1.0); - EXPECT_NEAR(20.541, state.dataWaterCoils->WaterCoil(1).DesInletAirTemp, 0.001); // coil inlet does include fan heat + EXPECT_NEAR(20.541, state->dataWaterCoils->WaterCoil(1).DesInletAirTemp, 0.001); // coil inlet does include fan heat // the heating coils are sized differently since SysAirMinFlowRat is not accounted for - EXPECT_NEAR(3848.0, state.dataWaterCoils->WaterCoil(2).DesWaterHeatingCoilRate, 1.0); + EXPECT_NEAR(3848.0, state->dataWaterCoils->WaterCoil(2).DesWaterHeatingCoilRate, 1.0); } TEST_F(ZoneUnitarySysTest, Test_UnitarySystemModel_factory) @@ -786,26 +787,26 @@ TEST_F(ZoneUnitarySysTest, Test_UnitarySystemModel_factory) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above // verify the size of the vector and the processed names // 1 UnitarySystem objects - EXPECT_EQ(1u, state.dataUnitarySystems->unitarySys.size()); + EXPECT_EQ(1u, state->dataUnitarySystems->unitarySys.size()); // test the object name EXPECT_EQ(compName, thisSys->Name); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // set up node conditions to test UnitarySystem set point based control // Unitary system air inlet node = 1 @@ -834,10 +835,10 @@ TEST_F(ZoneUnitarySysTest, Test_UnitarySystemModel_factory) Real64 OAUCoilOutTemp = 0.0; Real64 sensOut = 0.0; Real64 latOut = 0.0; - state.dataGlobal->SysSizingCalc = false; // permits unitary system sizing + state->dataGlobal->SysSizingCalc = false; // permits unitary system sizing EXPECT_EQ(compName, thisSys->Name); // simulate function is overloaded, but only to report back SysOutputProvided and LatOutputProvided. Either signature should give same result. - thisSys->simulate(state, + thisSys->simulate(*state, compName, FirstHVACIteration, AirLoopNum, @@ -990,19 +991,19 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_TwoSpeedDXCoolCoil_Only) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // overwrite outdoor weather temp to variable speed coil rated water temp until this gets fixed DataSizing::DesDayWeath(1).Temp(1) = 29.4; @@ -1022,7 +1023,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_TwoSpeedDXCoolCoil_Only) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -1045,7 +1046,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_TwoSpeedDXCoolCoil_Only) DataLoopNode::Node(1).HumRat = 0.00922; // 17C wb DataLoopNode::Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules // Cooling coil air inlet node = 3 DataLoopNode::Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow @@ -1054,10 +1055,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_TwoSpeedDXCoolCoil_Only) ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // COOLING mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -1273,19 +1274,19 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoolCoil_Only) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // overwrite outdoor weather temp to variable speed coil rated water temp until this gets fixed DataSizing::DesDayWeath(1).Temp(1) = 29.4; @@ -1305,7 +1306,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoolCoil_Only) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -1328,7 +1329,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoolCoil_Only) DataLoopNode::Node(1).HumRat = 0.00922; // 17C wb DataLoopNode::Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules // Cooling coil air inlet node = 3 DataLoopNode::Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow @@ -1337,10 +1338,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoolCoil_Only) ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // COOLING mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -1495,19 +1496,19 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; int AirLoopNum = 0; int CompIndex = 1; @@ -1519,7 +1520,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -1542,7 +1543,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) DataLoopNode::Node(1).HumRat = 0.00922; // 17C wb DataLoopNode::Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules // Heating coil air inlet node = 3 DataLoopNode::Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow @@ -1551,10 +1552,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -1580,7 +1581,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only) DataLoopNode::Node(2).TempSetPoint = 34.0; // Heating mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -1733,19 +1734,19 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Only) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; int AirLoopNum = 0; int CompIndex = 1; @@ -1757,7 +1758,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Only) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -1784,7 +1785,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Only) DataLoopNode::Node(1).HumRat = 0.00922; // 17C wb DataLoopNode::Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules // Heating coil air inlet node = 3 DataLoopNode::Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow @@ -1793,10 +1794,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Only) ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -1828,7 +1829,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageElecHeatCoil_Only) // Heating coil air outlet node = 2 DataLoopNode::Node(2).TempSetPoint = 34.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -1967,19 +1968,19 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_ElecHeatCoil_Only) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; int AirLoopNum = 0; int CompIndex = 1; @@ -1991,7 +1992,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_ElecHeatCoil_Only) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -2014,7 +2015,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_ElecHeatCoil_Only) DataLoopNode::Node(1).HumRat = 0.00922; // 17C wb DataLoopNode::Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules // Heating coil air inlet node = 3 DataLoopNode::Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow @@ -2023,10 +2024,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_ElecHeatCoil_Only) ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -2183,19 +2184,19 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only_ContFan std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; int AirLoopNum = 0; int CompIndex = 1; @@ -2207,7 +2208,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only_ContFan Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -2230,7 +2231,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only_ContFan DataLoopNode::Node(1).HumRat = 0.00922; // 17C wb DataLoopNode::Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules // Heating coil air inlet node = 3 DataLoopNode::Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow @@ -2239,10 +2240,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only_ContFan ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -2269,7 +2270,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiStageGasHeatCoil_Only_ContFan DataLoopNode::Node(2).TempSetPoint = 34.0; // Heating mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -2677,11 +2678,11 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultispeedPerformance) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors // Verify UnitarySystem air flow rates are read in as AutoSized @@ -2689,12 +2690,12 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultispeedPerformance) EXPECT_EQ(thisSys->m_MaxHeatAirVolFlow, DataSizing::AutoSize); EXPECT_EQ(thisSys->m_MaxNoCoolHeatAirVolFlow, DataSizing::AutoSize); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // sizing routine will overwrite water coil air and water inlet nodes with design conditions so no need set set up node conditions yet int AirLoopNum = 0; @@ -2707,7 +2708,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultispeedPerformance) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -2740,10 +2741,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultispeedPerformance) ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // COOLING mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -2771,7 +2772,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultispeedPerformance) DataLoopNode::Node(1).HumRat = 0.00693; // 11C wb DataLoopNode::Node(1).Enthalpy = 31598.76; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -2791,26 +2792,26 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultispeedPerformance) EXPECT_NEAR(DataLoopNode::Node(2).Temp, 16.0, 0.001); // expect design spec data to match inputs - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[0], 0.1000, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[0], 0.1010, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[1], 0.2000, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[1], 0.2010, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[2], 0.3000, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[2], 0.3010, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[3], 0.4000, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[3], 0.4010, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[4], 0.5000, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[4], 0.5010, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[5], 0.6000, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[5], 0.6010, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[6], 0.7000, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[6], 0.7010, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[7], 0.8000, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[7], 0.8010, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[8], 0.9000, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[8], 0.9010, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[9], 1.0000, 0.00001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[9], 1.0000, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[0], 0.1000, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[0], 0.1010, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[1], 0.2000, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[1], 0.2010, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[2], 0.3000, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[2], 0.3010, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[3], 0.4000, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[3], 0.4010, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[4], 0.5000, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[4], 0.5010, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[5], 0.6000, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[5], 0.6010, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[6], 0.7000, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[6], 0.7010, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[7], 0.8000, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[7], 0.8010, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[8], 0.9000, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[8], 0.9010, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[9], 1.0000, 0.00001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[9], 1.0000, 0.00001); // autosized air flow and capacity, unitary sytsem capacity matches coils EXPECT_EQ(thisSys->m_MaxCoolAirVolFlow, 1.5); @@ -2822,70 +2823,70 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultispeedPerformance) EXPECT_EQ(RatedSourceTempCool, 35.0); Real64 CoolCoolCapAtPeak = 32454.876753104443; Real64 TotCapTempModFac = CurveManager::CurveValue( - state, state.dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapFTemp(state.dataVariableSpeedCoils->VarSpeedCoil(1).NormSpedLevel), 17.410329442560833, RatedSourceTempCool); + *state, state->dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapFTemp(state->dataVariableSpeedCoils->VarSpeedCoil(1).NormSpedLevel), 17.410329442560833, RatedSourceTempCool); EXPECT_NEAR(TotCapTempModFac, 0.930018048445091, 0.001); Real64 RatedCapCoolTotalDes = CoolCoolCapAtPeak / TotCapTempModFac; EXPECT_NEAR(RatedCapCoolTotalDes, 34897.0396944, 0.001); EXPECT_NEAR(thisSys->m_DesignCoolingCapacity, RatedCapCoolTotalDes, 0.001); - EXPECT_EQ(thisSys->m_DesignCoolingCapacity, state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedCapCoolTotal); + EXPECT_EQ(thisSys->m_DesignCoolingCapacity, state->dataVariableSpeedCoils->VarSpeedCoil(1).RatedCapCoolTotal); EXPECT_NEAR(thisSys->m_DesignHeatingCapacity, RatedCapCoolTotalDes, 0.001); - EXPECT_EQ(thisSys->m_DesignHeatingCapacity, state.dataVariableSpeedCoils->VarSpeedCoil(2).RatedCapHeat); + EXPECT_EQ(thisSys->m_DesignHeatingCapacity, state->dataVariableSpeedCoils->VarSpeedCoil(2).RatedCapHeat); // variable speed coils size air flow differently than other models. The design air volume flow rate is back calculated from design capacity - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate, - state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedCapCoolTotal * state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowPerRatedTotCap(10)); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate, + state->dataVariableSpeedCoils->VarSpeedCoil(1).RatedCapCoolTotal * state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowPerRatedTotCap(10)); Real64 fullFlow = 1.949442; - EXPECT_NEAR(state.dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate, fullFlow, 0.00001); // different than unitary system air volume flow rate - EXPECT_NEAR(state.dataVariableSpeedCoils->VarSpeedCoil(2).RatedAirVolFlowRate, 1.70, 0.01); // VS DX heating coil was not autosized + EXPECT_NEAR(state->dataVariableSpeedCoils->VarSpeedCoil(1).RatedAirVolFlowRate, fullFlow, 0.00001); // different than unitary system air volume flow rate + EXPECT_NEAR(state->dataVariableSpeedCoils->VarSpeedCoil(2).RatedAirVolFlowRate, 1.70, 0.01); // VS DX heating coil was not autosized // checks on autosized cooling air flow rates EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[1], fullFlow * 0.1, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1), thisSys->m_CoolVolumeFlowRate[1]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1), thisSys->m_CoolVolumeFlowRate[1]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[2], fullFlow * 0.2, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(2), thisSys->m_CoolVolumeFlowRate[2]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(2), thisSys->m_CoolVolumeFlowRate[2]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[3], fullFlow * 0.3, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_CoolVolumeFlowRate[3]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_CoolVolumeFlowRate[3]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[4], fullFlow * 0.4, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(4), thisSys->m_CoolVolumeFlowRate[4]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(4), thisSys->m_CoolVolumeFlowRate[4]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[5], fullFlow * 0.5, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(5), thisSys->m_CoolVolumeFlowRate[5]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(5), thisSys->m_CoolVolumeFlowRate[5]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[6], fullFlow * 0.6, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(6), thisSys->m_CoolVolumeFlowRate[6]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(6), thisSys->m_CoolVolumeFlowRate[6]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[7], fullFlow * 0.7, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(7), thisSys->m_CoolVolumeFlowRate[7]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(7), thisSys->m_CoolVolumeFlowRate[7]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[8], fullFlow * 0.8, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(8), thisSys->m_CoolVolumeFlowRate[8]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(8), thisSys->m_CoolVolumeFlowRate[8]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[9], fullFlow * 0.9, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9), thisSys->m_CoolVolumeFlowRate[9]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9), thisSys->m_CoolVolumeFlowRate[9]); EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[10], fullFlow * 1.0, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(10), thisSys->m_CoolVolumeFlowRate[10]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(10), thisSys->m_CoolVolumeFlowRate[10]); // checks on autosized heating air flow rates EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[1], 0.171700, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(1), thisSys->m_HeatVolumeFlowRate[1]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(1), thisSys->m_HeatVolumeFlowRate[1]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[2], 0.341700, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(2), thisSys->m_HeatVolumeFlowRate[2]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(2), thisSys->m_HeatVolumeFlowRate[2]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[3], 0.511699, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(3), thisSys->m_HeatVolumeFlowRate[3]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(3), thisSys->m_HeatVolumeFlowRate[3]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[4], 0.681699, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(4), thisSys->m_HeatVolumeFlowRate[4]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(4), thisSys->m_HeatVolumeFlowRate[4]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[5], 0.851700, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(5), thisSys->m_HeatVolumeFlowRate[5]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(5), thisSys->m_HeatVolumeFlowRate[5]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[6], 1.021699, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(6), thisSys->m_HeatVolumeFlowRate[6]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(6), thisSys->m_HeatVolumeFlowRate[6]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[7], 1.191700, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(7), thisSys->m_HeatVolumeFlowRate[7]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(7), thisSys->m_HeatVolumeFlowRate[7]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[8], 1.361700, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(8), thisSys->m_HeatVolumeFlowRate[8]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(8), thisSys->m_HeatVolumeFlowRate[8]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[9], 1.531700, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(9), thisSys->m_HeatVolumeFlowRate[9]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(9), thisSys->m_HeatVolumeFlowRate[9]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[10], 1.700000, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(10), thisSys->m_HeatVolumeFlowRate[10]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(10), thisSys->m_HeatVolumeFlowRate[10]); // spot check MSHP volume flow rate data. NOTE: design spec object is 0 based - EXPECT_EQ(thisSys->m_CoolVolumeFlowRate[7], thisSys->m_CoolVolumeFlowRate[10] * state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[6]); - EXPECT_EQ(thisSys->m_HeatVolumeFlowRate[7], thisSys->m_HeatVolumeFlowRate[10] * state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[6]); + EXPECT_EQ(thisSys->m_CoolVolumeFlowRate[7], thisSys->m_CoolVolumeFlowRate[10] * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[6]); + EXPECT_EQ(thisSys->m_HeatVolumeFlowRate[7], thisSys->m_HeatVolumeFlowRate[10] * state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[6]); } TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl) @@ -3052,11 +3053,11 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors // Verify UnitarySystem air flow rates are read in as input @@ -3079,12 +3080,12 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl) DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(2).NodeNumIn = 8; DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(2).NodeNumOut = 9; - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // sizing routine will overwrite water coil air and water inlet nodes with design conditions so no need set set up node conditions yet int AirLoopNum = 0; @@ -3097,7 +3098,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -3154,10 +3155,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl) ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // COOLING mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -3227,7 +3228,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl) thisSys->m_RunOnLatentLoad = true; DataLoopNode::Node(thisSys->AirOutNode).HumRatMax = 0.008; // COOLING mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -3255,7 +3256,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl) DataLoopNode::Node(unitarySystemAirInletNodeIndex).HumRat = 0.00693; // 11C wb DataLoopNode::Node(unitarySystemAirInletNodeIndex).Enthalpy = 31598.76; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -3416,11 +3417,11 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl_Latent) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors auto unitarySystemAirInletNodeIndex = UtilityRoutines::FindItemInList("WATER COOLING COIL AIR INLET NODE", DataLoopNode::NodeID); // was Node 1 @@ -3434,12 +3435,12 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl_Latent) DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = coolingCoilWaterInletNodeIndex; DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = coolingCoilWaterOutletNodeIndex; - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; // sizing routine will overwrite water coil air and water inlet nodes with design conditions so no need set set up node conditions yet int AirLoopNum = 0; @@ -3452,7 +3453,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl_Latent) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -3485,12 +3486,12 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl_Latent) ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Case 0 - COOLING mode - no load, sensible or latent DataLoopNode::Node(coolingCoilAirOutletNodeIndex).HumRatMax = 0.02; DataLoopNode::Node(coolingCoilAirOutletNodeIndex).TempSetPoint = 30.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -3524,7 +3525,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl_Latent) // Case 1 - COOLING mode - sensible control only, no extra dehumidification required DataLoopNode::Node(coolingCoilAirOutletNodeIndex).HumRatMax = 0.02; DataLoopNode::Node(coolingCoilAirOutletNodeIndex).TempSetPoint = 20.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -3558,7 +3559,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl_Latent) // Case 2 - COOLING mode - sensible and latent load, extra dehumidification required DataLoopNode::Node(coolingCoilAirOutletNodeIndex).HumRatMax = 0.009; DataLoopNode::Node(coolingCoilAirOutletNodeIndex).TempSetPoint = 20.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -3592,7 +3593,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl_Latent) // Case 3 - COOLING mode - only latent load DataLoopNode::Node(coolingCoilAirOutletNodeIndex).HumRatMax = 0.009; DataLoopNode::Node(coolingCoilAirOutletNodeIndex).TempSetPoint = 30.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -3628,7 +3629,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_WaterCoilSPControl_Latent) DataLoopNode::Node(thisSys->AirOutNode).HumRatMax = 0.009; Real64 partLoadRatio = thisSys->m_CoolingPartLoadFrac; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -3661,7 +3662,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SetOnOffMassFlowRateTest) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects UnitarySys thisSys; - state.dataUnitarySystems->numUnitarySystems = 1; + state->dataUnitarySystems->numUnitarySystems = 1; Real64 OnOffAirFlowRatio; // This is a return value Real64 PartLoadRatio(1.0); @@ -3674,8 +3675,8 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SetOnOffMassFlowRateTest) DataHVACGlobals::MSHPMassFlowRateLow = 0.0; DataHVACGlobals::MSHPMassFlowRateHigh = 0.0; - thisSys.m_SysAvailSchedPtr = ScheduleManager::GetScheduleIndex(state, "FanAndCoilAvailSched"); // "Get" the schedule inputs - thisSys.m_FanAvailSchedPtr = ScheduleManager::GetScheduleIndex(state, "FanAndCoilAvailSched"); + thisSys.m_SysAvailSchedPtr = ScheduleManager::GetScheduleIndex(*state, "FanAndCoilAvailSched"); // "Get" the schedule inputs + thisSys.m_FanAvailSchedPtr = ScheduleManager::GetScheduleIndex(*state, "FanAndCoilAvailSched"); ScheduleManager::Schedule(1).CurrentValue = 1.0; // set availability and fan schedule to 1 thisSys.m_HeatMassFlowRate.resize(4); @@ -3683,7 +3684,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SetOnOffMassFlowRateTest) thisSys.m_MSHeatingSpeedRatio.resize(4); thisSys.m_MSCoolingSpeedRatio.resize(4); - thisSys.m_LastMode = state.dataUnitarySystems->HeatingMode; + thisSys.m_LastMode = state->dataUnitarySystems->HeatingMode; thisSys.m_IdleMassFlowRate = 0.2; thisSys.m_IdleSpeedRatio = 0.2; thisSys.m_FanAvailSchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); @@ -3706,31 +3707,31 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SetOnOffMassFlowRateTest) // heating load at various speeds thisSys.m_HeatingSpeedNum = 3; thisSys.m_CoolingSpeedNum = 0; - state.dataUnitarySystems->HeatingLoad = true; - state.dataUnitarySystems->CoolingLoad = false; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); + state->dataUnitarySystems->HeatingLoad = true; + state->dataUnitarySystems->CoolingLoad = false; + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); EXPECT_EQ(0.5, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(1.0, DataHVACGlobals::MSHPMassFlowRateHigh); - thisSys.setSpeedVariables(state, state.dataUnitarySystems->HeatingLoad, PartLoadRatio); + thisSys.setSpeedVariables(*state, state->dataUnitarySystems->HeatingLoad, PartLoadRatio); EXPECT_EQ(0.5, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(1.0, DataHVACGlobals::MSHPMassFlowRateHigh); PartLoadRatio = 0.7; // PLR should have no affect for constant fan operating mode - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); EXPECT_EQ(0.5, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(1.0, DataHVACGlobals::MSHPMassFlowRateHigh); - thisSys.setSpeedVariables(state, state.dataUnitarySystems->HeatingLoad, PartLoadRatio); + thisSys.setSpeedVariables(*state, state->dataUnitarySystems->HeatingLoad, PartLoadRatio); EXPECT_EQ(0.5, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(1.0, DataHVACGlobals::MSHPMassFlowRateHigh); PartLoadRatio = 1.0; thisSys.m_HeatingSpeedNum = 2; thisSys.m_CoolingSpeedNum = 0; - state.dataUnitarySystems->HeatingLoad = true; - state.dataUnitarySystems->CoolingLoad = false; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); + state->dataUnitarySystems->HeatingLoad = true; + state->dataUnitarySystems->CoolingLoad = false; + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.5, DataHVACGlobals::MSHPMassFlowRateHigh); @@ -3739,44 +3740,44 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SetOnOffMassFlowRateTest) thisSys.m_HeatingSpeedNum = 1; thisSys.m_CoolingSpeedNum = 0; - state.dataUnitarySystems->HeatingLoad = true; - state.dataUnitarySystems->CoolingLoad = false; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); + state->dataUnitarySystems->HeatingLoad = true; + state->dataUnitarySystems->CoolingLoad = false; + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateHigh); PartLoadRatio = 0.7; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateHigh); - thisSys.setSpeedVariables(state, state.dataUnitarySystems->HeatingLoad, PartLoadRatio); + thisSys.setSpeedVariables(*state, state->dataUnitarySystems->HeatingLoad, PartLoadRatio); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateHigh); PartLoadRatio = 1.0; // heating load with moisture load (cooling coil operates) - state.dataUnitarySystems->MoistureLoad = -0.001; + state->dataUnitarySystems->MoistureLoad = -0.001; thisSys.m_Humidistat = true; thisSys.m_DehumidControlType_Num = UnitarySys::DehumCtrlType::CoolReheat; thisSys.m_CoolingSpeedNum = 3; - state.dataUnitarySystems->HeatingLoad = true; - state.dataUnitarySystems->CoolingLoad = false; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); - EXPECT_EQ(0.6, state.dataUnitarySystems->CompOffMassFlow); - EXPECT_EQ(1.2, state.dataUnitarySystems->CompOnMassFlow); + state->dataUnitarySystems->HeatingLoad = true; + state->dataUnitarySystems->CoolingLoad = false; + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); + EXPECT_EQ(0.6, state->dataUnitarySystems->CompOffMassFlow); + EXPECT_EQ(1.2, state->dataUnitarySystems->CompOnMassFlow); EXPECT_EQ(0.6, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(1.2, DataHVACGlobals::MSHPMassFlowRateHigh); PartLoadRatio = 0.5; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); - EXPECT_EQ(0.6, state.dataUnitarySystems->CompOffMassFlow); - EXPECT_EQ(1.2, state.dataUnitarySystems->CompOnMassFlow); + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); + EXPECT_EQ(0.6, state->dataUnitarySystems->CompOffMassFlow); + EXPECT_EQ(1.2, state->dataUnitarySystems->CompOnMassFlow); EXPECT_EQ(0.6, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(1.2, DataHVACGlobals::MSHPMassFlowRateHigh); PartLoadRatio = 1.0; - state.dataUnitarySystems->MoistureLoad = 0.0; + state->dataUnitarySystems->MoistureLoad = 0.0; thisSys.m_Humidistat = false; thisSys.m_DehumidControlType_Num = UnitarySys::DehumCtrlType::None; @@ -3785,39 +3786,39 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SetOnOffMassFlowRateTest) thisSys.m_HeatingSpeedNum = 1; thisSys.m_CoolingSpeedNum = 0; - state.dataUnitarySystems->HeatingLoad = true; - state.dataUnitarySystems->CoolingLoad = false; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); - EXPECT_EQ(0.0, state.dataUnitarySystems->CompOffMassFlow); - EXPECT_EQ(0.25, state.dataUnitarySystems->CompOnMassFlow); + state->dataUnitarySystems->HeatingLoad = true; + state->dataUnitarySystems->CoolingLoad = false; + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); + EXPECT_EQ(0.0, state->dataUnitarySystems->CompOffMassFlow); + EXPECT_EQ(0.25, state->dataUnitarySystems->CompOnMassFlow); EXPECT_EQ(0.0, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateHigh); // cooling load at various speeds thisSys.m_HeatingSpeedNum = 0; thisSys.m_CoolingSpeedNum = 3; - state.dataUnitarySystems->HeatingLoad = false; - state.dataUnitarySystems->CoolingLoad = true; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); + state->dataUnitarySystems->HeatingLoad = false; + state->dataUnitarySystems->CoolingLoad = true; + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); EXPECT_EQ(0.6, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(1.2, DataHVACGlobals::MSHPMassFlowRateHigh); thisSys.m_HeatingSpeedNum = 0; thisSys.m_CoolingSpeedNum = 2; - state.dataUnitarySystems->HeatingLoad = false; - state.dataUnitarySystems->CoolingLoad = true; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); + state->dataUnitarySystems->HeatingLoad = false; + state->dataUnitarySystems->CoolingLoad = true; + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); EXPECT_EQ(0.3, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.6, DataHVACGlobals::MSHPMassFlowRateHigh); // cycling fan mode should drop to 0 flow rate at speed = 1 thisSys.m_HeatingSpeedNum = 0; thisSys.m_CoolingSpeedNum = 1; - state.dataUnitarySystems->HeatingLoad = false; - state.dataUnitarySystems->CoolingLoad = true; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); - EXPECT_EQ(0.0, state.dataUnitarySystems->CompOffMassFlow); // CompOffMassFlow equal to 0 mass flow rate for cycling fan - EXPECT_EQ(0.3, state.dataUnitarySystems->CompOnMassFlow); + state->dataUnitarySystems->HeatingLoad = false; + state->dataUnitarySystems->CoolingLoad = true; + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); + EXPECT_EQ(0.0, state->dataUnitarySystems->CompOffMassFlow); // CompOffMassFlow equal to 0 mass flow rate for cycling fan + EXPECT_EQ(0.3, state->dataUnitarySystems->CompOnMassFlow); EXPECT_EQ(0.0, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.3, DataHVACGlobals::MSHPMassFlowRateHigh); @@ -3826,45 +3827,45 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SetOnOffMassFlowRateTest) thisSys.m_HeatingSpeedNum = 0; thisSys.m_CoolingSpeedNum = 1; - state.dataUnitarySystems->HeatingLoad = false; - state.dataUnitarySystems->CoolingLoad = true; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); - EXPECT_EQ(0.3, state.dataUnitarySystems->CompOffMassFlow); // CompOffMassFlow equal to speed 1 mass flow rate - EXPECT_EQ(0.3, state.dataUnitarySystems->CompOnMassFlow); + state->dataUnitarySystems->HeatingLoad = false; + state->dataUnitarySystems->CoolingLoad = true; + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); + EXPECT_EQ(0.3, state->dataUnitarySystems->CompOffMassFlow); // CompOffMassFlow equal to speed 1 mass flow rate + EXPECT_EQ(0.3, state->dataUnitarySystems->CompOnMassFlow); EXPECT_EQ(0.3, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.3, DataHVACGlobals::MSHPMassFlowRateHigh); // no load condition (operates at idle speed) thisSys.m_HeatingSpeedNum = 0; thisSys.m_CoolingSpeedNum = 0; - state.dataUnitarySystems->HeatingLoad = false; - state.dataUnitarySystems->CoolingLoad = false; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); - EXPECT_EQ(0.2, state.dataUnitarySystems->CompOffMassFlow); // CompOffMassFlow equal to speed 1 mass flow rate - EXPECT_EQ(0.2, state.dataUnitarySystems->CompOnMassFlow); + state->dataUnitarySystems->HeatingLoad = false; + state->dataUnitarySystems->CoolingLoad = false; + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); + EXPECT_EQ(0.2, state->dataUnitarySystems->CompOffMassFlow); // CompOffMassFlow equal to speed 1 mass flow rate + EXPECT_EQ(0.2, state->dataUnitarySystems->CompOnMassFlow); EXPECT_EQ(0.2, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.2, DataHVACGlobals::MSHPMassFlowRateHigh); thisSys.m_MultiSpeedHeatingCoil = true; thisSys.m_HeatingSpeedNum = 1; - state.dataUnitarySystems->HeatingLoad = true; + state->dataUnitarySystems->HeatingLoad = true; PartLoadRatio = 0.7; // PLR has no impact for constant fan flow case - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateHigh); - thisSys.setSpeedVariables(state, state.dataUnitarySystems->HeatingLoad, PartLoadRatio); + thisSys.setSpeedVariables(*state, state->dataUnitarySystems->HeatingLoad, PartLoadRatio); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateHigh); // test for cycling fan flow case where MSHPMassFlowRateLow variable is proportional to PLR (flow @ 0.25 * PLR @ 0.7 = 0.175) thisSys.m_FanOpMode = DataHVACGlobals::CycFanCycCoil; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); EXPECT_EQ(0.175, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateHigh); - thisSys.setSpeedVariables(state, state.dataUnitarySystems->HeatingLoad, PartLoadRatio); + thisSys.setSpeedVariables(*state, state->dataUnitarySystems->HeatingLoad, PartLoadRatio); EXPECT_EQ(0.175, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.25, DataHVACGlobals::MSHPMassFlowRateHigh); @@ -3872,23 +3873,23 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SetOnOffMassFlowRateTest) thisSys.m_HeatingSpeedNum = 0; thisSys.m_CoolingSpeedNum = 1; thisSys.m_DiscreteSpeedCoolingCoil = true; - state.dataUnitarySystems->HeatingLoad = false; - state.dataUnitarySystems->CoolingLoad = true; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); + state->dataUnitarySystems->HeatingLoad = false; + state->dataUnitarySystems->CoolingLoad = true; + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); EXPECT_EQ(0.21, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.3, DataHVACGlobals::MSHPMassFlowRateHigh); - thisSys.setSpeedVariables(state, state.dataUnitarySystems->CoolingLoad, PartLoadRatio); + thisSys.setSpeedVariables(*state, state->dataUnitarySystems->CoolingLoad, PartLoadRatio); EXPECT_EQ(0.21, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.3, DataHVACGlobals::MSHPMassFlowRateHigh); // and flip back to constant fan and both variables should be the same thisSys.m_FanOpMode = DataHVACGlobals::ContFanCycCoil; - thisSys.setOnOffMassFlowRate(state, OnOffAirFlowRatio, PartLoadRatio); + thisSys.setOnOffMassFlowRate(*state, OnOffAirFlowRatio, PartLoadRatio); EXPECT_EQ(0.3, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.3, DataHVACGlobals::MSHPMassFlowRateHigh); - thisSys.setSpeedVariables(state, state.dataUnitarySystems->CoolingLoad, PartLoadRatio); + thisSys.setSpeedVariables(*state, state->dataUnitarySystems->CoolingLoad, PartLoadRatio); EXPECT_EQ(0.3, DataHVACGlobals::MSHPMassFlowRateLow); EXPECT_EQ(0.3, DataHVACGlobals::MSHPMassFlowRateHigh); } @@ -3931,7 +3932,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ConfirmUnitarySystemSizingTest) UnitarySys thisSys; UnitarySys *mySys(&thisSys); - state.dataUnitarySystems->numUnitarySystems = 1; + state->dataUnitarySystems->numUnitarySystems = 1; thisSys.UnitType = "AirLoopHVAC:UnitarySystem"; thisSys.m_MultiOrVarSpeedCoolCoil = false; @@ -3975,7 +3976,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ConfirmUnitarySystemSizingTest) // for FlowPerCoolingCapacity, do the division so sizing will yield 1.005 if (iSizingType == DataSizing::FlowPerCoolingCapacity) thisSys.m_MaxCoolAirVolFlow = 1.005 / 18827.616766698276; - mySys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + mySys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); EXPECT_EQ(1.005, thisSys.m_DesignFanVolFlowRate); EXPECT_EQ(1.005, thisSys.m_MaxCoolAirVolFlow); @@ -3994,7 +3995,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ConfirmUnitarySystemSizingTest) thisSys.m_MaxNoCoolHeatAirVolFlow = DataSizing::AutoSize; thisSys.m_DesignFanVolFlowRate = DataSizing::AutoSize; - mySys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + mySys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); EXPECT_EQ(1.005, thisSys.m_DesignFanVolFlowRate); EXPECT_EQ(1.005, thisSys.m_MaxCoolAirVolFlow); @@ -4035,7 +4036,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ConfirmUnitarySystemSizingTest) // for FlowPerHeatingCapacity, do the division so sizing will yield 1.005 if (iSizingType == DataSizing::FlowPerHeatingCapacity) thisSys.m_MaxHeatAirVolFlow = 1.005 / 15148.243236712493; - mySys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + mySys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); EXPECT_NEAR(1.005, thisSys.m_DesignFanVolFlowRate, 0.0000000001); EXPECT_NEAR(1.005, thisSys.m_MaxCoolAirVolFlow, 0.0000000001); @@ -4054,7 +4055,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ConfirmUnitarySystemSizingTest) thisSys.m_MaxNoCoolHeatAirVolFlow = DataSizing::AutoSize; thisSys.m_DesignFanVolFlowRate = DataSizing::AutoSize; - mySys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + mySys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); EXPECT_EQ(1.005, thisSys.m_DesignFanVolFlowRate); EXPECT_EQ(0.0, thisSys.m_MaxCoolAirVolFlow); @@ -4110,7 +4111,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ConfirmUnitarySystemSizingTest) // for FlowPerHeatingCapacity, do the division so sizing will yield 1.005 if (iHeatingSizingType == DataSizing::FlowPerHeatingCapacity) thisSys.m_MaxHeatAirVolFlow = 1.005 / 1431.9234900374995; - mySys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + mySys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); EXPECT_NEAR(1.005, thisSys.m_DesignFanVolFlowRate, 0.0000000001); EXPECT_NEAR(1.005, thisSys.m_MaxCoolAirVolFlow, 0.0000000001); @@ -4133,20 +4134,20 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) Real64 AirMassFlowRate(0.0); UnitarySys thisSys; - state.dataUnitarySystems->numUnitarySystems = 1; + state->dataUnitarySystems->numUnitarySystems = 1; DataPlant::TotNumLoops = 1; DataPlant::PlantLoop.allocate(DataPlant::TotNumLoops); thisSys.m_MultiOrVarSpeedHeatCoil = true; thisSys.m_MultiOrVarSpeedCoolCoil = true; DataLoopNode::Node.allocate(10); - state.dataWaterCoils->WaterCoil.allocate(1); + state->dataWaterCoils->WaterCoil.allocate(1); thisSys.m_HeatMassFlowRate.resize(4); thisSys.m_CoolMassFlowRate.resize(4); thisSys.m_MSHeatingSpeedRatio.resize(4); thisSys.m_MSCoolingSpeedRatio.resize(4); - thisSys.m_LastMode = state.dataUnitarySystems->HeatingMode; + thisSys.m_LastMode = state->dataUnitarySystems->HeatingMode; thisSys.m_IdleMassFlowRate = 0.2; thisSys.m_IdleSpeedRatio = 0.2; thisSys.m_FanAvailSchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); @@ -4169,14 +4170,14 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) thisSys.m_HeatingSpeedNum = 3; thisSys.m_NumOfSpeedCooling = 3; thisSys.m_CoolingSpeedNum = 0; - state.dataUnitarySystems->HeatingLoad = true; - state.dataUnitarySystems->CoolingLoad = false; + state->dataUnitarySystems->HeatingLoad = true; + state->dataUnitarySystems->CoolingLoad = false; // cycling fan mode thisSys.m_FanOpMode = DataHVACGlobals::CycFanCycCoil; // heating load only - state.dataUnitarySystems->MoistureLoad = 0.0; + state->dataUnitarySystems->MoistureLoad = 0.0; HeatCoilLoad = 12000.0; thisSys.m_Humidistat = false; @@ -4189,45 +4190,45 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) thisSys.m_HeatingCycRatio = 1.0; thisSys.m_HeatingSpeedNum = 3; - state.dataWaterCoils->CheckEquipName.allocate(1); - state.dataWaterCoils->NumWaterCoils = 1; - state.dataWaterCoils->GetWaterCoilsInputFlag = false; - state.dataWaterCoils->WaterCoil(1).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); - state.dataWaterCoils->WaterCoil(1).Name = "Water Heating Coil"; - state.dataWaterCoils->WaterCoil(1).WaterCoilType = DataHVACGlobals::Coil_HeatingWater; - state.dataWaterCoils->WaterCoil(1).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - state.dataWaterCoils->WaterCoil(1).DesAirVolFlowRate = 1.0; - state.dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).UACoil = 400.0; - state.dataWaterCoils->WaterCoil(1).InletAirTemp = 10.0; - state.dataWaterCoils->WaterCoil(1).InletAirEnthalpy = 18000.0; - state.dataWaterCoils->WaterCoil(1).InletAirHumRat = - Psychrometrics::PsyWFnTdbH(state, state.dataWaterCoils->WaterCoil(1).InletAirTemp, state.dataWaterCoils->WaterCoil(1).InletAirEnthalpy); - - state.dataWaterCoils->WaterCoil(1).AirInletNodeNum = 4; - state.dataWaterCoils->WaterCoil(1).AirOutletNodeNum = 5; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).Temp = 10.0; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).Enthalpy = 18000; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).HumRat = Psychrometrics::PsyWFnTdbH(state, - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).Temp, DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).Enthalpy); - - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMax = AirMassFlowRate; - - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum = 6; - state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum = 7; - state.dataWaterCoils->WaterCoil(1).InletWaterTemp = 60.0; - state.dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = state.dataWaterCoils->WaterCoil(1).InletWaterTemp; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + state->dataWaterCoils->CheckEquipName.allocate(1); + state->dataWaterCoils->NumWaterCoils = 1; + state->dataWaterCoils->GetWaterCoilsInputFlag = false; + state->dataWaterCoils->WaterCoil(1).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); + state->dataWaterCoils->WaterCoil(1).Name = "Water Heating Coil"; + state->dataWaterCoils->WaterCoil(1).WaterCoilType = DataHVACGlobals::Coil_HeatingWater; + state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + state->dataWaterCoils->WaterCoil(1).DesAirVolFlowRate = 1.0; + state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).UACoil = 400.0; + state->dataWaterCoils->WaterCoil(1).InletAirTemp = 10.0; + state->dataWaterCoils->WaterCoil(1).InletAirEnthalpy = 18000.0; + state->dataWaterCoils->WaterCoil(1).InletAirHumRat = + Psychrometrics::PsyWFnTdbH(*state, state->dataWaterCoils->WaterCoil(1).InletAirTemp, state->dataWaterCoils->WaterCoil(1).InletAirEnthalpy); + + state->dataWaterCoils->WaterCoil(1).AirInletNodeNum = 4; + state->dataWaterCoils->WaterCoil(1).AirOutletNodeNum = 5; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).Temp = 10.0; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).Enthalpy = 18000; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).HumRat = Psychrometrics::PsyWFnTdbH(*state, + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).Temp, DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).Enthalpy); + + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMax = AirMassFlowRate; + + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum = 6; + state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum = 7; + state->dataWaterCoils->WaterCoil(1).InletWaterTemp = 60.0; + state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = state->dataWaterCoils->WaterCoil(1).InletWaterTemp; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; for (int l = 1; l <= DataPlant::TotNumLoops; ++l) { auto &loop(DataPlant::PlantLoop(l)); @@ -4243,20 +4244,20 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryHeatingSystem) DataPlant::PlantLoop(1).FluidName = "FluidWaterLoop"; DataPlant::PlantLoop(1).FluidIndex = 1; DataPlant::PlantLoop(1).FluidName = "WATER"; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; thisSys.m_HeatingCoilIndex = 1; - thisSys.m_HeatingCoilName = state.dataWaterCoils->WaterCoil(1).Name; - thisSys.HeatCoilFluidInletNode = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - thisSys.HeatCoilFluidOutletNodeNum = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; - state.dataGlobal->DoingSizing = true; - state.dataWaterCoils->WaterCoil(1).TotWaterHeatingCoilRate = 0.0; + thisSys.m_HeatingCoilName = state->dataWaterCoils->WaterCoil(1).Name; + thisSys.HeatCoilFluidInletNode = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + thisSys.HeatCoilFluidOutletNodeNum = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + state->dataGlobal->DoingSizing = true; + state->dataWaterCoils->WaterCoil(1).TotWaterHeatingCoilRate = 0.0; - thisSys.calcUnitaryHeatingSystem(state, AirLoopNum, FirstHVACIteration, thisSys.m_HeatingCycRatio, CompOn, OnOffAirFlowRatio, HeatCoilLoad); + thisSys.calcUnitaryHeatingSystem(*state, AirLoopNum, FirstHVACIteration, thisSys.m_HeatingCycRatio, CompOn, OnOffAirFlowRatio, HeatCoilLoad); - EXPECT_NEAR(15750.0, state.dataWaterCoils->WaterCoil(1).TotWaterHeatingCoilRate, 2.0); + EXPECT_NEAR(15750.0, state->dataWaterCoils->WaterCoil(1).TotWaterHeatingCoilRate, 2.0); } TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) @@ -4272,7 +4273,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) Real64 ColdWaterMassFlowRate(0.0); UnitarySys thisSys; - state.dataUnitarySystems->numUnitarySystems = 1; + state->dataUnitarySystems->numUnitarySystems = 1; DataPlant::TotNumLoops = 1; DataPlant::PlantLoop.allocate(DataPlant::TotNumLoops); @@ -4284,13 +4285,13 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) thisSys.m_MultiOrVarSpeedHeatCoil = true; thisSys.m_MultiOrVarSpeedCoolCoil = true; DataLoopNode::Node.allocate(10); - state.dataWaterCoils->WaterCoil.allocate(1); + state->dataWaterCoils->WaterCoil.allocate(1); thisSys.m_HeatMassFlowRate.resize(4); thisSys.m_CoolMassFlowRate.resize(4); thisSys.m_MSHeatingSpeedRatio.resize(4); thisSys.m_MSCoolingSpeedRatio.resize(4); - thisSys.m_LastMode = state.dataUnitarySystems->HeatingMode; + thisSys.m_LastMode = state->dataUnitarySystems->HeatingMode; thisSys.m_IdleMassFlowRate = 0.2; thisSys.m_IdleSpeedRatio = 0.2; thisSys.m_FanAvailSchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); @@ -4315,9 +4316,9 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) thisSys.m_HeatingSpeedNum = 0; thisSys.m_NumOfSpeedCooling = 3; thisSys.m_CoolingSpeedNum = 3; - state.dataUnitarySystems->HeatingLoad = false; - state.dataUnitarySystems->CoolingLoad = true; - state.dataUnitarySystems->MoistureLoad = 0.0; + state->dataUnitarySystems->HeatingLoad = false; + state->dataUnitarySystems->CoolingLoad = true; + state->dataUnitarySystems->MoistureLoad = 0.0; AirMassFlowRate = 1.0; HotWaterMassFlowRate = 1.0; ColdWaterMassFlowRate = 1.0; @@ -4329,57 +4330,57 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) thisSys.m_CoolingCycRatio = 1.0; thisSys.m_CoolingSpeedNum = 3; - state.dataWaterCoils->CheckEquipName.allocate(1); - state.dataWaterCoils->NumWaterCoils = 1; - state.dataWaterCoils->GetWaterCoilsInputFlag = false; - state.dataWaterCoils->WaterCoil(1).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); - state.dataWaterCoils->WaterCoil(1).Name = "Water Cooling Coil"; - state.dataWaterCoils->WaterCoil(1).WaterCoilType = state.dataWaterCoils->CoilType_Cooling; - state.dataWaterCoils->WaterCoil(1).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_Cooling; - state.dataWaterCoils->WaterCoil(1).WaterCoilModel = state.dataWaterCoils->CoilModel_Cooling; - state.dataWaterCoils->WaterCoil(1).DesAirVolFlowRate = 1.0; - state.dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = ColdWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).CoolingCoilAnalysisMode = state.dataWaterCoils->SimpleAnalysis; - state.dataWaterCoils->WaterCoil(1).HeatExchType = state.dataWaterCoils->CrossFlow; - state.dataWaterCoils->WaterCoil(1).UACoilTotal = 4689.0; - state.dataWaterCoils->WaterCoil(1).UACoilExternal = 6110.0; - state.dataWaterCoils->WaterCoil(1).UACoilInternal = 20164.0; - state.dataWaterCoils->WaterCoil(1).TotCoilOutsideSurfArea = 50.0; - - state.dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = 0.001; - state.dataWaterCoils->WaterCoil(1).DesInletWaterTemp = 6.67; - state.dataWaterCoils->WaterCoil(1).DesInletAirTemp = 30.0; - state.dataWaterCoils->WaterCoil(1).DesOutletAirTemp = 12.0; - state.dataWaterCoils->WaterCoil(1).DesInletAirHumRat = 0.013; - state.dataWaterCoils->WaterCoil(1).DesOutletAirHumRat = 0.008; - state.dataWaterCoils->WaterCoil(1).AirInletNodeNum = 4; - state.dataWaterCoils->WaterCoil(1).AirOutletNodeNum = 5; - state.dataWaterCoils->WaterCoil(1).InletAirTemp = 30.0; - state.dataWaterCoils->WaterCoil(1).InletAirEnthalpy = 53000; - state.dataWaterCoils->WaterCoil(1).InletAirHumRat = - Psychrometrics::PsyWFnTdbH(state, state.dataWaterCoils->WaterCoil(1).InletAirTemp, state.dataWaterCoils->WaterCoil(1).InletAirEnthalpy); - state.dataWaterCoils->WaterCoil(1).InletWaterTemp = 6.0; - state.dataWaterCoils->WaterCoil(1).InletAirMassFlowRate = AirMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMax = AirMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).Temp = 30.0; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).Enthalpy = 53000; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).HumRat = Psychrometrics::PsyWFnTdbH(state, - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).Temp, DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).Enthalpy); - - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum = 6; - state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum = 7; - state.dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = ColdWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = ColdWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = state.dataWaterCoils->WaterCoil(1).InletWaterTemp; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + state->dataWaterCoils->CheckEquipName.allocate(1); + state->dataWaterCoils->NumWaterCoils = 1; + state->dataWaterCoils->GetWaterCoilsInputFlag = false; + state->dataWaterCoils->WaterCoil(1).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); + state->dataWaterCoils->WaterCoil(1).Name = "Water Cooling Coil"; + state->dataWaterCoils->WaterCoil(1).WaterCoilType = state->dataWaterCoils->CoilType_Cooling; + state->dataWaterCoils->WaterCoil(1).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_Cooling; + state->dataWaterCoils->WaterCoil(1).WaterCoilModel = state->dataWaterCoils->CoilModel_Cooling; + state->dataWaterCoils->WaterCoil(1).DesAirVolFlowRate = 1.0; + state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = ColdWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).CoolingCoilAnalysisMode = state->dataWaterCoils->SimpleAnalysis; + state->dataWaterCoils->WaterCoil(1).HeatExchType = state->dataWaterCoils->CrossFlow; + state->dataWaterCoils->WaterCoil(1).UACoilTotal = 4689.0; + state->dataWaterCoils->WaterCoil(1).UACoilExternal = 6110.0; + state->dataWaterCoils->WaterCoil(1).UACoilInternal = 20164.0; + state->dataWaterCoils->WaterCoil(1).TotCoilOutsideSurfArea = 50.0; + + state->dataWaterCoils->WaterCoil(1).MaxWaterVolFlowRate = 0.001; + state->dataWaterCoils->WaterCoil(1).DesInletWaterTemp = 6.67; + state->dataWaterCoils->WaterCoil(1).DesInletAirTemp = 30.0; + state->dataWaterCoils->WaterCoil(1).DesOutletAirTemp = 12.0; + state->dataWaterCoils->WaterCoil(1).DesInletAirHumRat = 0.013; + state->dataWaterCoils->WaterCoil(1).DesOutletAirHumRat = 0.008; + state->dataWaterCoils->WaterCoil(1).AirInletNodeNum = 4; + state->dataWaterCoils->WaterCoil(1).AirOutletNodeNum = 5; + state->dataWaterCoils->WaterCoil(1).InletAirTemp = 30.0; + state->dataWaterCoils->WaterCoil(1).InletAirEnthalpy = 53000; + state->dataWaterCoils->WaterCoil(1).InletAirHumRat = + Psychrometrics::PsyWFnTdbH(*state, state->dataWaterCoils->WaterCoil(1).InletAirTemp, state->dataWaterCoils->WaterCoil(1).InletAirEnthalpy); + state->dataWaterCoils->WaterCoil(1).InletWaterTemp = 6.0; + state->dataWaterCoils->WaterCoil(1).InletAirMassFlowRate = AirMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMax = AirMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).Temp = 30.0; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).Enthalpy = 53000; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).HumRat = Psychrometrics::PsyWFnTdbH(*state, + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).Temp, DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).Enthalpy); + + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum = 6; + state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum = 7; + state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = ColdWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = ColdWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = state->dataWaterCoils->WaterCoil(1).InletWaterTemp; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; for (int l = 1; l <= DataPlant::TotNumLoops; ++l) { auto &loop(DataPlant::PlantLoop(l)); @@ -4395,25 +4396,25 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_CalcUnitaryCoolingSystem) DataPlant::PlantLoop(1).FluidName = "FluidWaterLoop"; DataPlant::PlantLoop(1).FluidIndex = 1; DataPlant::PlantLoop(1).FluidName = "WATER"; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; thisSys.m_CoolingCoilIndex = 1; - thisSys.m_CoolingCoilName = state.dataWaterCoils->WaterCoil(1).Name; - thisSys.CoolCoilFluidInletNode = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - thisSys.CoolCoilFluidOutletNodeNum = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + thisSys.m_CoolingCoilName = state->dataWaterCoils->WaterCoil(1).Name; + thisSys.CoolCoilFluidInletNode = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + thisSys.CoolCoilFluidOutletNodeNum = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataGlobal->DoingSizing = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataGlobal->DoingSizing = true; - state.dataWaterCoils->WaterCoil(1).TotWaterCoolingCoilRate = 0.0; + state->dataWaterCoils->WaterCoil(1).TotWaterCoolingCoilRate = 0.0; thisSys.calcUnitaryCoolingSystem( - state, AirLoopNum, FirstHVACIteration, thisSys.m_CoolingCycRatio, CompOn, OnOffAirFlowRatio, CoilCoolHeatRat, false); + *state, AirLoopNum, FirstHVACIteration, thisSys.m_CoolingCycRatio, CompOn, OnOffAirFlowRatio, CoilCoolHeatRat, false); - EXPECT_NEAR(27530.0, state.dataWaterCoils->WaterCoil(1).TotWaterCoolingCoilRate, 2.0); + EXPECT_NEAR(27530.0, state->dataWaterCoils->WaterCoil(1).TotWaterCoolingCoilRate, 2.0); } TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput) @@ -4628,10 +4629,10 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData1(state); // read zone equipment configuration and list objects + DataZoneEquipment::GetZoneEquipmentData1(*state); // read zone equipment configuration and list objects DataSizing::ZoneEqSizing.allocate(1); DataZoneEquipment::ZoneEquipList(1).EquipIndex.allocate(1); @@ -4641,17 +4642,17 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput) bool zoneEquipment = true; int compTypeOfNum = DataHVACGlobals::UnitarySys_AnyCoilType; FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, compTypeOfNum, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, compTypeOfNum, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - ASSERT_EQ(1, state.dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects + ASSERT_EQ(1, state->dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects EXPECT_EQ(thisSys->UnitType, DataHVACGlobals::cFurnaceTypes(compTypeOfNum)); // compare UnitarySystem type string to valid type - state.dataGlobal->SysSizingCalc = true; // DISABLE SIZING - don't call UnitarySystem::sizeSystem, much more work needed to set up sizing arrays + state->dataGlobal->SysSizingCalc = true; // DISABLE SIZING - don't call UnitarySystem::sizeSystem, much more work needed to set up sizing arrays InletNode = thisSys->AirInNode; OutletNode = thisSys->AirOutNode; @@ -4694,8 +4695,8 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput) // This line tests case where other zone equipment changes deadband status DataZoneEnergyDemands::CurDeadBandOrSetback(1) = true; ScheduleManager::Schedule(1).CurrentValue = 1.0; - state.dataGlobal->BeginEnvrnFlag = true; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); // initialize RhoAir + state->dataGlobal->BeginEnvrnFlag = true; + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir DataLoopNode::Node(InletNode).MassFlowRateMaxAvail = thisSys->m_MaxCoolAirVolFlow * DataEnvironment::StdRhoAir; int AirLoopNum = 0; @@ -4708,7 +4709,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -4753,7 +4754,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput) DXCoils::DXCoil(1).RatedCBF(1) = 0.1; // autosizing is disabled so initialize coil bypass factor DXCoils::DXCoil(1).RatedAirMassFlowRate(1) = 1.9268939689375426; // autosizing is disabled so initialize cooling coil rated air mass flow rate - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -4787,7 +4788,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput) thisSys->m_ValidASHRAECoolCoil = true; thisSys->m_ValidASHRAEHeatCoil = true; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -4809,7 +4810,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput) // turn on dehumidification control and check that moisture load is < 0 thisSys->m_DehumidControlType_Num = UnitarySys::DehumCtrlType::CoolReheat; thisSys->m_RunOnLatentLoad = true; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -5173,23 +5174,23 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VSDXCoilSizing) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData1(state); // read zone equipment configuration and list objects + DataZoneEquipment::GetZoneEquipmentData1(*state); // read zone equipment configuration and list objects DataZoneEquipment::ZoneEquipList(1).EquipIndex.allocate(1); DataZoneEquipment::ZoneEquipList(1).EquipIndex(1) = 1; // initialize equipment index for ZoneHVAC std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInput(state, compName, zoneEquipment, 0); // get UnitarySystem input from object above + thisSys->getUnitarySystemInput(*state, compName, zoneEquipment, 0); // get UnitarySystem input from object above - ASSERT_EQ(1, state.dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects + ASSERT_EQ(1, state->dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects ASSERT_EQ(thisSys->m_DesignHeatingCapacity, DataSizing::AutoSize); } @@ -5508,10 +5509,10 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData1(state); // read zone equipment configuration and list objects + DataZoneEquipment::GetZoneEquipmentData1(*state); // read zone equipment configuration and list objects DataSizing::ZoneEqSizing.allocate(1); DataZoneEquipment::ZoneEquipList(1).EquipIndex.allocate(1); @@ -5520,16 +5521,16 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils) std::string compName = "UNITARY SYSTEM MODEL"; int compTypeOfNum = DataHVACGlobals::UnitarySys_AnyCoilType; bool zoneEquipment = true; - UnitarySystems::UnitarySys::factory(state, compTypeOfNum, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, compTypeOfNum, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInput(state, compName, zoneEquipment, 0); // get UnitarySystem input from object above + thisSys->getUnitarySystemInput(*state, compName, zoneEquipment, 0); // get UnitarySystem input from object above - ASSERT_EQ(1, state.dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects + ASSERT_EQ(1, state->dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects EXPECT_EQ(thisSys->UnitType, DataHVACGlobals::cFurnaceTypes(compTypeOfNum)); // compare UnitarySystem type string to valid type - state.dataGlobal->SysSizingCalc = false; // DISABLE SIZING - don't call UnitarySystem::sizeSystem, much more work needed to set up sizing arrays + state->dataGlobal->SysSizingCalc = false; // DISABLE SIZING - don't call UnitarySystem::sizeSystem, much more work needed to set up sizing arrays InletNode = thisSys->AirInNode; OutletNode = thisSys->AirOutNode; @@ -5575,11 +5576,11 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils) DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; ScheduleManager::Schedule(1).CurrentValue = 1.0; // FanAndCoilAvailSchedule ScheduleManager::Schedule(2).CurrentValue = 1.0; // ContinuousFanSchedule - state.dataGlobal->BeginEnvrnFlag = true; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); // initialize RhoAir + state->dataGlobal->BeginEnvrnFlag = true; + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir DataLoopNode::Node(InletNode).MassFlowRateMaxAvail = thisSys->m_MaxCoolAirVolFlow * DataEnvironment::StdRhoAir; - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); int AirLoopNum = 0; int CompIndex = 1; @@ -5591,7 +5592,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -5631,7 +5632,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils) DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::OutWetBulbTemp = 30.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -5970,10 +5971,10 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils_CyclingFan) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData1(state); // read zone equipment configuration and list objects + DataZoneEquipment::GetZoneEquipmentData1(*state); // read zone equipment configuration and list objects DataSizing::ZoneEqSizing.allocate(1); DataZoneEquipment::ZoneEquipList(1).EquipIndex.allocate(1); @@ -5982,16 +5983,16 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils_CyclingFan) std::string compName = "UNITARY SYSTEM MODEL"; int compTypeOfNum = DataHVACGlobals::UnitarySys_AnyCoilType; bool zoneEquipment = true; - UnitarySystems::UnitarySys::factory(state, compTypeOfNum, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, compTypeOfNum, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInput(state, compName, zoneEquipment, 0); // get UnitarySystem input from object above + thisSys->getUnitarySystemInput(*state, compName, zoneEquipment, 0); // get UnitarySystem input from object above - ASSERT_EQ(1, state.dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects + ASSERT_EQ(1, state->dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects EXPECT_EQ(thisSys->UnitType, DataHVACGlobals::cFurnaceTypes(compTypeOfNum)); // compare UnitarySystem type string to valid type - state.dataGlobal->SysSizingCalc = false; // DISABLE SIZING - don't call UnitarySystem::sizeSystem, much more work needed to set up sizing arrays + state->dataGlobal->SysSizingCalc = false; // DISABLE SIZING - don't call UnitarySystem::sizeSystem, much more work needed to set up sizing arrays InletNode = thisSys->AirInNode; OutletNode = thisSys->AirOutNode; @@ -6034,11 +6035,11 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils_CyclingFan) DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; ScheduleManager::Schedule(1).CurrentValue = 1.0; - state.dataGlobal->BeginEnvrnFlag = true; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); // initialize RhoAir + state->dataGlobal->BeginEnvrnFlag = true; + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir DataLoopNode::Node(InletNode).MassFlowRateMaxAvail = thisSys->m_MaxCoolAirVolFlow * DataEnvironment::StdRhoAir; - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); int AirLoopNum = 0; int CompIndex = 1; @@ -6050,7 +6051,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils_CyclingFan) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -6097,7 +6098,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_VarSpeedCoils_CyclingFan) DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::OutWetBulbTemp = 30.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -6295,21 +6296,21 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetBadSupplyAirMethodInput) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData1(state); // read zone equipment configuration and list objects + DataZoneEquipment::GetZoneEquipmentData1(*state); // read zone equipment configuration and list objects HeatingCoils::GetCoilsInputFlag = true; HeatingCoils::HeatingCoil.deallocate(); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_TRUE(ErrorsFound); // expect error on ill-formed input } @@ -6729,24 +6730,24 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ReportingTest) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - 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); + 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); - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData(state); // read zone equipment + DataZoneEquipment::GetZoneEquipmentData(*state); // read zone equipment std::string compName = "UNITARY SYSTEM MODEL"; int compTypeOfNum = DataHVACGlobals::UnitarySys_AnyCoilType; bool zoneEquipment = true; - UnitarySystems::UnitarySys::factory(state, compTypeOfNum, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, compTypeOfNum, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above - ASSERT_EQ(1, state.dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects + ASSERT_EQ(1, state->dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects EXPECT_EQ(thisSys->UnitType, DataHVACGlobals::cFurnaceTypes(compTypeOfNum)); // compare UnitarySystem type string to valid type InletNode = thisSys->AirInNode; @@ -6754,12 +6755,12 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ReportingTest) ControlZoneNum = thisSys->NodeNumOfControlledZone; AirLoopNum = 0; - state.dataUnitarySystems->HeatingLoad = false; - state.dataUnitarySystems->CoolingLoad = false; + state->dataUnitarySystems->HeatingLoad = false; + state->dataUnitarySystems->CoolingLoad = false; // zone predicted load is assume to be heating and the unitary system zone equipment // inlet and outlet air conditions were set for heating - state.dataUnitarySystems->HeatingLoad = true; + state->dataUnitarySystems->HeatingLoad = true; // set up zone equipment inlet node condtions DataLoopNode::Node(InletNode).Temp = 17.57; DataLoopNode::Node(InletNode).HumRat = 0.007; @@ -6777,7 +6778,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ReportingTest) Psychrometrics::PsyHFnTdbW(DataLoopNode::Node(ControlZoneNum).Temp, DataLoopNode::Node(ControlZoneNum).HumRat); // calculate the "Unitary System Total Cooling/Heating Rate" report variables - thisSys->reportUnitarySystem(state, AirLoopNum); + thisSys->reportUnitarySystem(*state, AirLoopNum); EXPECT_NEAR(483.5, thisSys->m_TotCoolEnergyRate, 1.0); EXPECT_EQ(0.0, thisSys->m_TotHeatEnergyRate); } @@ -7462,26 +7463,26 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXCoilSizing) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); createFacilityElectricPowerServiceObject(); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->DoingSizing = true; - SizingManager::ManageSizing(state); - state.dataGlobal->DoingSizing = false; - state.dataGlobal->SysSizingCalc = false; + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->DoingSizing = true; + SizingManager::ManageSizing(*state); + state->dataGlobal->DoingSizing = false; + state->dataGlobal->SysSizingCalc = false; DataSizing::CurZoneEqNum = 1; DataSizing::ZoneEqSizing.allocate(1); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool ErrorsFound = false; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); DataSizing::ZoneSizingRunDone = true; DataSizing::ZoneEqSizing(DataSizing::CurZoneEqNum).DesignSizeFromParent = false; @@ -7491,16 +7492,16 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXCoilSizing) bool FirstHVACIteration = true; int AirLoopNum = 0; - thisSys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + thisSys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); - EXPECT_EQ(1, state.dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects + EXPECT_EQ(1, state->dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects EXPECT_EQ(thisSys->m_DesignHeatingCapacity * 0.00005, thisSys->m_MaxHeatAirVolFlow); EXPECT_EQ(thisSys->m_DesignCoolingCapacity * 0.00005, thisSys->m_MaxCoolAirVolFlow); EXPECT_EQ(thisSys->m_DesignCoolingCapacity, DXCoils::DXCoil(thisSys->m_CoolingCoilIndex).MSRatedTotCap(thisSys->m_NumOfSpeedCooling)); // 64-bit MSVS shows these next variables as identical yet other compilers show diff's, changing ASSERT_EQ to EXPECT_NEAR EXPECT_NEAR(thisSys->m_DesignHeatingCapacity, - state.dataVariableSpeedCoils->VarSpeedCoil(thisSys->m_HeatingCoilIndex).MSRatedTotCap(thisSys->m_NumOfSpeedHeating), + state->dataVariableSpeedCoils->VarSpeedCoil(thisSys->m_HeatingCoilIndex).MSRatedTotCap(thisSys->m_NumOfSpeedHeating), 0.001); // 3 cooling speeds with autosized MSHP design spec yielding equally distributed air flow at 1/3 per speed @@ -7511,41 +7512,41 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXCoilSizing) EXPECT_NEAR(thisSys->m_CoolVolumeFlowRate[3], 0.098323, 0.000001); EXPECT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_CoolVolumeFlowRate[3], 0.000001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[0], 0.333333, 0.000001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[1], 0.666666, 0.000001); - EXPECT_NEAR(state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[2], 1.000000, 0.000001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[0], 0.333333, 0.000001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[1], 0.666666, 0.000001); + EXPECT_NEAR(state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[2], 1.000000, 0.000001); EXPECT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(1), - thisSys->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[0], + thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[0], 0.000001); EXPECT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(2), - thisSys->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[1], + thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[1], 0.000001); EXPECT_NEAR(DXCoils::DXCoil(1).MSRatedAirVolFlowRate(3), - thisSys->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[2], + thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[2], 0.000001); // 10 heating speeds with autosized MSHP design spec yielding equally distributed air flow at 1/10 per speed EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[1], 0.008237, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1), thisSys->m_HeatVolumeFlowRate[1]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1), thisSys->m_HeatVolumeFlowRate[1]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[2], 0.016473, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(2), thisSys->m_HeatVolumeFlowRate[2]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(2), thisSys->m_HeatVolumeFlowRate[2]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[3], 0.024710, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_HeatVolumeFlowRate[3]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(3), thisSys->m_HeatVolumeFlowRate[3]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[4], 0.032946, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(4), thisSys->m_HeatVolumeFlowRate[4]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(4), thisSys->m_HeatVolumeFlowRate[4]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[5], 0.041183, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(5), thisSys->m_HeatVolumeFlowRate[5]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(5), thisSys->m_HeatVolumeFlowRate[5]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[6], 0.049420, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(6), thisSys->m_HeatVolumeFlowRate[6]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(6), thisSys->m_HeatVolumeFlowRate[6]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[7], 0.057656, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(7), thisSys->m_HeatVolumeFlowRate[7]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(7), thisSys->m_HeatVolumeFlowRate[7]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[8], 0.065892, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(8), thisSys->m_HeatVolumeFlowRate[8]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(8), thisSys->m_HeatVolumeFlowRate[8]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[9], 0.074129, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9), thisSys->m_HeatVolumeFlowRate[9]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(9), thisSys->m_HeatVolumeFlowRate[9]); EXPECT_NEAR(thisSys->m_HeatVolumeFlowRate[10], 0.082366, 0.000001); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(10), thisSys->m_HeatVolumeFlowRate[10]); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(10), thisSys->m_HeatVolumeFlowRate[10]); } TEST_F(EnergyPlusFixture, UnitarySystemModel_WaterToAirHeatPump) @@ -7785,10 +7786,10 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_WaterToAirHeatPump) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData1(state); // read zone equipment configuration and list objects + DataZoneEquipment::GetZoneEquipmentData1(*state); // read zone equipment configuration and list objects DataSizing::ZoneEqSizing.allocate(1); DataZoneEquipment::ZoneEquipList(1).EquipIndex.allocate(1); @@ -7825,17 +7826,17 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_WaterToAirHeatPump) std::string compName = "UNITARY SYSTEM MODEL"; int compTypeOfNum = DataHVACGlobals::UnitarySys_AnyCoilType; bool zoneEquipment = true; - UnitarySystems::UnitarySys::factory(state, compTypeOfNum, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, compTypeOfNum, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - ASSERT_EQ(1, state.dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects + ASSERT_EQ(1, state->dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects EXPECT_EQ(thisSys->UnitType, DataHVACGlobals::cFurnaceTypes(compTypeOfNum)); // compare UnitarySystem type string to valid type - state.dataGlobal->SysSizingCalc = false; // DISABLE SIZING - don't call UnitarySystem::sizeSystem, much more work needed to set up sizing arrays + state->dataGlobal->SysSizingCalc = false; // DISABLE SIZING - don't call UnitarySystem::sizeSystem, much more work needed to set up sizing arrays InletNode = thisSys->AirInNode; OutletNode = thisSys->AirOutNode; @@ -7879,11 +7880,11 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_WaterToAirHeatPump) DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = DataHVACGlobals::DualSetPointWithDeadBand; ScheduleManager::Schedule(1).CurrentValue = 1.0; - state.dataGlobal->BeginEnvrnFlag = true; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); // initialize RhoAir + state->dataGlobal->BeginEnvrnFlag = true; + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir DataLoopNode::Node(InletNode).MassFlowRateMaxAvail = thisSys->m_DesignFanVolFlowRate * DataEnvironment::StdRhoAir; - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // system output should match RemainingOutputRequired = 1000.0 W (heating mode) int AirLoopNum = 0; @@ -7896,7 +7897,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_WaterToAirHeatPump) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -7937,7 +7938,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_WaterToAirHeatPump) DataEnvironment::OutWetBulbTemp = 30.0; // system output should match RemainingOutputRequired = -1000.0 W (cooling mode) - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -8118,10 +8119,10 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData1(state); // read zone equipment configuration and list objects + DataZoneEquipment::GetZoneEquipmentData1(*state); // read zone equipment configuration and list objects DataSizing::CurZoneEqNum = 1; DataSizing::ZoneEqSizing.allocate(1); @@ -8161,17 +8162,17 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) std::string compName = "UNITARY SYSTEM MODEL"; int compTypeOfNum = DataHVACGlobals::UnitarySys_AnyCoilType; bool zoneEquipment = true; - UnitarySystems::UnitarySys::factory(state, compTypeOfNum, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, compTypeOfNum, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - ASSERT_EQ(1, state.dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects + ASSERT_EQ(1, state->dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects EXPECT_EQ(thisSys->UnitType, DataHVACGlobals::cFurnaceTypes(compTypeOfNum)); // compare UnitarySystem type string to valid type - state.dataGlobal->SysSizingCalc = false; // DISABLE SIZING - don't call UnitarySystem::sizeSystem, much more work needed to set up sizing arrays + state->dataGlobal->SysSizingCalc = false; // DISABLE SIZING - don't call UnitarySystem::sizeSystem, much more work needed to set up sizing arrays InletNode = thisSys->AirInNode; OutletNode = thisSys->AirOutNode; @@ -8216,11 +8217,11 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) // fill the schedule values ScheduleManager::Schedule(1).CurrentValue = 1.0; // availability ScheduleManager::Schedule(2).CurrentValue = 1.0; // constant fan - state.dataGlobal->BeginEnvrnFlag = true; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); // initialize RhoAir + state->dataGlobal->BeginEnvrnFlag = true; + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir DataLoopNode::Node(InletNode).MassFlowRateMaxAvail = thisSys->m_DesignFanVolFlowRate * DataEnvironment::StdRhoAir; - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // call once to initialize some variables (i.e., min air flow rate not correct on first pass) int AirLoopNum = 0; int CompIndex = 1; @@ -8232,7 +8233,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -8256,7 +8257,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) // HEATING LOAD // Heating Test 1 - low load, operate at min fan flow, modulate water flow to meet load // system output should match RemainingOutputRequired = 2000.0 W (heating mode) - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -8291,12 +8292,12 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) Real64 saveSystemHeatWaterFlowRate = thisSys->MaxHeatCoilFluidFlow; // test that heating coil was operating prior to the next call to simulate EXPECT_GT(DataLoopNode::Node(thisSys->HeatCoilFluidInletNode).MassFlowRate, 0.0); - EXPECT_GT(state.dataWaterCoils->WaterCoil(thisSys->m_HeatingCoilIndex).TotWaterHeatingCoilRate, 0.0); + EXPECT_GT(state->dataWaterCoils->WaterCoil(thisSys->m_HeatingCoilIndex).TotWaterHeatingCoilRate, 0.0); EXPECT_LT(DataLoopNode::Node(thisSys->HeatCoilInletNodeNum).Temp, DataLoopNode::Node(thisSys->HeatCoilOutletNodeNum).Temp); thisSys->MaxHeatCoilFluidFlow = 0.0; // use a smaller heat load so fan heat exceeds the load and the SZVAV model will be called DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired = 800.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -8312,10 +8313,10 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) // the fact that the unit test proceeded to here means the program did not crash EXPECT_EQ(1.0, thisSys->m_HeatingPartLoadFrac); // model tried to turn on coil EXPECT_EQ(0.0, DataLoopNode::Node(thisSys->HeatCoilFluidInletNode).MassFlowRate); // these show coil is off - EXPECT_EQ(0.0, state.dataWaterCoils->WaterCoil(thisSys->m_HeatingCoilIndex).TotWaterHeatingCoilRate); + EXPECT_EQ(0.0, state->dataWaterCoils->WaterCoil(thisSys->m_HeatingCoilIndex).TotWaterHeatingCoilRate); EXPECT_EQ(DataLoopNode::Node(thisSys->HeatCoilInletNodeNum).Temp, DataLoopNode::Node(thisSys->HeatCoilOutletNodeNum).Temp); // reset for next unit tests - state.dataUnitarySystems->unitarySys[0].MaxHeatCoilFluidFlow = saveSystemHeatWaterFlowRate; + state->dataUnitarySystems->unitarySys[0].MaxHeatCoilFluidFlow = saveSystemHeatWaterFlowRate; // increase heating load so that upper temperature limit is reached DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired = 6000.0; // heating load @@ -8329,7 +8330,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToHeatSP; // Heating Test 2 - moderate load, operate above min fan flow, modulate water flow to meet load - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -8371,7 +8372,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToHeatSP; // Heating Test 3 - high load, operate at max fan flow, modulate water flow to meet load - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -8409,7 +8410,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToHeatSP; // Heating Test 4 - very high load, operate at max fan and water flow, load not met - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -8462,7 +8463,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) // Cooling Test 1 - low load, operate at min fan flow, modulate water flow to meet load // system output should match RemainingOutputRequired = -2000.0 W (cooling mode) - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -8501,7 +8502,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToHeatSP; // Cooling Test 2 - moderate load, operate above min fan flow, modulate water flow to meet load - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -8533,10 +8534,10 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) Real64 saveSystemCoolWaterFlowRate = thisSys->MaxCoolCoilFluidFlow; // test that cooling coil was operating prior to the next call to simulate EXPECT_GT(DataLoopNode::Node(thisSys->CoolCoilFluidInletNode).MassFlowRate, 0.0); - EXPECT_GT(state.dataWaterCoils->WaterCoil(thisSys->m_CoolingCoilIndex).TotWaterCoolingCoilRate, 0.0); + EXPECT_GT(state->dataWaterCoils->WaterCoil(thisSys->m_CoolingCoilIndex).TotWaterCoolingCoilRate, 0.0); EXPECT_GT(DataLoopNode::Node(thisSys->CoolCoilInletNodeNum).Temp, DataLoopNode::Node(thisSys->CoolCoilOutletNodeNum).Temp); thisSys->MaxCoolCoilFluidFlow = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -8552,7 +8553,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) // the fact that the unit test proceeded to here means the program did not crash EXPECT_EQ(1.0, thisSys->m_CoolingPartLoadFrac); // model tried to turn on coil EXPECT_EQ(0.0, DataLoopNode::Node(thisSys->CoolCoilFluidInletNode).MassFlowRate); // these show coil is off - EXPECT_EQ(0.0, state.dataWaterCoils->WaterCoil(thisSys->m_CoolingCoilIndex).TotWaterCoolingCoilRate); + EXPECT_EQ(0.0, state->dataWaterCoils->WaterCoil(thisSys->m_CoolingCoilIndex).TotWaterCoolingCoilRate); EXPECT_EQ(DataLoopNode::Node(thisSys->CoolCoilInletNodeNum).Temp, DataLoopNode::Node(thisSys->CoolCoilOutletNodeNum).Temp); // reset for next unit tests thisSys->MaxCoolCoilFluidFlow = saveSystemCoolWaterFlowRate; @@ -8568,7 +8569,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToHeatSP; // Cooling Test 3 - high load, operate at max fan flow, modulate water flow to meet load - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -8606,7 +8607,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_ASHRAEModel_WaterCoils) DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputReqToHeatSP; // Cooling Test 4 - very high load, operate at max fan and water flow, load not met - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -9133,27 +9134,27 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXHeatingCoilOnly) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); createFacilityElectricPowerServiceObject(); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->DoingSizing = true; - SizingManager::ManageSizing(state); - state.dataGlobal->DoingSizing = false; - state.dataGlobal->SysSizingCalc = false; + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->DoingSizing = true; + SizingManager::ManageSizing(*state); + state->dataGlobal->DoingSizing = false; + state->dataGlobal->SysSizingCalc = false; DataSizing::CurZoneEqNum = 1; DataSizing::ZoneEqSizing.allocate(1); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool ErrorsFound = false; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); DataSizing::ZoneSizingRunDone = true; DataSizing::ZoneEqSizing(DataSizing::CurZoneEqNum).DesignSizeFromParent = false; @@ -9162,10 +9163,10 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXHeatingCoilOnly) bool FirstHVACIteration = true; int AirLoopNum = 0; - thisSys->sizeSystem(state, FirstHVACIteration, AirLoopNum); - DXCoils::SizeDXCoil(state, 1); + thisSys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); + DXCoils::SizeDXCoil(*state, 1); - ASSERT_EQ(1, state.dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects + ASSERT_EQ(1, state->dataUnitarySystems->numUnitarySystems); // only 1 unitary system above so expect 1 as number of unitary system objects ASSERT_NEAR(thisSys->m_DesignHeatingCapacity, 1303.091, 0.001); ASSERT_EQ(thisSys->m_DesignCoolingCapacity, 0.0); @@ -9915,23 +9916,23 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) DataZoneEquipment::ZoneEquipConfig.allocate(1); DataZoneEquipment::ZoneEquipConfig(1).ActualZoneNum = 1; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData(state); // read zone equipment configuration and list objects - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); - SingleDuct::GetSysInput(state); + DataZoneEquipment::GetZoneEquipmentData(*state); // read zone equipment configuration and list objects + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); + SingleDuct::GetSysInput(*state); - BranchInputManager::ManageBranchInput(state); // just gets input and returns. + BranchInputManager::ManageBranchInput(*state); // just gets input and returns. DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "UNITARY SYSTEM MODEL"; - state.dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:UnitarySystem"; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).NumBranches = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).TotalComponents = 1; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).Name = "UNITARY SYSTEM MODEL"; + state->dataAirSystemsData->PrimaryAirSystems(1).Branch(1).Comp(1).TypeOf = "AirLoopHVAC:UnitarySystem"; DataZoneControls::NumTempControlledZones = 1; DataZoneControls::TempControlledZone.allocate(DataZoneControls::NumTempControlledZones); @@ -9941,13 +9942,13 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); ControlZoneNum = 1; DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); @@ -9977,8 +9978,8 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::OutWetBulbTemp = 30.0; - state.dataAirLoop->AirLoopControlInfo.allocate(1); - state.dataGlobal->SysSizingCalc = true; + state->dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataGlobal->SysSizingCalc = true; thisSys->m_ZoneInletNode = DataZoneEquipment::ZoneEquipConfig(1).InletNode(1); @@ -9991,63 +9992,63 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) DataEnvironment::StdRhoAir = 1.2; DataLoopNode::Node(InletNode).MassFlowRateMaxAvail = thisSys->m_MaxCoolAirVolFlow * DataEnvironment::StdRhoAir; Iter = 4; - thisSys->m_CoolVolumeFlowRate[Iter] = thisSys->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[Iter - 1]; + thisSys->m_CoolVolumeFlowRate[Iter] = thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[Iter - 1]; thisSys->m_CoolMassFlowRate[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] * DataEnvironment::StdRhoAir; thisSys->m_MSCoolingSpeedRatio[Iter] = - thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state.dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; + thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; DXCoils::DXCoil(1).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(1).MSRatedAirVolFlowRate(Iter) * DataEnvironment::StdRhoAir; DXCoils::DXCoil(2).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(2).MSRatedAirVolFlowRate(Iter) * DataEnvironment::StdRhoAir; Iter = 1; - thisSys->m_CoolVolumeFlowRate[Iter] = thisSys->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[Iter - 1]; + thisSys->m_CoolVolumeFlowRate[Iter] = thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[Iter - 1]; thisSys->m_CoolMassFlowRate[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] * DataEnvironment::StdRhoAir; thisSys->m_MSCoolingSpeedRatio[Iter] = - thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state.dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; + thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; DXCoils::DXCoil(1).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(1).MSRatedAirVolFlowRate(Iter) * DataEnvironment::StdRhoAir; DXCoils::DXCoil(2).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(2).MSRatedAirVolFlowRate(Iter) * DataEnvironment::StdRhoAir; Iter = 2; - thisSys->m_CoolVolumeFlowRate[Iter] = thisSys->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[Iter - 1]; + thisSys->m_CoolVolumeFlowRate[Iter] = thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[Iter - 1]; thisSys->m_CoolMassFlowRate[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] * DataEnvironment::StdRhoAir; thisSys->m_MSCoolingSpeedRatio[Iter] = - thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state.dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; + thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; DXCoils::DXCoil(1).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(1).MSRatedAirVolFlowRate(Iter) * DataEnvironment::StdRhoAir; DXCoils::DXCoil(2).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(2).MSRatedAirVolFlowRate(Iter) * DataEnvironment::StdRhoAir; Iter = 3; - thisSys->m_CoolVolumeFlowRate[Iter] = thisSys->m_MaxCoolAirVolFlow * state.dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[Iter - 1]; + thisSys->m_CoolVolumeFlowRate[Iter] = thisSys->m_MaxCoolAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].coolingVolFlowRatio[Iter - 1]; thisSys->m_CoolMassFlowRate[Iter] = thisSys->m_CoolVolumeFlowRate[Iter] * DataEnvironment::StdRhoAir; thisSys->m_MSCoolingSpeedRatio[Iter] = - thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state.dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; + thisSys->m_CoolVolumeFlowRate[Iter] / thisSys->m_CoolVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedCooling]; DXCoils::DXCoil(1).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(1).MSRatedAirVolFlowRate(Iter) * DataEnvironment::StdRhoAir; DXCoils::DXCoil(2).MSRatedAirMassFlowRate(Iter) = DXCoils::DXCoil(2).MSRatedAirVolFlowRate(Iter) * DataEnvironment::StdRhoAir; Iter = 4; - thisSys->m_HeatVolumeFlowRate[Iter] = thisSys->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[Iter - 1]; + thisSys->m_HeatVolumeFlowRate[Iter] = thisSys->m_MaxHeatAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[Iter - 1]; thisSys->m_HeatMassFlowRate[Iter] = thisSys->m_HeatVolumeFlowRate[Iter] * DataEnvironment::StdRhoAir; thisSys->m_MSHeatingSpeedRatio[Iter] = - thisSys->m_HeatVolumeFlowRate[Iter] / thisSys->m_HeatVolumeFlowRate[state.dataUnitarySystems->designSpecMSHP[0].numOfSpeedHeating]; + thisSys->m_HeatVolumeFlowRate[Iter] / thisSys->m_HeatVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedHeating]; Iter = 1; - thisSys->m_HeatVolumeFlowRate[Iter] = thisSys->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[Iter - 1]; + thisSys->m_HeatVolumeFlowRate[Iter] = thisSys->m_MaxHeatAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[Iter - 1]; thisSys->m_HeatMassFlowRate[Iter] = thisSys->m_HeatVolumeFlowRate[Iter] * DataEnvironment::StdRhoAir; thisSys->m_MSHeatingSpeedRatio[Iter] = - thisSys->m_HeatVolumeFlowRate[Iter] / thisSys->m_HeatVolumeFlowRate[state.dataUnitarySystems->designSpecMSHP[0].numOfSpeedHeating]; + thisSys->m_HeatVolumeFlowRate[Iter] / thisSys->m_HeatVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedHeating]; Iter = 2; - thisSys->m_HeatVolumeFlowRate[Iter] = thisSys->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[Iter - 1]; + thisSys->m_HeatVolumeFlowRate[Iter] = thisSys->m_MaxHeatAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[Iter - 1]; thisSys->m_HeatMassFlowRate[Iter] = thisSys->m_HeatVolumeFlowRate[Iter] * DataEnvironment::StdRhoAir; thisSys->m_MSHeatingSpeedRatio[Iter] = - thisSys->m_HeatVolumeFlowRate[Iter] / thisSys->m_HeatVolumeFlowRate[state.dataUnitarySystems->designSpecMSHP[0].numOfSpeedHeating]; + thisSys->m_HeatVolumeFlowRate[Iter] / thisSys->m_HeatVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedHeating]; Iter = 3; - thisSys->m_HeatVolumeFlowRate[Iter] = thisSys->m_MaxHeatAirVolFlow * state.dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[Iter - 1]; + thisSys->m_HeatVolumeFlowRate[Iter] = thisSys->m_MaxHeatAirVolFlow * state->dataUnitarySystems->designSpecMSHP[0].heatingVolFlowRatio[Iter - 1]; thisSys->m_HeatMassFlowRate[Iter] = thisSys->m_HeatVolumeFlowRate[Iter] * DataEnvironment::StdRhoAir; thisSys->m_MSHeatingSpeedRatio[Iter] = - thisSys->m_HeatVolumeFlowRate[Iter] / thisSys->m_HeatVolumeFlowRate[state.dataUnitarySystems->designSpecMSHP[0].numOfSpeedHeating]; + thisSys->m_HeatVolumeFlowRate[Iter] / thisSys->m_HeatVolumeFlowRate[state->dataUnitarySystems->designSpecMSHP[0].numOfSpeedHeating]; thisSys->m_IdleMassFlowRate = thisSys->m_CoolMassFlowRate[1]; // flow rates are set up now, don't call getInput again thisSys->m_ThisSysInputShouldBeGotten = false; - state.dataGlobal->BeginEnvrnFlag = true; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); // initialize RhoAir + state->dataGlobal->BeginEnvrnFlag = true; + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); // initialize RhoAir - state.dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirLoop->AirLoopFlow.allocate(1); DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).RemainingOutputRequired = -10000.0; // cooling load DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).OutputRequiredToCoolingSP = -10000.0; @@ -10069,7 +10070,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -10101,7 +10102,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) DataEnvironment::OutHumRat = 0.0001; DataEnvironment::OutBaroPress = 101325.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -10128,7 +10129,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultiSpeedCoils_SingleMode) DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).SequencedOutputRequiredToHeatingSP(1) = DataZoneEnergyDemands::ZoneSysEnergyDemand(ControlZoneNum).OutputRequiredToHeatingSP; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -11021,25 +11022,25 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_MultispeedDXCoilHeatRecoveryHandlin ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); createFacilityElectricPowerServiceObject(); - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->DoingSizing = true; - SizingManager::ManageSizing(state); - state.dataGlobal->DoingSizing = false; - state.dataGlobal->SysSizingCalc = false; + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->DoingSizing = true; + SizingManager::ManageSizing(*state); + state->dataGlobal->DoingSizing = false; + state->dataGlobal->SysSizingCalc = false; DataSizing::CurZoneEqNum = 1; DataSizing::ZoneEqSizing.allocate(1); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool ErrorsFound = false; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above ASSERT_FALSE(DXCoils::DXCoil(1).MSHPHeatRecActive); // electricity ASSERT_TRUE(DXCoils::DXCoil(2).MSHPHeatRecActive); // natural gas @@ -11122,24 +11123,24 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SizingWithFans) ASSERT_TRUE(process_idf(idf_objects)); std::string fanName = "TEST FAN 1"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor fanName = "TEST FAN 2"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor fanName = "TEST FAN 3"; - HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(state, fanName)); // call constructor + HVACFan::fanObjs.emplace_back(new HVACFan::FanSystem(*state, fanName)); // call constructor DataSizing::CurZoneEqNum = 0; DataSizing::CurSysNum = 0; DataSizing::CurOASysNum = 0; DataEnvironment::StdRhoAir = 1.2; - HVACFan::fanObjs[2]->simulate(state, _, _, _, _); // triggers sizing call + HVACFan::fanObjs[2]->simulate(*state, _, _, _, _); // triggers sizing call Real64 locFanSizeVdot = HVACFan::fanObjs[2]->designAirVolFlowRate; // get function - Real64 locDesignHeatGain3 = HVACFan::fanObjs[2]->getFanDesignHeatGain(state, locFanSizeVdot); + Real64 locDesignHeatGain3 = HVACFan::fanObjs[2]->getFanDesignHeatGain(*state, locFanSizeVdot); EXPECT_NEAR(locDesignHeatGain3, 402.0, 0.1); - Fans::GetFanInput(state); - Real64 locDesignHeatGain4 = Fans::FanDesHeatGain(state, 1, locFanSizeVdot); + Fans::GetFanInput(*state); + Real64 locDesignHeatGain4 = Fans::FanDesHeatGain(*state, 1, locFanSizeVdot); EXPECT_NEAR(locDesignHeatGain4, 50.25, 0.1); DataSizing::DataTotCapCurveIndex = 0; @@ -11154,11 +11155,11 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SizingWithFans) DataSizing::FinalSysSizing(DataSizing::CurSysNum).DesCoolVolFlow = 1.005; DataSizing::FinalSysSizing(DataSizing::CurSysNum).DesOutAirVolFlow = 0.2; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 0; - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).SupFanNum = 0; - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).RetFanNum = 0; - state.dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).supFanModelTypeEnum = DataAirSystems::fanModelTypeNotYetSet; + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).NumOACoolCoils = 0; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).SupFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).RetFanNum = 0; + state->dataAirSystemsData->PrimaryAirSystems(DataSizing::CurSysNum).supFanModelTypeEnum = DataAirSystems::fanModelTypeNotYetSet; DataSizing::SysSizingRunDone = true; DataSizing::SysSizInput.allocate(1); @@ -11177,7 +11178,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SizingWithFans) bool FirstHVACIteration(true); UnitarySys thisSys; UnitarySys *mySys(&thisSys); - state.dataUnitarySystems->numUnitarySystems = 1; + state->dataUnitarySystems->numUnitarySystems = 1; DataEnvironment::StdRhoAir = 1.2; // Prevent divide by zero in Sizer @@ -11205,7 +11206,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SizingWithFans) thisSys.m_FanIndex = 2; // Fan:SystemModel is zero-based subscripts, so 2 is 3 Real64 expectedSize = 18976.394 + locDesignHeatGain3; - mySys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + mySys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); EXPECT_EQ(1.005, thisSys.m_MaxCoolAirVolFlow); EXPECT_NEAR(expectedSize, thisSys.m_DesignCoolingCapacity, 0.001); @@ -11222,7 +11223,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SizingWithFans) thisSys.m_FanIndex = 1; // Fan:ConstantVolume is one-based subscripts, so 1 is 1 expectedSize = 18976.394 + locDesignHeatGain4; - mySys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + mySys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); EXPECT_EQ(1.005, thisSys.m_MaxCoolAirVolFlow); EXPECT_NEAR(expectedSize, thisSys.m_DesignCoolingCapacity, 0.001); @@ -11230,7 +11231,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_SizingWithFans) // clean DataSizing::NumSysSizInput = 0; DataSizing::FinalSysSizing.deallocate(); - state.dataAirSystemsData->PrimaryAirSystems.deallocate(); + state->dataAirSystemsData->PrimaryAirSystems.deallocate(); DataSizing::SysSizInput.deallocate(); DataSizing::UnitarySysEqSizing.deallocate(); DataSizing::OASysEqSizing.deallocate(); @@ -11364,18 +11365,18 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInputATMixerInlet) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; UnitarySys mySys; HVACSystemData *thisSys = DataZoneEquipment::ZoneEquipList(1).compPointer[2]; // UnitarySystem is the 2nd in the zone equipment list DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - mySys.getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above - mySys = state.dataUnitarySystems->unitarySys[0]; + mySys.getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + mySys = state->dataUnitarySystems->unitarySys[0]; EXPECT_NE(nullptr, thisSys); EXPECT_FALSE(ErrorsFound); // expect no errors @@ -11513,18 +11514,18 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInputATMixerSupply) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; UnitarySys mySys; HVACSystemData *thisSys = DataZoneEquipment::ZoneEquipList(1).compPointer[2]; // UnitarySystem is the 2nd in the zone equipment list DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - mySys.getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above - mySys = state.dataUnitarySystems->unitarySys[0]; + mySys.getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + mySys = state->dataUnitarySystems->unitarySys[0]; EXPECT_TRUE(thisSys); EXPECT_FALSE(ErrorsFound); // expect no errors EXPECT_TRUE(mySys.ATMixerExists); @@ -11639,19 +11640,19 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInputZoneEquipment) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); // call the UnitarySystem factory std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input EXPECT_FALSE(ErrorsFound); // expect no errors EXPECT_FALSE(thisSys->ATMixerExists); @@ -11770,16 +11771,16 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInputZoneEquipmentBlankCtrlZone) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); UnitarySys thisSys; std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys.getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input + thisSys.getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input EXPECT_TRUE(ErrorsFound); // expect errors when control zone name is blank and Control Type = Load } @@ -11889,35 +11890,35 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FractionOfAutoSizedCoolingValueTes bool ErrorsFound = false; bool zoneEquipment = true; std::string compName = "UNITARY SYSTEM MODEL"; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); DataSizing::ZoneSizingRunDone = true; // DataSizing::NumPltSizInput = 2; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(2).Name; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; // check user specified values before overriding during sizing Real64 userspecifiedFractionOfAutoSizedCoolingFlowRateValue = thisSys->m_MaxNoCoolHeatAirVolFlow; - EXPECT_EQ(thisSys->m_NoCoolHeatSAFMethod, state.dataUnitarySystems->FractionOfAutoSizedCoolingValue); + EXPECT_EQ(thisSys->m_NoCoolHeatSAFMethod, state->dataUnitarySystems->FractionOfAutoSizedCoolingValue); EXPECT_EQ(userspecifiedFractionOfAutoSizedCoolingFlowRateValue, 0.9); bool FirstHVACIteration = true; int AirLoopNum = 0; - thisSys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + thisSys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); // check autosized cooling and heating flow rates EXPECT_EQ(thisSys->m_MaxCoolAirVolFlow, 1.5); EXPECT_EQ(thisSys->m_MaxHeatAirVolFlow, 1.5); @@ -12031,34 +12032,34 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FlowPerCoolingCapacityTest) bool ErrorsFound = false; bool zoneEquipment = true; std::string compName = "UNITARY SYSTEM MODEL"; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); DataSizing::ZoneSizingRunDone = true; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterSimpleHeating; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + DataPlant::PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(2).Name; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = DataPlant::TypeOf_CoilWaterCooling; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum; - DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; + DataPlant::PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; // check user specified values before overriding during sizing Real64 userspecifiedFlowPerCoolingCapacityValue = thisSys->m_MaxNoCoolHeatAirVolFlow; - EXPECT_EQ(thisSys->m_NoCoolHeatSAFMethod, state.dataUnitarySystems->FlowPerCoolingCapacity); + EXPECT_EQ(thisSys->m_NoCoolHeatSAFMethod, state->dataUnitarySystems->FlowPerCoolingCapacity); EXPECT_EQ(userspecifiedFlowPerCoolingCapacityValue, 0.0000462180155978106); bool FirstHVACIteration = true; int AirLoopNum = 0; - thisSys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + thisSys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); // check autosized cooling and heating flow rates EXPECT_EQ(thisSys->m_MaxCoolAirVolFlow, 1.5); EXPECT_EQ(thisSys->m_MaxHeatAirVolFlow, 1.5); @@ -12202,11 +12203,11 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_getUnitarySystemInputDataTest) bool ErrorsFound = false; bool zoneEquipment = true; std::string compName = "UNITARY SYSTEM MODEL"; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors // check each input fields of unitary system EXPECT_EQ("UNITARY SYSTEM MODEL", thisSys->Name); // checks object name @@ -12460,10 +12461,10 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInputwithTradeOff) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData1(state); // read zone equipment configuration and list objects + DataZoneEquipment::GetZoneEquipmentData1(*state); // read zone equipment configuration and list objects DataSizing::ZoneEqSizing.allocate(1); DataZoneEquipment::ZoneEquipList(1).EquipIndex.allocate(1); @@ -12473,12 +12474,12 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInputwithTradeOff) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; - state.dataGlobal->DoCoilDirectSolutions = true; + state->dataGlobal->DoCoilDirectSolutions = true; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors // Issue 7777 @@ -12695,9 +12696,9 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_AllFlowFieldsBlankInputTest) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - DataZoneEquipment::GetZoneEquipmentData1(state); + DataZoneEquipment::GetZoneEquipmentData1(*state); DataSizing::ZoneEqSizing.allocate(1); DataZoneEquipment::ZoneEquipList(1).EquipIndex.allocate(1); DataZoneEquipment::ZoneEquipList(1).EquipIndex(1) = 1; @@ -12706,13 +12707,13 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_AllFlowFieldsBlankInputTest) std::string compName = "UNITARY SYSTEM MODEL"; int compTypeOfNum = DataHVACGlobals::UnitarySys_AnyCoilType; bool zoneEquipment(true); - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); EXPECT_FALSE(ErrorsFound); - ASSERT_EQ(1, state.dataUnitarySystems->numUnitarySystems); + ASSERT_EQ(1, state->dataUnitarySystems->numUnitarySystems); EXPECT_EQ(thisSys->UnitType, DataHVACGlobals::cFurnaceTypes(compTypeOfNum)); EXPECT_TRUE(thisSys->m_FanExists); @@ -12725,9 +12726,9 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_AllFlowFieldsBlankInputTest) EXPECT_EQ(thisClgCoil.RatedTotCap(1), DataSizing::AutoSize); EXPECT_EQ(thisHtgCoil.NominalCapacity, DataSizing::AutoSize); - ASSERT_EQ(thisSys->m_CoolingSAFMethod, state.dataUnitarySystems->None); - ASSERT_EQ(thisSys->m_HeatingSAFMethod, state.dataUnitarySystems->None); - ASSERT_EQ(thisSys->m_NoCoolHeatSAFMethod, state.dataUnitarySystems->None); + ASSERT_EQ(thisSys->m_CoolingSAFMethod, state->dataUnitarySystems->None); + ASSERT_EQ(thisSys->m_HeatingSAFMethod, state->dataUnitarySystems->None); + ASSERT_EQ(thisSys->m_NoCoolHeatSAFMethod, state->dataUnitarySystems->None); EXPECT_EQ(thisSys->m_MaxCoolAirVolFlow, DataSizing::AutoSize); EXPECT_EQ(thisSys->m_MaxHeatAirVolFlow, DataSizing::AutoSize); @@ -12753,14 +12754,14 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_AllFlowFieldsBlankInputTest) DataSizing::FinalZoneSizing(DataSizing::CurZoneEqNum).HeatDesTemp = 30.0; DataSizing::FinalZoneSizing(DataSizing::CurZoneEqNum).HeatDesHumRat = 0.007; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, 101325.0, 20.0, 0.0); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, 101325.0, 20.0, 0.0); DataSizing::FinalZoneSizing(DataSizing::CurZoneEqNum).DesHeatMassFlow = DataSizing::FinalZoneSizing(DataSizing::CurZoneEqNum).DesHeatVolFlow * DataEnvironment::StdRhoAir; int AirLoopNum(0); bool FirstHVACIteration(true); - thisSys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + thisSys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); // check autosized flows and capacity EXPECT_EQ(thisSys->m_MaxCoolAirVolFlow, 1.005); EXPECT_EQ(thisSys->m_MaxHeatAirVolFlow, 1.005); @@ -14037,52 +14038,52 @@ TEST_F(EnergyPlusFixture, Test_UnitarySystemModel_SubcoolReheatCoil) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; // Read objects - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetWindowGlassSpectralData(state, ErrorsFound); + HeatBalanceManager::GetWindowGlassSpectralData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - SurfaceGeometry::GetGeometryParameters(state, ErrorsFound); + SurfaceGeometry::GetGeometryParameters(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, ErrorsFound); + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + SurfaceGeometry::GetSurfaceData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager ScheduleManager::Schedule(6).CurrentValue = 1.0; // Enable schedule without calling schedule manager ScheduleManager::Schedule(7).CurrentValue = 4.0; // Enable schedule without calling schedule manager - ZoneEquipmentManager::GetZoneEquipment(state); - SimAirServingZones::GetAirPathData(state); + ZoneEquipmentManager::GetZoneEquipment(*state); + SimAirServingZones::GetAirPathData(*state); ScheduleManager::Schedule(7).MinValue = 4.0; // Enable schedule without calling schedule manager ScheduleManager::Schedule(7).MaxValue = 4.0; // Enable schedule without calling schedule manager ScheduleManager::Schedule(7).MaxMinSet = true; - ZoneTempPredictorCorrector::GetZoneAirSetPoints(state); + ZoneTempPredictorCorrector::GetZoneAirSetPoints(*state); std::string compName = "SYS 1 FURNACE DX COOL UNITARY SYSTEM"; bool zoneEquipment = false; int compTypeOfNum = DataHVACGlobals::UnitarySys_AnyCoilType; bool FirstHVACIteration = true; DataZoneEquipment::ZoneEquipConfig(1).InletNodeAirLoopNum(1) = 1; - UnitarySystems::UnitarySys::factory(state, compTypeOfNum, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, compTypeOfNum, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above // verify the size of the vector and the processed names // 1 UnitarySystem objects - EXPECT_EQ(1u, state.dataUnitarySystems->unitarySys.size()); + EXPECT_EQ(1u, state->dataUnitarySystems->unitarySys.size()); - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning //// test calling the sim routine int AirLoopNum = 1; @@ -14091,7 +14092,7 @@ TEST_F(EnergyPlusFixture, Test_UnitarySystemModel_SubcoolReheatCoil) bool CoolingActive = true; int OAUnitNum = 0; Real64 OAUCoilOutTemp = 0.0; - state.dataGlobal->SysSizingCalc = false; + state->dataGlobal->SysSizingCalc = false; DataSizing::CurSysNum = 1; bool ZoneEquipFlag = false; // simulate function is overloaded, but only to report back SysOutputProvided and LatOutputProvided. Either signature should give same result. @@ -14128,7 +14129,7 @@ TEST_F(EnergyPlusFixture, Test_UnitarySystemModel_SubcoolReheatCoil) DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = -50.0; DataZoneEnergyDemands::ZoneSysMoistureDemand(1).RemainingOutputReqToDehumidSP = -0.007806893; DataEnvironment::StdRhoAir = 1.2043; - thisSys->simulate(state, + thisSys->simulate(*state, compName, FirstHVACIteration, AirLoopNum, @@ -14161,7 +14162,7 @@ TEST_F(EnergyPlusFixture, Test_UnitarySystemModel_SubcoolReheatCoil) DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -397.162; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = -3601.8; DataZoneEnergyDemands::ZoneSysMoistureDemand(1).RemainingOutputReqToDehumidSP = -1.1696238E-4; - thisSys->simulate(state, + thisSys->simulate(*state, compName, FirstHVACIteration, AirLoopNum, @@ -14186,7 +14187,7 @@ TEST_F(EnergyPlusFixture, Test_UnitarySystemModel_SubcoolReheatCoil) DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputRequired = -2000.00; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -2000.00; DataZoneEnergyDemands::ZoneSysMoistureDemand(1).RemainingOutputReqToDehumidSP = -1.1696238E-5; - thisSys->simulate(state, + thisSys->simulate(*state, compName, FirstHVACIteration, AirLoopNum, @@ -14415,10 +14416,10 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput_Autosizing) ASSERT_TRUE(process_idf(idf_objects)); // read idf objects bool ErrorsFound(false); - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); // expect no errors - DataZoneEquipment::GetZoneEquipmentData1(state); // read zone equipment configuration and list objects + DataZoneEquipment::GetZoneEquipmentData1(*state); // read zone equipment configuration and list objects DataSizing::ZoneEqSizing.allocate(1); DataZoneEquipment::ZoneEquipList(1).EquipIndex.allocate(1); @@ -14428,11 +14429,11 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput_Autosizing) bool zoneEquipment = true; int compTypeOfNum = DataHVACGlobals::UnitarySys_AnyCoilType; - UnitarySystems::UnitarySys::factory(state, compTypeOfNum, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys::factory(*state, compTypeOfNum, compName, zoneEquipment, 0); // only 1 unitary system above so expect 1 as number of unitary system objects - ASSERT_EQ(1, state.dataUnitarySystems->numUnitarySystems); + ASSERT_EQ(1, state->dataUnitarySystems->numUnitarySystems); // Now retrieve it - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; // indicate zone data is available DataZoneEquipment::ZoneEquipInputsFilled = true; @@ -14440,7 +14441,7 @@ TEST_F(EnergyPlusFixture, UnitarySystemModel_GetInput_Autosizing) // get UnitarySystem input from object above // Before fix for #7771, it throws // C++ exception with description "[json.exception.type_error.302] type must be number, but is string" thrown in the test body. - ASSERT_NO_THROW(thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound)); + ASSERT_NO_THROW(thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound)); EXPECT_FALSE(ErrorsFound); // Like I said above in the IDF snippet section, control type has to be SingleZoneVAV or autosizing of @@ -14671,11 +14672,11 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_VariableSpeedDXCoilsNoLoadFlowRate std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors ; // Verify UnitarySystem air flow rates are read in as AutoSized @@ -14683,20 +14684,20 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_VariableSpeedDXCoilsNoLoadFlowRate EXPECT_EQ(thisSys->m_MaxHeatAirVolFlow, DataSizing::AutoSize); EXPECT_EQ(thisSys->m_MaxNoCoolHeatAirVolFlow, DataSizing::AutoSize); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; int AirLoopNum = 0; - thisSys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + thisSys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); EXPECT_EQ(1.500, thisSys->m_DesignFanVolFlowRate); EXPECT_EQ(1.500, thisSys->m_MaxCoolAirVolFlow); EXPECT_EQ(1.500, thisSys->m_MaxHeatAirVolFlow); Real64 results_noLoadHeatingFlowRatio = - state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1) / state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(5); + state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1) / state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(5); Real64 results_noLoadCoolingFlowRatio = - state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(1) / state.dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(5); + state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(1) / state->dataVariableSpeedCoils->VarSpeedCoil(2).MSRatedAirVolFlowRate(5); Real64 results_noLoadFlowRatioMin = min(results_noLoadHeatingFlowRatio, results_noLoadCoolingFlowRatio); EXPECT_NEAR(results_noLoadFlowRatioMin, thisSys->m_NoLoadAirFlowRateRatio, 0.00001); @@ -14979,11 +14980,11 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsNoLoadFlowRateSiz std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors // Verify UnitarySystem air flow rates are read in as AutoSized EXPECT_EQ(thisSys->m_MaxCoolAirVolFlow, DataSizing::AutoSize); @@ -14991,19 +14992,19 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsNoLoadFlowRateSiz EXPECT_EQ(thisSys->m_MaxNoCoolHeatAirVolFlow, DataSizing::AutoSize); EXPECT_EQ(thisSys->m_NoLoadAirFlowRateRatio, 1.0); - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; int AirLoopNum = 0; - thisSys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + thisSys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); EXPECT_EQ(1.500, thisSys->m_DesignFanVolFlowRate); EXPECT_EQ(1.500, thisSys->m_MaxCoolAirVolFlow); EXPECT_EQ(1.500, thisSys->m_MaxHeatAirVolFlow); int MSHPIndex = thisSys->m_DesignSpecMSHPIndex; - Real64 results_noLoadHeatingFlowRatio = 1.0 / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling); - Real64 results_noLoadCoolingFlowRatio = 1.0 / double(state.dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedHeating); + Real64 results_noLoadHeatingFlowRatio = 1.0 / double(state->dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedCooling); + Real64 results_noLoadCoolingFlowRatio = 1.0 / double(state->dataUnitarySystems->designSpecMSHP[MSHPIndex].numOfSpeedHeating); Real64 results_noLoadFlowRatioMin = min(results_noLoadHeatingFlowRatio, results_noLoadCoolingFlowRatio); EXPECT_NEAR(results_noLoadFlowRatioMin, thisSys->m_NoLoadAirFlowRateRatio, 0.00001); @@ -15288,18 +15289,18 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsDirectSolutionTes std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; int AirLoopNum = 0; - thisSys->sizeSystem(state, FirstHVACIteration, AirLoopNum); + thisSys->sizeSystem(*state, FirstHVACIteration, AirLoopNum); // Test direct solution DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); @@ -15339,7 +15340,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsDirectSolutionTes Real64 latOut = 0.0; //Speed 1 - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -15353,9 +15354,9 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsDirectSolutionTes latOut); EXPECT_NEAR(thisSys->m_CycRatio, 0.02422, 0.001); EXPECT_NEAR(sensOut, -227.705, 0.1); - state.dataGlobal->DoCoilDirectSolutions = true; + state->dataGlobal->DoCoilDirectSolutions = true; thisSys->FullOutput.resize(3); - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -15373,8 +15374,8 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsDirectSolutionTes DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputRequired = -12000.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -12000.0; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToHeatSP = -5000.0; - state.dataGlobal->DoCoilDirectSolutions = false; - thisSys->simulate(state, + state->dataGlobal->DoCoilDirectSolutions = false; + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -15390,8 +15391,8 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_MultiSpeedDXCoilsDirectSolutionTes EXPECT_NEAR(thisSys->m_SpeedRatio, 0.228062, 0.001); EXPECT_NEAR(sensOut, -11998.0, 3.0); - state.dataGlobal->DoCoilDirectSolutions = true; - thisSys->simulate(state, + state->dataGlobal->DoCoilDirectSolutions = true; + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -15551,13 +15552,13 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_SetpointControlCyclingFan) // call the UnitarySystem factory std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above std::string const error_string = delimited_string({ " ** Severe ** AirLoopHVAC:UnitarySystem = UNITARY SYSTEM MODEL\n ** ~~~ ** For FAN:ONOFF = SUPPLY FAN 1\n ** ~~~ ** Fan operating mode must be continuous (fan operating mode schedule values > 0).\n ** ~~~ ** Error found in Supply Air Fan Operating Mode Schedule Name ALWAYSZERO\n ** ~~~ ** ...schedule values must be (>0., <=1.)" }); @@ -15683,19 +15684,19 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FuelHeatCoilStptNodeTest) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; int AirLoopNum = 0; int CompIndex = 1; @@ -15707,7 +15708,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FuelHeatCoilStptNodeTest) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -15730,7 +15731,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FuelHeatCoilStptNodeTest) DataLoopNode::Node(1).HumRat = 0.00922; // 17C wb DataLoopNode::Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules // Heating coil air inlet node = 3 DataLoopNode::Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow @@ -15739,10 +15740,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_FuelHeatCoilStptNodeTest) ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -15879,19 +15880,19 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_ElecHeatCoilStptNodeTest) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; int AirLoopNum = 0; int CompIndex = 1; @@ -15903,7 +15904,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_ElecHeatCoilStptNodeTest) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -15926,7 +15927,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_ElecHeatCoilStptNodeTest) DataLoopNode::Node(1).HumRat = 0.00922; // 17C wb DataLoopNode::Node(1).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules // Heating coil air inlet node = 3 DataLoopNode::Node(3).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow @@ -15935,10 +15936,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_ElecHeatCoilStptNodeTest) ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -16181,8 +16182,8 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_DesuperHeatCoilStptNodeTest) std::string compName = "UNITARY SYSTEM MODEL"; bool zoneEquipment = true; bool FirstHVACIteration = true; - UnitarySystems::UnitarySys::factory(state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); - UnitarySystems::UnitarySys *thisSys = &state.dataUnitarySystems->unitarySys[0]; + UnitarySystems::UnitarySys::factory(*state, DataHVACGlobals::UnitarySys_AnyCoilType, compName, zoneEquipment, 0); + UnitarySystems::UnitarySys *thisSys = &state->dataUnitarySystems->unitarySys[0]; thisSys->AirInNode = 3; DataZoneEquipment::ZoneEquipInputsFilled = true; // indicate zone data is available @@ -16196,16 +16197,16 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_DesuperHeatCoilStptNodeTest) DataLoopNode::Node(20).Temp = 24.0; // 24C db DataLoopNode::Node(20).HumRat = 0.00922; // 17C wb - RefrigeratedCase::ManageRefrigeratedCaseRacks(state); - thisSys->getUnitarySystemInputData(state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above + RefrigeratedCase::ManageRefrigeratedCaseRacks(*state); + thisSys->getUnitarySystemInputData(*state, compName, zoneEquipment, 0, ErrorsFound); // get UnitarySystem input from object above EXPECT_FALSE(ErrorsFound); // expect no errors - OutputReportPredefined::SetPredefinedTables(state); + OutputReportPredefined::SetPredefinedTables(*state); // UnitarySystem used as zone equipment will not be modeled when FirstHAVCIteration is true, first time FirstHVACIteration = false will disable // the 'return' on FirstHVACIteration = true set FirstHVACIteration to false for unit testing to size water coils FirstHVACIteration = false; - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; int AirLoopNum = 0; int CompIndex = 1; @@ -16217,7 +16218,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_DesuperHeatCoilStptNodeTest) Real64 sensOut = 0.0; Real64 latOut = 0.0; - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, @@ -16240,7 +16241,7 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_DesuperHeatCoilStptNodeTest) DataLoopNode::Node(3).HumRat = 0.00922; // 17C wb DataLoopNode::Node(3).Enthalpy = 47597.03; // www.sugartech.com/psychro/index.php - ScheduleManager::ProcessScheduleInput(state); // read schedules + ScheduleManager::ProcessScheduleInput(*state); // read schedules // Heating coil air inlet node = 4 DataLoopNode::Node(4).MassFlowRateMax = thisSys->m_DesignMassFlowRate; // max at fan outlet so fan won't limit flow @@ -16249,10 +16250,10 @@ TEST_F(ZoneUnitarySysTest, UnitarySystemModel_DesuperHeatCoilStptNodeTest) ScheduleManager::Schedule(1).CurrentValue = 1.0; // Enable schedule without calling schedule manager - state.dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning + state->dataGlobal->BeginEnvrnFlag = true; // act as if simulation is beginning // Heating mode - thisSys->simulate(state, + thisSys->simulate(*state, thisSys->Name, FirstHVACIteration, AirLoopNum, diff --git a/tst/EnergyPlus/unit/UtilityRoutines.unit.cc b/tst/EnergyPlus/unit/UtilityRoutines.unit.cc index 3db75c3e347..78c2430aee3 100644 --- a/tst/EnergyPlus/unit/UtilityRoutines.unit.cc +++ b/tst/EnergyPlus/unit/UtilityRoutines.unit.cc @@ -54,6 +54,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -81,7 +82,7 @@ TEST_F(EnergyPlusFixture, RecurringWarningTest) std::string myMessage1 = "Test message 1"; // proper call to ShowRecurringWarningErrorAtEnd to set up new recurring warning int ErrIndex1 = 0; - ShowRecurringWarningErrorAtEnd(state, myMessage1, ErrIndex1); + ShowRecurringWarningErrorAtEnd(*state, myMessage1, ErrIndex1); EXPECT_EQ(ErrIndex1, 1); EXPECT_EQ(DataErrorTracking::RecurringErrors.size(), 1u); EXPECT_EQ(" ** Warning ** " + myMessage1, DataErrorTracking::RecurringErrors(1).Message); @@ -90,21 +91,21 @@ TEST_F(EnergyPlusFixture, RecurringWarningTest) std::string myMessage2 = "Test message 2"; // improper call to ShowRecurringWarningErrorAtEnd to set up new recurring warning int ErrIndex2 = 6; - ShowRecurringWarningErrorAtEnd(state, myMessage2, ErrIndex2); + ShowRecurringWarningErrorAtEnd(*state, myMessage2, ErrIndex2); EXPECT_EQ(ErrIndex2, 2); // ShowRecurringWarningErrorAtEnd handles improper index and returns correct value EXPECT_EQ(DataErrorTracking::RecurringErrors.size(), 2u); EXPECT_EQ(" ** Warning ** " + myMessage2, DataErrorTracking::RecurringErrors(2).Message); EXPECT_EQ(1, DataErrorTracking::RecurringErrors(2).Count); ErrIndex2 = 6; - ShowRecurringWarningErrorAtEnd(state, myMessage2, ErrIndex2); + ShowRecurringWarningErrorAtEnd(*state, myMessage2, ErrIndex2); EXPECT_EQ(ErrIndex2, 2); // ShowRecurringWarningErrorAtEnd handles improper index and returns correct value EXPECT_EQ(DataErrorTracking::RecurringErrors.size(), 2u); EXPECT_EQ(" ** Warning ** " + myMessage2, DataErrorTracking::RecurringErrors(2).Message); EXPECT_EQ(2, DataErrorTracking::RecurringErrors(2).Count); std::string myMessage3 = "Test message 3"; - ShowRecurringContinueErrorAtEnd(state, myMessage3, ErrIndex1); + ShowRecurringContinueErrorAtEnd(*state, myMessage3, ErrIndex1); // index gets updated with correct value EXPECT_EQ(ErrIndex1, 3); EXPECT_EQ(DataErrorTracking::RecurringErrors.size(), 3u); @@ -112,7 +113,7 @@ TEST_F(EnergyPlusFixture, RecurringWarningTest) EXPECT_EQ(1, DataErrorTracking::RecurringErrors(3).Count); std::string myMessage4 = "Test message 4"; - ShowRecurringSevereErrorAtEnd(state, myMessage4, ErrIndex1); + ShowRecurringSevereErrorAtEnd(*state, myMessage4, ErrIndex1); // index gets updated with correct value EXPECT_EQ(ErrIndex1, 4); EXPECT_EQ(DataErrorTracking::RecurringErrors.size(), 4u); @@ -120,7 +121,7 @@ TEST_F(EnergyPlusFixture, RecurringWarningTest) EXPECT_EQ(1, DataErrorTracking::RecurringErrors(4).Count); // same message for different show message type (changed severe to warning) should be valid - ShowRecurringWarningErrorAtEnd(state, myMessage4, ErrIndex1); + ShowRecurringWarningErrorAtEnd(*state, myMessage4, ErrIndex1); // index gets updated with correct value EXPECT_EQ(ErrIndex1, 5); EXPECT_EQ(" ** Warning ** " + myMessage4, DataErrorTracking::RecurringErrors(5).Message); @@ -128,14 +129,14 @@ TEST_F(EnergyPlusFixture, RecurringWarningTest) TEST_F(EnergyPlusFixture, DisplayMessageTest) { - DisplayString(state, "Testing"); + DisplayString(*state, "Testing"); EXPECT_TRUE(has_cout_output(true)); // Open six files to get unit number beyond 6 - these all get closed later by EnergyPlusFixture - DisplayString(state, "Testing"); + DisplayString(*state, "Testing"); EXPECT_TRUE(has_cout_output(true)); // repeat this one - before fix, this broke cout_stream EXPECT_FALSE(has_cout_output(true)); - DisplayString(state, "Testing"); + DisplayString(*state, "Testing"); EXPECT_TRUE(has_cout_output(true)); } @@ -147,12 +148,12 @@ TEST_F(EnergyPlusFixture, UtilityRoutines_appendPerfLog1) std::remove(DataStringGlobals::outputPerfLogFileName.c_str()); // make sure the static variables are cleared - UtilityRoutines::appendPerfLog(state, "RESET", "RESET"); + UtilityRoutines::appendPerfLog(*state, "RESET", "RESET"); // add headers and values - UtilityRoutines::appendPerfLog(state, "header1", "value1-1"); - UtilityRoutines::appendPerfLog(state, "header2", "value1-2"); - UtilityRoutines::appendPerfLog(state, "header3", "value1-3", true); + UtilityRoutines::appendPerfLog(*state, "header1", "value1-1"); + UtilityRoutines::appendPerfLog(*state, "header2", "value1-2"); + UtilityRoutines::appendPerfLog(*state, "header3", "value1-3", true); std::ifstream perfLogFile; std::stringstream perfLogStrSteam; @@ -175,7 +176,7 @@ TEST_F(EnergyPlusFixture, UtilityRoutines_appendPerfLog1) TEST_F(EnergyPlusFixture, UtilityRoutines_appendPerfLog2) { // make sure the static variables are cleared - UtilityRoutines::appendPerfLog(state, "RESET", "RESET"); + UtilityRoutines::appendPerfLog(*state, "RESET", "RESET"); DataStringGlobals::outputPerfLogFileName = "eplusout_2_perflog.csv"; @@ -187,9 +188,9 @@ TEST_F(EnergyPlusFixture, UtilityRoutines_appendPerfLog2) initPerfLogFile.close(); // without deleting file add headers and values again - UtilityRoutines::appendPerfLog(state, "ignored1", "value2-1"); - UtilityRoutines::appendPerfLog(state, "ignored2", "value2-2"); - UtilityRoutines::appendPerfLog(state, "ignored3", "value2-3", true); + UtilityRoutines::appendPerfLog(*state, "ignored1", "value2-1"); + UtilityRoutines::appendPerfLog(*state, "ignored2", "value2-2"); + UtilityRoutines::appendPerfLog(*state, "ignored3", "value2-3", true); std::ifstream perfLogFile; std::stringstream perfLogStrSteam; diff --git a/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc b/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc index 81deab5b060..6dc7aeaa62b 100644 --- a/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc +++ b/tst/EnergyPlus/unit/VAVDefMinMaxFlow.unit.cc @@ -49,6 +49,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -239,16 +240,16 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing1) TermUnitFinalZoneSizing.allocate(1); CalcFinalZoneSizing.allocate(1); TermUnitSizing.allocate(1); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE3-1", Zone(1).Name); - GetOARequirements(state); // get the OA requirements object - GetZoneAirDistribution(state); // get zone air distribution objects - GetZoneSizingInput(state); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetOARequirements(*state); // get the OA requirements object + GetZoneAirDistribution(*state); // get zone air distribution objects + GetZoneSizingInput(*state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); ZoneSizingRunDone = true; CurZoneEqNum = 1; CurTermUnitSizingNum = 1; @@ -283,8 +284,8 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing1) EXPECT_DOUBLE_EQ(FinalZoneSizing(CurZoneEqNum).DesHeatMaxAirFlow2, 0.0); EXPECT_NEAR(FinalZoneSizing(CurZoneEqNum).DesHeatVolFlowMax, 0.084324, 0.000001); sd_airterminal(1).ZoneFloorArea = Zone(1).FloorArea; - UpdateTermUnitFinalZoneSizing(state); // Fills the TermUnitFinalZoneSizing array - sd_airterminal(1).SizeSys(state); + UpdateTermUnitFinalZoneSizing(*state); // Fills the TermUnitFinalZoneSizing array + sd_airterminal(1).SizeSys(*state); EXPECT_DOUBLE_EQ(sd_airterminal(CurZoneEqNum).ZoneMinAirFracDes, 0.22); EXPECT_NEAR(sd_airterminal(CurZoneEqNum).MaxAirVolFlowRateDuringReheat, 0.084324, 0.000001); @@ -419,16 +420,16 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing2) NumAirTerminalSizingSpec = 1; CalcFinalZoneSizing.allocate(1); TermUnitSizing.allocate(1); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE3-1", Zone(1).Name); - GetOARequirements(state); // get the OA requirements object - GetZoneAirDistribution(state); // get zone air distribution objects - GetZoneSizingInput(state); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetOARequirements(*state); // get the OA requirements object + GetZoneAirDistribution(*state); // get zone air distribution objects + GetZoneSizingInput(*state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); ZoneSizingRunDone = true; CurZoneEqNum = 1; CurTermUnitSizingNum = 1; @@ -463,8 +464,8 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing2) EXPECT_NEAR(FinalZoneSizing(CurZoneEqNum).DesHeatMaxAirFlow2, 0.196047, 0.000001); // EXPECT_NEAR( FinalZoneSizing( CurZoneEqNum ).DesHeatVolFlowMax, 0.084324, 0.000001 ); sd_airterminal(1).ZoneFloorArea = Zone(1).FloorArea; - UpdateTermUnitFinalZoneSizing(state); // Fills the TermUnitFinalZoneSizing array - sd_airterminal(1).SizeSys(state); + UpdateTermUnitFinalZoneSizing(*state); // Fills the TermUnitFinalZoneSizing array + sd_airterminal(1).SizeSys(*state); EXPECT_NEAR(sd_airterminal(CurZoneEqNum).ZoneMinAirFracDes, 0.348739, 0.000001); EXPECT_NEAR(sd_airterminal(CurZoneEqNum).MaxAirVolFlowRateDuringReheat, 0.196047, 0.000001); @@ -598,16 +599,16 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing3) TermUnitFinalZoneSizing.allocate(1); CalcFinalZoneSizing.allocate(1); TermUnitSizing.allocate(1); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE3-1", Zone(1).Name); - GetOARequirements(state); // get the OA requirements object - GetZoneAirDistribution(state); // get zone air distribution objects - GetZoneSizingInput(state); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetOARequirements(*state); // get the OA requirements object + GetZoneAirDistribution(*state); // get zone air distribution objects + GetZoneSizingInput(*state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); ZoneSizingRunDone = true; CurZoneEqNum = 1; CurTermUnitSizingNum = 1; @@ -644,7 +645,7 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing3) EXPECT_DOUBLE_EQ(FinalZoneSizing(CurZoneEqNum).DesHeatMaxAirFlow2, 0.0); EXPECT_DOUBLE_EQ(FinalZoneSizing(CurZoneEqNum).DesHeatVolFlowMax, 0.11); sd_airterminal(1).ZoneFloorArea = Zone(1).FloorArea; - sd_airterminal(1).SizeSys(state); + sd_airterminal(1).SizeSys(*state); EXPECT_DOUBLE_EQ(sd_airterminal(CurZoneEqNum).ZoneMinAirFracDes, 0.22); EXPECT_NEAR(sd_airterminal(CurZoneEqNum).MaxAirVolFlowRateDuringReheat, 0.092756, 0.000001); @@ -779,21 +780,21 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing4) TermUnitFinalZoneSizing.allocate(1); CalcFinalZoneSizing.allocate(1); TermUnitSizing.allocate(1); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE3-1", Zone(1).Name); - // GetOARequirements(state); // get the OA requirements object - // GetZoneAirDistribution(state); // get zone air distribution objects - // GetZoneSizingInput(state); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + // GetOARequirements(*state); // get the OA requirements object + // GetZoneAirDistribution(*state); // get zone air distribution objects + // GetZoneSizingInput(*state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); ZoneSizingRunDone = false; CurZoneEqNum = 1; Zone(1).FloorArea = 96.48; sd_airterminal(1).ZoneFloorArea = Zone(1).FloorArea; - sd_airterminal(1).SizeSys(state); + sd_airterminal(1).SizeSys(*state); EXPECT_NEAR(sd_airterminal(CurZoneEqNum).ZoneMinAirFracDes, 0.348739, 0.000001); EXPECT_NEAR(sd_airterminal(CurZoneEqNum).MaxAirVolFlowRateDuringReheat, 0.196047, 0.000001); @@ -929,16 +930,16 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing5) TermUnitFinalZoneSizing.allocate(1); CalcFinalZoneSizing.allocate(1); TermUnitSizing.allocate(1); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("SPACE3-1", Zone(1).Name); - GetOARequirements(state); // get the OA requirements object - GetZoneAirDistribution(state); // get zone air distribution objects - GetZoneSizingInput(state); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetOARequirements(*state); // get the OA requirements object + GetZoneAirDistribution(*state); // get zone air distribution objects + GetZoneSizingInput(*state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetZoneAirLoopEquipment(state); - GetSysInput(state); + GetZoneAirLoopEquipment(*state); + GetSysInput(*state); ZoneSizingRunDone = true; CurZoneEqNum = 1; CurTermUnitSizingNum = 1; @@ -973,8 +974,8 @@ TEST_F(EnergyPlusFixture, VAVDefMinMaxFlowTestSizing5) EXPECT_DOUBLE_EQ(FinalZoneSizing(CurZoneEqNum).DesHeatMaxAirFlow2, 0.0); EXPECT_DOUBLE_EQ(FinalZoneSizing(CurZoneEqNum).DesHeatVolFlowMax, 0.08); sd_airterminal(1).ZoneFloorArea = Zone(1).FloorArea; - UpdateTermUnitFinalZoneSizing(state); // Fills the TermUnitFinalZoneSizing array - sd_airterminal(1).SizeSys(state); + UpdateTermUnitFinalZoneSizing(*state); // Fills the TermUnitFinalZoneSizing array + sd_airterminal(1).SizeSys(*state); EXPECT_DOUBLE_EQ(sd_airterminal(CurZoneEqNum).ZoneMinAirFracDes, 0.07351776 / 0.21081); EXPECT_DOUBLE_EQ(sd_airterminal(CurZoneEqNum).MaxAirVolFlowRateDuringReheat, 0.08); diff --git a/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc b/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc index 45b96e19ed9..f22a2996a75 100644 --- a/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc +++ b/tst/EnergyPlus/unit/VariableSpeedCoils.unit.cc @@ -48,6 +48,7 @@ // EnergyPlus::VariableSpeedCoils Unit Tests // Google Test Headers +#include #include "Fixtures/EnergyPlusFixture.hh" #include #include @@ -2485,11 +2486,11 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_mixedCoilTypesInput) ASSERT_TRUE(process_idf(idf_objects)); - VariableSpeedCoils::GetVarSpeedCoilInput(state); + VariableSpeedCoils::GetVarSpeedCoilInput(*state); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(1).Name, "LOBBY_ZN_1_FLR_2 WSHP COOLING MODE"); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(1).Name, "LOBBY_ZN_1_FLR_2 WSHP COOLING MODE"); - EXPECT_EQ(state.dataVariableSpeedCoils->VarSpeedCoil(2).Name, "PSZ-AC_1:5_COOLC STANDARD 4-COMPRESSOR IPAK"); + EXPECT_EQ(state->dataVariableSpeedCoils->VarSpeedCoil(2).Name, "PSZ-AC_1:5_COOLC STANDARD 4-COMPRESSOR IPAK"); } TEST_F(EnergyPlusFixture, CoilHeatingDXVariableSpeed_MinOADBTempCompOperLimit) @@ -2654,10 +2655,10 @@ TEST_F(EnergyPlusFixture, CoilHeatingDXVariableSpeed_MinOADBTempCompOperLimit) ASSERT_TRUE(process_idf(idf_objects)); - VariableSpeedCoils::GetVarSpeedCoilInput(state); + VariableSpeedCoils::GetVarSpeedCoilInput(*state); - ASSERT_EQ("HEATING COIL VARIABLESPEED", state.dataVariableSpeedCoils->VarSpeedCoil(1).Name); // Heating Coil Variable Speed - ASSERT_EQ(-60.0, state.dataVariableSpeedCoils->VarSpeedCoil(1).MinOATCompressor); // removed the minimum limit of -50.0C + ASSERT_EQ("HEATING COIL VARIABLESPEED", state->dataVariableSpeedCoils->VarSpeedCoil(1).Name); // Heating Coil Variable Speed + ASSERT_EQ(-60.0, state->dataVariableSpeedCoils->VarSpeedCoil(1).MinOATCompressor); // removed the minimum limit of -50.0C } TEST_F(EnergyPlusFixture, VariableSpeedCoils_Test_CalcTotCap_VSWSHP) @@ -2751,37 +2752,37 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_Test_CalcTotCap_VSWSHP) ASSERT_TRUE(process_idf(idf_objects)); - VariableSpeedCoils::GetVarSpeedCoilInput(state); + VariableSpeedCoils::GetVarSpeedCoilInput(*state); Real64 LSInletDBTemp = 24.0; // conditions at 24 DB / 20 Wb found at http://www.sugartech.co.za/psychro/index.php Real64 LSInletHumRat = 0.013019367; Real64 LSInletEnth = 57256.90248; Real64 LSInletWBTemp = 20.0; - Real64 AirMassFlowRatio = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1); + Real64 AirMassFlowRatio = state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedAirVolFlowRate(1); Real64 WaterMassFlowRatio = 0.0; Real64 LSMassFlowRate = 1.45; Real64 CBFSpeed = 0.000001; - Real64 MSRatedTotCap = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedTotCap(1); - int MSCapFTemp = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapFTemp(1); - int MSCapAirFFlow = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapAirFFlow(1); - int MSCapWaterFFlow = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapWaterFFlow(1); + Real64 MSRatedTotCap = state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedTotCap(1); + int MSCapFTemp = state->dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapFTemp(1); + int MSCapAirFFlow = state->dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapAirFFlow(1); + int MSCapWaterFFlow = state->dataVariableSpeedCoils->VarSpeedCoil(1).MSCCapWaterFFlow(1); Real64 QLoadTotal = 0.0; Real64 QLoadTotal1 = 0.0; Real64 QLoadTotal2 = 0.0; - Real64 SHR = state.dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedSHR(1); + Real64 SHR = state->dataVariableSpeedCoils->VarSpeedCoil(1).MSRatedSHR(1); Real64 SSInletTemp = 24.0; Real64 InletAirPressure = 101320.0; - VariableSpeedCoils::CalcTotCapSHR_VSWSHP(state, LSInletDBTemp, LSInletHumRat, LSInletEnth, LSInletWBTemp, AirMassFlowRatio, WaterMassFlowRatio, + VariableSpeedCoils::CalcTotCapSHR_VSWSHP(*state, LSInletDBTemp, LSInletHumRat, LSInletEnth, LSInletWBTemp, AirMassFlowRatio, WaterMassFlowRatio, LSMassFlowRate, CBFSpeed, MSRatedTotCap, MSCapFTemp, MSCapAirFFlow, MSCapWaterFFlow, 0.0, 0, 0, 0, QLoadTotal1, QLoadTotal2, QLoadTotal, SHR, SSInletTemp, InletAirPressure, 0.0, 1, - state.dataVariableSpeedCoils->VarSpeedCoil(1).capModFacTotal); + state->dataVariableSpeedCoils->VarSpeedCoil(1).capModFacTotal); // same calculations as in CalcTotCapSHR_VSWSHP (except CapFTemp term is 1 so no need to add that calc here) Real64 hDelta = MSRatedTotCap / LSMassFlowRate; // Change in air enthalpy across the cooling coil [J/kg] Real64 hADP = LSInletEnth - hDelta / (1.0 - CBFSpeed); // Apparatus dew point enthalpy [J/kg] - Real64 tADP = Psychrometrics::PsyTsatFnHPb(state, hADP, InletAirPressure); // Apparatus dew point temperature [C] - Real64 wADP = Psychrometrics::PsyWFnTdbH(state, tADP, hADP); // Apparatus dew point humidity ratio [kg/kg] + Real64 tADP = Psychrometrics::PsyTsatFnHPb(*state, hADP, InletAirPressure); // Apparatus dew point temperature [C] + Real64 wADP = Psychrometrics::PsyWFnTdbH(*state, tADP, hADP); // Apparatus dew point humidity ratio [kg/kg] Real64 hTinwADP = Psychrometrics::PsyHFnTdbW(LSInletDBTemp, wADP); // Enthalpy at inlet dry-bulb and wADP [J/kg] Real64 SHRCalc = min((hTinwADP - hADP) / (LSInletEnth - hADP), 1.0); // temporary calculated value of SHR @@ -2795,7 +2796,7 @@ TEST_F(EnergyPlusFixture, VariableSpeedCoils_Test_CalcTotCap_VSWSHP) Real64 OutletTemp = LSInletDBTemp - (1.0 - CBFSpeed) * (LSInletDBTemp - tADP); Real64 OutletHumRat = LSInletHumRat - (1.0 - CBFSpeed) * (LSInletHumRat - wADP); Real64 OutletEnthalpy = LSInletEnth - hDelta; - Real64 OutletAirRH = Psychrometrics::PsyRhFnTdbWPb(state, OutletTemp, OutletHumRat, InletAirPressure); + Real64 OutletAirRH = Psychrometrics::PsyRhFnTdbWPb(*state, OutletTemp, OutletHumRat, InletAirPressure); // outlet conditions should be very near the saturation curve EXPECT_NEAR(OutletTemp, tADP, 0.0001); diff --git a/tst/EnergyPlus/unit/Vector.unit.cc b/tst/EnergyPlus/unit/Vector.unit.cc index 1712be7d927..e6fe3dcb939 100644 --- a/tst/EnergyPlus/unit/Vector.unit.cc +++ b/tst/EnergyPlus/unit/Vector.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include #include @@ -62,7 +63,7 @@ using namespace ObjexxFCL; TEST_F(EnergyPlusFixture, VectorTest_Basic) { - ShowMessage(state, "Begin Test: VectorTest, Basic"); + ShowMessage(*state, "Begin Test: VectorTest, Basic"); { Vector v(0.0, 0.0, 0.0); EXPECT_EQ(0.0, v.x); diff --git a/tst/EnergyPlus/unit/Vectors.unit.cc b/tst/EnergyPlus/unit/Vectors.unit.cc index 16f31ab60fa..609c9bb04c9 100644 --- a/tst/EnergyPlus/unit/Vectors.unit.cc +++ b/tst/EnergyPlus/unit/Vectors.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include #include diff --git a/tst/EnergyPlus/unit/VentilatedSlab.unit.cc b/tst/EnergyPlus/unit/VentilatedSlab.unit.cc index db7f73901e2..706c7f08f4d 100644 --- a/tst/EnergyPlus/unit/VentilatedSlab.unit.cc +++ b/tst/EnergyPlus/unit/VentilatedSlab.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -79,17 +80,17 @@ using namespace EnergyPlus::SurfaceGeometry; TEST_F(EnergyPlusFixture, VentilatedSlab_CalcVentilatedSlabCoilOutputTest) { - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; Real64 PowerMet = 0.0; Real64 LatOutputProvided = 0.0; - state.dataVentilatedSlab->NumOfVentSlabs = 1; - state.dataVentilatedSlab->VentSlab.allocate(state.dataVentilatedSlab->NumOfVentSlabs); + state->dataVentilatedSlab->NumOfVentSlabs = 1; + state->dataVentilatedSlab->VentSlab.allocate(state->dataVentilatedSlab->NumOfVentSlabs); int Item = 1; int FanOutletNode = 1; int OutletNode = 2; - state.dataVentilatedSlab->VentSlab(Item).FanOutletNode = FanOutletNode; - state.dataVentilatedSlab->VentSlab(Item).RadInNode = OutletNode; + state->dataVentilatedSlab->VentSlab(Item).FanOutletNode = FanOutletNode; + state->dataVentilatedSlab->VentSlab(Item).RadInNode = OutletNode; Node.allocate(2); Node(OutletNode).MassFlowRate = 0.5; @@ -106,12 +107,12 @@ TEST_F(EnergyPlusFixture, VentilatedSlab_CalcVentilatedSlabCoilOutputTest) Node(FanOutletNode).HumRat = 0.003; Node(OutletNode).Temp = 20.0; Node(OutletNode).HumRat = 0.003; - CalcVentilatedSlabCoilOutput(state, Item, PowerMet, LatOutputProvided); + CalcVentilatedSlabCoilOutput(*state, Item, PowerMet, LatOutputProvided); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).HeatCoilPower > 0.0); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower == 0.0); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower == 0.0); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower == 0.0); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).HeatCoilPower > 0.0); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower == 0.0); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower == 0.0); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower == 0.0); EXPECT_TRUE(LatOutputProvided == 0.0); EXPECT_TRUE(PowerMet > 0.0); @@ -120,12 +121,12 @@ TEST_F(EnergyPlusFixture, VentilatedSlab_CalcVentilatedSlabCoilOutputTest) Node(FanOutletNode).HumRat = 0.003; Node(OutletNode).Temp = 20.0; Node(OutletNode).HumRat = 0.003; - CalcVentilatedSlabCoilOutput(state, Item, PowerMet, LatOutputProvided); + CalcVentilatedSlabCoilOutput(*state, Item, PowerMet, LatOutputProvided); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).HeatCoilPower == 0.0); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower > 0.0); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower == state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower == 0.0); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).HeatCoilPower == 0.0); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower > 0.0); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower == state->dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower == 0.0); EXPECT_TRUE(LatOutputProvided == 0.0); EXPECT_TRUE(PowerMet < 0.0); @@ -134,12 +135,12 @@ TEST_F(EnergyPlusFixture, VentilatedSlab_CalcVentilatedSlabCoilOutputTest) Node(FanOutletNode).HumRat = 0.008; Node(OutletNode).Temp = 20.0; Node(OutletNode).HumRat = 0.003; - CalcVentilatedSlabCoilOutput(state, Item, PowerMet, LatOutputProvided); + CalcVentilatedSlabCoilOutput(*state, Item, PowerMet, LatOutputProvided); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).HeatCoilPower == 0.0); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower > 0.0); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower > state.dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower); - EXPECT_TRUE(state.dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower > 0.0); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).HeatCoilPower == 0.0); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower > 0.0); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).TotCoolCoilPower > state->dataVentilatedSlab->VentSlab(Item).SensCoolCoilPower); + EXPECT_TRUE(state->dataVentilatedSlab->VentSlab(Item).LateCoolCoilPower > 0.0); EXPECT_TRUE(LatOutputProvided < 0.0); EXPECT_TRUE(PowerMet < 0.0); @@ -148,7 +149,7 @@ TEST_F(EnergyPlusFixture, VentilatedSlab_CalcVentilatedSlabCoilOutputTest) TEST_F(EnergyPlusFixture, VentilatedSlab_InitVentilatedSlabTest) { - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; bool ErrorsFound(false); // function returns true on error int Item(1); // index for the current ventilated slab int VentSlabZoneNum(1); // number of zone being served @@ -2298,40 +2299,40 @@ TEST_F(EnergyPlusFixture, VentilatedSlab_InitVentilatedSlabTest) DataSizing::CurZoneEqNum = 1; DataSizing::ZoneEqSizing.allocate(1); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedule data + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedule data ErrorsFound = false; - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); // read project control data EXPECT_FALSE(ErrorsFound); ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); ErrorsFound = false; - GetMaterialData(state, ErrorsFound); // read construction material data + GetMaterialData(*state, ErrorsFound); // read construction material data EXPECT_FALSE(ErrorsFound); ErrorsFound = false; - HeatBalanceManager::GetConstructData(state, ErrorsFound); // read construction data + HeatBalanceManager::GetConstructData(*state, ErrorsFound); // read construction data EXPECT_FALSE(ErrorsFound); ErrorsFound = false; - SetupZoneGeometry(state, ErrorsFound); // read zone geometry data + SetupZoneGeometry(*state, ErrorsFound); // read zone geometry data EXPECT_FALSE(ErrorsFound); ErrorsFound = false; - GetSurfaceListsInputs(state); // read surface data + GetSurfaceListsInputs(*state); // read surface data EXPECT_FALSE(ErrorsFound); - GetVentilatedSlabInput(state); // read ventilated slab data - EXPECT_EQ(2, state.dataVentilatedSlab->NumOfVentSlabs); - EXPECT_EQ("ZONE1VENTSLAB", state.dataVentilatedSlab->VentSlab(1).Name); - EXPECT_EQ("ZONE4VENTSLAB", state.dataVentilatedSlab->VentSlab(2).Name); + GetVentilatedSlabInput(*state); // read ventilated slab data + EXPECT_EQ(2, state->dataVentilatedSlab->NumOfVentSlabs); + EXPECT_EQ("ZONE1VENTSLAB", state->dataVentilatedSlab->VentSlab(1).Name); + EXPECT_EQ("ZONE4VENTSLAB", state->dataVentilatedSlab->VentSlab(2).Name); - InitVentilatedSlab(state, Item, VentSlabZoneNum, FirstHVACIteration); - EXPECT_EQ(324.38499999999999, state.dataVentilatedSlab->VentSlab(1).TotalSurfaceArea); - EXPECT_EQ(139.21499999999997, state.dataVentilatedSlab->VentSlab(2).TotalSurfaceArea); + InitVentilatedSlab(*state, Item, VentSlabZoneNum, FirstHVACIteration); + EXPECT_EQ(324.38499999999999, state->dataVentilatedSlab->VentSlab(1).TotalSurfaceArea); + EXPECT_EQ(139.21499999999997, state->dataVentilatedSlab->VentSlab(2).TotalSurfaceArea); } diff --git a/tst/EnergyPlus/unit/WaterCoils.unit.cc b/tst/EnergyPlus/unit/WaterCoils.unit.cc index 3e81006626b..117c913246c 100644 --- a/tst/EnergyPlus/unit/WaterCoils.unit.cc +++ b/tst/EnergyPlus/unit/WaterCoils.unit.cc @@ -61,6 +61,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -133,10 +134,10 @@ class WaterCoilsTest : public EnergyPlusFixture CurZoneEqNum = 0; CurSysNum = 0; CurOASysNum = 0; - state.dataWaterCoils->NumWaterCoils = 1; - state.dataWaterCoils->WaterCoil.allocate(state.dataWaterCoils->NumWaterCoils); - state.dataWaterCoils->WaterCoilNumericFields.allocate(state.dataWaterCoils->NumWaterCoils); - state.dataWaterCoils->WaterCoilNumericFields(state.dataWaterCoils->NumWaterCoils).FieldNames.allocate(17); // max N fields for water coil + state->dataWaterCoils->NumWaterCoils = 1; + state->dataWaterCoils->WaterCoil.allocate(state->dataWaterCoils->NumWaterCoils); + state->dataWaterCoils->WaterCoilNumericFields.allocate(state->dataWaterCoils->NumWaterCoils); + state->dataWaterCoils->WaterCoilNumericFields(state->dataWaterCoils->NumWaterCoils).FieldNames.allocate(17); // max N fields for water coil TotNumLoops = 1; PlantLoop.allocate(TotNumLoops); PlantSizData.allocate(1); @@ -154,8 +155,8 @@ class WaterCoilsTest : public EnergyPlusFixture SysSizPeakDDNum(1).TotCoolPeakDD = 1; FinalSysSizing.allocate(1); FinalZoneSizing.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopControlInfo.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopControlInfo.allocate(1); InitializePsychRoutines(); } @@ -163,9 +164,9 @@ class WaterCoilsTest : public EnergyPlusFixture { EnergyPlusFixture::TearDown(); // Remember to tear down the base fixture after cleaning up derived fixture! - state.dataWaterCoils->NumWaterCoils = 0; - state.dataWaterCoils->WaterCoil.clear(); - state.dataWaterCoils->WaterCoilNumericFields.clear(); + state->dataWaterCoils->NumWaterCoils = 0; + state->dataWaterCoils->WaterCoil.clear(); + state->dataWaterCoils->WaterCoilNumericFields.clear(); PlantLoop.clear(); PlantSizData.clear(); ZoneEqSizing.clear(); @@ -175,8 +176,8 @@ class WaterCoilsTest : public EnergyPlusFixture SysSizPeakDDNum.clear(); FinalSysSizing.clear(); SysSizPeakDDNum.clear(); - state.dataAirSystemsData->PrimaryAirSystems.clear(); - state.dataAirLoop->AirLoopControlInfo.clear(); + state->dataAirSystemsData->PrimaryAirSystems.clear(); + state->dataAirLoop->AirLoopControlInfo.clear(); cached_Twb.clear(); cached_Psat.clear(); } @@ -185,7 +186,7 @@ class WaterCoilsTest : public EnergyPlusFixture TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) { OutBaroPress = 101325.0; - StdRhoAir = PsyRhoAirFnPbTdbW(state, OutBaroPress, 20.0, 0.0); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, OutBaroPress, 20.0, 0.0); // set up sizing flags SysSizingRunDone = true; @@ -222,21 +223,21 @@ TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) // set up water coil int CoilNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Cooling Coil"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Cooling; - state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - - state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(3) = "Maximum Flow Rate"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Cooling Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Cooling; + state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + + state->dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(3) = "Maximum Flow Rate"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; CurZoneEqNum = 0; CurSysNum = 1; @@ -249,9 +250,9 @@ TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) NumOfGlycols = 1; createCoilSelectionReportObj(); - SizeWaterCoil(state, CoilNum); + SizeWaterCoil(*state, CoilNum); - EXPECT_DOUBLE_EQ(0.00159, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + EXPECT_DOUBLE_EQ(0.00159, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); // Check that all Data* variables have been reset EXPECT_EQ(0, DataPltSizCoolNum); EXPECT_EQ(0, DataWaterLoopNum); @@ -271,18 +272,18 @@ TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) FinalSysSizing(1).DesMainVolFlow = 0.00259; FinalSysSizing(1).MassFlowAtCoolPeak = FinalSysSizing(1).DesMainVolFlow * StdRhoAir; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Cooling Coil 2"; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Cooling Coil 2"; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - SizeWaterCoil(state, CoilNum); + SizeWaterCoil(*state, CoilNum); - EXPECT_DOUBLE_EQ(0.00259, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + EXPECT_DOUBLE_EQ(0.00259, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); EXPECT_EQ(0, DataPltSizCoolNum); EXPECT_EQ(0, DataWaterLoopNum); EXPECT_DOUBLE_EQ(0.0, DataConstantUsedForSizing); @@ -303,21 +304,21 @@ TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) CurOASysNum = 0; FinalSysSizing(1).DesMainVolFlow = 0.00359; FinalSysSizing(1).MassFlowAtCoolPeak = FinalSysSizing(1).DesMainVolFlow * StdRhoAir; - state.dataAirLoop->AirLoopControlInfo(1).UnitarySys = true; + state->dataAirLoop->AirLoopControlInfo(1).UnitarySys = true; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Heating Coil"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Heating Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - SizeWaterCoil(state, CoilNum); + SizeWaterCoil(*state, CoilNum); - EXPECT_DOUBLE_EQ(0.00359, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + EXPECT_DOUBLE_EQ(0.00359, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); EXPECT_EQ(0, DataPltSizCoolNum); EXPECT_EQ(0, DataWaterLoopNum); EXPECT_DOUBLE_EQ(0.0, DataConstantUsedForSizing); @@ -336,19 +337,19 @@ TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) FinalSysSizing(1).DesMainVolFlow = 0.00459; FinalSysSizing(1).MassFlowAtCoolPeak = FinalSysSizing(1).DesMainVolFlow * StdRhoAir; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Heating Coil 2"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Water Heating Coil 2"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - SizeWaterCoil(state, CoilNum); + SizeWaterCoil(*state, CoilNum); - EXPECT_DOUBLE_EQ(0.00459, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + EXPECT_DOUBLE_EQ(0.00459, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); EXPECT_EQ(0, DataPltSizCoolNum); EXPECT_EQ(0, DataWaterLoopNum); EXPECT_DOUBLE_EQ(0.0, DataConstantUsedForSizing); @@ -382,26 +383,26 @@ TEST_F(WaterCoilsTest, WaterCoolingCoilSizing) ZoneEqSizing(1).HeatingAirFlow = true; ZoneEqSizing(1).HeatingAirVolFlow = 0.1; FinalZoneSizing(1).DesHeatMassFlow = StdRhoAir * ZoneEqSizing(1).HeatingAirVolFlow; - state.dataWaterCoils->MySizeFlag.allocate(1); - state.dataWaterCoils->MySizeFlag(CoilNum) = true; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(CoilNum) = true; - - state.dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesTotWaterCoilLoad = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - - SizeWaterCoil(state, CoilNum); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(CoilNum).InletAirTemp, 16.0, 0.0001); // a mixture of zone air (20 C) and 10% OA (-20 C) = 16 C - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(CoilNum).DesTotWaterCoilLoad, 1709.8638, 0.0001); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(CoilNum).UACoil, 51.2456, 0.0001); - EXPECT_NEAR(state.dataWaterCoils->WaterCoil(CoilNum).OutletAirTemp, 30.1302, 0.0001); // reasonable delta T above inlet air temp + state->dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->MySizeFlag(CoilNum) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(CoilNum) = true; + + state->dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesTotWaterCoilLoad = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + + SizeWaterCoil(*state, CoilNum); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(CoilNum).InletAirTemp, 16.0, 0.0001); // a mixture of zone air (20 C) and 10% OA (-20 C) = 16 C + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(CoilNum).DesTotWaterCoilLoad, 1709.8638, 0.0001); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(CoilNum).UACoil, 51.2456, 0.0001); + EXPECT_NEAR(state->dataWaterCoils->WaterCoil(CoilNum).OutletAirTemp, 30.1302, 0.0001); // reasonable delta T above inlet air temp } TEST_F(WaterCoilsTest, TdbFnHRhPbTest) @@ -410,16 +411,16 @@ TEST_F(WaterCoilsTest, TdbFnHRhPbTest) // using IP PsyCalc // http://linricsoftw.web701.discountasp.net/webpsycalc.aspx - EXPECT_NEAR(25.0, TdbFnHRhPb(state, 45170., 0.40, 101312.), 0.05); - EXPECT_NEAR(20.0, TdbFnHRhPb(state, 34760., 0.40, 101312.), 0.05); - EXPECT_NEAR(25.0, TdbFnHRhPb(state, 50290., 0.50, 101312.), 0.05); - EXPECT_NEAR(20.0, TdbFnHRhPb(state, 38490., 0.50, 101312.), 0.05); + EXPECT_NEAR(25.0, TdbFnHRhPb(*state, 45170., 0.40, 101312.), 0.05); + EXPECT_NEAR(20.0, TdbFnHRhPb(*state, 34760., 0.40, 101312.), 0.05); + EXPECT_NEAR(25.0, TdbFnHRhPb(*state, 50290., 0.50, 101312.), 0.05); + EXPECT_NEAR(20.0, TdbFnHRhPb(*state, 38490., 0.50, 101312.), 0.05); } TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) { OutBaroPress = 101325.0; - StdRhoAir = PsyRhoAirFnPbTdbW(state, OutBaroPress, 20.0, 0.0); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, OutBaroPress, 20.0, 0.0); // set up sizing flags SysSizingRunDone = true; @@ -456,27 +457,27 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) // set up water coil int CoilNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); - - state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state.dataWaterCoils->UAandFlow; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - - state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(2) = "Maximum Water Flow Rate"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); + + state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state->dataWaterCoils->UAandFlow; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + + state->dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(2) = "Maximum Water Flow Rate"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; CurZoneEqNum = 0; CurSysNum = 1; @@ -484,41 +485,41 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) DataWaterLoopNum = 1; NumOfGlycols = 1; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MySizeFlag.allocate(1); - state.dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->MySizeFlag(1) = true; // run water coil sizing createCoilSelectionReportObj(); - SizeWaterCoil(state, CoilNum); - EXPECT_DOUBLE_EQ(1.0, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + SizeWaterCoil(*state, CoilNum); + EXPECT_DOUBLE_EQ(1.0, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); Real64 CpAirStd = 0.0; Real64 DesMassFlow = 0.0; Real64 DesCoilHeatingLoad = 0.0; CpAirStd = PsyCpAirFnW(0.0); - DesMassFlow = state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir; + DesMassFlow = state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir; DesCoilHeatingLoad = CpAirStd * DesMassFlow * (40.0 - 5.0); // check heating coil design load - EXPECT_DOUBLE_EQ(DesCoilHeatingLoad, state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate); + EXPECT_DOUBLE_EQ(DesCoilHeatingLoad, state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate); Real64 Cp = 0; Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = GetSpecificHeatGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - rho = GetDensityGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - DesWaterFlowRate = state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (10.0 * Cp * rho); + Cp = GetSpecificHeatGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + rho = GetDensityGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (10.0 * Cp * rho); // check heating coil design water flow rate - EXPECT_DOUBLE_EQ(DesWaterFlowRate, state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); + EXPECT_DOUBLE_EQ(DesWaterFlowRate, state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); // check coil UA-value sizing - EXPECT_NEAR(1435.01, state.dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.01); + EXPECT_NEAR(1435.01, state->dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.01); // test single zone VAV reheat coil sizing CurZoneEqNum = 1; @@ -526,20 +527,20 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) CurSysNum = 0; TermUnitSizing.allocate(1); TermUnitFinalZoneSizing.allocate(1); - TermUnitSizing(CurTermUnitSizingNum).AirVolFlow = state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate / 3.0; // DesAirVolFlowRate = 1.0 - TermUnitSizing(CurTermUnitSizingNum).MaxHWVolFlow = state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate / 3.0; + TermUnitSizing(CurTermUnitSizingNum).AirVolFlow = state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate / 3.0; // DesAirVolFlowRate = 1.0 + TermUnitSizing(CurTermUnitSizingNum).MaxHWVolFlow = state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate / 3.0; TermUnitSizing(CurTermUnitSizingNum).MinFlowFrac = 0.5; DataSizing::TermUnitSingDuct = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state.dataWaterCoils->UAandFlow; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state->dataWaterCoils->UAandFlow; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; SysSizingRunDone = false; ZoneSizingRunDone = true; @@ -560,18 +561,18 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing) FinalZoneSizing(CurZoneEqNum).ZoneHumRatAtHeatPeak = 0.008; TermUnitFinalZoneSizing(CurTermUnitSizingNum) = FinalZoneSizing(CurZoneEqNum); - state.dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MySizeFlag(1) = true; // run water coil sizing - SizeWaterCoil(state, CoilNum); + SizeWaterCoil(*state, CoilNum); // check coil UA-value sizing - EXPECT_NEAR(577.686, state.dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.01); // smaller UA than result above at 1435.00 + EXPECT_NEAR(577.686, state->dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.01); // smaller UA than result above at 1435.00 } TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) { OutBaroPress = 101325.0; - StdRhoAir = PsyRhoAirFnPbTdbW(state, OutBaroPress, 20.0, 0.0); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, OutBaroPress, 20.0, 0.0); // set up sizing flags SysSizingRunDone = true; @@ -608,27 +609,27 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) // set up water coil int CoilNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); - - state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state.dataWaterCoils->UAandFlow; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - - state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(2) = "Maximum Water Flow Rate"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); + + state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state->dataWaterCoils->UAandFlow; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + + state->dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(2) = "Maximum Water Flow Rate"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; CurZoneEqNum = 0; CurSysNum = 1; @@ -636,41 +637,41 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) DataWaterLoopNum = 1; NumOfGlycols = 1; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MySizeFlag.allocate(1); - state.dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->MySizeFlag(1) = true; // run water coil sizing createCoilSelectionReportObj(); - SizeWaterCoil(state, CoilNum); - EXPECT_DOUBLE_EQ(1.0, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + SizeWaterCoil(*state, CoilNum); + EXPECT_DOUBLE_EQ(1.0, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); Real64 CpAirStd = 0.0; Real64 DesMassFlow = 0.0; Real64 DesCoilHeatingLoad = 0.0; CpAirStd = PsyCpAirFnW(0.0); - DesMassFlow = state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir; + DesMassFlow = state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir; DesCoilHeatingLoad = CpAirStd * DesMassFlow * (40.0 - 5.0); // check heating coil design load - EXPECT_DOUBLE_EQ(DesCoilHeatingLoad, state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate); + EXPECT_DOUBLE_EQ(DesCoilHeatingLoad, state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate); Real64 Cp = 0; Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = GetSpecificHeatGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - rho = GetDensityGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - DesWaterFlowRate = state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (10.0 * Cp * rho); + Cp = GetSpecificHeatGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + rho = GetDensityGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (10.0 * Cp * rho); // check heating coil design water flow rate - EXPECT_DOUBLE_EQ(DesWaterFlowRate, state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); + EXPECT_DOUBLE_EQ(DesWaterFlowRate, state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); // check coil UA-value sizing - EXPECT_NEAR(1435.01, state.dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.01); + EXPECT_NEAR(1435.01, state->dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.01); // test single zone VAV reheat coil sizing CurZoneEqNum = 1; @@ -679,20 +680,20 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) TermUnitSizing.allocate(1); TermUnitFinalZoneSizing.allocate(1); TermUnitSizing(CurTermUnitSizingNum).AirVolFlow = - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate / 1500.0; // DesAirVolFlowRate = 1.0 so TU air flow = 0.00067 (lower than 0.001) - TermUnitSizing(CurTermUnitSizingNum).MaxHWVolFlow = state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate / 1500.0; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate / 1500.0; // DesAirVolFlowRate = 1.0 so TU air flow = 0.00067 (lower than 0.001) + TermUnitSizing(CurTermUnitSizingNum).MaxHWVolFlow = state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate / 1500.0; TermUnitSizing(CurTermUnitSizingNum).MinFlowFrac = 0.5; DataSizing::TermUnitSingDuct = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state.dataWaterCoils->UAandFlow; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state->dataWaterCoils->UAandFlow; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; SysSizingRunDone = false; ZoneSizingRunDone = true; @@ -713,21 +714,21 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing) FinalZoneSizing(CurZoneEqNum).ZoneHumRatAtHeatPeak = 0.008; TermUnitFinalZoneSizing(CurTermUnitSizingNum) = FinalZoneSizing(CurZoneEqNum); - state.dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MySizeFlag(1) = true; // run water coil sizing - SizeWaterCoil(state, CoilNum); + SizeWaterCoil(*state, CoilNum); // water flow rate should be non-zero, and air flow rate being so small will get set to 0 during sizing - EXPECT_GT(state.dataWaterCoils->WaterCoil(CoilNum).InletWaterMassFlowRate, 0.0); - EXPECT_EQ(0.0, state.dataWaterCoils->WaterCoil(CoilNum).InletAirMassFlowRate); + EXPECT_GT(state->dataWaterCoils->WaterCoil(CoilNum).InletWaterMassFlowRate, 0.0); + EXPECT_EQ(0.0, state->dataWaterCoils->WaterCoil(CoilNum).InletAirMassFlowRate); // check coil UA-value sizing - EXPECT_NEAR(1.0, state.dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.0001); // TU air flow is too low to size, set to 0, so UA is set to 1.0 + EXPECT_NEAR(1.0, state->dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.0001); // TU air flow is too low to size, set to 0, so UA is set to 1.0 } TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp) { OutBaroPress = 101325.0; - StdRhoAir = PsyRhoAirFnPbTdbW(state, OutBaroPress, 20.0, 0.0); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, OutBaroPress, 20.0, 0.0); // set up sizing flags SysSizingRunDone = true; @@ -764,27 +765,27 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp) // set up water coil int CoilNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); - - state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state.dataWaterCoils->UAandFlow; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - - state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(2) = "Maximum Water Flow Rate"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); + + state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state->dataWaterCoils->UAandFlow; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + + state->dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(2) = "Maximum Water Flow Rate"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; CurZoneEqNum = 0; CurSysNum = 1; @@ -793,48 +794,48 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp) DataWaterLoopNum = 1; NumOfGlycols = 1; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MySizeFlag.allocate(1); - state.dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->MySizeFlag(1) = true; // run water coil sizing createCoilSelectionReportObj(); - SizeWaterCoil(state, CoilNum); - EXPECT_DOUBLE_EQ(1.0, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + SizeWaterCoil(*state, CoilNum); + EXPECT_DOUBLE_EQ(1.0, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); Real64 CpAirStd = 0.0; Real64 DesMassFlow = 0.0; Real64 DesCoilHeatingLoad = 0.0; CpAirStd = PsyCpAirFnW(0.0); - DesMassFlow = state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir; + DesMassFlow = state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir; DesCoilHeatingLoad = CpAirStd * DesMassFlow * (40.0 - 5.0); // check heating coil design load - EXPECT_DOUBLE_EQ(DesCoilHeatingLoad, state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate); + EXPECT_DOUBLE_EQ(DesCoilHeatingLoad, state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate); Real64 Cp = 0; Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = GetSpecificHeatGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - rho = GetDensityGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - DesWaterFlowRate = state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (10.0 * Cp * rho); + Cp = GetSpecificHeatGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + rho = GetDensityGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (10.0 * Cp * rho); // check heating coil design water flow rate - EXPECT_DOUBLE_EQ(DesWaterFlowRate, state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); + EXPECT_DOUBLE_EQ(DesWaterFlowRate, state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); // check coil UA-value sizing for low design loop exit temp - EXPECT_NEAR(2479.27, state.dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.01); + EXPECT_NEAR(2479.27, state->dataWaterCoils->WaterCoil(CoilNum).UACoil, 0.01); Real64 DesCoilInletWaterTempUsed = 0.0; Real64 DataFanOpMode = ContFanCycCoil; - Real64 UAMax = state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate; + Real64 UAMax = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate; // check if coil design inlet water temperature is increased above the plant loop exit temp - EstimateCoilInletWaterTemp(state, CoilNum, DataFanOpMode, 1.0, UAMax, DesCoilInletWaterTempUsed); + EstimateCoilInletWaterTemp(*state, CoilNum, DataFanOpMode, 1.0, UAMax, DesCoilInletWaterTempUsed); EXPECT_GT(DesCoilInletWaterTempUsed, PlantSizData(1).ExitTemp); EXPECT_NEAR(48.73, DesCoilInletWaterTempUsed, 0.01); } @@ -843,8 +844,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing) { InitializePsychRoutines(); OutBaroPress = 101325.0; - StdRhoAir = PsyRhoAirFnPbTdbW(state, OutBaroPress, 20.0, 0.0); - ShowMessage(state, "Begin Test: state.dataWaterCoils->WaterCoilsTest, CoilCoolingWaterSimpleSizing"); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, OutBaroPress, 20.0, 0.0); + ShowMessage(*state, "Begin Test: state->dataWaterCoils->WaterCoilsTest, CoilCoolingWaterSimpleSizing"); // set up sizing flags SysSizingRunDone = true; @@ -880,27 +881,27 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing) // set up water coil int CoilNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Test Simple Water Cooling Coil"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Cooling; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_Cooling; // Coil:Cooling:Water - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state.dataWaterCoils->CoilModel_Cooling; - - state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - - state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp = 6.67; - state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp = true; - - state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(1) = "Design Water Flow Rate"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Simple Water Cooling Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Cooling; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_Cooling; // Coil:Cooling:Water + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilModel_Cooling; + + state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + + state->dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp = 6.67; + state->dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp = true; + + state->dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(1) = "Design Water Flow Rate"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; CurZoneEqNum = 0; CurSysNum = 1; @@ -914,8 +915,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing) // run water coil sizing createCoilSelectionReportObj(); - SizeWaterCoil(state, CoilNum); - EXPECT_DOUBLE_EQ(1.0, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + SizeWaterCoil(*state, CoilNum); + EXPECT_DOUBLE_EQ(1.0, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); Real64 DesCoilCoolingLoad = 0.0; Real64 CoilInEnth = 0.0; @@ -923,29 +924,29 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing) CoilInEnth = PsyHFnTdbW(20.0, 0.01); CoilOutEnth = PsyHFnTdbW(10.0, 0.0085); - DesCoilCoolingLoad = state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir * (CoilInEnth - CoilOutEnth); + DesCoilCoolingLoad = state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir * (CoilInEnth - CoilOutEnth); // check cooling coil design load - EXPECT_DOUBLE_EQ(DesCoilCoolingLoad, state.dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate); + EXPECT_DOUBLE_EQ(DesCoilCoolingLoad, state->dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate); Real64 Cp = 0; Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = GetSpecificHeatGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - rho = GetDensityGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - DesWaterFlowRate = state.dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate / (state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp * Cp * rho); + Cp = GetSpecificHeatGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + rho = GetDensityGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate / (state->dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp * Cp * rho); // check cooling coil design water flow rate - EXPECT_DOUBLE_EQ(DesWaterFlowRate, state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); + EXPECT_DOUBLE_EQ(DesWaterFlowRate, state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); } TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing) { InitializePsychRoutines(); OutBaroPress = 101325.0; - StdRhoAir = PsyRhoAirFnPbTdbW(state, OutBaroPress, 20.0, 0.0); - ShowMessage(state, "Begin Test: state.dataWaterCoils->WaterCoilsTest, CoilCoolingWaterDetailedSizing"); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, OutBaroPress, 20.0, 0.0); + ShowMessage(*state, "Begin Test: state->dataWaterCoils->WaterCoilsTest, CoilCoolingWaterDetailedSizing"); // set up sizing flags SysSizingRunDone = true; @@ -981,43 +982,43 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing) // set up water coil int CoilNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Test Detailed Water Cooling Coil"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Cooling; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_DetFlatFinCooling; // Coil:Cooling:Water:DetailedGeometry - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state.dataWaterCoils->CoilModel_Detailed; - - state.dataWaterCoils->WaterCoil(CoilNum).TubeOutsideSurfArea = 6.23816; - state.dataWaterCoils->WaterCoil(CoilNum).TotTubeInsideArea = 6.20007018; - state.dataWaterCoils->WaterCoil(CoilNum).FinSurfArea = 101.7158224; - state.dataWaterCoils->WaterCoil(CoilNum).MinAirFlowArea = 0.810606367; - state.dataWaterCoils->WaterCoil(CoilNum).CoilDepth = 0.165097968; - state.dataWaterCoils->WaterCoil(CoilNum).FinDiam = 0.43507152; - state.dataWaterCoils->WaterCoil(CoilNum).FinThickness = 0.001499982; - state.dataWaterCoils->WaterCoil(CoilNum).TubeInsideDiam = 0.014449958; - state.dataWaterCoils->WaterCoil(CoilNum).TubeOutsideDiam = 0.015879775; - state.dataWaterCoils->WaterCoil(CoilNum).TubeThermConductivity = 385.764854; - state.dataWaterCoils->WaterCoil(CoilNum).FinThermConductivity = 203.882537; - state.dataWaterCoils->WaterCoil(CoilNum).FinSpacing = 0.001814292; - state.dataWaterCoils->WaterCoil(CoilNum).TubeDepthSpacing = 0.02589977; - state.dataWaterCoils->WaterCoil(CoilNum).NumOfTubeRows = 6; - state.dataWaterCoils->WaterCoil(CoilNum).NumOfTubesPerRow = 16; - state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp = 6.67; - state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp = true; - - state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - - state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(1) = "Design Water Flow Rate"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Detailed Water Cooling Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Cooling; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_DetFlatFinCooling; // Coil:Cooling:Water:DetailedGeometry + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilModel_Detailed; + + state->dataWaterCoils->WaterCoil(CoilNum).TubeOutsideSurfArea = 6.23816; + state->dataWaterCoils->WaterCoil(CoilNum).TotTubeInsideArea = 6.20007018; + state->dataWaterCoils->WaterCoil(CoilNum).FinSurfArea = 101.7158224; + state->dataWaterCoils->WaterCoil(CoilNum).MinAirFlowArea = 0.810606367; + state->dataWaterCoils->WaterCoil(CoilNum).CoilDepth = 0.165097968; + state->dataWaterCoils->WaterCoil(CoilNum).FinDiam = 0.43507152; + state->dataWaterCoils->WaterCoil(CoilNum).FinThickness = 0.001499982; + state->dataWaterCoils->WaterCoil(CoilNum).TubeInsideDiam = 0.014449958; + state->dataWaterCoils->WaterCoil(CoilNum).TubeOutsideDiam = 0.015879775; + state->dataWaterCoils->WaterCoil(CoilNum).TubeThermConductivity = 385.764854; + state->dataWaterCoils->WaterCoil(CoilNum).FinThermConductivity = 203.882537; + state->dataWaterCoils->WaterCoil(CoilNum).FinSpacing = 0.001814292; + state->dataWaterCoils->WaterCoil(CoilNum).TubeDepthSpacing = 0.02589977; + state->dataWaterCoils->WaterCoil(CoilNum).NumOfTubeRows = 6; + state->dataWaterCoils->WaterCoil(CoilNum).NumOfTubesPerRow = 16; + state->dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp = 6.67; + state->dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp = true; + + state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + + state->dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(1) = "Design Water Flow Rate"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; CurZoneEqNum = 0; CurSysNum = 1; @@ -1030,8 +1031,8 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing) // run water coil sizing createCoilSelectionReportObj(); - SizeWaterCoil(state, CoilNum); - EXPECT_DOUBLE_EQ(1.0, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + SizeWaterCoil(*state, CoilNum); + EXPECT_DOUBLE_EQ(1.0, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); Real64 DesCoilCoolingLoad = 0.0; Real64 CoilInEnth = 0.0; @@ -1039,26 +1040,26 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing) CoilInEnth = PsyHFnTdbW(FinalSysSizing(1).MixTempAtCoolPeak, FinalSysSizing(1).MixHumRatAtCoolPeak); CoilOutEnth = PsyHFnTdbW(FinalSysSizing(1).CoolSupTemp, FinalSysSizing(1).CoolSupHumRat); - DesCoilCoolingLoad = state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir * (CoilInEnth - CoilOutEnth); + DesCoilCoolingLoad = state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir * (CoilInEnth - CoilOutEnth); // check cooling coil design load - EXPECT_DOUBLE_EQ(DesCoilCoolingLoad, state.dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate); + EXPECT_DOUBLE_EQ(DesCoilCoolingLoad, state->dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate); Real64 Cp = 0; Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = GetSpecificHeatGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - rho = GetDensityGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - DesWaterFlowRate = state.dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate / (6.67 * Cp * rho); + Cp = GetSpecificHeatGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + rho = GetDensityGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::CWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterCoolingCoilRate / (6.67 * Cp * rho); // check cooling coil design water flow rate - EXPECT_DOUBLE_EQ(DesWaterFlowRate, state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); + EXPECT_DOUBLE_EQ(DesWaterFlowRate, state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); } TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing) { InitializePsychRoutines(); OutBaroPress = 101325.0; - StdRhoAir = PsyRhoAirFnPbTdbW(state, OutBaroPress, 20.0, 0.0); - ShowMessage(state, "Begin Test: state.dataWaterCoils->WaterCoilsTest, CoilHeatingWaterSimpleSizing"); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, OutBaroPress, 20.0, 0.0); + ShowMessage(*state, "Begin Test: state->dataWaterCoils->WaterCoilsTest, CoilHeatingWaterSimpleSizing"); // set up sizing flags SysSizingRunDone = true; @@ -1093,26 +1094,26 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing) // set up water coil int CoilNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Test Simple Water Heating Coil"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - - state.dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp = 11.0; - state.dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp = true; - - state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(2) = "Maximum Water Flow Rate"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Test Simple Water Heating Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + + state->dataWaterCoils->WaterCoil(CoilNum).DesignWaterDeltaTemp = 11.0; + state->dataWaterCoils->WaterCoil(CoilNum).UseDesignWaterDeltaTemp = true; + + state->dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(2) = "Maximum Water Flow Rate"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; CurZoneEqNum = 0; CurSysNum = 1; @@ -1126,8 +1127,8 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing) // run water coil sizing createCoilSelectionReportObj(); - SizeWaterCoil(state, CoilNum); - EXPECT_DOUBLE_EQ(1.0, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + SizeWaterCoil(*state, CoilNum); + EXPECT_DOUBLE_EQ(1.0, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); Real64 CpAirStd = 0.0; Real64 DesMassFlow = 0.0; @@ -1138,23 +1139,23 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing) DesCoilHeatingLoad = CpAirStd * DesMassFlow * (40.0 - 5.0); // check heating coil design load - EXPECT_DOUBLE_EQ(DesCoilHeatingLoad, state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate); + EXPECT_DOUBLE_EQ(DesCoilHeatingLoad, state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate); Real64 Cp = 0; Real64 rho = 0; Real64 DesWaterFlowRate = 0; - Cp = GetSpecificHeatGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - rho = GetDensityGlycol(state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); - DesWaterFlowRate = state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (11.0 * Cp * rho); + Cp = GetSpecificHeatGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + rho = GetDensityGlycol(*state, PlantLoop(1).FluidName, DataGlobalConstants::HWInitConvTemp(), PlantLoop(1).FluidIndex, "Unit Test"); + DesWaterFlowRate = state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate / (11.0 * Cp * rho); // check heating coil design water flow rate - EXPECT_DOUBLE_EQ(DesWaterFlowRate, state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); + EXPECT_DOUBLE_EQ(DesWaterFlowRate, state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); } TEST_F(WaterCoilsTest, HotWaterHeatingCoilAutoSizeTempTest) { OutBaroPress = 101325.0; - StdRhoAir = PsyRhoAirFnPbTdbW(state, OutBaroPress, 20.0, 0.0); + StdRhoAir = PsyRhoAirFnPbTdbW(*state, OutBaroPress, 20.0, 0.0); // set up sizing flags SysSizingRunDone = true; @@ -1191,27 +1192,27 @@ TEST_F(WaterCoilsTest, HotWaterHeatingCoilAutoSizeTempTest) // set up water coil int CoilNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state.dataWaterCoils->CoilType_Heating; - state.dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); - - state.dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; - state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state.dataWaterCoils->UAandFlow; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; - state.dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; - - state.dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(2) = "Maximum Water Flow Rate"; - state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; + state->dataWaterCoils->WaterCoil(CoilNum).Name = "Water Heating Coil"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; // Coil:Heating:Water + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilModel = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).WaterCoilType = state->dataWaterCoils->CoilType_Heating; + state->dataWaterCoils->WaterCoil(CoilNum).SchedPtr = DataGlobalConstants::ScheduleAlwaysOn(); + + state->dataWaterCoils->WaterCoil(CoilNum).RequestingAutoSize = true; + state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).UACoil = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).CoilPerfInpMeth = state->dataWaterCoils->UAandFlow; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletWaterTemp = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesInletAirHumRat = AutoSize; + state->dataWaterCoils->WaterCoil(CoilNum).DesOutletAirHumRat = AutoSize; + + state->dataWaterCoils->WaterCoilNumericFields(CoilNum).FieldNames(2) = "Maximum Water Flow Rate"; + state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum = 1; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(CoilNum).WaterInletNodeNum; CurZoneEqNum = 0; CurSysNum = 1; @@ -1220,38 +1221,38 @@ TEST_F(WaterCoilsTest, HotWaterHeatingCoilAutoSizeTempTest) DataWaterLoopNum = 1; NumOfGlycols = 1; - state.dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); - state.dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; + state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1); + state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true; - state.dataWaterCoils->MySizeFlag.allocate(1); - state.dataWaterCoils->MySizeFlag(1) = true; + state->dataWaterCoils->MySizeFlag.allocate(1); + state->dataWaterCoils->MySizeFlag(1) = true; // run water coil sizing - SizeWaterCoil(state, CoilNum); - EXPECT_DOUBLE_EQ(1.0, state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); + SizeWaterCoil(*state, CoilNum); + EXPECT_DOUBLE_EQ(1.0, state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate); Real64 CpAirStd(0.0); Real64 DesMassFlow(0.0); Real64 DesCoilHeatingLoad(0.0); CpAirStd = PsyCpAirFnW(0.0); - DesMassFlow = state.dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir; + DesMassFlow = state->dataWaterCoils->WaterCoil(CoilNum).DesAirVolFlowRate * StdRhoAir; DesCoilHeatingLoad = DesMassFlow * CpAirStd * (40.0 - 5.0); // check heating coil design load - EXPECT_DOUBLE_EQ(DesCoilHeatingLoad, state.dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate); + EXPECT_DOUBLE_EQ(DesCoilHeatingLoad, state->dataWaterCoils->WaterCoil(CoilNum).DesWaterHeatingCoilRate); Real64 Cp(0.0); Real64 rho(0.0); Real64 DesWaterFlowRate(0.0); // now size heating coil hot water flow rate at 60.0C - Cp = GetSpecificHeatGlycol(state, PlantLoop(1).FluidName, 60.0, PlantLoop(1).FluidIndex, "Unit Test"); - rho = GetDensityGlycol(state, PlantLoop(1).FluidName, 60.0, PlantLoop(1).FluidIndex, "Unit Test"); + Cp = GetSpecificHeatGlycol(*state, PlantLoop(1).FluidName, 60.0, PlantLoop(1).FluidIndex, "Unit Test"); + rho = GetDensityGlycol(*state, PlantLoop(1).FluidName, 60.0, PlantLoop(1).FluidIndex, "Unit Test"); DesWaterFlowRate = DesCoilHeatingLoad / (PlantSizData(1).DeltaT * Cp * rho); // check heating coil design water flow rate calculated here and sizing results are identical - EXPECT_DOUBLE_EQ(DesWaterFlowRate, state.dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); + EXPECT_DOUBLE_EQ(DesWaterFlowRate, state->dataWaterCoils->WaterCoil(CoilNum).MaxWaterVolFlowRate); } TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) @@ -1280,11 +1281,11 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) DataEnvironment::OutBaroPress = 101325.0; DataEnvironment::StdRhoAir = 1.20; - state.dataWaterCoils->GetWaterCoilsInputFlag = true; + state->dataWaterCoils->GetWaterCoilsInputFlag = true; NumCoils = 0; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->MinutesPerTimeStep = 60; InitializePsychRoutines(); @@ -1412,16 +1413,16 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) ASSERT_TRUE(process_idf(idf_objects)); - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); EXPECT_EQ("EAST ZONE", Zone(1).Name); - GetZoneEquipmentData1(state); - ProcessScheduleInput(state); + GetZoneEquipmentData1(*state); + ProcessScheduleInput(*state); ScheduleInputProcessed = true; - GetFanInput(state); + GetFanInput(*state); EXPECT_EQ(DataHVACGlobals::FanType_SimpleOnOff, Fan(1).FanType_Num); - GetFanCoilUnits(state); + GetFanCoilUnits(*state); EXPECT_EQ("CONSTANTFANVARIABLEFLOW", FanCoil(1).CapCtrlMeth); EXPECT_EQ("OUTDOORAIR:MIXER", FanCoil(1).OAMixType); EXPECT_EQ("FAN:ONOFF", FanCoil(1).FanType); @@ -1443,11 +1444,11 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) Node(OAMixer(1).RetNode).Temp = 24.0; Node(OAMixer(1).RetNode).Enthalpy = 36000; - Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); + Node(OAMixer(1).RetNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).RetNode).Temp, Node(OAMixer(1).RetNode).Enthalpy); Node(OAMixer(1).InletNode).Temp = 30.0; Node(OAMixer(1).InletNode).Enthalpy = 53000; - Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); + Node(OAMixer(1).InletNode).HumRat = PsyWFnTdbH(*state, Node(OAMixer(1).InletNode).Temp, Node(OAMixer(1).InletNode).Enthalpy); Node(FanCoil(1).AirInNode).MassFlowRate = AirMassFlow; Node(FanCoil(1).AirInNode).MassFlowRateMin = AirMassFlow; @@ -1474,34 +1475,34 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) Node(Fan(1).InletNodeNum).MassFlowRateMax = AirMassFlow; Node(Fan(1).InletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - state.dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; - state.dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; - state.dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; - state.dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; - - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - state.dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; - - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; - Node(state.dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; - - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; - Node(state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; - state.dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).UACoilTotal = 470.0; + state->dataWaterCoils->WaterCoil(2).UACoilExternal = 611.0; + state->dataWaterCoils->WaterCoil(2).UACoilInternal = 2010.0; + state->dataWaterCoils->WaterCoil(2).TotCoilOutsideSurfArea = 50.0; + + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMin = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMax = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(2).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + state->dataWaterCoils->WaterCoil(2).InletWaterMassFlowRate = ColdWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(2).MaxWaterMassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum).Temp = 6.0; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRate = ColdWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum).MassFlowRateMaxAvail = ColdWaterMassFlowRate; + + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRate = AirMassFlow; + Node(state->dataWaterCoils->WaterCoil(1).AirInletNodeNum).MassFlowRateMaxAvail = AirMassFlow; + + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).Temp = 60.0; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRate = HotWaterMassFlowRate; + Node(state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum).MassFlowRateMaxAvail = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).InletWaterMassFlowRate = HotWaterMassFlowRate; + state->dataWaterCoils->WaterCoil(1).MaxWaterMassFlowRate = HotWaterMassFlowRate; for (int l = 1; l <= TotNumLoops; ++l) { auto &loop(PlantLoop(l)); @@ -1517,42 +1518,42 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) DataHeatBalFanSys::TempControlType.allocate(1); DataHeatBalFanSys::TempControlType(1) = 4; - state.dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(2).WaterLoopCompNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; - state.dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; - state.dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopNum = 2; + state->dataWaterCoils->WaterCoil(1).WaterLoopSide = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopBranchNum = 1; + state->dataWaterCoils->WaterCoil(1).WaterLoopCompNum = 1; PlantLoop(2).Name = "ChilledWaterLoop"; PlantLoop(2).FluidName = "ChilledWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(2).Name; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_Cooling; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(2).WaterInletNodeNum; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(2).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_Cooling; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(2).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; PlantLoop(2).LoopSide(1).FlowLock = 0; PlantLoop(1).Name = "HotWaterLoop"; PlantLoop(1).FluidName = "HotWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterCoils->WaterCoil(1).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterCoils->WaterCoil_SimpleHeating; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterCoils->WaterCoil(1).WaterInletNodeNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterCoils->WaterCoil(1).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterCoils->WaterCoil_SimpleHeating; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterCoils->WaterCoil(1).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumOut = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; PlantLoop(1).LoopSide(1).FlowLock = 0; FanCoil(1).CoolCoilLoopNum = 2; FanCoil(1).HeatCoilLoopNum = 1; FanCoil(1).CoolCoilLoopSide = 1; FanCoil(1).HeatCoilLoopSide = 1; - FanCoil(1).HeatCoilFluidOutletNodeNum = state.dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; - FanCoil(1).CoolCoilFluidOutletNodeNum = state.dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; + FanCoil(1).HeatCoilFluidOutletNodeNum = state->dataWaterCoils->WaterCoil(1).WaterOutletNodeNum; + FanCoil(1).CoolCoilFluidOutletNodeNum = state->dataWaterCoils->WaterCoil(2).WaterOutletNodeNum; FanCoil(1).CoolCoilBranchNum = 1; FanCoil(1).CoolCoilCompNum = 1; FanCoil(1).HeatCoilBranchNum = 1; @@ -1567,7 +1568,7 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) QUnitOut = 0.0; QZnReq = -4000.0; - state.dataGlobal->DoingSizing = true; + state->dataGlobal->DoingSizing = true; CurZoneEqNum = 1; ZoneSizingRunDone = true; @@ -1585,17 +1586,17 @@ TEST_F(WaterCoilsTest, FanCoilCoolingWaterFlowTest) DataSizing::ZoneEqSizing(CurZoneEqNum).MaxHWVolFlow = 0.0002; // Initial design air volume flow rate based on the design conditions - state.dataWaterCoils->WaterCoil(2).DesAirVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(2).DesAirVolFlowRate = DataSizing::AutoSize; // Initial design water flow rate based on the design conditions - state.dataWaterCoils->WaterCoil(2).MaxWaterVolFlowRate = DataSizing::AutoSize; + state->dataWaterCoils->WaterCoil(2).MaxWaterVolFlowRate = DataSizing::AutoSize; // normal cooling simulation for constant fan variable flow fan coil - Sim4PipeFanCoil(state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); + Sim4PipeFanCoil(*state, FanCoilNum, ZoneNum, ControlledZoneNum, FirstHVACIteration, QUnitOut, LatOutputProvided); // Expect final design air volume flow rate to equal the user-specified air volume flow rate from the ZoneHVAC:FourPipeFanCoil object - EXPECT_EQ(state.dataWaterCoils->WaterCoil(2).DesAirVolFlowRate, 0.5); + EXPECT_EQ(state->dataWaterCoils->WaterCoil(2).DesAirVolFlowRate, 0.5); // Expect final design water flow rate to equal the user-specified water flow rate from the ZoneHVAC:FourPipeFanCoil object - EXPECT_EQ(state.dataWaterCoils->WaterCoil(2).MaxWaterVolFlowRate, 0.0002); + EXPECT_EQ(state->dataWaterCoils->WaterCoil(2).MaxWaterVolFlowRate, 0.0002); } diff --git a/tst/EnergyPlus/unit/WaterManager.unit.cc b/tst/EnergyPlus/unit/WaterManager.unit.cc index 7f3e716f8b3..ac7ea46a6e4 100644 --- a/tst/EnergyPlus/unit/WaterManager.unit.cc +++ b/tst/EnergyPlus/unit/WaterManager.unit.cc @@ -50,6 +50,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -76,19 +77,19 @@ TEST_F(EnergyPlusFixture, WaterManager_NormalAnnualPrecipitation) }); ASSERT_TRUE(process_idf(idf_objects)); - WaterManager::GetWaterManagerInput(state); + WaterManager::GetWaterManagerInput(*state); ScheduleManager::Schedule(1).CurrentValue = 1.0; - WaterManager::UpdatePrecipitation(state); + WaterManager::UpdatePrecipitation(*state); Real64 ExpectedNomAnnualRain = 0.80771; Real64 ExpectedCurrentRate = 1.0 * (0.75 / 0.80771) / DataGlobalConstants::SecInHour(); - Real64 NomAnnualRain = state.dataWaterData->RainFall.NomAnnualRain; + Real64 NomAnnualRain = state->dataWaterData->RainFall.NomAnnualRain; EXPECT_NEAR(NomAnnualRain, ExpectedNomAnnualRain, 0.000001); - Real64 CurrentRate = state.dataWaterData->RainFall.CurrentRate; + Real64 CurrentRate = state->dataWaterData->RainFall.CurrentRate; EXPECT_NEAR(CurrentRate, ExpectedCurrentRate, 0.000001); } @@ -109,15 +110,15 @@ TEST_F(EnergyPlusFixture, WaterManager_ZeroAnnualPrecipitation) "1;", }); ASSERT_TRUE(process_idf(idf_objects)); - WaterManager::GetWaterManagerInput(state); + WaterManager::GetWaterManagerInput(*state); ScheduleManager::Schedule(1).CurrentValue = 1.0; - WaterManager::UpdatePrecipitation(state); + WaterManager::UpdatePrecipitation(*state); - Real64 NomAnnualRain = state.dataWaterData->RainFall.NomAnnualRain; + Real64 NomAnnualRain = state->dataWaterData->RainFall.NomAnnualRain; EXPECT_NEAR(NomAnnualRain, 0.0, 0.000001); - Real64 CurrentRate = state.dataWaterData->RainFall.CurrentRate; + Real64 CurrentRate = state->dataWaterData->RainFall.CurrentRate; EXPECT_NEAR(CurrentRate, 0.0, 0.000001); } diff --git a/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc b/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc index 0c70b3f7616..22bc4e4ae46 100644 --- a/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc +++ b/tst/EnergyPlus/unit/WaterThermalTanks.unit.cc @@ -55,6 +55,7 @@ #include // EnergyPlus Headers +#include #include "Fixtures/EnergyPlusFixture.hh" #include #include @@ -356,9 +357,9 @@ TEST_F(EnergyPlusFixture, HPWHZoneEquipSeqenceNumberWarning) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); } TEST_F(EnergyPlusFixture, HPWHWrappedDummyNodeConfig) @@ -530,11 +531,11 @@ TEST_F(EnergyPlusFixture, HPWHWrappedDummyNodeConfig) ASSERT_TRUE(process_idf(idf_objects)); - WaterThermalTanks::GetWaterThermalTankInput(state); + WaterThermalTanks::GetWaterThermalTankInput(*state); - for (int i = 1; i <= state.dataWaterThermalTanks->numHeatPumpWaterHeater; ++i) { - auto const &HPWH = state.dataWaterThermalTanks->HPWaterHeater(i); - auto const &Tank = state.dataWaterThermalTanks->WaterThermalTank(HPWH.WaterHeaterTankNum); + for (int i = 1; i <= state->dataWaterThermalTanks->numHeatPumpWaterHeater; ++i) { + auto const &HPWH = state->dataWaterThermalTanks->HPWaterHeater(i); + auto const &Tank = state->dataWaterThermalTanks->WaterThermalTank(HPWH.WaterHeaterTankNum); EXPECT_EQ(HPWH.CondWaterInletNode, Tank.SourceOutletNode); EXPECT_EQ(HPWH.CondWaterOutletNode, Tank.SourceInletNode); } @@ -723,10 +724,10 @@ TEST_F(EnergyPlusFixture, HPWHEnergyBalance) ASSERT_TRUE(process_idf(idf_objects)); DataEnvironment::StdRhoAir = 1.0; - ASSERT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + ASSERT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(1); - WaterThermalTanks::HeatPumpWaterHeaterData &HPWH = state.dataWaterThermalTanks->HPWaterHeater(Tank.HeatPumpNum); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(1); + WaterThermalTanks::HeatPumpWaterHeaterData &HPWH = state->dataWaterThermalTanks->HPWaterHeater(Tank.HeatPumpNum); DXCoils::DXCoilData &Coil = DXCoils::DXCoil(HPWH.DXCoilNum); Tank.Node(1).SavedTemp = 51.190278176501131; Tank.Node(2).SavedTemp = 51.190445301209223; @@ -757,23 +758,23 @@ TEST_F(EnergyPlusFixture, HPWHEnergyBalance) Tank.UseInletTemp = 15.624554988670047; Tank.AmbientTemp = 23.0; - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 10. / 60.; - TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 10. / 60.; + TimeStepSys = state->dataGlobal->TimeStepZone; SysTimeElapsed = 0.0; - Tank.TimeElapsed = state.dataGlobal->HourOfDay + state.dataGlobal->TimeStep * state.dataGlobal->TimeStepZone + SysTimeElapsed; + Tank.TimeElapsed = state->dataGlobal->HourOfDay + state->dataGlobal->TimeStep * state->dataGlobal->TimeStepZone + SysTimeElapsed; DataHVACGlobals::HPWHInletDBTemp = 21.666666666666668; DataHVACGlobals::HPWHInletWBTemp = 14.963459972723468; HPWH.SetPointTemp = 51.666666666666664; OutputReportPredefined::pdstHeatCoil = -1; - state.dataWaterThermalTanks->mdotAir = 0.0993699992873531; + state->dataWaterThermalTanks->mdotAir = 0.0993699992873531; int GlycolIndex = 0; - const Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, Water, Tank.TankTemp, GlycolIndex, "HPWHEnergyBalance"); + const Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, Water, Tank.TankTemp, GlycolIndex, "HPWHEnergyBalance"); - Tank.CalcHeatPumpWaterHeater(state, false); + Tank.CalcHeatPumpWaterHeater(*state, false); const Real64 HeatFromCoil = Coil.TotalHeatingEnergyRate * TimeStepSys * 3600; // J Real64 TankEnergySum = 0; @@ -795,7 +796,7 @@ TEST_F(EnergyPlusFixture, HPWHEnergyBalance) EXPECT_NEAR(HeatFromCoil, TankEnergySum, ErrorBound); // ValidateFuelType tests for WaterHeater:Stratified - WaterThermalTanks::getWaterHeaterStratifiedInput(state); + WaterThermalTanks::getWaterHeaterStratifiedInput(*state); EXPECT_EQ(Tank.FuelType, "Electricity"); EXPECT_EQ(Tank.OffCycParaFuelType, "Electricity"); EXPECT_EQ(Tank.OnCycParaFuelType, "Electricity"); @@ -1033,14 +1034,14 @@ TEST_F(EnergyPlusFixture, HPWHSizing) int CompIndex = 1; Real64 SenseLoadMet = 0; Real64 LatLoadMet = 0; - HeatBalanceManager::GetZoneData(state, ErrorsFound); + HeatBalanceManager::GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); DataHVACGlobals::TimeStepSys = 1; - SetPredefinedTables(state); + SetPredefinedTables(*state); DataHeatBalFanSys::MAT.allocate(1); DataHeatBalFanSys::MAT(1) = 20.0; - WaterThermalTanks::SimHeatPumpWaterHeater(state, "Zone4HeatPumpWaterHeater", true, SenseLoadMet, LatLoadMet, CompIndex); - EXPECT_EQ(Fans::Fan(1).MaxAirFlowRate, state.dataWaterThermalTanks->HPWaterHeater(1).OperatingAirFlowRate); + WaterThermalTanks::SimHeatPumpWaterHeater(*state, "Zone4HeatPumpWaterHeater", true, SenseLoadMet, LatLoadMet, CompIndex); + EXPECT_EQ(Fans::Fan(1).MaxAirFlowRate, state->dataWaterThermalTanks->HPWaterHeater(1).OperatingAirFlowRate); EXPECT_EQ(Fans::Fan(1).MaxAirFlowRate, DXCoils::DXCoil(1).RatedAirVolFlowRate(1)); } @@ -1226,7 +1227,7 @@ TEST_F(EnergyPlusFixture, HPWHOutdoorAirMissingNodeNameWarning) ASSERT_TRUE(process_idf(idf_objects)); - bool ErrorsFound = WaterThermalTanks::GetWaterThermalTankInput(state); + bool ErrorsFound = WaterThermalTanks::GetWaterThermalTankInput(*state); EXPECT_TRUE(ErrorsFound); ASSERT_TRUE(ErrorsFound); @@ -1394,19 +1395,19 @@ TEST_F(EnergyPlusFixture, HPWHTestSPControl) DataEnvironment::StdRhoAir = 1.0; DataHVACGlobals::TimeStepSys = 1; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60 / state.dataGlobal->NumOfTimeStepInHour; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DayOfWeek = 1; DataEnvironment::DayOfYear_Schedule = 1; - SetPredefinedTables(state); - ScheduleManager::UpdateScheduleValues(state); + SetPredefinedTables(*state); + ScheduleManager::UpdateScheduleValues(*state); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(1); - WaterThermalTanks::HeatPumpWaterHeaterData &HeatPump = state.dataWaterThermalTanks->HPWaterHeater(1); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(1); + WaterThermalTanks::HeatPumpWaterHeaterData &HeatPump = state->dataWaterThermalTanks->HPWaterHeater(1); DataHVACGlobals::HPWHInletDBTemp = 30.0; DataEnvironment::WaterMainsTemp = 40.0; DataHVACGlobals::DXCoilTotalCapacity = 3500.0; @@ -1417,23 +1418,23 @@ TEST_F(EnergyPlusFixture, HPWHTestSPControl) DataEnvironment::OutBaroPress = 101325.0; bool FirstHVACIteration(true); - state.dataGlobal->WarmupFlag = true; + state->dataGlobal->WarmupFlag = true; // HeatPump.SetPointTemp = 60.0, deadband = 2C, HP on at 58 C and off at 60 C // Tank.SetPointTemp = 30.0, tank elements should not be used // Tank.TankTemp = 60.0; // based on schedule // Tank.SavedTankTemp = 60.0; - HeatPump.SaveMode = state.dataWaterThermalTanks->floatMode; - Tank.Mode = state.dataWaterThermalTanks->floatMode; - Tank.initialize(state, FirstHVACIteration); - state.dataGlobal->WarmupFlag = false; - Tank.initialize(state, FirstHVACIteration); // read set point schedules on second pass when WarmupFlag is false. - Tank.CalcHeatPumpWaterHeater(state, FirstHVACIteration); + HeatPump.SaveMode = state->dataWaterThermalTanks->floatMode; + Tank.Mode = state->dataWaterThermalTanks->floatMode; + Tank.initialize(*state, FirstHVACIteration); + state->dataGlobal->WarmupFlag = false; + Tank.initialize(*state, FirstHVACIteration); // read set point schedules on second pass when WarmupFlag is false. + Tank.CalcHeatPumpWaterHeater(*state, FirstHVACIteration); Tank.UpdateWaterThermalTank(); // no standby losses, tank at 60 C, tank should remain at 60 C and HP should be off. EXPECT_NEAR(60.0, Tank.TankTemp, 0.0000001); EXPECT_NEAR(0.0, HeatPump.HeatingPLR, 0.0000001); - EXPECT_EQ(state.dataWaterThermalTanks->floatMode, HeatPump.Mode); // expect HP to remain in floating mode + EXPECT_EQ(state->dataWaterThermalTanks->floatMode, HeatPump.Mode); // expect HP to remain in floating mode EXPECT_NEAR(60.0, Tank.TankTempAvg, 0.0000001); // average tank temp over time step EXPECT_NEAR(60.0, Tank.SourceOutletTemp, 0.0000001); // source outlet = average tank temp @@ -1442,45 +1443,45 @@ TEST_F(EnergyPlusFixture, HPWHTestSPControl) // HP in heating mode and tank at low temp needing full HP operation. Use nodes not adding heat to tank. Tank.TankTemp = 50.0; Tank.SavedTankTemp = 50.0; - HeatPump.SaveMode = state.dataWaterThermalTanks->heatMode; - Tank.SavedMode = state.dataWaterThermalTanks->heatMode; - Tank.initialize(state, FirstHVACIteration); - Tank.CalcHeatPumpWaterHeater(state, FirstHVACIteration); + HeatPump.SaveMode = state->dataWaterThermalTanks->heatMode; + Tank.SavedMode = state->dataWaterThermalTanks->heatMode; + Tank.initialize(*state, FirstHVACIteration); + Tank.CalcHeatPumpWaterHeater(*state, FirstHVACIteration); Tank.UpdateWaterThermalTank(); // no standby losses, tank at 50 C, tank should heat up and HP should be on. EXPECT_NEAR(57.2028862, Tank.TankTemp, 0.0000001); // final tank temperature EXPECT_NEAR(1.0, HeatPump.HeatingPLR, 0.0000001); // HP operating at full capacity - EXPECT_EQ(state.dataWaterThermalTanks->heatMode, HeatPump.Mode); // expect HP to remain in heating mode + EXPECT_EQ(state->dataWaterThermalTanks->heatMode, HeatPump.Mode); // expect HP to remain in heating mode EXPECT_NEAR(53.6014431, Tank.TankTempAvg, 0.0000001); // average tank temp over time step EXPECT_NEAR(53.6014431, Tank.SourceOutletTemp, 0.0000001); // source outlet = average tank temp // HP in heating mode and tank at moderate temp needing only partial HP operation. Use nodes not adding heat to tank. Tank.TankTemp = 56.0; Tank.SavedTankTemp = 56.0; - HeatPump.SaveMode = state.dataWaterThermalTanks->heatMode; - Tank.SavedMode = state.dataWaterThermalTanks->heatMode; - Tank.CalcHeatPumpWaterHeater(state, FirstHVACIteration); + HeatPump.SaveMode = state->dataWaterThermalTanks->heatMode; + Tank.SavedMode = state->dataWaterThermalTanks->heatMode; + Tank.CalcHeatPumpWaterHeater(*state, FirstHVACIteration); Tank.UpdateWaterThermalTank(); // no standby losses, tank at 56 C, tank should heat up to 60 C (within convergence tolerance) and HP should cycle. EXPECT_NEAR(60.0011328, Tank.TankTemp, 0.0000001); EXPECT_NEAR(0.5548081, HeatPump.HeatingPLR, 0.0000001); - EXPECT_EQ(state.dataWaterThermalTanks->floatMode, HeatPump.Mode); // expect HP to switch to floating mode since it reached set point + EXPECT_EQ(state->dataWaterThermalTanks->floatMode, HeatPump.Mode); // expect HP to switch to floating mode since it reached set point EXPECT_NEAR(58.0005664, Tank.TankTempAvg, 0.0000001); // average tank temp over time step EXPECT_NEAR(58.0005664, Tank.SourceOutletTemp, 0.0000001); // source outlet = average tank temp // HP in heating mode and tank at moderate temp with use node adding heat to tank Tank.TankTemp = 56.0; Tank.SavedTankTemp = 56.0; - HeatPump.SaveMode = state.dataWaterThermalTanks->heatMode; - Tank.SavedMode = state.dataWaterThermalTanks->heatMode; + HeatPump.SaveMode = state->dataWaterThermalTanks->heatMode; + Tank.SavedMode = state->dataWaterThermalTanks->heatMode; Tank.UseMassFlowRate = 0.02; Tank.UseInletTemp = 90.0; - Tank.CalcHeatPumpWaterHeater(state, FirstHVACIteration); + Tank.CalcHeatPumpWaterHeater(*state, FirstHVACIteration); Tank.UpdateWaterThermalTank(); // no standby losses, tank at 56 C, tank should heat up > 60 C since use nodes add heat to tank and HP should be off and floating. EXPECT_NEAR(61.96991668, Tank.TankTemp, 0.0000001); EXPECT_NEAR(0.0, HeatPump.HeatingPLR, 0.0000001); - EXPECT_EQ(state.dataWaterThermalTanks->floatMode, + EXPECT_EQ(state->dataWaterThermalTanks->floatMode, HeatPump.Mode); // expect HP to switch to floating mode since use nodes added sufficient heat to exceed set point EXPECT_NEAR(59.08095576, Tank.TankTempAvg, 0.0000001); // average tank temp over time step EXPECT_NEAR(59.08095576, Tank.SourceOutletTemp, 0.0000001); // source outlet = average tank temp @@ -1488,16 +1489,16 @@ TEST_F(EnergyPlusFixture, HPWHTestSPControl) // HP in floating mode and tank at moderate temp with use node adding heat to tank Tank.TankTemp = 56.0; Tank.SavedTankTemp = 56.0; - HeatPump.SaveMode = state.dataWaterThermalTanks->floatMode; - Tank.SavedMode = state.dataWaterThermalTanks->floatMode; + HeatPump.SaveMode = state->dataWaterThermalTanks->floatMode; + Tank.SavedMode = state->dataWaterThermalTanks->floatMode; Tank.UseMassFlowRate = 0.02; Tank.UseInletTemp = 90.0; - Tank.CalcHeatPumpWaterHeater(state, FirstHVACIteration); + Tank.CalcHeatPumpWaterHeater(*state, FirstHVACIteration); Tank.UpdateWaterThermalTank(); // no standby losses, tank at 56 C, tank should heat up > 60 C since use nodes add heat to tank and HP should be off and floating. EXPECT_NEAR(61.96991668, Tank.TankTemp, 0.0000001); EXPECT_NEAR(0.0, HeatPump.HeatingPLR, 0.0000001); - EXPECT_EQ(state.dataWaterThermalTanks->floatMode, + EXPECT_EQ(state->dataWaterThermalTanks->floatMode, HeatPump.Mode); // expect HP to remain in floating mode since use nodes added sufficient heat to exceed set point EXPECT_NEAR(59.08095576, Tank.TankTempAvg, 0.0000001); // average tank temp over time step EXPECT_NEAR(59.08095576, Tank.SourceOutletTemp, 0.0000001); // source outlet = average tank temp @@ -1506,21 +1507,21 @@ TEST_F(EnergyPlusFixture, HPWHTestSPControl) Tank.TankTemp = 56.0; Tank.SavedTankTemp = 56.0; HeatPump.SetPointTemp = 30.0; // SP reduced below tank temperature while in heating mode - HeatPump.SaveMode = state.dataWaterThermalTanks->heatMode; - Tank.SavedMode = state.dataWaterThermalTanks->heatMode; + HeatPump.SaveMode = state->dataWaterThermalTanks->heatMode; + Tank.SavedMode = state->dataWaterThermalTanks->heatMode; Tank.UseMassFlowRate = 0.0; Tank.UseInletTemp = 90.0; - Tank.CalcHeatPumpWaterHeater(state, FirstHVACIteration); + Tank.CalcHeatPumpWaterHeater(*state, FirstHVACIteration); Tank.UpdateWaterThermalTank(); // no standby losses, tank at 56 C, tank should remain at 56 C since use nodes are not adding heat to tank and HP set point temp was reduced EXPECT_NEAR(56.0, Tank.TankTemp, 0.0000001); EXPECT_NEAR(0.0, HeatPump.HeatingPLR, 0.0000001); - EXPECT_EQ(state.dataWaterThermalTanks->floatMode, HeatPump.Mode); // expect HP to switch to floating mode since HP set point temperature was reduced + EXPECT_EQ(state->dataWaterThermalTanks->floatMode, HeatPump.Mode); // expect HP to switch to floating mode since HP set point temperature was reduced EXPECT_NEAR(56.0, Tank.TankTempAvg, 0.0000001); // average tank temp over time step EXPECT_NEAR(56.0, Tank.SourceOutletTemp, 0.0000001); // source outlet = average tank temp // ValidateFuelType tests for WaterHeater:Mixed - WaterThermalTanks::getWaterHeaterMixedInputs(state); + WaterThermalTanks::getWaterHeaterMixedInputs(*state); EXPECT_EQ(Tank.FuelType, "Electricity"); EXPECT_EQ(Tank.OffCycParaFuelType, "Electricity"); EXPECT_EQ(Tank.OnCycParaFuelType, "Electricity"); @@ -1595,9 +1596,9 @@ TEST_F(EnergyPlusFixture, StratifiedTankUseEnergy) ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(1); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(1); for (int i = 1; i <= Tank.Nodes; ++i) { auto &node = Tank.Node(i); @@ -1606,19 +1607,19 @@ TEST_F(EnergyPlusFixture, StratifiedTankUseEnergy) } Tank.TankTemp = 48.89; - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 10. / 60.; - TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 10. / 60.; + TimeStepSys = state->dataGlobal->TimeStepZone; SysTimeElapsed = 0.0; - Tank.TimeElapsed = state.dataGlobal->HourOfDay + state.dataGlobal->TimeStep * state.dataGlobal->TimeStepZone + SysTimeElapsed; + Tank.TimeElapsed = state->dataGlobal->HourOfDay + state->dataGlobal->TimeStep * state->dataGlobal->TimeStepZone + SysTimeElapsed; Tank.AmbientTemp = 20.0; Tank.UseInletTemp = 10.0; Tank.SetPointTemp = 48.89; Tank.SetPointTemp2 = Tank.SetPointTemp; Tank.UseMassFlowRate = 0.000189; - Tank.CalcWaterThermalTankStratified(state); + Tank.CalcWaterThermalTankStratified(*state); // Energy Use is negative relative to the tank ASSERT_LT(Tank.UseRate, 0.0); @@ -1694,31 +1695,31 @@ TEST_F(EnergyPlusFixture, StratifiedTankSourceTemperatures) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - InternalHeatGains::GetInternalHeatGainsInput(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); - 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); + 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); ScheduleManager::ScheduleInputProcessed = true; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 7; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); int TankNum(1); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(TankNum); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); for (int i = 1; i <= Tank.Nodes; ++i) { auto &node = Tank.Node(i); @@ -1737,13 +1738,13 @@ TEST_F(EnergyPlusFixture, StratifiedTankSourceTemperatures) Tank.SourceMassFlowRate = 5.0; Tank.TimeElapsed = 0.0; - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 15. / 60.; - TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 15. / 60.; + TimeStepSys = state->dataGlobal->TimeStepZone; SysTimeElapsed = 0.0; - Tank.CalcWaterThermalTankStratified(state); + Tank.CalcWaterThermalTankStratified(*state); // check source inlet and outlet temperatures are different EXPECT_EQ(Tank.SourceInletTemp, 5.0); @@ -1812,19 +1813,19 @@ TEST_F(EnergyPlusFixture, MixedTankTimeNeededCalc) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - InternalHeatGains::GetInternalHeatGainsInput(state); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + InternalHeatGains::GetInternalHeatGainsInput(*state); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); int TankNum(1); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(TankNum); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1.0 / 60.0; // one-minute system time step - TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1.0 / 60.0; // one-minute system time step + TimeStepSys = state->dataGlobal->TimeStepZone; Tank.TankTemp = 60.0; Tank.AmbientTempZone = 20.0; Tank.AmbientTemp = 20.0; @@ -1838,7 +1839,7 @@ TEST_F(EnergyPlusFixture, MixedTankTimeNeededCalc) // zero source mass flow rate Tank.SourceMassFlowRate = 0.0; - Tank.CalcWaterThermalTankMixed(state); + Tank.CalcWaterThermalTankMixed(*state); // steady state estimated tank skin heat loss rate (1 minute time step) Real64 TankSkinHeatLossRate = -Tank.OffCycLossFracToZone * Tank.OffCycLossCoeff * (Tank.AmbientTempZone - Tank.TankTempAvg); @@ -1926,18 +1927,18 @@ TEST_F(EnergyPlusFixture, StratifiedTankCalc) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - InternalHeatGains::GetInternalHeatGainsInput(state); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + InternalHeatGains::GetInternalHeatGainsInput(*state); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 20.0 / 60.0; - TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 20.0 / 60.0; + TimeStepSys = state->dataGlobal->TimeStepZone; const int TankNum = 1; - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(TankNum); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); for (auto &node : Tank.Node) { node.Temp = 60.0; node.SavedTemp = 60.0; @@ -1951,7 +1952,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankCalc) Tank.UseMassFlowRate = 0.0; Tank.SourceMassFlowRate = 0.0; - Tank.CalcWaterThermalTankStratified(state); + Tank.CalcWaterThermalTankStratified(*state); std::vector NodeTemps; NodeTemps.resize(Tank.Nodes); @@ -1975,7 +1976,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankCalc) node.SavedTemp = 58.05; } - Tank.CalcWaterThermalTankStratified(state); + Tank.CalcWaterThermalTankStratified(*state); for (int i = 0; i < Tank.Nodes; ++i) { NodeTemps[i] = Tank.Node[i].Temp; @@ -1998,7 +1999,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankCalc) Tank.UseMassFlowRate = 2 * 6.30901964e-5 * 997; // 2 gal/min - Tank.CalcWaterThermalTankStratified(state); + Tank.CalcWaterThermalTankStratified(*state); for (int i = 0; i < Tank.Nodes; ++i) { NodeTemps[i] = Tank.Node[i].Temp; @@ -2015,7 +2016,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankCalc) auto &node = Tank.Node[i]; TankNodeEnergy += node.Mass * (NodeTemps[i] - PrevNodeTemps[i]); } - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, "WATER", 60.0, DummyIndex, "StratifiedTankCalcNoDraw"); + Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, "WATER", 60.0, DummyIndex, "StratifiedTankCalcNoDraw"); TankNodeEnergy *= Cp; EXPECT_NEAR(Tank.NetHeatTransferRate * SecInTimeStep, TankNodeEnergy, fabs(TankNodeEnergy * 0.0001)); @@ -2035,7 +2036,7 @@ TEST_F(EnergyPlusFixture, StratifiedTankCalc) node.SavedTemp = node.Temp; } - Tank.CalcWaterThermalTankStratified(state); + Tank.CalcWaterThermalTankStratified(*state); for (auto &node : Tank.Node) { EXPECT_LE(node.Temp, Tank.TankTempLimit); @@ -2123,22 +2124,22 @@ TEST_F(EnergyPlusFixture, StratifiedTankSourceFlowRateCalc) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - InternalHeatGains::GetInternalHeatGainsInput(state); + InternalHeatGains::GetInternalHeatGainsInput(*state); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); const int TankNum = 1; - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(TankNum); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); Tank.SourceInletNode = 1; Tank.SourceOutletNode = 2; - Tank.SetupStratifiedNodes(state); + Tank.SetupStratifiedNodes(*state); - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 20.0 / 60.0; - TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 20.0 / 60.0; + TimeStepSys = state->dataGlobal->TimeStepZone; // Test a constant temperature source flow rate for (auto &node : Tank.Node) { @@ -2156,9 +2157,9 @@ TEST_F(EnergyPlusFixture, StratifiedTankSourceFlowRateCalc) Tank.SourceMassFlowRate = 6.30901964e-5 * 997; // 1 gal/min int DummyIndex = 1; - Real64 Cp = FluidProperties::GetSpecificHeatGlycol(state, "WATER", 60.0, DummyIndex, "StratifiedTankCalcNoDraw"); + Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, "WATER", 60.0, DummyIndex, "StratifiedTankCalcNoDraw"); - Tank.CalcWaterThermalTankStratified(state); + Tank.CalcWaterThermalTankStratified(*state); Real64 EnergySum = 0.0; for (int i = 0; i < Tank.Nodes; ++i) { @@ -2362,39 +2363,39 @@ TEST_F(EnergyPlusFixture, DesuperheaterTimeAdvanceCheck) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - 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); + 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); ScheduleManager::ScheduleInputProcessed = true; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 7; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); int TankNum = 1; int DXNum = 1; bool FirstHVAC = true; - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(TankNum); - WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater = state.dataWaterThermalTanks->WaterHeaterDesuperheater(Tank.DesuperheaterNum); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); + WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater = state->dataWaterThermalTanks->WaterHeaterDesuperheater(Tank.DesuperheaterNum); // Inititate tank conditions - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1; - TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1; + TimeStepSys = state->dataGlobal->TimeStepZone; SysTimeElapsed = 0.0; // First iteration condition set (extreme) @@ -2414,7 +2415,7 @@ TEST_F(EnergyPlusFixture, DesuperheaterTimeAdvanceCheck) Tank.Mode = 0; Tank.SetPointTemp = 50; EXPECT_TRUE(Desuperheater.FirstTimeThroughFlag); - Tank.CalcDesuperheaterWaterHeater(state, FirstHVAC); + Tank.CalcDesuperheaterWaterHeater(*state, FirstHVAC); // FirsttimeThroughFlag attribute supposed to set as false after first run EXPECT_FALSE(Desuperheater.FirstTimeThroughFlag); // Advanced to next time step (0 => 1) @@ -2427,7 +2428,7 @@ TEST_F(EnergyPlusFixture, DesuperheaterTimeAdvanceCheck) DataHeatBalance::HeatReclaimDXCoil(DXNum).AvailCapacity = 500; Tank.TankTemp = 20.0; // Assumed Tank temperature from previous iteration EXPECT_FALSE(Desuperheater.FirstTimeThroughFlag); - Tank.CalcDesuperheaterWaterHeater(state, FirstHVAC); + Tank.CalcDesuperheaterWaterHeater(*state, FirstHVAC); EXPECT_FALSE(Desuperheater.FirstTimeThroughFlag); EXPECT_EQ(Node(Desuperheater.WaterInletNode).Temp, 50); // Saved temperature not supposed to change @@ -2441,7 +2442,7 @@ TEST_F(EnergyPlusFixture, DesuperheaterTimeAdvanceCheck) FirstHVAC = false; Tank.TankTemp = 20.0; DataHeatBalance::HeatReclaimDXCoil(DXNum).AvailCapacity = 500; - Tank.CalcDesuperheaterWaterHeater(state, FirstHVAC); + Tank.CalcDesuperheaterWaterHeater(*state, FirstHVAC); // Flag changed from false to true EXPECT_TRUE(Desuperheater.FirstTimeThroughFlag); // Saved temperature not supposed to change @@ -2593,24 +2594,24 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - 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); + 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); ScheduleManager::ScheduleInputProcessed = true; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 7; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); DataPlant::TotNumLoops = 1; int TankNum(1); int HPNum(1); @@ -2622,7 +2623,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) int CompNum(1); Real64 PLR(0.5); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); // Test if the new data Structure for water to air heat pump coils successfully initialized EXPECT_EQ(DataHeatBalance::HeatReclaimSimple_WAHPCoil(1).Name, "GSHP_COIL1"); EXPECT_EQ(DataHeatBalance::HeatReclaimSimple_WAHPCoil(1).SourceType, "Coil:Cooling:WaterToAirHeatPump:EquationFit"); @@ -2634,9 +2635,9 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) Node(3).Temp = 15.0; Node(3).MassFlowRate = 0.05; // Plant loop must be initialized - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).LoopNum = 1; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).LoopNum = 1; PlantLoop.allocate(LoopNum); - PlantLoop(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).LoopNum).FluidIndex = 1; + PlantLoop(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).LoopNum).FluidIndex = 1; PlantLoop(LoopNum).LoopSide.allocate(DemandSide); PlantLoop(LoopNum).LoopSide.allocate(SupplySide); auto &SupplySideloop(PlantLoop(LoopNum).LoopSide(SupplySide)); @@ -2648,18 +2649,18 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) CoilBranch.Comp(CompNum).TypeOf_Num = 67; CoilBranch.Comp(CompNum).Name = "GSHP_COIL1"; - state.dataGlobal->BeginEnvrnFlag = true; - WaterToAirHeatPumpSimple::InitSimpleWatertoAirHP(state, HPNum, 10.0, 1.0, 0.0, 10.0, 10.0, CyclingScheme, 1.0, 1); - WaterToAirHeatPumpSimple::CalcHPCoolingSimple(state, HPNum, CyclingScheme, 1.0, 10.0, 10.0, 1, PLR, 1.0); + state->dataGlobal->BeginEnvrnFlag = true; + WaterToAirHeatPumpSimple::InitSimpleWatertoAirHP(*state, HPNum, 10.0, 1.0, 0.0, 10.0, 10.0, CyclingScheme, 1.0, 1); + WaterToAirHeatPumpSimple::CalcHPCoolingSimple(*state, HPNum, CyclingScheme, 1.0, 10.0, 10.0, 1, PLR, 1.0); // Coil source side heat successfully passed to HeatReclaimSimple_WAHPCoil(1).AvailCapacity - EXPECT_EQ(DataHeatBalance::HeatReclaimSimple_WAHPCoil(1).AvailCapacity, state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).QSource); + EXPECT_EQ(DataHeatBalance::HeatReclaimSimple_WAHPCoil(1).AvailCapacity, state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).QSource); // Reclaimed heat successfully returned to reflect the plant impact DataHeatBalance::HeatReclaimSimple_WAHPCoil(1).WaterHeatingDesuperheaterReclaimedHeat(1) = 100.0; - WaterToAirHeatPumpSimple::CalcHPCoolingSimple(state, HPNum, CyclingScheme, 1.0, 10.0, 10.0, 1, PLR, 1.0); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).QSource, DataHeatBalance::HeatReclaimSimple_WAHPCoil(1).AvailCapacity - 100.0); + WaterToAirHeatPumpSimple::CalcHPCoolingSimple(*state, HPNum, CyclingScheme, 1.0, 10.0, 10.0, 1, PLR, 1.0); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).QSource, DataHeatBalance::HeatReclaimSimple_WAHPCoil(1).AvailCapacity - 100.0); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(TankNum); - WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater = state.dataWaterThermalTanks->WaterHeaterDesuperheater(Tank.DesuperheaterNum); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); + WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater = state->dataWaterThermalTanks->WaterHeaterDesuperheater(Tank.DesuperheaterNum); for (int i = 1; i <= Tank.Nodes; ++i) { auto &node = Tank.Node(i); @@ -2678,17 +2679,17 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) Desuperheater.Mode = 1; Node(Desuperheater.WaterInletNode).Temp = Tank.SourceOutletTemp; - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1. / 60.; - TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1. / 60.; + TimeStepSys = state->dataGlobal->TimeStepZone; SysTimeElapsed = 0.0; DataHeatBalance::HeatReclaimSimple_WAHPCoil(1).AvailCapacity = 1000; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).PartLoadRatio = 0.0; - Tank.initialize(state, true); + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).PartLoadRatio = 0.0; + Tank.initialize(*state, true); Tank.SetPointTemp = 45; Tank.SetPointTemp2 = 45; - Tank.CalcDesuperheaterWaterHeater(state, true); + Tank.CalcDesuperheaterWaterHeater(*state, true); // If there's no demand in water thermal tank, no heat is reclaimed EXPECT_EQ(Desuperheater.HeaterRate, 0); @@ -2703,10 +2704,10 @@ TEST_F(EnergyPlusFixture, StratifiedTank_GSHP_DesuperheaterSourceHeat) Tank.SourceMassFlowRate = 0.003; Node(Desuperheater.WaterInletNode).Temp = Tank.SavedSourceOutletTemp; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).PartLoadRatio = 0.8; - Tank.initialize(state, false); + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(1).PartLoadRatio = 0.8; + Tank.initialize(*state, false); Desuperheater.SaveMode = 1; - Tank.CalcDesuperheaterWaterHeater(state, false); + Tank.CalcDesuperheaterWaterHeater(*state, false); // The HVAC part load ratio is successfully passed to waterthermaltank desuperheater data struct EXPECT_EQ(Desuperheater.DXSysPLR, 0.8); // The heater rate is correctly calculated @@ -2988,29 +2989,29 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - 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); + 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); ScheduleManager::ScheduleInputProcessed = true; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 7; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); int TankNum(1); int DXNum(1); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); // Source name and type successfully passed to DataHeatBalance::HeatReclaimDXCoil data struct EXPECT_EQ(DataHeatBalance::HeatReclaimDXCoil(1).Name, "MULTISPEED_COIL"); EXPECT_EQ(DataHeatBalance::HeatReclaimDXCoil(1).SourceType, "Coil:Cooling:DX:MultiSpeed"); @@ -3019,7 +3020,7 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) DataEnvironment::OutDryBulbTemp = 32.0; DataEnvironment::OutHumRat = 0.02; DataEnvironment::OutBaroPress = 101325.0; - DataEnvironment::OutWetBulbTemp = Psychrometrics::PsyTwbFnTdbWPb(state, 32.0, 0.02, 101325.0); + DataEnvironment::OutWetBulbTemp = Psychrometrics::PsyTwbFnTdbWPb(*state, 32.0, 0.02, 101325.0); DXCoil(1).MSRatedAirMassFlowRate(1) = DXCoil(1).MSRatedAirVolFlowRate(1) * 1.2; DXCoil(1).MSRatedAirMassFlowRate(2) = DXCoil(1).MSRatedAirVolFlowRate(2) * 1.2; @@ -3036,20 +3037,20 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) DXCoil(1).MSRatedCBF(2) = 0.0408; // Calculate multispeed DX cooling coils - DXCoils::CalcMultiSpeedDXCoilCooling(state, DXNum, 1, 1, 2, 1, 1, 1); + DXCoils::CalcMultiSpeedDXCoilCooling(*state, DXNum, 1, 1, 2, 1, 1, 1); // Source availably heat successfully passed to DataHeatBalance::HeatReclaimDXCoil data struct EXPECT_EQ(DataHeatBalance::HeatReclaimDXCoil(DXNum).AvailCapacity, DXCoil(DXNum).TotalCoolingEnergyRate + DXCoil(DXNum).ElecCoolingPower); // Now move to the water thermal tank calculation - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(TankNum); - WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater = state.dataWaterThermalTanks->WaterHeaterDesuperheater(Tank.DesuperheaterNum); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); + WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater = state->dataWaterThermalTanks->WaterHeaterDesuperheater(Tank.DesuperheaterNum); // Inititate tank conditions - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1; - TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1; + TimeStepSys = state->dataGlobal->TimeStepZone; SysTimeElapsed = 0.0; Tank.TankTemp = 45.0; Tank.AmbientTemp = 20.0; @@ -3065,7 +3066,7 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) Tank.Mode = 0; Tank.SetPointTemp = 40.0; Desuperheater.FirstTimeThroughFlag = true; - Tank.CalcDesuperheaterWaterHeater(state, true); + Tank.CalcDesuperheaterWaterHeater(*state, true); EXPECT_EQ(Desuperheater.DXSysPLR, DXCoil(DXNum).PartLoadRatio); // if desuperheater was not on through all the timestep, part load ratio is searched to meet load demand @@ -3082,8 +3083,8 @@ TEST_F(EnergyPlusFixture, Desuperheater_Multispeed_Coil_Test) Desuperheater.SaveMode = 0; Node(Desuperheater.WaterInletNode).Temp = Tank.SavedSourceOutletTemp; Tank.SourceMassFlowRate = 0.003; - DXCoils::CalcMultiSpeedDXCoilCooling(state, DXNum, 1, 1, 2, 1, 1, 1); - Tank.CalcDesuperheaterWaterHeater(state, false); + DXCoils::CalcMultiSpeedDXCoilCooling(*state, DXNum, 1, 1, 2, 1, 1, 1); + Tank.CalcDesuperheaterWaterHeater(*state, false); EXPECT_EQ(Desuperheater.Mode, 0); EXPECT_EQ(Desuperheater.HeaterRate, 0.0); EXPECT_EQ(Tank.SourceRate, 0.0); @@ -3150,30 +3151,30 @@ TEST_F(EnergyPlusFixture, MixedTankAlternateSchedule) ASSERT_TRUE(process_idf(idf_objects)); // Schedules setup - 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); + 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); ScheduleManager::ScheduleInputProcessed = true; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 7; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); int TankNum(1); int DemandSide(1); Real64 rho; int WaterIndex(1); bool NeedsHeatOrCool; - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(TankNum); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); // set tank temp to be alternate setpoint Tank.TankTemp = 70.0; @@ -3182,27 +3183,27 @@ TEST_F(EnergyPlusFixture, MixedTankAlternateSchedule) // Source side is in the demand side of the plant loop Tank.SrcSide.loopSideNum = DemandSide; Tank.SavedSourceOutletTemp = 60.0; - rho = GetDensityGlycol(state, "Water", Tank.TankTemp, WaterIndex, "MixedTankAlternateSchedule"); + rho = GetDensityGlycol(*state, "Water", Tank.TankTemp, WaterIndex, "MixedTankAlternateSchedule"); // Set the available max flow rates for tank and node Tank.PlantSourceMassFlowRateMax = Tank.SourceDesignVolFlowRate * rho; DataLoopNode::Node(1).MassFlowRateMax = Tank.PlantSourceMassFlowRateMax; DataLoopNode::Node(1).MassFlowRateMaxAvail = Tank.PlantSourceMassFlowRateMax; - NeedsHeatOrCool = Tank.SourceHeatNeed(state, 70.0, Tank.SetPointTemp - 2.0, Tank.SetPointTemp); + NeedsHeatOrCool = Tank.SourceHeatNeed(*state, 70.0, Tank.SetPointTemp - 2.0, Tank.SetPointTemp); EXPECT_FALSE(NeedsHeatOrCool); // set tank temp between 55 to 70 to enable alternate setpoint control Tank.TankTemp = 60.0; - NeedsHeatOrCool = Tank.SourceHeatNeed(state, 60.0, Tank.SetPointTemp - 2.0, Tank.SetPointTemp); + NeedsHeatOrCool = Tank.SourceHeatNeed(*state, 60.0, Tank.SetPointTemp - 2.0, Tank.SetPointTemp); EXPECT_TRUE(NeedsHeatOrCool); // plant mass flow rate logic for firstHVAC mode not crashed - Tank.initialize(state, true); + Tank.initialize(*state, true); EXPECT_EQ(Tank.SourceMassFlowRate, 0.0005 * rho); // plant mass flow rate logic added to other iterations run - Tank.initialize(state, false); + Tank.initialize(*state, false); EXPECT_EQ(Tank.SourceMassFlowRate, 0.0005 * rho); } @@ -3256,15 +3257,15 @@ TEST_F(EnergyPlusFixture, MixedTank_WarnPotentialFreeze) ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); int TankNum(1); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(TankNum); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1.0 / 60.0; // one-minute system time step - DataHVACGlobals::TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1.0 / 60.0; // one-minute system time step + DataHVACGlobals::TimeStepSys = state->dataGlobal->TimeStepZone; Tank.TankTemp = 2.0; Tank.AmbientTemp = -40; @@ -3279,7 +3280,7 @@ TEST_F(EnergyPlusFixture, MixedTank_WarnPotentialFreeze) Tank.SourceMassFlowRate = 0.0; // Calls CalcWaterThermalTankMixed - Tank.CalcWaterThermalTank(state); + Tank.CalcWaterThermalTank(*state); // expected tank avg temp less than starting value of 2 C EXPECT_LT(Tank.TankTempAvg, 2.0); @@ -3356,15 +3357,15 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarnPotentialFreeze) ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); int TankNum(1); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(TankNum); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(TankNum); - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1.0 / 60.0; // one-minute system time step - DataHVACGlobals::TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1.0 / 60.0; // one-minute system time step + DataHVACGlobals::TimeStepSys = state->dataGlobal->TimeStepZone; Tank.TankTemp = 2.0; for (auto &node : Tank.Node) { @@ -3384,7 +3385,7 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarnPotentialFreeze) Tank.SourceMassFlowRate = 0.0; // Calls CalcWaterThermalTankStratified - Tank.CalcWaterThermalTank(state); + Tank.CalcWaterThermalTank(*state); // expected tank avg temp less than starting value of 2 C EXPECT_LT(Tank.TankTempAvg, 2.0); @@ -3645,44 +3646,44 @@ TEST_F(EnergyPlusFixture, MultipleDesuperheaterSingleSource) ASSERT_TRUE(process_idf(idf_objects)); - 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); + 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); ScheduleManager::ScheduleInputProcessed = true; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::Month = 7; DataEnvironment::DayOfMonth = 21; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DSTIndicator = 0; DataEnvironment::DayOfWeek = 2; DataEnvironment::HolidayIndex = 0; DataEnvironment::DayOfYear_Schedule = General::OrdinalDay(DataEnvironment::Month, DataEnvironment::DayOfMonth, 1); - ScheduleManager::UpdateScheduleValues(state); + ScheduleManager::UpdateScheduleValues(*state); // Initiate tank conditions - state.dataGlobal->HourOfDay = 0; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1; - TimeStepSys = state.dataGlobal->TimeStepZone; + state->dataGlobal->HourOfDay = 0; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1; + TimeStepSys = state->dataGlobal->TimeStepZone; SysTimeElapsed = 0.0; int DXNum = 1; bool FirstHVAC = true; - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); // first tank - WaterThermalTanks::WaterThermalTankData &Tank1 = state.dataWaterThermalTanks->WaterThermalTank(1); + WaterThermalTanks::WaterThermalTankData &Tank1 = state->dataWaterThermalTanks->WaterThermalTank(1); int desuperheaterNum1 = Tank1.DesuperheaterNum; - WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater1 = state.dataWaterThermalTanks->WaterHeaterDesuperheater(desuperheaterNum1); + WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater1 = state->dataWaterThermalTanks->WaterHeaterDesuperheater(desuperheaterNum1); // second tank - WaterThermalTanks::WaterThermalTankData &Tank2 = state.dataWaterThermalTanks->WaterThermalTank(2); + WaterThermalTanks::WaterThermalTankData &Tank2 = state->dataWaterThermalTanks->WaterThermalTank(2); int desuperheaterNum2 = Tank2.DesuperheaterNum; - WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater2 = state.dataWaterThermalTanks->WaterHeaterDesuperheater(desuperheaterNum2); + WaterThermalTanks::WaterHeaterDesuperheaterData &Desuperheater2 = state->dataWaterThermalTanks->WaterHeaterDesuperheater(desuperheaterNum2); - for (auto &e : state.dataWaterThermalTanks->WaterThermalTank) { + for (auto &e : state->dataWaterThermalTanks->WaterThermalTank) { e.TankTemp = 20; // previous time step temperature e.UseInletTemp = 10; e.UseMassFlowRate = 0.0; @@ -3691,7 +3692,7 @@ TEST_F(EnergyPlusFixture, MultipleDesuperheaterSingleSource) e.Mode = 0; e.SetPointTemp = 50; } - for (auto &desuperheater : state.dataWaterThermalTanks->WaterHeaterDesuperheater) { + for (auto &desuperheater : state->dataWaterThermalTanks->WaterHeaterDesuperheater) { desuperheater.SetPointTemp = 55; desuperheater.Mode = 1; } @@ -3701,7 +3702,7 @@ TEST_F(EnergyPlusFixture, MultipleDesuperheaterSingleSource) // first tank heat reclaim // Call desuperheater calculation function - Tank1.CalcDesuperheaterWaterHeater(state, FirstHVAC); + Tank1.CalcDesuperheaterWaterHeater(*state, FirstHVAC); // Reclaim efficiency applied correctly EXPECT_EQ(Desuperheater1.HeaterRate, 500 * 0.1); // Results stored in ata structs @@ -3712,7 +3713,7 @@ TEST_F(EnergyPlusFixture, MultipleDesuperheaterSingleSource) EXPECT_NEAR(Tank1.SourceRate, Desuperheater1.HeaterRate, Tank1.SourceRate * 0.05); // Call desuperheater calculation function - Tank2.CalcDesuperheaterWaterHeater(state, FirstHVAC); + Tank2.CalcDesuperheaterWaterHeater(*state, FirstHVAC); // Reclaim efficiency applied correctly EXPECT_EQ(Desuperheater2.HeaterRate, 500 * 0.15); // Results stored in ata structs @@ -4170,15 +4171,15 @@ TEST_F(EnergyPlusFixture, HPWH_Both_Pumped_and_Wrapped_InputProcessing) ASSERT_TRUE(process_idf(idf_objects)); - EXPECT_TRUE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_TRUE(WaterThermalTanks::GetWaterThermalTankInput(*state)); - EXPECT_EQ(state.dataWaterThermalTanks->HPWaterHeater.size(), 2u); - EXPECT_EQ(state.dataWaterThermalTanks->numHeatPumpWaterHeater, 2); + EXPECT_EQ(state->dataWaterThermalTanks->HPWaterHeater.size(), 2u); + EXPECT_EQ(state->dataWaterThermalTanks->numHeatPumpWaterHeater, 2); int HPWaterHeaterNum = 1; { - auto const &HPWH = state.dataWaterThermalTanks->HPWaterHeater(HPWaterHeaterNum); - auto const &HPWHTank = state.dataWaterThermalTanks->WaterThermalTank(HPWH.WaterHeaterTankNum); + auto const &HPWH = state->dataWaterThermalTanks->HPWaterHeater(HPWaterHeaterNum); + auto const &HPWHTank = state->dataWaterThermalTanks->WaterThermalTank(HPWH.WaterHeaterTankNum); EXPECT_EQ(HPWH.Name, "HPWHPUMPED"); EXPECT_EQ(HPWHTank.Name, "HPWHPUMPED MIXED TANK"); EXPECT_EQ(HPWH.CondWaterInletNode, HPWHTank.SourceOutletNode); @@ -4187,7 +4188,7 @@ TEST_F(EnergyPlusFixture, HPWH_Both_Pumped_and_Wrapped_InputProcessing) EXPECT_EQ(HPWH.FanName, "HPWHPUMPED FANSYSTEMMODEL"); // ValidateFuelType tests for WaterHeater:Mixed - WaterThermalTanks::getWaterHeaterMixedInputs(state); + WaterThermalTanks::getWaterHeaterMixedInputs(*state); EXPECT_EQ(HPWHTank.FuelType, "Steam"); EXPECT_EQ(HPWHTank.OffCycParaFuelType, "Steam"); EXPECT_EQ(HPWHTank.OnCycParaFuelType, "Steam"); @@ -4195,8 +4196,8 @@ TEST_F(EnergyPlusFixture, HPWH_Both_Pumped_and_Wrapped_InputProcessing) ++HPWaterHeaterNum; { - auto const &HPWH = state.dataWaterThermalTanks->HPWaterHeater(HPWaterHeaterNum); - auto const &HPWHTank = state.dataWaterThermalTanks->WaterThermalTank(HPWH.WaterHeaterTankNum); + auto const &HPWH = state->dataWaterThermalTanks->HPWaterHeater(HPWaterHeaterNum); + auto const &HPWHTank = state->dataWaterThermalTanks->WaterThermalTank(HPWH.WaterHeaterTankNum); EXPECT_EQ(HPWH.Name, "HPWHWRAPPED"); EXPECT_EQ(HPWHTank.Name, "HPWHWRAPPED STRATIFIED TANK"); EXPECT_EQ(HPWH.CondWaterInletNode, HPWHTank.SourceOutletNode); @@ -4398,21 +4399,21 @@ TEST_F(EnergyPlusFixture, CrashCalcStandardRatings_HPWH_and_Standalone) DataEnvironment::StdRhoAir = 1.0; DataHVACGlobals::TimeStepSys = 1; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->MinutesPerTimeStep = 60 / state.dataGlobal->NumOfTimeStepInHour; - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 1; DataEnvironment::DayOfWeek = 1; DataEnvironment::DayOfYear_Schedule = 1; - SetPredefinedTables(state); - ScheduleManager::UpdateScheduleValues(state); + SetPredefinedTables(*state); + ScheduleManager::UpdateScheduleValues(*state); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); { - auto &HPWH = state.dataWaterThermalTanks->HPWaterHeater(1); + auto &HPWH = state->dataWaterThermalTanks->HPWaterHeater(1); EXPECT_EQ(HPWH.WaterHeaterTankNum, 1); - auto &HPWHTank = state.dataWaterThermalTanks->WaterThermalTank(HPWH.WaterHeaterTankNum); + auto &HPWHTank = state->dataWaterThermalTanks->WaterThermalTank(HPWH.WaterHeaterTankNum); EXPECT_EQ(HPWHTank.Name, "HPWHTANK"); DataHVACGlobals::HPWHInletDBTemp = 30.0; @@ -4425,18 +4426,18 @@ TEST_F(EnergyPlusFixture, CrashCalcStandardRatings_HPWH_and_Standalone) DataEnvironment::OutBaroPress = 101325.0; bool FirstHVACIteration(true); - state.dataGlobal->WarmupFlag = true; + state->dataGlobal->WarmupFlag = true; // HeatPump.SetPointTemp = 60.0, deadband = 2C, HP on at 58 C and off at 60 C // Tank.SetPointTemp = 30.0, tank elements should not be used // Tank.TankTemp = 60.0; // based on schedule // Tank.SavedTankTemp = 60.0; - HPWH.SaveMode = state.dataWaterThermalTanks->floatMode; - HPWHTank.Mode = state.dataWaterThermalTanks->floatMode; - HPWHTank.initialize(state, FirstHVACIteration); + HPWH.SaveMode = state->dataWaterThermalTanks->floatMode; + HPWHTank.Mode = state->dataWaterThermalTanks->floatMode; + HPWHTank.initialize(*state, FirstHVACIteration); } { - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(2); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(2); EXPECT_EQ(Tank.Name, "STANDALONE TANK"); EXPECT_EQ(Tank.HeatPumpNum, 0); DataHVACGlobals::HPWHInletDBTemp = 30.0; @@ -4449,10 +4450,10 @@ TEST_F(EnergyPlusFixture, CrashCalcStandardRatings_HPWH_and_Standalone) DataEnvironment::OutBaroPress = 101325.0; bool FirstHVACIteration(true); - state.dataGlobal->WarmupFlag = true; + state->dataGlobal->WarmupFlag = true; - Tank.Mode = state.dataWaterThermalTanks->floatMode; - Tank.initialize(state, FirstHVACIteration); + Tank.Mode = state->dataWaterThermalTanks->floatMode; + Tank.initialize(*state, FirstHVACIteration); } } @@ -4690,7 +4691,7 @@ TEST_F(EnergyPlusFixture, HPWH_Wrapped_Stratified_Simultaneous) ASSERT_TRUE(process_idf(idf_objects)); // This returns true if ErrorsFound - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); // Previous warning before fix //std::string const error_string = delimited_string({ @@ -4964,7 +4965,7 @@ TEST_F(EnergyPlusFixture, HPWH_Pumped_Stratified_Simultaneous) ASSERT_TRUE(process_idf(idf_objects)); // This returns true if ErrorsFound - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); // Previous warning before fix //std::string const error_string = delimited_string({ @@ -5053,14 +5054,14 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_FalsePositiveBlank ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - InternalHeatGains::GetInternalHeatGainsInput(state); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + InternalHeatGains::GetInternalHeatGainsInput(*state); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); - EXPECT_EQ(1, state.dataWaterThermalTanks->numWaterHeaterStratified); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(1); + EXPECT_EQ(1, state->dataWaterThermalTanks->numWaterHeaterStratified); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(1); EXPECT_EQ(6, Tank.Nodes); EXPECT_EQ(6u, Tank.AdditionalLossCoeff.size()); for (int i = 1; i <= Tank.Nodes; ++i) { @@ -5154,14 +5155,14 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_FalsePositiveZeroe ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - InternalHeatGains::GetInternalHeatGainsInput(state); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + InternalHeatGains::GetInternalHeatGainsInput(*state); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); - EXPECT_EQ(1, state.dataWaterThermalTanks->numWaterHeaterStratified); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(1); + EXPECT_EQ(1, state->dataWaterThermalTanks->numWaterHeaterStratified); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(1); EXPECT_EQ(6, Tank.Nodes); EXPECT_EQ(6u, Tank.AdditionalLossCoeff.size()); for (int i = 1; i <= Tank.Nodes; ++i) { @@ -5253,14 +5254,14 @@ TEST_F(EnergyPlusFixture, StratifiedTank_WarningNumberOfNodes_ExpectedWarning) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound = false; - HeatBalanceManager::GetZoneData(state, ErrorsFound); // read zone data + HeatBalanceManager::GetZoneData(*state, ErrorsFound); // read zone data EXPECT_FALSE(ErrorsFound); - InternalHeatGains::GetInternalHeatGainsInput(state); - EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(state)); + InternalHeatGains::GetInternalHeatGainsInput(*state); + EXPECT_FALSE(WaterThermalTanks::GetWaterThermalTankInput(*state)); - EXPECT_EQ(1, state.dataWaterThermalTanks->numWaterHeaterStratified); - WaterThermalTanks::WaterThermalTankData &Tank = state.dataWaterThermalTanks->WaterThermalTank(1); + EXPECT_EQ(1, state->dataWaterThermalTanks->numWaterHeaterStratified); + WaterThermalTanks::WaterThermalTankData &Tank = state->dataWaterThermalTanks->WaterThermalTank(1); EXPECT_EQ(6, Tank.Nodes); EXPECT_EQ(6u, Tank.AdditionalLossCoeff.size()); for (int i = 1; i <= Tank.Nodes; ++i) { diff --git a/tst/EnergyPlus/unit/WaterToAirHeatPump.unit.cc b/tst/EnergyPlus/unit/WaterToAirHeatPump.unit.cc index 83e1b8e1a9a..33074bb8ac2 100644 --- a/tst/EnergyPlus/unit/WaterToAirHeatPump.unit.cc +++ b/tst/EnergyPlus/unit/WaterToAirHeatPump.unit.cc @@ -53,6 +53,7 @@ #include "Fixtures/EnergyPlusFixture.hh" // EnergyPlus Headers +#include #include #include #include @@ -190,22 +191,22 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpTest_SimWaterToAir) FluidProperties::RefrigData(1).RhofgValues(1) = 0.341; FluidProperties::RefrigData(1).RhofgValues(2) = 523.8; - GetWatertoAirHPInput(state); + GetWatertoAirHPInput(*state); int HPNum(1); Real64 DesignAirflow(2.0); - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).Temp = 5.0; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).Enthalpy = 44650.0; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).Temp = 5.0; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).Enthalpy = 44650.0; - state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMax = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMaxAvail = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; + state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMax = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMaxAvail = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).MassFlowRate = DesignAirflow; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).Temp = 26.0; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).HumRat = 0.007; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).Enthalpy = 43970.75; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).MassFlowRate = DesignAirflow; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).Temp = 26.0; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).HumRat = 0.007; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).Enthalpy = 43970.75; TotNumLoops = 2; PlantLoop.allocate(TotNumLoops); @@ -225,9 +226,9 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpTest_SimWaterToAir) PlantLoop(1).FluidName = "ChilledWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WAHPPlantTypeOfNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WAHPPlantTypeOfNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum; bool InitFlag(true); Real64 MaxONOFFCyclesperHour(4.0); @@ -240,58 +241,58 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpTest_SimWaterToAir) bool FirstHVACIteration(true); Real64 RuntimeFrac(1.0); int CompOp(1); - state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).LoopNum = 1; + state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).LoopNum = 1; - InitWatertoAirHP(state, HPNum, InitFlag, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, DesignAirflow, PartLoadRatio); + InitWatertoAirHP(*state, HPNum, InitFlag, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, DesignAirflow, PartLoadRatio); - CalcWatertoAirHPCooling(state, HPNum, CyclingScheme, FirstHVACIteration, RuntimeFrac, InitFlag, SensLoad, CompOp, PartLoadRatio); + CalcWatertoAirHPCooling(*state, HPNum, CyclingScheme, FirstHVACIteration, RuntimeFrac, InitFlag, SensLoad, CompOp, PartLoadRatio); // make sure the coil is active - EXPECT_NE(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).QSource, 0.0); - EXPECT_NE(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).Power, 0.0); + EXPECT_NE(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).QSource, 0.0); + EXPECT_NE(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).Power, 0.0); // check the source side energy balance - EXPECT_NEAR(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).QSource, - state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).InletWaterMassFlowRate * (state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).OutletWaterEnthalpy - state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).InletWaterEnthalpy), + EXPECT_NEAR(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).QSource, + state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).InletWaterMassFlowRate * (state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).OutletWaterEnthalpy - state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).InletWaterEnthalpy), 0.000000001); HPNum = 2; - state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).LoopNum = 2; + state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).LoopNum = 2; PlantLoop(2).Name = "HotWaterLoop"; PlantLoop(2).FluidName = "HotWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).Name; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WAHPPlantTypeOfNum; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WAHPPlantTypeOfNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).Temp = 35.0; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).Enthalpy = 43950.0; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).Temp = 35.0; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).Enthalpy = 43950.0; - state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMax = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMaxAvail = state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; + state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMax = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMaxAvail = state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).MassFlowRate = DesignAirflow; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).Temp = 15.0; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).HumRat = 0.004; - DataLoopNode::Node(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).Enthalpy = PsyHFnTdbW(15.0, 0.004); + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).MassFlowRate = DesignAirflow; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).Temp = 15.0; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).HumRat = 0.004; + DataLoopNode::Node(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).AirInletNodeNum).Enthalpy = PsyHFnTdbW(15.0, 0.004); - state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; + state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; - InitWatertoAirHP(state, HPNum, InitFlag, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, DesignAirflow, PartLoadRatio); + InitWatertoAirHP(*state, HPNum, InitFlag, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, DesignAirflow, PartLoadRatio); - CalcWatertoAirHPHeating(state, HPNum, CyclingScheme, FirstHVACIteration, RuntimeFrac, InitFlag, SensLoad, CompOp, PartLoadRatio); + CalcWatertoAirHPHeating(*state, HPNum, CyclingScheme, FirstHVACIteration, RuntimeFrac, InitFlag, SensLoad, CompOp, PartLoadRatio); // make sure the coil is active - EXPECT_NE(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).QSource, 0.0); - EXPECT_NE(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).Power, 0.0); + EXPECT_NE(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).QSource, 0.0); + EXPECT_NE(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).Power, 0.0); // check the source side energy balance - EXPECT_NEAR(state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).QSource, - state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).InletWaterMassFlowRate * (state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).InletWaterEnthalpy - state.dataWaterToAirHeatPump->WatertoAirHP(HPNum).OutletWaterEnthalpy), + EXPECT_NEAR(state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).QSource, + state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).InletWaterMassFlowRate * (state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).InletWaterEnthalpy - state->dataWaterToAirHeatPump->WatertoAirHP(HPNum).OutletWaterEnthalpy), 0.000000001); // clean up - state.dataWaterToAirHeatPump->WatertoAirHP.deallocate(); + state->dataWaterToAirHeatPump->WatertoAirHP.deallocate(); FluidProperties::RefrigData.deallocate(); } diff --git a/tst/EnergyPlus/unit/WaterToAirHeatPumpSimple.unit.cc b/tst/EnergyPlus/unit/WaterToAirHeatPumpSimple.unit.cc index b8156423704..ba1d624246e 100644 --- a/tst/EnergyPlus/unit/WaterToAirHeatPumpSimple.unit.cc +++ b/tst/EnergyPlus/unit/WaterToAirHeatPumpSimple.unit.cc @@ -53,6 +53,7 @@ #include "Fixtures/EnergyPlusFixture.hh" // EnergyPlus Headers +#include #include #include #include @@ -87,17 +88,17 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimpleTest_SizeHVACWaterToAir) CurSysNum = 0; CurZoneEqNum = 1; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP.allocate(HPNum); + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP.allocate(HPNum); FinalZoneSizing.allocate(CurZoneEqNum); ZoneEqSizing.allocate(CurZoneEqNum); DesDayWeath.allocate(1); DesDayWeath(1).Temp.allocate(24); - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WatertoAirHPType = "COOLING"; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedAirVolFlowRate = AutoSize; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolTotal = AutoSize; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolSens = AutoSize; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedWaterVolFlowRate = 0.0; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WatertoAirHPType = "COOLING"; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedAirVolFlowRate = AutoSize; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolTotal = AutoSize; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolSens = AutoSize; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedWaterVolFlowRate = 0.0; FinalZoneSizing(CurZoneEqNum).DesCoolVolFlow = 0.20; FinalZoneSizing(CurZoneEqNum).DesHeatVolFlow = 0.20; @@ -112,35 +113,35 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimpleTest_SizeHVACWaterToAir) ZoneEqSizing(CurZoneEqNum).OAVolFlow = 0.0; // performance curve coefficients - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).TotalCoolCap1 = -9.149069561; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).TotalCoolCap2 = 10.878140260; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).TotalCoolCap3 = -1.718780157; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).TotalCoolCap4 = 0.746414818; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).TotalCoolCap5 = 0.0; - - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCOPCool = 5.12; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap1 = -5.462690012; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap2 = 17.95968138; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap3 = -11.87818402; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap4 = -0.980163419; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap5 = 0.767285761; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap6 = 0.0; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).TotalCoolCap1 = -9.149069561; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).TotalCoolCap2 = 10.878140260; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).TotalCoolCap3 = -1.718780157; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).TotalCoolCap4 = 0.746414818; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).TotalCoolCap5 = 0.0; + + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCOPCool = 5.12; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap1 = -5.462690012; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap2 = 17.95968138; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap3 = -11.87818402; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap4 = -0.980163419; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap5 = 0.767285761; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).SensCoolCap6 = 0.0; DesDayWeath(1).Temp(15) = 32.0; StdBaroPress = 101325.0; ZoneEqDXCoil = true; - WaterToAirHeatPumpSimple::SizeHVACWaterToAir(state, HPNum); + WaterToAirHeatPumpSimple::SizeHVACWaterToAir(*state, HPNum); // check that the design oulet air humidity ratio did not change EXPECT_DOUBLE_EQ(0.0075, FinalZoneSizing(CurZoneEqNum).CoolDesHumRat); // check that the total cooling capacity is >= the sensible cooling capacity - EXPECT_GE(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolTotal, state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolSens); + EXPECT_GE(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolTotal, state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolSens); - if (state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolTotal != 0.0) { - ShowMessage(state, "SizeHVACWaterToAir: Rated Sensible Heat Ratio = " + - RoundSigDigits(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolSens / state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolTotal, 2) + " [-]"); + if (state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolTotal != 0.0) { + ShowMessage(*state, "SizeHVACWaterToAir: Rated Sensible Heat Ratio = " + + RoundSigDigits(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolSens / state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).RatedCapCoolTotal, 2) + " [-]"); } } @@ -204,22 +205,22 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimple_TestWaterFlowControl) ASSERT_TRUE(process_idf(idf_objects)); - GetSimpleWatertoAirHPInput(state); + GetSimpleWatertoAirHPInput(*state); int HPNum(1); Real64 DesignAirflow(2.0); - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).Temp = 5.0; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).Enthalpy = 44650.0; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).Temp = 5.0; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).Enthalpy = 44650.0; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMax = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMaxAvail = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMax = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMaxAvail = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).MassFlowRate = DesignAirflow; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).Temp = 26.0; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).HumRat = 0.007; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).Enthalpy = 43970.75; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).MassFlowRate = DesignAirflow; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).Temp = 26.0; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).HumRat = 0.007; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).Enthalpy = 43970.75; TotNumLoops = 2; PlantLoop.allocate(TotNumLoops); @@ -239,9 +240,9 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimple_TestWaterFlowControl) PlantLoop(1).FluidName = "ChilledWater"; PlantLoop(1).FluidIndex = 1; PlantLoop(1).FluidName = "WATER"; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WAHPPlantTypeOfNum; - PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WAHPPlantTypeOfNum; + PlantLoop(1).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum; int CompOp(1); int CyclingScheme(1); @@ -254,137 +255,137 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpSimple_TestWaterFlowControl) Real64 PartLoadRatio(1.0); Real64 RuntimeFrac(1.0); Real64 OnOffAirFlowRatio(1.0); - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).LoopNum = 1; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).LoopNum = 1; DataEnvironment::OutBaroPress = 101325.0; - InitSimpleWatertoAirHP(state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, + InitSimpleWatertoAirHP(*state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, FirstHVACIteration); - CalcHPCoolingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 5.0); - EXPECT_NEAR(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 5.19458, 0.00001); + CalcHPCoolingSimple(*state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 5.0); + EXPECT_NEAR(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 5.19458, 0.00001); PartLoadRatio = 0.5; RuntimeFrac = 0.5; - InitSimpleWatertoAirHP(state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, + InitSimpleWatertoAirHP(*state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, FirstHVACIteration); - CalcHPCoolingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 5.0); - EXPECT_NEAR(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 5.09729, 0.00001); + CalcHPCoolingSimple(*state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 5.0); + EXPECT_NEAR(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 5.09729, 0.00001); - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterCyclingMode = WaterCycling; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterCyclingMode = WaterCycling; PartLoadRatio = 1.0; RuntimeFrac = 1.0; - InitSimpleWatertoAirHP(state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, + InitSimpleWatertoAirHP(*state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, FirstHVACIteration); - CalcHPCoolingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 5.0); - EXPECT_NEAR(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 5.19458, 0.00001); + CalcHPCoolingSimple(*state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 5.0); + EXPECT_NEAR(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 5.19458, 0.00001); PartLoadRatio = 0.5; RuntimeFrac = 0.5; - InitSimpleWatertoAirHP(state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, + InitSimpleWatertoAirHP(*state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, FirstHVACIteration); - CalcHPCoolingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 7.5); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 5.0); - EXPECT_NEAR(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 5.19458, 0.00001); + CalcHPCoolingSimple(*state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 7.5); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 5.0); + EXPECT_NEAR(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 5.19458, 0.00001); // test reduced flow at coil water inlet node PartLoadRatio = 0.25; RuntimeFrac = 0.25; - Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = 3.75; - InitSimpleWatertoAirHP(state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, + Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = 3.75; + InitSimpleWatertoAirHP(*state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, FirstHVACIteration); - CalcHPCoolingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 3.75); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 5.0); - EXPECT_NEAR(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 5.19458, 0.00001); - UpdateSimpleWatertoAirHP(state, HPNum); - EXPECT_EQ(Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate, 3.75); - EXPECT_EQ(Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterOutletNodeNum).MassFlowRate, 3.75); - EXPECT_NEAR(Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterOutletNodeNum).Temp, 5.19458, 0.00001); + CalcHPCoolingSimple(*state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, LatentLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 3.75); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 5.0); + EXPECT_NEAR(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 5.19458, 0.00001); + UpdateSimpleWatertoAirHP(*state, HPNum); + EXPECT_EQ(Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate, 3.75); + EXPECT_EQ(Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterOutletNodeNum).MassFlowRate, 3.75); + EXPECT_NEAR(Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterOutletNodeNum).Temp, 5.19458, 0.00001); HPNum = 2; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).LoopNum = 2; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).LoopNum = 2; PlantLoop(2).Name = "HotWaterLoop"; PlantLoop(2).FluidName = "HotWater"; PlantLoop(2).FluidIndex = 1; PlantLoop(2).FluidName = "WATER"; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WAHPPlantTypeOfNum; - PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).Name = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).Name; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).TypeOf_Num = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WAHPPlantTypeOfNum; + PlantLoop(2).LoopSide(1).Branch(1).Comp(1).NodeNumIn = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).Temp = 35.0; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).Enthalpy = 43950.0; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).Temp = 35.0; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).Enthalpy = 43950.0; - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMax = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMaxAvail = state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMax = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRateMaxAvail = state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).MassFlowRate = DesignAirflow; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).Temp = 15.0; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).HumRat = 0.004; - DataLoopNode::Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).Enthalpy = PsyHFnTdbW(15.0, 0.004); + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).MassFlowRate = DesignAirflow; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).Temp = 15.0; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).HumRat = 0.004; + DataLoopNode::Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).AirInletNodeNum).Enthalpy = PsyHFnTdbW(15.0, 0.004); - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).DesignWaterMassFlowRate = 15.0; - InitSimpleWatertoAirHP(state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, + InitSimpleWatertoAirHP(*state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, FirstHVACIteration); PartLoadRatio = 1.0; RuntimeFrac = 1.0; - InitSimpleWatertoAirHP(state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, + InitSimpleWatertoAirHP(*state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, FirstHVACIteration); - CalcHPHeatingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 35.0); - EXPECT_NEAR(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 34.514131, 0.00001); + CalcHPHeatingSimple(*state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 35.0); + EXPECT_NEAR(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 34.514131, 0.00001); PartLoadRatio = 0.5; RuntimeFrac = 0.5; - InitSimpleWatertoAirHP(state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, + InitSimpleWatertoAirHP(*state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, FirstHVACIteration); - CalcHPHeatingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 35.0); - EXPECT_NEAR(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 34.757065, 0.00001); + CalcHPHeatingSimple(*state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 35.0); + EXPECT_NEAR(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 34.757065, 0.00001); - state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterCyclingMode = WaterCycling; + state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterCyclingMode = WaterCycling; PartLoadRatio = 1.0; RuntimeFrac = 1.0; - InitSimpleWatertoAirHP(state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, + InitSimpleWatertoAirHP(*state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, FirstHVACIteration); - CalcHPHeatingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 35.0); - EXPECT_NEAR(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 34.514131, 0.00001); + CalcHPHeatingSimple(*state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 15.0); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 35.0); + EXPECT_NEAR(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 34.514131, 0.00001); PartLoadRatio = 0.5; RuntimeFrac = 0.5; - InitSimpleWatertoAirHP(state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, + InitSimpleWatertoAirHP(*state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, FirstHVACIteration); - CalcHPHeatingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 7.5); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 35.0); - EXPECT_NEAR(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 34.514131, 0.00001); + CalcHPHeatingSimple(*state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 7.5); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 35.0); + EXPECT_NEAR(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 34.514131, 0.00001); // test reduced flow at coil water inlet node PartLoadRatio = 0.25; RuntimeFrac = 0.25; - Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = 3.75; - InitSimpleWatertoAirHP(state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, + Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate = 3.75; + InitSimpleWatertoAirHP(*state, HPNum, MaxONOFFCyclesperHour, HPTimeConstant, FanDelayTime, SensLoad, LatentLoad, CyclingScheme, OnOffAirFlowRatio, FirstHVACIteration); - CalcHPHeatingSimple(state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 3.75); - EXPECT_EQ(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 35.0); - EXPECT_NEAR(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 34.514131, 0.00001); - UpdateSimpleWatertoAirHP(state, HPNum); - EXPECT_EQ(Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate, 3.75); - EXPECT_EQ(Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterOutletNodeNum).MassFlowRate, 3.75); - EXPECT_NEAR(Node(state.dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterOutletNodeNum).Temp, 34.514131, 0.00001); + CalcHPHeatingSimple(*state, HPNum, CyclingScheme, RuntimeFrac, SensLoad, CompOp, PartLoadRatio, OnOffAirFlowRatio); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterMassFlowRate, 3.75); + EXPECT_EQ(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).InletWaterTemp, 35.0); + EXPECT_NEAR(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).OutletWaterTemp, 34.514131, 0.00001); + UpdateSimpleWatertoAirHP(*state, HPNum); + EXPECT_EQ(Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterInletNodeNum).MassFlowRate, 3.75); + EXPECT_EQ(Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterOutletNodeNum).MassFlowRate, 3.75); + EXPECT_NEAR(Node(state->dataWaterToAirHeatPumpSimple->SimpleWatertoAirHP(HPNum).WaterOutletNodeNum).Temp, 34.514131, 0.00001); } diff --git a/tst/EnergyPlus/unit/WeatherManager.unit.cc b/tst/EnergyPlus/unit/WeatherManager.unit.cc index bd8de668310..27d444f1c27 100644 --- a/tst/EnergyPlus/unit/WeatherManager.unit.cc +++ b/tst/EnergyPlus/unit/WeatherManager.unit.cc @@ -54,6 +54,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -123,40 +124,40 @@ TEST_F(EnergyPlusFixture, SkyTempTest) ASSERT_TRUE(process_idf(idf_objects)); Array2D TomorrowSkyTemp; // Sky temperature - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 60 / state.dataGlobal->NumOfTimeStepInHour; - TomorrowSkyTemp.allocate(state.dataGlobal->NumOfTimeStepInHour, 24); + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 60 / state->dataGlobal->NumOfTimeStepInHour; + TomorrowSkyTemp.allocate(state->dataGlobal->NumOfTimeStepInHour, 24); TomorrowSkyTemp = 0.0; // Febuary 27 - ScheduleManager::GetScheduleValuesForDay(state, 1, TomorrowSkyTemp, 58, 3); + ScheduleManager::GetScheduleValuesForDay(*state, 1, TomorrowSkyTemp, 58, 3); EXPECT_NEAR(2.27, TomorrowSkyTemp(1, 1), .001); // Febuary 28 - ScheduleManager::GetScheduleValuesForDay(state, 1, TomorrowSkyTemp, 59, 4); + ScheduleManager::GetScheduleValuesForDay(*state, 1, TomorrowSkyTemp, 59, 4); EXPECT_NEAR(2.28, TomorrowSkyTemp(1, 1), .001); // March 1 - ScheduleManager::GetScheduleValuesForDay(state, 1, TomorrowSkyTemp, 60, 5); + ScheduleManager::GetScheduleValuesForDay(*state, 1, TomorrowSkyTemp, 60, 5); EXPECT_NEAR(3.01, TomorrowSkyTemp(1, 1), .001); // Not March 2, this "Day" is ignored unless its a leap year, otherwise same data as March 1 - ScheduleManager::GetScheduleValuesForDay(state, 1, TomorrowSkyTemp, 61, 6); + ScheduleManager::GetScheduleValuesForDay(*state, 1, TomorrowSkyTemp, 61, 6); EXPECT_NEAR(3.01, TomorrowSkyTemp(1, 1), .001); // March 2 - ScheduleManager::GetScheduleValuesForDay(state, 1, TomorrowSkyTemp, 62, 6); + ScheduleManager::GetScheduleValuesForDay(*state, 1, TomorrowSkyTemp, 62, 6); EXPECT_NEAR(3.02, TomorrowSkyTemp(1, 1), .001); } TEST_F(EnergyPlusFixture, SkyEmissivityTest) { // setup environment state - state.dataWeatherManager->Environment.allocate(4); - state.dataWeatherManager->Environment(1).SkyTempModel = EmissivityCalcType::ClarkAllenModel; - state.dataWeatherManager->Environment(2).SkyTempModel = EmissivityCalcType::BruntModel; - state.dataWeatherManager->Environment(3).SkyTempModel = EmissivityCalcType::IdsoModel; - state.dataWeatherManager->Environment(4).SkyTempModel = EmissivityCalcType::BerdahlMartinModel; + state->dataWeatherManager->Environment.allocate(4); + state->dataWeatherManager->Environment(1).SkyTempModel = EmissivityCalcType::ClarkAllenModel; + state->dataWeatherManager->Environment(2).SkyTempModel = EmissivityCalcType::BruntModel; + state->dataWeatherManager->Environment(3).SkyTempModel = EmissivityCalcType::IdsoModel; + state->dataWeatherManager->Environment(4).SkyTempModel = EmissivityCalcType::BerdahlMartinModel; // init local variables Real64 OpaqueSkyCover(0.0); @@ -164,17 +165,17 @@ TEST_F(EnergyPlusFixture, SkyEmissivityTest) Real64 DewPoint(16.7); Real64 RelHum(0.6); - EXPECT_NEAR(0.832, CalcSkyEmissivity(state, state.dataWeatherManager->Environment(1).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); - EXPECT_NEAR(0.862, CalcSkyEmissivity(state, state.dataWeatherManager->Environment(2).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); - EXPECT_NEAR(0.867, CalcSkyEmissivity(state, state.dataWeatherManager->Environment(3).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); - EXPECT_NEAR(0.862, CalcSkyEmissivity(state, state.dataWeatherManager->Environment(4).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); + EXPECT_NEAR(0.832, CalcSkyEmissivity(*state, state->dataWeatherManager->Environment(1).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); + EXPECT_NEAR(0.862, CalcSkyEmissivity(*state, state->dataWeatherManager->Environment(2).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); + EXPECT_NEAR(0.867, CalcSkyEmissivity(*state, state->dataWeatherManager->Environment(3).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); + EXPECT_NEAR(0.862, CalcSkyEmissivity(*state, state->dataWeatherManager->Environment(4).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); DryBulb = 5.0; DewPoint = -2.13; - EXPECT_NEAR(0.781, CalcSkyEmissivity(state, state.dataWeatherManager->Environment(1).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); - EXPECT_NEAR(0.746, CalcSkyEmissivity(state, state.dataWeatherManager->Environment(2).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); - EXPECT_NEAR(0.760, CalcSkyEmissivity(state, state.dataWeatherManager->Environment(3).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); - EXPECT_NEAR(0.747, CalcSkyEmissivity(state, state.dataWeatherManager->Environment(4).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); + EXPECT_NEAR(0.781, CalcSkyEmissivity(*state, state->dataWeatherManager->Environment(1).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); + EXPECT_NEAR(0.746, CalcSkyEmissivity(*state, state->dataWeatherManager->Environment(2).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); + EXPECT_NEAR(0.760, CalcSkyEmissivity(*state, state->dataWeatherManager->Environment(3).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); + EXPECT_NEAR(0.747, CalcSkyEmissivity(*state, state->dataWeatherManager->Environment(4).SkyTempModel, OpaqueSkyCover, DryBulb, DewPoint, RelHum), 0.001); } TEST_F(EnergyPlusFixture, WaterMainsCorrelationTest) @@ -183,17 +184,17 @@ TEST_F(EnergyPlusFixture, WaterMainsCorrelationTest) using DataEnvironment::Latitude; using DataEnvironment::WaterMainsTemp; - state.dataWeatherManager->WaterMainsTempsMethod = WeatherManager::WaterMainsTempCalcMethod::Correlation; - state.dataWeatherManager->WaterMainsTempsAnnualAvgAirTemp = 9.69; - state.dataWeatherManager->WaterMainsTempsMaxDiffAirTemp = 28.1; + state->dataWeatherManager->WaterMainsTempsMethod = WeatherManager::WaterMainsTempCalcMethod::Correlation; + state->dataWeatherManager->WaterMainsTempsAnnualAvgAirTemp = 9.69; + state->dataWeatherManager->WaterMainsTempsMaxDiffAirTemp = 28.1; DayOfYear = 50; Latitude = 40.0; - CalcWaterMainsTemp(state); + CalcWaterMainsTemp(*state); EXPECT_NEAR(WaterMainsTemp, 6.6667, 0.0001); Latitude = -40.0; - CalcWaterMainsTemp(state); + CalcWaterMainsTemp(*state); EXPECT_NEAR(WaterMainsTemp, 19.3799, 0.0001); } @@ -317,18 +318,18 @@ TEST_F(EnergyPlusFixture, UnderwaterBoundaryConditionFullyPopulated) // need to populate the OSCM array by calling the get input for it bool errorsFound = false; - SurfaceGeometry::GetOSCMData(state, errorsFound); + SurfaceGeometry::GetOSCMData(*state, errorsFound); EXPECT_FALSE(errorsFound); EXPECT_EQ(DataSurfaces::TotOSCM, 1); // then process the input for this underwater surface - bool shouldBeTrue = WeatherManager::CheckIfAnyUnderwaterBoundaries(state); + bool shouldBeTrue = WeatherManager::CheckIfAnyUnderwaterBoundaries(*state); EXPECT_TRUE(shouldBeTrue); - EXPECT_EQ(state.dataWeatherManager->underwaterBoundaries[0].Name, "UNDERWATERSURFACENAME"); - EXPECT_NEAR(state.dataWeatherManager->underwaterBoundaries[0].distanceFromLeadingEdge, 31.4159, 0.0001); - EXPECT_EQ(state.dataWeatherManager->underwaterBoundaries[0].OSCMIndex, 1); - EXPECT_EQ(state.dataWeatherManager->underwaterBoundaries[0].WaterTempScheduleIndex, 1); - EXPECT_EQ(state.dataWeatherManager->underwaterBoundaries[0].VelocityScheduleIndex, 2); + EXPECT_EQ(state->dataWeatherManager->underwaterBoundaries[0].Name, "UNDERWATERSURFACENAME"); + EXPECT_NEAR(state->dataWeatherManager->underwaterBoundaries[0].distanceFromLeadingEdge, 31.4159, 0.0001); + EXPECT_EQ(state->dataWeatherManager->underwaterBoundaries[0].OSCMIndex, 1); + EXPECT_EQ(state->dataWeatherManager->underwaterBoundaries[0].WaterTempScheduleIndex, 1); + EXPECT_EQ(state->dataWeatherManager->underwaterBoundaries[0].VelocityScheduleIndex, 2); } TEST_F(EnergyPlusFixture, UnderwaterBoundaryConditionMissingVelocityOK) @@ -341,18 +342,18 @@ TEST_F(EnergyPlusFixture, UnderwaterBoundaryConditionMissingVelocityOK) // need to populate the OSCM array by calling the get input for it bool errorsFound = false; - SurfaceGeometry::GetOSCMData(state, errorsFound); + SurfaceGeometry::GetOSCMData(*state, errorsFound); EXPECT_FALSE(errorsFound); EXPECT_EQ(DataSurfaces::TotOSCM, 1); // then process the input for this underwater surface - bool shouldBeTrue = WeatherManager::CheckIfAnyUnderwaterBoundaries(state); + bool shouldBeTrue = WeatherManager::CheckIfAnyUnderwaterBoundaries(*state); EXPECT_TRUE(shouldBeTrue); - EXPECT_EQ(state.dataWeatherManager->underwaterBoundaries[0].Name, "UNDERWATERSURFACENAME"); - EXPECT_NEAR(state.dataWeatherManager->underwaterBoundaries[0].distanceFromLeadingEdge, 31.4159, 0.0001); - EXPECT_EQ(state.dataWeatherManager->underwaterBoundaries[0].OSCMIndex, 1); - EXPECT_EQ(state.dataWeatherManager->underwaterBoundaries[0].WaterTempScheduleIndex, 1); - EXPECT_EQ(state.dataWeatherManager->underwaterBoundaries[0].VelocityScheduleIndex, 0); + EXPECT_EQ(state->dataWeatherManager->underwaterBoundaries[0].Name, "UNDERWATERSURFACENAME"); + EXPECT_NEAR(state->dataWeatherManager->underwaterBoundaries[0].distanceFromLeadingEdge, 31.4159, 0.0001); + EXPECT_EQ(state->dataWeatherManager->underwaterBoundaries[0].OSCMIndex, 1); + EXPECT_EQ(state->dataWeatherManager->underwaterBoundaries[0].WaterTempScheduleIndex, 1); + EXPECT_EQ(state->dataWeatherManager->underwaterBoundaries[0].VelocityScheduleIndex, 0); } TEST_F(EnergyPlusFixture, UnderwaterBoundaryConditionConvectionCoefficients) @@ -381,27 +382,27 @@ TEST_F(EnergyPlusFixture, WaterMainsCorrelationFromWeatherFileTest) ASSERT_TRUE(process_idf(idf_objects)); bool foundErrors(false); - WeatherManager::GetWaterMainsTemperatures(state, foundErrors); + WeatherManager::GetWaterMainsTemperatures(*state, foundErrors); EXPECT_FALSE(foundErrors); // expect no errors - EXPECT_EQ(state.dataWeatherManager->WaterMainsTempsMethod, WeatherManager::WaterMainsTempCalcMethod::CorrelationFromWeatherFile); + EXPECT_EQ(state->dataWeatherManager->WaterMainsTempsMethod, WeatherManager::WaterMainsTempCalcMethod::CorrelationFromWeatherFile); // for calculation method CorrelationFromWeatherFile these parameters are ignored - EXPECT_EQ(state.dataWeatherManager->WaterMainsTempsAnnualAvgAirTemp, 0.0); - EXPECT_EQ(state.dataWeatherManager->WaterMainsTempsMaxDiffAirTemp, 0.0); + EXPECT_EQ(state->dataWeatherManager->WaterMainsTempsAnnualAvgAirTemp, 0.0); + EXPECT_EQ(state->dataWeatherManager->WaterMainsTempsMaxDiffAirTemp, 0.0); // set water mains parameters for CorrelationFromWeatherFile method - state.dataWeatherManager->OADryBulbAverage.AnnualAvgOADryBulbTemp = 9.99; - state.dataWeatherManager->OADryBulbAverage.MonthlyAvgOADryBulbTempMaxDiff = 28.78; - state.dataWeatherManager->OADryBulbAverage.OADryBulbWeatherDataProcessed = true; + state->dataWeatherManager->OADryBulbAverage.AnnualAvgOADryBulbTemp = 9.99; + state->dataWeatherManager->OADryBulbAverage.MonthlyAvgOADryBulbTempMaxDiff = 28.78; + state->dataWeatherManager->OADryBulbAverage.OADryBulbWeatherDataProcessed = true; DataEnvironment::Latitude = 42.00; // CHICAGO_IL_USA_WMO_725300 // January 15th water mains temperature test DataEnvironment::DayOfYear = 15; // January 15th - WeatherManager::CalcWaterMainsTemp(state); + WeatherManager::CalcWaterMainsTemp(*state); EXPECT_NEAR(DataEnvironment::WaterMainsTemp, 7.5145, 0.0001); // July 15th water mains temperature test DataEnvironment::DayOfYear = 196; // July 15th - WeatherManager::CalcWaterMainsTemp(state); + WeatherManager::CalcWaterMainsTemp(*state); EXPECT_NEAR(DataEnvironment::WaterMainsTemp, 19.0452, 0.0001); } @@ -427,42 +428,42 @@ TEST_F(EnergyPlusFixture, WaterMainsCorrelationFromStatFileTest) ASSERT_TRUE(process_idf(idf_objects)); bool foundErrors(false); - WeatherManager::GetWaterMainsTemperatures(state, foundErrors); + WeatherManager::GetWaterMainsTemperatures(*state, foundErrors); EXPECT_FALSE(foundErrors); // expect no errors - EXPECT_EQ(state.dataWeatherManager->WaterMainsTempsMethod, WeatherManager::WaterMainsTempCalcMethod::CorrelationFromWeatherFile); + EXPECT_EQ(state->dataWeatherManager->WaterMainsTempsMethod, WeatherManager::WaterMainsTempCalcMethod::CorrelationFromWeatherFile); // for calculation method CorrelationFromWeatherFile these parameters are ignored - EXPECT_EQ(state.dataWeatherManager->WaterMainsTempsAnnualAvgAirTemp, 0.0); - EXPECT_EQ(state.dataWeatherManager->WaterMainsTempsMaxDiffAirTemp, 0.0); + EXPECT_EQ(state->dataWeatherManager->WaterMainsTempsAnnualAvgAirTemp, 0.0); + EXPECT_EQ(state->dataWeatherManager->WaterMainsTempsMaxDiffAirTemp, 0.0); Array1D MonthlyDryBulbTempFromStatFile(12, {-4.60, -2.50, 3.80, 10.00, 15.30, 21.10, 24.10, 21.80, 18.10, 11.00, 4.70, -3.70}); - state.dataWeatherManager->OADryBulbAverage.MonthlyDailyAverageDryBulbTemp = MonthlyDryBulbTempFromStatFile; + state->dataWeatherManager->OADryBulbAverage.MonthlyDailyAverageDryBulbTemp = MonthlyDryBulbTempFromStatFile; // calc water mains parameters for CorrelationFromWeatherFile method for (int i = 1; i <= 12; ++i) { - AnnualDailyAverageDryBulbTempSum += state.dataWeatherManager->OADryBulbAverage.MonthlyDailyAverageDryBulbTemp(i) * state.dataWeatherManager->EndDayOfMonth(i); - MonthlyDailyDryBulbMin = min(MonthlyDailyDryBulbMin, state.dataWeatherManager->OADryBulbAverage.MonthlyDailyAverageDryBulbTemp(i)); - MonthlyDailyDryBulbMax = max(MonthlyDailyDryBulbMax, state.dataWeatherManager->OADryBulbAverage.MonthlyDailyAverageDryBulbTemp(i)); - AnnualNumberOfDays += state.dataWeatherManager->EndDayOfMonth(i); + AnnualDailyAverageDryBulbTempSum += state->dataWeatherManager->OADryBulbAverage.MonthlyDailyAverageDryBulbTemp(i) * state->dataWeatherManager->EndDayOfMonth(i); + MonthlyDailyDryBulbMin = min(MonthlyDailyDryBulbMin, state->dataWeatherManager->OADryBulbAverage.MonthlyDailyAverageDryBulbTemp(i)); + MonthlyDailyDryBulbMax = max(MonthlyDailyDryBulbMax, state->dataWeatherManager->OADryBulbAverage.MonthlyDailyAverageDryBulbTemp(i)); + AnnualNumberOfDays += state->dataWeatherManager->EndDayOfMonth(i); } - state.dataWeatherManager->OADryBulbAverage.AnnualAvgOADryBulbTemp = AnnualDailyAverageDryBulbTempSum / AnnualNumberOfDays; - state.dataWeatherManager->OADryBulbAverage.MonthlyAvgOADryBulbTempMaxDiff = MonthlyDailyDryBulbMax - MonthlyDailyDryBulbMin; + state->dataWeatherManager->OADryBulbAverage.AnnualAvgOADryBulbTemp = AnnualDailyAverageDryBulbTempSum / AnnualNumberOfDays; + state->dataWeatherManager->OADryBulbAverage.MonthlyAvgOADryBulbTempMaxDiff = MonthlyDailyDryBulbMax - MonthlyDailyDryBulbMin; // check results - EXPECT_NEAR(state.dataWeatherManager->OADryBulbAverage.AnnualAvgOADryBulbTemp, 9.9882, 0.0001); - EXPECT_NEAR(state.dataWeatherManager->OADryBulbAverage.MonthlyAvgOADryBulbTempMaxDiff, 28.7000, 0.0001); + EXPECT_NEAR(state->dataWeatherManager->OADryBulbAverage.AnnualAvgOADryBulbTemp, 9.9882, 0.0001); + EXPECT_NEAR(state->dataWeatherManager->OADryBulbAverage.MonthlyAvgOADryBulbTempMaxDiff, 28.7000, 0.0001); // test water mains temperature // WeatherManager::WaterMainsTempsMethod = WeatherManager::CorrelationFromWeatherFileMethod; - state.dataWeatherManager->OADryBulbAverage.OADryBulbWeatherDataProcessed = true; + state->dataWeatherManager->OADryBulbAverage.OADryBulbWeatherDataProcessed = true; DataEnvironment::Latitude = 42.00; // CHICAGO_IL_USA_WMO_725300 // January 21st water mains temperature test DataEnvironment::DayOfYear = 21; // January 21st - WeatherManager::CalcWaterMainsTemp(state); + WeatherManager::CalcWaterMainsTemp(*state); EXPECT_NEAR(DataEnvironment::WaterMainsTemp, 7.23463, 0.00001); // July 21st water mains temperature test DataEnvironment::DayOfYear = 202; // July 21st - WeatherManager::CalcWaterMainsTemp(state); + WeatherManager::CalcWaterMainsTemp(*state); EXPECT_NEAR(DataEnvironment::WaterMainsTemp, 19.33812, 0.00001); } TEST_F(EnergyPlusFixture, WaterMainsOutputReports_CorrelationFromWeatherFileTest) @@ -481,20 +482,20 @@ TEST_F(EnergyPlusFixture, WaterMainsOutputReports_CorrelationFromWeatherFileTest ASSERT_TRUE(process_idf(idf_objects)); bool foundErrors(false); - WeatherManager::GetWaterMainsTemperatures(state, foundErrors); + WeatherManager::GetWaterMainsTemperatures(*state, foundErrors); EXPECT_FALSE(foundErrors); // expect no errors - EXPECT_EQ(state.dataWeatherManager->WaterMainsTempsMethod, WeatherManager::WaterMainsTempCalcMethod::CorrelationFromWeatherFile); + EXPECT_EQ(state->dataWeatherManager->WaterMainsTempsMethod, WeatherManager::WaterMainsTempCalcMethod::CorrelationFromWeatherFile); // for calculation method CorrelationFromWeatherFile these two parameters are ignored - EXPECT_EQ(state.dataWeatherManager->WaterMainsTempsAnnualAvgAirTemp, 0.0); - EXPECT_EQ(state.dataWeatherManager->WaterMainsTempsMaxDiffAirTemp, 0.0); + EXPECT_EQ(state->dataWeatherManager->WaterMainsTempsAnnualAvgAirTemp, 0.0); + EXPECT_EQ(state->dataWeatherManager->WaterMainsTempsMaxDiffAirTemp, 0.0); // set water mains temp parameters for CorrelationFromWeatherFile method - state.dataWeatherManager->OADryBulbAverage.AnnualAvgOADryBulbTemp = 9.99; - state.dataWeatherManager->OADryBulbAverage.MonthlyAvgOADryBulbTempMaxDiff = 28.78; - state.dataWeatherManager->OADryBulbAverage.OADryBulbWeatherDataProcessed = true; + state->dataWeatherManager->OADryBulbAverage.AnnualAvgOADryBulbTemp = 9.99; + state->dataWeatherManager->OADryBulbAverage.MonthlyAvgOADryBulbTempMaxDiff = 28.78; + state->dataWeatherManager->OADryBulbAverage.OADryBulbWeatherDataProcessed = true; // report water mains parameters to eio file - WeatherManager::ReportWaterMainsTempParameters(state); + WeatherManager::ReportWaterMainsTempParameters(*state); std::string const eiooutput = delimited_string({"! ," "Calculation Method{}," @@ -570,11 +571,11 @@ TEST_F(EnergyPlusFixture, ASHRAE_Tau2017ModelTest) bool ErrorsFound(false); DataEnvironment::TotDesDays = 2; // setup environment state - state.dataWeatherManager->Environment.allocate(DataEnvironment::TotDesDays); - state.dataWeatherManager->DesignDay.allocate(DataEnvironment::TotDesDays); - state.dataWeatherManager->Environment(1).DesignDayNum = 1; - state.dataWeatherManager->Environment(2).DesignDayNum = 2; - GetDesignDayData(state, DataEnvironment::TotDesDays, ErrorsFound); + state->dataWeatherManager->Environment.allocate(DataEnvironment::TotDesDays); + state->dataWeatherManager->DesignDay.allocate(DataEnvironment::TotDesDays); + state->dataWeatherManager->Environment(1).DesignDayNum = 1; + state->dataWeatherManager->Environment(2).DesignDayNum = 2; + GetDesignDayData(*state, DataEnvironment::TotDesDays, ErrorsFound); ASSERT_FALSE(ErrorsFound); // init local variables @@ -586,10 +587,10 @@ TEST_F(EnergyPlusFixture, ASHRAE_Tau2017ModelTest) // EnvrnNum = 1 uses Tau values of January int EnvrnNum = 1; Real64 CosZenith = 1.0; // assumed zero zenith angle - Real64 TauB = state.dataWeatherManager->DesDayInput(EnvrnNum).TauB; - Real64 TauD = state.dataWeatherManager->DesDayInput(EnvrnNum).TauD; + Real64 TauB = state->dataWeatherManager->DesDayInput(EnvrnNum).TauB; + Real64 TauD = state->dataWeatherManager->DesDayInput(EnvrnNum).TauD; // check tau values - EXPECT_EQ(DesignDaySolarModel::ASHRAE_Tau2017, state.dataWeatherManager->DesDayInput(EnvrnNum).SolarModel); + EXPECT_EQ(DesignDaySolarModel::ASHRAE_Tau2017, state->dataWeatherManager->DesDayInput(EnvrnNum).SolarModel); EXPECT_EQ(0.325, TauB); EXPECT_EQ(2.461, TauD); // calc expected values for environment 1 @@ -600,7 +601,7 @@ TEST_F(EnergyPlusFixture, ASHRAE_Tau2017ModelTest) Real64 expectedIDifH = ETR * std::exp(-TauD * std::pow(M, AD)); Real64 expectedIGlbH = expectedIDirN * CosZenith + expectedIDifH; // calc TauModel - ASHRAETauModel(state, state.dataWeatherManager->DesDayInput(EnvrnNum).SolarModel, ETR, CosZenith, TauB, TauD, BeamRad, DiffRad, GloHorzRad); + ASHRAETauModel(*state, state->dataWeatherManager->DesDayInput(EnvrnNum).SolarModel, ETR, CosZenith, TauB, TauD, BeamRad, DiffRad, GloHorzRad); // check the coefficients are correctly applied EXPECT_EQ(expectedIDirN, BeamRad); EXPECT_EQ(expectedIDifH, DiffRad); @@ -609,8 +610,8 @@ TEST_F(EnergyPlusFixture, ASHRAE_Tau2017ModelTest) // EnvrnNum = 2 uses Tau values of July EnvrnNum = 2; CosZenith = 1.0; // assumed zero zenith angle - TauB = state.dataWeatherManager->DesDayInput(EnvrnNum).TauB; - TauD = state.dataWeatherManager->DesDayInput(EnvrnNum).TauD; + TauB = state->dataWeatherManager->DesDayInput(EnvrnNum).TauB; + TauD = state->dataWeatherManager->DesDayInput(EnvrnNum).TauD; // check tau values EXPECT_EQ(0.556, TauB); EXPECT_EQ(1.779, TauD); @@ -626,7 +627,7 @@ TEST_F(EnergyPlusFixture, ASHRAE_Tau2017ModelTest) DiffRad = 0.0; GloHorzRad = 0.0; // calc TauModel - ASHRAETauModel(state, state.dataWeatherManager->DesDayInput(EnvrnNum).SolarModel, ETR, CosZenith, TauB, TauD, BeamRad, DiffRad, GloHorzRad); + ASHRAETauModel(*state, state->dataWeatherManager->DesDayInput(EnvrnNum).SolarModel, ETR, CosZenith, TauB, TauD, BeamRad, DiffRad, GloHorzRad); // check the coefficients are correctly applied EXPECT_EQ(expectedIDirN, BeamRad); EXPECT_EQ(expectedIDifH, DiffRad); @@ -669,13 +670,13 @@ TEST_F(EnergyPlusFixture, WeatherManager_NoLocation) { ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->BeginSimFlag = false; - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataWeatherManager->LocationGathered = false; + state->dataGlobal->BeginSimFlag = false; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataWeatherManager->LocationGathered = false; bool Available{false}; bool ErrorsFound{false}; - ASSERT_THROW(WeatherManager::GetNextEnvironment(state, Available, ErrorsFound), std::runtime_error); + ASSERT_THROW(WeatherManager::GetNextEnvironment(*state, Available, ErrorsFound), std::runtime_error); ASSERT_TRUE(ErrorsFound); std::string const error_string = delimited_string({ @@ -689,8 +690,8 @@ TEST_F(EnergyPlusFixture, WeatherManager_NoLocation) { }); EXPECT_TRUE(compare_err_stream(error_string, true)); - EXPECT_EQ(1, state.dataWeatherManager->NumOfEnvrn); - EXPECT_EQ(state.dataWeatherManager->Environment(1).KindOfEnvrn, DataGlobalConstants::KindOfSim::DesignDay); + EXPECT_EQ(1, state->dataWeatherManager->NumOfEnvrn); + EXPECT_EQ(state->dataWeatherManager->Environment(1).KindOfEnvrn, DataGlobalConstants::KindOfSim::DesignDay); } // Test for https://github.com/NREL/EnergyPlus/issues/7550 @@ -741,39 +742,39 @@ TEST_F(SQLiteFixture, DesignDay_EnthalphyAtMaxDB) ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::OpenOutputFiles(state); + SimulationManager::OpenOutputFiles(*state); // reset eio stream has_eio_output(true); bool ErrorsFound(false); DataEnvironment::TotDesDays = 1; // setup environment state - state.dataWeatherManager->Environment.allocate(DataEnvironment::TotDesDays); - state.dataWeatherManager->DesignDay.allocate(DataEnvironment::TotDesDays); - - state.dataWeatherManager->Environment(1).DesignDayNum = 1; - state.dataWeatherManager->Environment(1).WP_Type1 = 0; - state.dataGlobal->MinutesPerTimeStep = 60; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->BeginSimFlag = true; + state->dataWeatherManager->Environment.allocate(DataEnvironment::TotDesDays); + state->dataWeatherManager->DesignDay.allocate(DataEnvironment::TotDesDays); + + state->dataWeatherManager->Environment(1).DesignDayNum = 1; + state->dataWeatherManager->Environment(1).WP_Type1 = 0; + state->dataGlobal->MinutesPerTimeStep = 60; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->BeginSimFlag = true; DataReportingFlags::DoWeatherInitReporting = true; - WeatherManager::SetupInterpolationValues(state); - WeatherManager::AllocateWeatherData(state); + WeatherManager::SetupInterpolationValues(*state); + WeatherManager::AllocateWeatherData(*state); - WeatherManager::GetDesignDayData(state, DataEnvironment::TotDesDays, ErrorsFound); + WeatherManager::GetDesignDayData(*state, DataEnvironment::TotDesDays, ErrorsFound); ASSERT_FALSE(ErrorsFound); - WeatherManager::SetUpDesignDay(state, 1); - EXPECT_EQ(state.dataWeatherManager->DesDayInput(1).HumIndType, DDHumIndType::Enthalpy); - EXPECT_EQ(state.dataWeatherManager->DesDayInput(1).HumIndValue, 90500.0); + WeatherManager::SetUpDesignDay(*state, 1); + EXPECT_EQ(state->dataWeatherManager->DesDayInput(1).HumIndType, DDHumIndType::Enthalpy); + EXPECT_EQ(state->dataWeatherManager->DesDayInput(1).HumIndValue, 90500.0); unsigned n_RH_not100 = 0; for (int Hour = 1; Hour <= 24; ++Hour) { - for (int TS = 1; TS <= state.dataGlobal->NumOfTimeStepInHour; ++TS) { - EXPECT_GE(state.dataWeatherManager->TomorrowOutRelHum(TS, Hour), 0.); - EXPECT_LE(state.dataWeatherManager->TomorrowOutRelHum(TS, Hour), 100.); - if (state.dataWeatherManager->TomorrowOutRelHum(TS, Hour) < 100.) { + for (int TS = 1; TS <= state->dataGlobal->NumOfTimeStepInHour; ++TS) { + EXPECT_GE(state->dataWeatherManager->TomorrowOutRelHum(TS, Hour), 0.); + EXPECT_LE(state->dataWeatherManager->TomorrowOutRelHum(TS, Hour), 100.); + if (state->dataWeatherManager->TomorrowOutRelHum(TS, Hour) < 100.) { ++n_RH_not100; } } @@ -791,10 +792,10 @@ TEST_F(SQLiteFixture, DesignDay_EnthalphyAtMaxDB) EXPECT_TRUE(compare_eio_stream(eiooutput, false)); - OutputReportTabular::WriteEioTables(state); + OutputReportTabular::WriteEioTables(*state); // Close output files *after* the EIO has been written to - SimulationManager::CloseOutputFiles(state); + SimulationManager::CloseOutputFiles(*state); EnergyPlus::sqlite->sqliteCommit(); @@ -895,7 +896,7 @@ TEST_F(EnergyPlusFixture, IRHoriz_InterpretWeatherZeroIRHoriz) { for (auto WeatherDataLine : Lines){ - WeatherManager::InterpretWeatherDataLine(state, WeatherDataLine, + WeatherManager::InterpretWeatherDataLine(*state, WeatherDataLine, ErrorFound, WYear, WMonth, @@ -938,7 +939,7 @@ TEST_F(EnergyPlusFixture, IRHoriz_InterpretWeatherZeroIRHoriz) { TEST_F(EnergyPlusFixture, IRHoriz_InterpretWeatherCalculateMissingIRHoriz) { - state.files.inputWeatherFileName.fileName = configured_source_directory() + "/tst/EnergyPlus/unit/Resources/WeatherManagerIROutputTest.epw"; + state->files.inputWeatherFileName.fileName = configured_source_directory() + "/tst/EnergyPlus/unit/Resources/WeatherManagerIROutputTest.epw"; std::string const idf_objects = delimited_string({ " Version,9.3;", @@ -1003,25 +1004,25 @@ TEST_F(EnergyPlusFixture, IRHoriz_InterpretWeatherCalculateMissingIRHoriz) { DataEnvironment::TotDesDays = 2; // setup environment state - state.dataWeatherManager->Environment.allocate(DataEnvironment::TotDesDays); - state.dataWeatherManager->DesignDay.allocate(DataEnvironment::TotDesDays); - state.dataWeatherManager->Environment(1).DesignDayNum = 1; - state.dataWeatherManager->Environment(2).DesignDayNum = 2; - GetDesignDayData(state, DataEnvironment::TotDesDays, ErrorsFound); + state->dataWeatherManager->Environment.allocate(DataEnvironment::TotDesDays); + state->dataWeatherManager->DesignDay.allocate(DataEnvironment::TotDesDays); + state->dataWeatherManager->Environment(1).DesignDayNum = 1; + state->dataWeatherManager->Environment(2).DesignDayNum = 2; + GetDesignDayData(*state, DataEnvironment::TotDesDays, ErrorsFound); ASSERT_FALSE(ErrorsFound); - state.dataWeatherManager->Envrn =1; + state->dataWeatherManager->Envrn =1; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataWeatherManager->Environment.allocate(1); - state.dataWeatherManager->Environment(1).SkyTempModel = EmissivityCalcType::ClarkAllenModel; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataWeatherManager->Environment.allocate(1); + state->dataWeatherManager->Environment(1).SkyTempModel = EmissivityCalcType::ClarkAllenModel; - AllocateWeatherData(state); - OpenWeatherFile(state, ErrorsFound); - ReadWeatherForDay(state, 0, 1, false); + AllocateWeatherData(*state); + OpenWeatherFile(*state, ErrorsFound); + ReadWeatherForDay(*state, 0, 1, false); Real64 expected_IRHorizSky = 345.73838855245953; - EXPECT_NEAR(state.dataWeatherManager->TomorrowHorizIRSky(1, 1), expected_IRHorizSky, 0.001); + EXPECT_NEAR(state->dataWeatherManager->TomorrowHorizIRSky(1, 1), expected_IRHorizSky, 0.001); } // Test for Issue 7957: add new sky cover weather output values; @@ -1071,21 +1072,21 @@ TEST_F(EnergyPlusFixture, Add_and_InterpolateWeatherInputOutputTest) ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::PostIPProcessing(state); + SimulationManager::PostIPProcessing(*state); bool ErrorsFound(false); ErrorsFound = false; - state.dataWeatherManager->WeatherFileExists = true; - state.files.inputWeatherFileName.fileName = configured_source_directory() + "/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"; + state->dataWeatherManager->WeatherFileExists = true; + state->files.inputWeatherFileName.fileName = configured_source_directory() + "/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"; - state.dataGlobal->BeginSimFlag = true; - SimulationManager::GetProjectData(state); + state->dataGlobal->BeginSimFlag = true; + SimulationManager::GetProjectData(*state); bool Available(true); Available = true; - state.dataGlobal->BeginSimFlag = true; - WeatherManager::GetNextEnvironment(state, Available, ErrorsFound); + state->dataGlobal->BeginSimFlag = true; + WeatherManager::GetNextEnvironment(*state, Available, ErrorsFound); // Test get output variables for Total Sky Cover and Opaque Sky Cover EXPECT_EQ("Site Outdoor Air Drybulb Temperature", OutputProcessor::RVariableTypes(1).VarNameOnly); @@ -1102,21 +1103,21 @@ TEST_F(EnergyPlusFixture, Add_and_InterpolateWeatherInputOutputTest) EXPECT_EQ(9, OutputProcessor::RVariableTypes(3).ReportID); EXPECT_EQ(10, OutputProcessor::RVariableTypes(4).ReportID); - state.dataWeatherManager->Envrn = 1; + state->dataWeatherManager->Envrn = 1; - state.dataGlobal->NumOfTimeStepInHour =4; - state.dataWeatherManager->Environment.allocate(1); - state.dataWeatherManager->Environment(1).SkyTempModel = EmissivityCalcType::ClarkAllenModel; - state.dataWeatherManager->Environment(1).StartMonth = 1; - state.dataWeatherManager->Environment(1).StartDay = 1; + state->dataGlobal->NumOfTimeStepInHour =4; + state->dataWeatherManager->Environment.allocate(1); + state->dataWeatherManager->Environment(1).SkyTempModel = EmissivityCalcType::ClarkAllenModel; + state->dataWeatherManager->Environment(1).StartMonth = 1; + state->dataWeatherManager->Environment(1).StartDay = 1; - state.dataWeatherManager->Environment(1).UseWeatherFileHorizontalIR = false; + state->dataWeatherManager->Environment(1).UseWeatherFileHorizontalIR = false; - AllocateWeatherData(state); - OpenWeatherFile(state, ErrorsFound); - ReadWeatherForDay(state, 1, 1, true); + AllocateWeatherData(*state); + OpenWeatherFile(*state, ErrorsFound); + ReadWeatherForDay(*state, 1, 1, true); // Test the feature of interpolating some weather inputs to calc sky temp Real64 expected_SkyTemp = -20.8188538296; - EXPECT_NEAR(state.dataWeatherManager->TomorrowSkyTemp(2, 1), expected_SkyTemp, 1e-6); + EXPECT_NEAR(state->dataWeatherManager->TomorrowSkyTemp(2, 1), expected_SkyTemp, 1e-6); } diff --git a/tst/EnergyPlus/unit/WinCalcEngine.unit.cc b/tst/EnergyPlus/unit/WinCalcEngine.unit.cc index f12c6dd299e..92353a7d090 100644 --- a/tst/EnergyPlus/unit/WinCalcEngine.unit.cc +++ b/tst/EnergyPlus/unit/WinCalcEngine.unit.cc @@ -61,6 +61,7 @@ #include #include "Fixtures/EnergyPlusFixture.hh" +#include #include "Windows-CalcEngine/src/Common/src/FenestrationCommon.hpp" using namespace EnergyPlus; @@ -96,14 +97,14 @@ TEST_F(EnergyPlusFixture, WCEClear) ASSERT_TRUE(process_idf(idf_objects)); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); - WindowManager::initWindowModel(state); - WindowManager::InitWindowOpticalCalculations(state); - HeatBalanceManager::InitHeatBalance(state); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); + WindowManager::initWindowModel(*state); + WindowManager::InitWindowOpticalCalculations(*state); + HeatBalanceManager::InitHeatBalance(*state); auto aWinConstSimp = WindowManager::CWindowConstructionsSimplified::instance(); - auto solarLayer = aWinConstSimp.getEquivalentLayer(state, FenestrationCommon::WavelengthRange::Solar, 1); + auto solarLayer = aWinConstSimp.getEquivalentLayer(*state, FenestrationCommon::WavelengthRange::Solar, 1); // Transmittance Front const auto Tfront = solarLayer->getPropertySimple(FenestrationCommon::PropertySimple::T, FenestrationCommon::Side::Front, @@ -188,14 +189,14 @@ TEST_F(EnergyPlusFixture, WCEVenetian) ASSERT_TRUE(process_idf(idf_objects)); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); - WindowManager::initWindowModel(state); - WindowManager::InitWindowOpticalCalculations(state); - HeatBalanceManager::InitHeatBalance(state); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); + WindowManager::initWindowModel(*state); + WindowManager::InitWindowOpticalCalculations(*state); + HeatBalanceManager::InitHeatBalance(*state); auto aWinConstSimp = WindowManager::CWindowConstructionsSimplified::instance(); - auto solarLayer = aWinConstSimp.getEquivalentLayer(state, FenestrationCommon::WavelengthRange::Solar, 1); + auto solarLayer = aWinConstSimp.getEquivalentLayer(*state, FenestrationCommon::WavelengthRange::Solar, 1); // Transmittance Front const auto Tfront = solarLayer->getPropertySimple(FenestrationCommon::PropertySimple::T, FenestrationCommon::Side::Front, @@ -266,14 +267,14 @@ TEST_F(EnergyPlusFixture, WCEShade) ASSERT_TRUE(process_idf(idf_objects)); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); - WindowManager::initWindowModel(state); - WindowManager::InitWindowOpticalCalculations(state); - HeatBalanceManager::InitHeatBalance(state); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); + WindowManager::initWindowModel(*state); + WindowManager::InitWindowOpticalCalculations(*state); + HeatBalanceManager::InitHeatBalance(*state); auto aWinConstSimp = WindowManager::CWindowConstructionsSimplified::instance(); - auto solarLayer = aWinConstSimp.getEquivalentLayer(state, FenestrationCommon::WavelengthRange::Solar, 1); + auto solarLayer = aWinConstSimp.getEquivalentLayer(*state, FenestrationCommon::WavelengthRange::Solar, 1); // Transmittance Front const auto Tfront_dir_dir = solarLayer->getPropertySimple(FenestrationCommon::PropertySimple::T, FenestrationCommon::Side::Front, diff --git a/tst/EnergyPlus/unit/WindowAC.unit.cc b/tst/EnergyPlus/unit/WindowAC.unit.cc index 135e4103da4..c1af8b5d8f2 100644 --- a/tst/EnergyPlus/unit/WindowAC.unit.cc +++ b/tst/EnergyPlus/unit/WindowAC.unit.cc @@ -48,6 +48,7 @@ #include // EnergyPlus Headers +#include #include "Fixtures/EnergyPlusFixture.hh" #include #include @@ -429,45 +430,45 @@ TEST_F(EnergyPlusFixture, WindowAC_VStest1) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 6; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 10; // must initialize this to get schedules initialized - ScheduleManager::ProcessScheduleInput(state); // read schedule data + state->dataGlobal->NumOfTimeStepInHour = 6; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 10; // must initialize this to get schedules initialized + ScheduleManager::ProcessScheduleInput(*state); // read schedule data bool errorsFound(false); - HeatBalanceManager::GetProjectControlData(state, errorsFound); // read project control data + HeatBalanceManager::GetProjectControlData(*state, errorsFound); // read project control data EXPECT_FALSE(errorsFound); // OutputProcessor::TimeValue.allocate(2); - state.dataGlobal->DDOnlySimulation = true; + state->dataGlobal->DDOnlySimulation = true; - SimulationManager::GetProjectData(state); - OutputReportPredefined::SetPredefinedTables(state); - HeatBalanceManager::SetPreConstructionInputParameters(state); // establish array bounds for constructions early + SimulationManager::GetProjectData(*state); + OutputReportPredefined::SetPredefinedTables(*state); + HeatBalanceManager::SetPreConstructionInputParameters(*state); // establish array bounds for constructions early - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; - state.dataGlobal->ZoneSizingCalc = true; + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->ZoneSizingCalc = true; EnergyPlus::createFacilityElectricPowerServiceObject(); - SizingManager::ManageSizing(state); + SizingManager::ManageSizing(*state); - SimulationManager::SetupSimulation(state, errorsFound); + SimulationManager::SetupSimulation(*state, errorsFound); // Real64 qDotMet(0.0); // Watts total cap Real64 lDotProvid(0.0); // latent removal kg/s int compIndex(0); - WindowAC::SimWindowAC(state, "ZONE1WINDAC", 1, true, qDotMet, lDotProvid, compIndex); + WindowAC::SimWindowAC(*state, "ZONE1WINDAC", 1, true, qDotMet, lDotProvid, compIndex); // check input processing EXPECT_EQ(compIndex, 1); - EXPECT_EQ(state.dataWindowAC->WindAC(1).DXCoilType_Num, DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed); + EXPECT_EQ(state->dataWindowAC->WindAC(1).DXCoilType_Num, DataHVACGlobals::Coil_CoolingAirToAirVariableSpeed); // check Sizing - EXPECT_NEAR(state.dataWindowAC->WindAC(1).MaxAirVolFlow, 0.0415, 0.0001); + EXPECT_NEAR(state->dataWindowAC->WindAC(1).MaxAirVolFlow, 0.0415, 0.0001); DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -295.0; DataZoneEnergyDemands::CurDeadBandOrSetback(1) = false; - WindowAC::SimWindowAC(state, "ZONE1WINDAC", 1, true, qDotMet, lDotProvid, compIndex); + WindowAC::SimWindowAC(*state, "ZONE1WINDAC", 1, true, qDotMet, lDotProvid, compIndex); // check output EXPECT_NEAR(qDotMet, -295.0, 0.1); diff --git a/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc b/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc index 72cd325bf4d..19a42ae7bb2 100644 --- a/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc +++ b/tst/EnergyPlus/unit/WindowEquivalentLayer.unit.cc @@ -57,6 +57,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -179,8 +180,8 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_GetInput) ASSERT_TRUE(process_idf(idf_objects)); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); int VBMatNum(0); for (int i = 1; i <= 4; i++) { @@ -191,13 +192,13 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_GetInput) } EXPECT_EQ(1, DataHeatBalance::TotBlindsEQL); EXPECT_EQ(dataMaterial.Material(VBMatNum).Group, DataHeatBalance::BlindEquivalentLayer); - EXPECT_EQ(dataMaterial.Material(VBMatNum).SlatAngleType, state.dataWindowEquivalentLayer->lscVBNOBM); + EXPECT_EQ(dataMaterial.Material(VBMatNum).SlatAngleType, state->dataWindowEquivalentLayer->lscVBNOBM); int ConstrNum = 1; int EQLNum = 0; - InitEquivalentLayerWindowCalculations(state); - EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; - EXPECT_EQ(CFS(EQLNum).L(CFS(EQLNum).VBLayerPtr).CNTRL, state.dataWindowEquivalentLayer->lscVBNOBM); + InitEquivalentLayerWindowCalculations(*state); + EQLNum = state->dataConstruction->Construct(ConstrNum).EQLConsPtr; + EXPECT_EQ(CFS(EQLNum).L(CFS(EQLNum).VBLayerPtr).CNTRL, state->dataWindowEquivalentLayer->lscVBNOBM); } TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBMaximizeBeamSolar) @@ -524,12 +525,12 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBMaximizeBeamSolar) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); // - SimulationManager::ManageSimulation(state); + SimulationManager::ManageSimulation(*state); // re-set the hour of the day to mid-day - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 12; - state.dataGlobal->CurrentTime = 12.0; - WeatherManager::DetermineSunUpDown(state, DataEnvironment::SOLCOS); + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 12; + state->dataGlobal->CurrentTime = 12.0; + WeatherManager::DetermineSunUpDown(*state, DataEnvironment::SOLCOS); // get window surface index for (int iSurf = 1; iSurf <= DataSurfaces::TotSurfaces; iSurf++) { if (DataSurfaces::SurfWinWindowModelType(iSurf) == DataSurfaces::WindowEQLModel) { @@ -545,9 +546,9 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBMaximizeBeamSolar) } } // get equivalent layer window optical properties - CalcEQLOpticalProperty(state, SurfNum, DataWindowEquivalentLayer::isBEAM, AbsSolBeam); + CalcEQLOpticalProperty(*state, SurfNum, DataWindowEquivalentLayer::isBEAM, AbsSolBeam); // check that the slat angle control type is set to MaximizeSolar - EXPECT_EQ(dataMaterial.Material(VBMatNum).SlatAngleType, state.dataWindowEquivalentLayer->lscVBPROF); + EXPECT_EQ(dataMaterial.Material(VBMatNum).SlatAngleType, state->dataWindowEquivalentLayer->lscVBPROF); // check the slat angle EXPECT_NEAR(-71.0772, DataSurfaces::SurfWinSlatAngThisTSDeg(SurfNum), 0.0001); // check that for MaximizeSolar slat angle control, the slat angle = -ve vertical profile angle @@ -879,12 +880,12 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBBlockBeamSolar) ASSERT_TRUE(process_idf(idf_objects)); // OutputProcessor::TimeValue.allocate(2); - SimulationManager::ManageSimulation(state); + SimulationManager::ManageSimulation(*state); // re-set the hour of the day to noon - state.dataGlobal->TimeStep = 1; - state.dataGlobal->HourOfDay = 12; - state.dataGlobal->CurrentTime = 12.0; - WeatherManager::DetermineSunUpDown(state, DataEnvironment::SOLCOS); + state->dataGlobal->TimeStep = 1; + state->dataGlobal->HourOfDay = 12; + state->dataGlobal->CurrentTime = 12.0; + WeatherManager::DetermineSunUpDown(*state, DataEnvironment::SOLCOS); // get equivalent layer window surface index for (int iSurf = 1; iSurf <= DataSurfaces::TotSurfaces; iSurf++) { if (DataSurfaces::SurfWinWindowModelType(iSurf) == DataSurfaces::WindowEQLModel) { @@ -900,9 +901,9 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBBlockBeamSolar) } } // calc window optical property - CalcEQLOpticalProperty(state, SurfNum, DataWindowEquivalentLayer::isBEAM, AbsSolBeam); + CalcEQLOpticalProperty(*state, SurfNum, DataWindowEquivalentLayer::isBEAM, AbsSolBeam); // check VB slat angle for BlockBeamSolar slat angle control - EXPECT_EQ(dataMaterial.Material(VBMatNum).SlatAngleType, state.dataWindowEquivalentLayer->lscVBNOBM); + EXPECT_EQ(dataMaterial.Material(VBMatNum).SlatAngleType, state->dataWindowEquivalentLayer->lscVBNOBM); // check the VB slat angle EXPECT_NEAR(18.9228, DataSurfaces::SurfWinSlatAngThisTSDeg(SurfNum), 0.0001); // check that for BlockBeamSolar slat angle control, the slat angle = 90 - ProfAngVer @@ -932,16 +933,16 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_InvalidLayerTest) ASSERT_TRUE(process_idf(idf_objects)); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); EXPECT_EQ(1, DataHeatBalance::TotMaterials); EXPECT_EQ(dataMaterial.Material(1).Group, DataHeatBalance::WindowSimpleGlazing); // get construction returns error forund true due to invalid layer - GetConstructData(state, ErrorsFound); + GetConstructData(*state, ErrorsFound); EXPECT_EQ(1, DataHeatBalance::TotConstructs); EXPECT_EQ(1, DataWindowEquivalentLayer::TotWinEquivLayerConstructs); - EXPECT_TRUE(state.dataConstruction->Construct(1).TypeIsWindow); - EXPECT_TRUE(state.dataConstruction->Construct(1).WindowTypeEQL); + EXPECT_TRUE(state->dataConstruction->Construct(1).TypeIsWindow); + EXPECT_TRUE(state->dataConstruction->Construct(1).WindowTypeEQL); EXPECT_TRUE(ErrorsFound); // error found due to invalid layer } @@ -1229,7 +1230,7 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_AirGapOutdoorVentedTest) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::ManageSimulation(state); + SimulationManager::ManageSimulation(*state); int EQLNum(1); Array1D T({1, CFSMAXNL}, 0.0); @@ -1253,17 +1254,17 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_AirGapOutdoorVentedTest) H(2) = HcIn; // check the window air gap vent type: vented to outdoor - EXPECT_EQ(CFS(EQLNum).G(1).GTYPE, state.dataWindowEquivalentLayer->gtyOPENout); + EXPECT_EQ(CFS(EQLNum).G(1).GTYPE, state->dataWindowEquivalentLayer->gtyOPENout); // zero solar absorbed on glazing layers or no solar input Source = 0.0; - ASHWAT_ThermalCalc(state, CFS(EQLNum), TIN, Tout, HcIn, HcOut, TRMOUT, TRMIN, Source, TOL, QOCF, QOCFRoom, T, Q, JF, JB, H); + ASHWAT_ThermalCalc(*state, CFS(EQLNum), TIN, Tout, HcIn, HcOut, TRMOUT, TRMIN, Source, TOL, QOCF, QOCFRoom, T, Q, JF, JB, H); EXPECT_NEAR(T(1), 308.610, 0.001); EXPECT_NEAR(T(2), 306.231, 0.001); // with solar absrobed on glazing layers Source(1) = 100.0; // outside glass layer Source(2) = 50.0; // inside glass layer - ASHWAT_ThermalCalc(state, CFS(EQLNum), TIN, Tout, HcIn, HcOut, TRMOUT, TRMIN, Source, TOL, QOCF, QOCFRoom, T, Q, JF, JB, H); + ASHWAT_ThermalCalc(*state, CFS(EQLNum), TIN, Tout, HcIn, HcOut, TRMOUT, TRMIN, Source, TOL, QOCF, QOCFRoom, T, Q, JF, JB, H); EXPECT_NEAR(T(1), 313.886, 0.001); EXPECT_NEAR(T(2), 310.559, 0.001); } @@ -1551,7 +1552,7 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_AirGapIndoorVentedTest) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::ManageSimulation(state); + SimulationManager::ManageSimulation(*state); int EQLNum(1); Array1D T({1, CFSMAXNL}, 0.0); @@ -1575,17 +1576,17 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_AirGapIndoorVentedTest) H(2) = HcIn; // check the window air gap vent type: vented to outdoor - EXPECT_EQ(CFS(EQLNum).G(1).GTYPE, state.dataWindowEquivalentLayer->gtyOPENin); + EXPECT_EQ(CFS(EQLNum).G(1).GTYPE, state->dataWindowEquivalentLayer->gtyOPENin); // zero solar absorbed on glazing layers or no solar input Source = 0.0; - ASHWAT_ThermalCalc(state, CFS(EQLNum), TIN, Tout, HcIn, HcOut, TRMOUT, TRMIN, Source, TOL, QOCF, QOCFRoom, T, Q, JF, JB, H); + ASHWAT_ThermalCalc(*state, CFS(EQLNum), TIN, Tout, HcIn, HcOut, TRMOUT, TRMIN, Source, TOL, QOCF, QOCFRoom, T, Q, JF, JB, H); EXPECT_NEAR(T(1), 307.054, 0.001); EXPECT_NEAR(T(2), 304.197, 0.001); // with solar absrobed on glazing layers Source(1) = 100.0; // outside glass layer Source(2) = 50.0; // inside glass layer - ASHWAT_ThermalCalc(state, CFS(EQLNum), TIN, Tout, HcIn, HcOut, TRMOUT, TRMIN, Source, TOL, QOCF, QOCFRoom, T, Q, JF, JB, H); + ASHWAT_ThermalCalc(*state, CFS(EQLNum), TIN, Tout, HcIn, HcOut, TRMOUT, TRMIN, Source, TOL, QOCF, QOCFRoom, T, Q, JF, JB, H); EXPECT_NEAR(T(1), 314.666, 0.001); EXPECT_NEAR(T(2), 311.282, 0.001); } @@ -1937,7 +1938,7 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBEffectiveEmissivityTest) }); ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::ManageSimulation(state); + SimulationManager::ManageSimulation(*state); int EQLNum(0); int SurfNum(0); @@ -1959,14 +1960,14 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBEffectiveEmissivityTest) } // get equivalent layer window contruction index for (int ConstrPtr = 1; ConstrPtr <= DataHeatBalance::TotConstructs; ++ConstrPtr) { - if (state.dataConstruction->Construct(ConstrPtr).WindowTypeEQL) { + if (state->dataConstruction->Construct(ConstrPtr).WindowTypeEQL) { ConstrNum = ConstrPtr; } } // check VB slat angle control for FixedSlatAngle - EXPECT_EQ(dataMaterial.Material(VBMatNum).SlatAngleType, state.dataWindowEquivalentLayer->lscNONE); + EXPECT_EQ(dataMaterial.Material(VBMatNum).SlatAngleType, state->dataWindowEquivalentLayer->lscNONE); - EQLNum = state.dataConstruction->Construct(ConstrNum).EQLConsPtr; + EQLNum = state->dataConstruction->Construct(ConstrNum).EQLConsPtr; // check number of solid layers EXPECT_EQ(CFS(EQLNum).NL, 3); // check optical and thermal property of the VB layer (Inside Layer) @@ -1975,7 +1976,7 @@ TEST_F(EnergyPlusFixture, WindowEquivalentLayer_VBEffectiveEmissivityTest) EXPECT_EQ(CFS(EQLNum).L(3).LWP_MAT.EPSLF, 0.90); EXPECT_EQ(CFS(EQLNum).L(3).LWP_MAT.EPSLB, 0.90); // check inside face effective emissivity - EXPECT_NEAR(state.dataConstruction->Construct(ConstrNum).InsideAbsorpThermal, 0.91024, 0.00001); + EXPECT_NEAR(state->dataConstruction->Construct(ConstrNum).InsideAbsorpThermal, 0.91024, 0.00001); // for fixed slate angle the emissivity remains the same - EXPECT_NEAR(EQLWindowInsideEffectiveEmiss(state, ConstrNum), 0.91024, 0.00001); + EXPECT_NEAR(EQLWindowInsideEffectiveEmiss(*state, ConstrNum), 0.91024, 0.00001); } diff --git a/tst/EnergyPlus/unit/WindowLayerEffectiveMultipliers.unit.cc b/tst/EnergyPlus/unit/WindowLayerEffectiveMultipliers.unit.cc index 6b0e197d32a..31cb2927ae6 100644 --- a/tst/EnergyPlus/unit/WindowLayerEffectiveMultipliers.unit.cc +++ b/tst/EnergyPlus/unit/WindowLayerEffectiveMultipliers.unit.cc @@ -55,6 +55,7 @@ #include #include #include +#include #include "Fixtures/EnergyPlusFixture.hh" diff --git a/tst/EnergyPlus/unit/WindowManager.unit.cc b/tst/EnergyPlus/unit/WindowManager.unit.cc index 4c37e487db7..eb8428921f5 100644 --- a/tst/EnergyPlus/unit/WindowManager.unit.cc +++ b/tst/EnergyPlus/unit/WindowManager.unit.cc @@ -57,6 +57,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -191,16 +192,16 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) DataHeatBalance::ZoneIntGain.allocate(1); createFacilityElectricPowerServiceObject(); - HeatBalanceManager::SetPreConstructionInputParameters(state); + HeatBalanceManager::SetPreConstructionInputParameters(*state); Psychrometrics::InitializePsychRoutines(); - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::OutBaroPress = 100000; DataHeatBalFanSys::ZTAV.allocate(1); @@ -213,7 +214,7 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) DataHeatBalance::MRT(1) = 0.0; DataHeatBalFanSys::ZoneAirHumRatAvg(1) = 0.0; - HeatBalanceManager::ManageHeatBalance(state); + HeatBalanceManager::ManageHeatBalance(*state); // This test will emulate NFRC 100 U-factor test int winNum; @@ -226,8 +227,8 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) int cNum; - for (size_t i = 1; i <= state.dataConstruction->Construct.size(); ++i) { - if (state.dataConstruction->Construct(i).TypeIsWindow) { + for (size_t i = 1; i <= state->dataConstruction->Construct.size(); ++i) { + if (state->dataConstruction->Construct(i).TypeIsWindow) { cNum = i; } } @@ -250,7 +251,7 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) DataHeatBalFanSys::MAT.dimension(1, T_in); // initial guess temperatures - int numTemps = 2 + 2 * state.dataConstruction->Construct(cNum).TotGlassLayers; + int numTemps = 2 + 2 * state->dataConstruction->Construct(cNum).TotGlassLayers; Real64 inSurfTemp = T_in - (1.0 / (numTemps - 1)) * (T_in - T_out); Real64 outSurfTemp = T_out + (1.0 / (numTemps - 1)) * (T_in - T_out); @@ -263,8 +264,8 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) DataEnvironment::SunIsUp = true; } - HeatBalanceSurfaceManager::InitSolarHeatGains(state); - SolarShading::CalcInteriorSolarDistribution(state); + HeatBalanceSurfaceManager::InitSolarHeatGains(*state); + SolarShading::CalcInteriorSolarDistribution(*state); // Calculate heat balance (iteratively solve for surface temperatures) Real64 outSurfTempPrev = outSurfTemp; @@ -285,7 +286,7 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) DataSurfaces::Surface(1).Tilt = 180 - tiltSave; DataSurfaces::Surface(1).CosTilt = cos(DataSurfaces::Surface(winNum).Tilt * DataGlobalConstants::Pi() / 180); DataSurfaces::Surface(1).SinTilt = sin(DataSurfaces::Surface(winNum).Tilt * DataGlobalConstants::Pi() / 180); - ConvectionCoefficients::CalcISO15099WindowIntConvCoeff(state, + ConvectionCoefficients::CalcISO15099WindowIntConvCoeff(*state, winNum, outSurfTemp, T_out); // This subroutine sets the global HConvIn( 1 ) variable. We will use it to set the exterior natural convection. h_exterior = h_exterior_f + DataHeatBalance::HConvIn(winNum); // add natural convection @@ -294,11 +295,11 @@ TEST_F(EnergyPlusFixture, WindowFrameTest) DataSurfaces::Surface(1).Tilt = tiltSave; DataSurfaces::Surface(1).CosTilt = cos(tiltSave * DataGlobalConstants::Pi() / 180); DataSurfaces::Surface(1).SinTilt = sin(tiltSave * DataGlobalConstants::Pi() / 180); - ConvectionCoefficients::CalcISO15099WindowIntConvCoeff(state, + ConvectionCoefficients::CalcISO15099WindowIntConvCoeff(*state, winNum, inSurfTemp, T_in); // This time it's actually being used as intended. HConvIn( 1 ) is referenced from the actual heat balance calculation. - WindowManager::CalcWindowHeatBalance(state, winNum, h_exterior, inSurfTemp, outSurfTemp); + WindowManager::CalcWindowHeatBalance(*state, winNum, h_exterior, inSurfTemp, outSurfTemp); outSurfTempDiff = std::fabs(outSurfTemp - outSurfTempPrev); inSurfTempDiff = std::fabs(inSurfTemp - inSurfTempPrev); @@ -464,21 +465,21 @@ TEST_F(EnergyPlusFixture, WindowManager_RefAirTempTest) DataHeatBalance::ZoneIntGain.allocate(1); createFacilityElectricPowerServiceObject(); - HeatBalanceManager::SetPreConstructionInputParameters(state); - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); - HeatBalanceManager::GetFrameAndDividerData(state, ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); - HeatBalanceManager::GetBuildingData(state, ErrorsFound); + HeatBalanceManager::SetPreConstructionInputParameters(*state); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); + HeatBalanceManager::GetFrameAndDividerData(*state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); + HeatBalanceManager::GetBuildingData(*state, ErrorsFound); Psychrometrics::InitializePsychRoutines(); - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::OutBaroPress = 100000; DataZoneEquipment::ZoneEquipConfig.allocate(1); @@ -598,19 +599,19 @@ TEST_F(EnergyPlusFixture, WindowManager_RefAirTempTest) Real64 outSurfTemp; // Claculate temperature based on supply flow rate - WindowManager::CalcWindowHeatBalance(state, surfNum2, DataHeatBalance::HConvIn(surfNum2), inSurfTemp, outSurfTemp); + WindowManager::CalcWindowHeatBalance(*state, surfNum2, DataHeatBalance::HConvIn(surfNum2), inSurfTemp, outSurfTemp); EXPECT_NEAR(20.0, DataHeatBalance::TempEffBulkAir(surfNum2), 0.0001); // Claculate temperature based on zone temperature with supply flow rate = 0 DataLoopNode::Node(1).MassFlowRate = 0.0; DataLoopNode::Node(2).MassFlowRate = 0.0; - WindowManager::CalcWindowHeatBalance(state, surfNum2, DataHeatBalance::HConvIn(surfNum2), inSurfTemp, outSurfTemp); + WindowManager::CalcWindowHeatBalance(*state, surfNum2, DataHeatBalance::HConvIn(surfNum2), inSurfTemp, outSurfTemp); EXPECT_NEAR(25.0, DataHeatBalance::TempEffBulkAir(surfNum2), 0.0001); // Adjacent surface DataLoopNode::Node(1).MassFlowRate = 0.1; DataLoopNode::Node(2).MassFlowRate = 0.1; DataSurfaces::Surface(1).ExtBoundCond = 2; - WindowManager::CalcWindowHeatBalance(state, surfNum2, DataHeatBalance::HConvIn(surfNum2), inSurfTemp, outSurfTemp); + WindowManager::CalcWindowHeatBalance(*state, surfNum2, DataHeatBalance::HConvIn(surfNum2), inSurfTemp, outSurfTemp); EXPECT_NEAR(20.0, DataHeatBalance::TempEffBulkAir(surfNum2), 0.0001); DataLoopNode::Node(1).MassFlowRate = 0.0; @@ -618,7 +619,7 @@ TEST_F(EnergyPlusFixture, WindowManager_RefAirTempTest) DataSurfaces::Surface(1).ExtBoundCond = 2; DataSurfaces::Surface(2).ExtBoundCond = 1; DataSurfaces::Surface(1).TAirRef = DataSurfaces::ZoneSupplyAirTemp; - WindowManager::CalcWindowHeatBalance(state, surfNum2, DataHeatBalance::HConvIn(surfNum2), inSurfTemp, outSurfTemp); + WindowManager::CalcWindowHeatBalance(*state, surfNum2, DataHeatBalance::HConvIn(surfNum2), inSurfTemp, outSurfTemp); EXPECT_NEAR(25.0, DataHeatBalance::TempEffBulkAir(surfNum2), 0.0001); } @@ -2484,55 +2485,55 @@ TEST_F(EnergyPlusFixture, SpectralAngularPropertyTest) ASSERT_TRUE(process_idf(idf_objects)); - SimulationManager::GetProjectData(state); + SimulationManager::GetProjectData(*state); bool FoundError = false; - HeatBalanceManager::GetProjectControlData(state, FoundError); // read project control data + HeatBalanceManager::GetProjectControlData(*state, FoundError); // read project control data EXPECT_FALSE(FoundError); // expect no errors - HeatBalanceManager::SetPreConstructionInputParameters(state); - CurveManager::GetCurveInput(state); - state.dataCurveManager->GetCurvesInputFlag = false; + HeatBalanceManager::SetPreConstructionInputParameters(*state); + CurveManager::GetCurveInput(*state); + state->dataCurveManager->GetCurvesInputFlag = false; - HeatBalanceManager::GetWindowGlassSpectralData(state, FoundError); + HeatBalanceManager::GetWindowGlassSpectralData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetMaterialData(state, FoundError); + HeatBalanceManager::GetMaterialData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetFrameAndDividerData(state, FoundError); + HeatBalanceManager::GetFrameAndDividerData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetConstructData(state, FoundError); + HeatBalanceManager::GetConstructData(*state, FoundError); EXPECT_FALSE(FoundError); - HeatBalanceManager::GetZoneData(state, FoundError); // Read Zone data from input file + HeatBalanceManager::GetZoneData(*state, FoundError); // Read Zone data from input file EXPECT_FALSE(FoundError); - SurfaceGeometry::GetGeometryParameters(state, FoundError); + SurfaceGeometry::GetGeometryParameters(*state, FoundError); EXPECT_FALSE(FoundError); - state.dataSurfaceGeometry->CosZoneRelNorth.allocate(4); - state.dataSurfaceGeometry->SinZoneRelNorth.allocate(4); + state->dataSurfaceGeometry->CosZoneRelNorth.allocate(4); + state->dataSurfaceGeometry->SinZoneRelNorth.allocate(4); - state.dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosZoneRelNorth(4) = std::cos(-DataHeatBalance::Zone(4).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->SinZoneRelNorth(4) = std::sin(-DataHeatBalance::Zone(4).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(1) = std::cos(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(2) = std::cos(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(3) = std::cos(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->CosZoneRelNorth(4) = std::cos(-DataHeatBalance::Zone(4).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(1) = std::sin(-DataHeatBalance::Zone(1).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(2) = std::sin(-DataHeatBalance::Zone(2).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(3) = std::sin(-DataHeatBalance::Zone(3).RelNorth * DataGlobalConstants::DegToRadians()); + state->dataSurfaceGeometry->SinZoneRelNorth(4) = std::sin(-DataHeatBalance::Zone(4).RelNorth * DataGlobalConstants::DegToRadians()); - state.dataSurfaceGeometry->CosBldgRelNorth = 1.0; - state.dataSurfaceGeometry->SinBldgRelNorth = 0.0; + state->dataSurfaceGeometry->CosBldgRelNorth = 1.0; + state->dataSurfaceGeometry->SinBldgRelNorth = 0.0; - state.dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; - state.dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; + state->dataSurfaceGeometry->CosBldgRotAppGonly = 1.0; + state->dataSurfaceGeometry->SinBldgRotAppGonly = 0.0; - SurfaceGeometry::GetSurfaceData(state, FoundError); // setup zone geometry and get zone data + SurfaceGeometry::GetSurfaceData(*state, FoundError); // setup zone geometry and get zone data EXPECT_FALSE(FoundError); // expect no errors - WindowManager::InitGlassOpticalCalculations(state); + WindowManager::InitGlassOpticalCalculations(*state); int NumAngles = 10; // Number of incident angles Real64 sum; @@ -2550,16 +2551,16 @@ TEST_F(EnergyPlusFixture, SpectralAngularPropertyTest) NumAngles, {0.131680954, 0.118416146, 0.105964377, 0.093826087, 0.08151269, 0.068601358, 0.054850634, 0.040339052, 0.025090929, 0.0}); for (int i = 1; i <= NumAngles; i++) { - EXPECT_NEAR(correctT(i), state.dataWindowManager->tsolPhi(i), 0.0001); - EXPECT_NEAR(correctR(i), state.dataWindowManager->rfsolPhi(i), 0.0001); - EXPECT_NEAR(correctabs1(i), state.dataWindowManager->solabsPhi(1, i), 0.0001); - EXPECT_NEAR(correctabs2(i), state.dataWindowManager->solabsPhi(2, i), 0.0001); - sum = state.dataWindowManager->tsolPhi(i) + state.dataWindowManager->rfsolPhi(i) + state.dataWindowManager->solabsPhi(1, i) + state.dataWindowManager->solabsPhi(2, i); + EXPECT_NEAR(correctT(i), state->dataWindowManager->tsolPhi(i), 0.0001); + EXPECT_NEAR(correctR(i), state->dataWindowManager->rfsolPhi(i), 0.0001); + EXPECT_NEAR(correctabs1(i), state->dataWindowManager->solabsPhi(1, i), 0.0001); + EXPECT_NEAR(correctabs2(i), state->dataWindowManager->solabsPhi(2, i), 0.0001); + sum = state->dataWindowManager->tsolPhi(i) + state->dataWindowManager->rfsolPhi(i) + state->dataWindowManager->solabsPhi(1, i) + state->dataWindowManager->solabsPhi(2, i); EXPECT_NEAR(sum, 1.0, 0.0001); } - state.dataSurfaceGeometry->CosZoneRelNorth.deallocate(); - state.dataSurfaceGeometry->SinZoneRelNorth.deallocate(); + state->dataSurfaceGeometry->CosZoneRelNorth.deallocate(); + state->dataSurfaceGeometry->SinZoneRelNorth.deallocate(); } TEST_F(EnergyPlusFixture, WindowManager_SrdLWRTest) @@ -2684,27 +2685,27 @@ TEST_F(EnergyPlusFixture, WindowManager_SrdLWRTest) " autocalculate; !- Volume {m3}"}); ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(state); + ScheduleManager::ProcessScheduleInput(*state); DataHeatBalance::ZoneIntGain.allocate(1); createFacilityElectricPowerServiceObject(); - HeatBalanceManager::SetPreConstructionInputParameters(state); - HeatBalanceManager::GetProjectControlData(state, ErrorsFound); - HeatBalanceManager::GetFrameAndDividerData(state, ErrorsFound); - HeatBalanceManager::GetMaterialData(state, ErrorsFound); - HeatBalanceManager::GetConstructData(state, ErrorsFound); - HeatBalanceManager::GetBuildingData(state, ErrorsFound); + HeatBalanceManager::SetPreConstructionInputParameters(*state); + HeatBalanceManager::GetProjectControlData(*state, ErrorsFound); + HeatBalanceManager::GetFrameAndDividerData(*state, ErrorsFound); + HeatBalanceManager::GetMaterialData(*state, ErrorsFound); + HeatBalanceManager::GetConstructData(*state, ErrorsFound); + HeatBalanceManager::GetBuildingData(*state, ErrorsFound); - EXPECT_TRUE(state.dataGlobal->AnyLocalEnvironmentsInModel); + EXPECT_TRUE(state->dataGlobal->AnyLocalEnvironmentsInModel); Psychrometrics::InitializePsychRoutines(); - state.dataGlobal->TimeStep = 1; - state.dataGlobal->TimeStepZone = 1; - state.dataGlobal->HourOfDay = 1; - state.dataGlobal->NumOfTimeStepInHour = 1; - state.dataGlobal->BeginSimFlag = true; - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->TimeStep = 1; + state->dataGlobal->TimeStepZone = 1; + state->dataGlobal->HourOfDay = 1; + state->dataGlobal->NumOfTimeStepInHour = 1; + state->dataGlobal->BeginSimFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataEnvironment::OutBaroPress = 100000; DataZoneEquipment::ZoneEquipConfig.allocate(1); @@ -2826,9 +2827,9 @@ TEST_F(EnergyPlusFixture, WindowManager_SrdLWRTest) ScheduleManager::Schedule(1).CurrentValue = 25.0; // Srd Srfs Temp // Calculate temperature based on supply flow rate - WindowManager::CalcWindowHeatBalance(state, surfNum2, DataHeatBalance::HConvIn(surfNum2), inSurfTemp, outSurfTemp); + WindowManager::CalcWindowHeatBalance(*state, surfNum2, DataHeatBalance::HConvIn(surfNum2), inSurfTemp, outSurfTemp); // Test if LWR from surrounding surfaces correctly calculated - EXPECT_DOUBLE_EQ(DataGlobalConstants::StefanBoltzmann() * 0.84 * 0.6 * (pow_4(25.0 + DataGlobalConstants::KelvinConv()) - pow_4(state.dataWindowManager->thetas(1))), DataHeatBalSurface::SurfQRadLWOutSrdSurfs(surfNum2)); + EXPECT_DOUBLE_EQ(DataGlobalConstants::StefanBoltzmann() * 0.84 * 0.6 * (pow_4(25.0 + DataGlobalConstants::KelvinConv()) - pow_4(state->dataWindowManager->thetas(1))), DataHeatBalSurface::SurfQRadLWOutSrdSurfs(surfNum2)); EXPECT_NEAR(-24.9342, DataHeatBalSurface::QHeatEmiReport(surfNum2),3); } TEST_F(EnergyPlusFixture, WindowMaterialComplexShadeTest) @@ -2858,7 +2859,7 @@ TEST_F(EnergyPlusFixture, WindowMaterialComplexShadeTest) ASSERT_TRUE(process_idf(idf_objects)); bool errors_found = false; - HeatBalanceManager::GetMaterialData(state, errors_found); + HeatBalanceManager::GetMaterialData(*state, errors_found); EXPECT_FALSE(errors_found); EXPECT_EQ(DataHeatBalance::ComplexShade(1).Name, "SHADE_14_LAYER"); EXPECT_EQ(DataHeatBalance::ComplexShade(1).LayerType, 1); diff --git a/tst/EnergyPlus/unit/XingGroundTemperatureModel.unit.cc b/tst/EnergyPlus/unit/XingGroundTemperatureModel.unit.cc index 6f6c985ebe7..1415a4d0277 100644 --- a/tst/EnergyPlus/unit/XingGroundTemperatureModel.unit.cc +++ b/tst/EnergyPlus/unit/XingGroundTemperatureModel.unit.cc @@ -52,6 +52,7 @@ // EnergyPlus Headers #include "EnergyPlus/DataIPShortCuts.hh" +#include #include "EnergyPlus/GroundTemperatureModeling/GroundTemperatureModelManager.hh" #include "EnergyPlus/GroundTemperatureModeling/XingGroundTemperatureModel.hh" #include "Fixtures/EnergyPlusFixture.hh" @@ -78,17 +79,17 @@ TEST_F(EnergyPlusFixture, XingGroundTempsModelTest) std::string const CurrentModuleObject = CurrentModuleObjects(objectType_XingGroundTemp); - auto thisModel = GetGroundTempModelAndInit(state, CurrentModuleObject, "TEST"); + auto thisModel = GetGroundTempModelAndInit(*state, CurrentModuleObject, "TEST"); - EXPECT_NEAR(-1.43, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 0.0), 0.01); - EXPECT_NEAR(2.15, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 6393600), 0.1); // March 15 - EXPECT_NEAR(19.74, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 22291200), 0.1); // Sept 15 - EXPECT_NEAR(-2.03, thisModel->getGroundTempAtTimeInSeconds(state, 0.0, 35510400), 0.1); // Feb 15 of next year + EXPECT_NEAR(-1.43, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 0.0), 0.01); + EXPECT_NEAR(2.15, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 6393600), 0.1); // March 15 + EXPECT_NEAR(19.74, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 22291200), 0.1); // Sept 15 + EXPECT_NEAR(-2.03, thisModel->getGroundTempAtTimeInSeconds(*state, 0.0, 35510400), 0.1); // Feb 15 of next year - EXPECT_NEAR(-2.71, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 1), 0.1); // January - EXPECT_NEAR(23.61, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 7), 0.1); // July - EXPECT_NEAR(1.62, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 12), 0.1); // December - EXPECT_NEAR(-2.12, thisModel->getGroundTempAtTimeInMonths(state, 0.0, 14), 0.1); // Feb of next year + EXPECT_NEAR(-2.71, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 1), 0.1); // January + EXPECT_NEAR(23.61, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 7), 0.1); // July + EXPECT_NEAR(1.62, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 12), 0.1); // December + EXPECT_NEAR(-2.12, thisModel->getGroundTempAtTimeInMonths(*state, 0.0, 14), 0.1); // Feb of next year - EXPECT_NEAR(11.1, thisModel->getGroundTempAtTimeInMonths(state, 100.0, 1), 0.1); // January--deep + EXPECT_NEAR(11.1, thisModel->getGroundTempAtTimeInMonths(*state, 100.0, 1), 0.1); // January--deep } diff --git a/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc b/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc index cd36a2b2e90..94c61b22b9a 100644 --- a/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc +++ b/tst/EnergyPlus/unit/ZoneContaminantPredictorCorrector.unit.cc @@ -53,6 +53,7 @@ #include "Fixtures/EnergyPlusFixture.hh" // EnergyPlus Headers +#include #include #include #include @@ -108,7 +109,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_AddMDotOATest) ZT.allocate(1); MixingMassFlowZone.allocate(1); - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataContaminantBalance::Contaminant.CO2Simulation = true; DataContaminantBalance::Contaminant.GenericContamSimulation = true; @@ -206,8 +207,8 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_AddMDotOATest) HybridModelZone(1).InfiltrationCalc_C = false; HybridModelZone(1).PeopleCountCalc_C = false; - state.dataZonePlenum->NumZoneReturnPlenums = 0; - state.dataZonePlenum->NumZoneSupplyPlenums = 0; + state->dataZonePlenum->NumZoneReturnPlenums = 0; + state->dataZonePlenum->NumZoneSupplyPlenums = 0; OAMFL.allocate(1); VAMFL.allocate(1); @@ -253,11 +254,11 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_AddMDotOATest) DataContaminantBalance::ContaminantControlledZone(1).NumOfZones = 1; DataContaminantBalance::ZoneGCSetPoint(1) = 0.0025; - PredictZoneContaminants(state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep); + PredictZoneContaminants(*state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep); EXPECT_NEAR(1.041692180, DataContaminantBalance::CO2PredictedRate(1), 0.00001); EXPECT_NEAR(76.89754831, DataContaminantBalance::GCPredictedRate(1), 0.00001); - CorrectZoneContaminants(state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep); + CorrectZoneContaminants(*state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep); EXPECT_NEAR(489.931000, Node(5).CO2, 0.00001); EXPECT_NEAR(0.09093100, Node(5).GenContam, 0.00001); @@ -275,7 +276,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_CorrectZoneContamina ZT.allocate(1); MixingMassFlowZone.allocate(1); - state.dataGlobal->NumOfZones = 1; + state->dataGlobal->NumOfZones = 1; DataContaminantBalance::Contaminant.CO2Simulation = true; DataContaminantBalance::Contaminant.GenericContamSimulation = true; @@ -363,8 +364,8 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_CorrectZoneContamina HybridModelZone(1).InfiltrationCalc_C = false; HybridModelZone(1).PeopleCountCalc_C = false; - state.dataZonePlenum->NumZoneReturnPlenums = 0; - state.dataZonePlenum->NumZoneSupplyPlenums = 0; + state->dataZonePlenum->NumZoneReturnPlenums = 0; + state->dataZonePlenum->NumZoneSupplyPlenums = 0; OAMFL.allocate(1); VAMFL.allocate(1); @@ -396,7 +397,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_CorrectZoneContamina ZT(1) = 24.0; MixingMassFlowZone(1) = 0.0; - CorrectZoneContaminants(state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep); + CorrectZoneContaminants(*state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep); EXPECT_NEAR(490.0, Node(5).CO2, 0.00001); EXPECT_NEAR(90.000999, Node(5).GenContam, 0.00001); @@ -414,7 +415,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneCO2ControlT ZT.allocate(3); MixingMassFlowZone.allocate(3); - state.dataGlobal->NumOfZones = 3; + state->dataGlobal->NumOfZones = 3; DataContaminantBalance::Contaminant.CO2Simulation = true; @@ -547,8 +548,8 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneCO2ControlT OutBaroPress = 101325.0; - state.dataZonePlenum->NumZoneReturnPlenums = 0; - state.dataZonePlenum->NumZoneSupplyPlenums = 0; + state->dataZonePlenum->NumZoneReturnPlenums = 0; + state->dataZonePlenum->NumZoneSupplyPlenums = 0; OAMFL.allocate(3); VAMFL.allocate(3); @@ -616,7 +617,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneCO2ControlT DataContaminantBalance::ContaminantControlledZone(3).ActualZoneNum = 3; DataContaminantBalance::ContaminantControlledZone(3).NumOfZones = 1; - PredictZoneContaminants(state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep); + PredictZoneContaminants(*state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep); EXPECT_NEAR(1.0416921806, DataContaminantBalance::CO2PredictedRate(1), 0.00001); EXPECT_NEAR(1.0434496257, DataContaminantBalance::CO2PredictedRate(2), 0.00001); EXPECT_NEAR(1.0399406399, DataContaminantBalance::CO2PredictedRate(3), 0.00001); @@ -632,7 +633,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneGCControlTe ZT.allocate(3); MixingMassFlowZone.allocate(3); - state.dataGlobal->NumOfZones = 3; + state->dataGlobal->NumOfZones = 3; DataContaminantBalance::Contaminant.CO2Simulation = false; DataContaminantBalance::Contaminant.GenericContamSimulation = true; @@ -755,8 +756,8 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneGCControlTe OutBaroPress = 101325.0; - state.dataZonePlenum->NumZoneReturnPlenums = 0; - state.dataZonePlenum->NumZoneSupplyPlenums = 0; + state->dataZonePlenum->NumZoneReturnPlenums = 0; + state->dataZonePlenum->NumZoneSupplyPlenums = 0; OAMFL.allocate(3); VAMFL.allocate(3); @@ -826,7 +827,7 @@ TEST_F(EnergyPlusFixture, ZoneContaminantPredictorCorrector_MultiZoneGCControlTe DataContaminantBalance::ContaminantControlledZone(3).ActualZoneNum = 3; DataContaminantBalance::ContaminantControlledZone(3).NumOfZones = 1; - PredictZoneContaminants(state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep); + PredictZoneContaminants(*state, ShortenTimeStepSys, UseZoneTimeStepHistory, PriorTimeStep); EXPECT_NEAR(19.549478386, DataContaminantBalance::GCPredictedRate(1), 0.00001); EXPECT_NEAR(20.887992514, DataContaminantBalance::GCPredictedRate(2), 0.00001); diff --git a/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc b/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc index 719bc9ade84..4d1aa9ee8d9 100644 --- a/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc +++ b/tst/EnergyPlus/unit/ZoneEquipmentManager.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -123,11 +124,11 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); - AllocateHeatBalArrays(state); - GetZoneEquipmentData1(state); + GetZoneData(*state, ErrorsFound); + AllocateHeatBalArrays(*state); + GetZoneEquipmentData1(*state); ZoneEquipInputsFilled = true; - GetSimpleAirModelInputs(state, ErrorsFound); + GetSimpleAirModelInputs(*state, ErrorsFound); int ZoneNum = 1; int NodeNum; for (NodeNum = 1; NodeNum <= ZoneEquipConfig(ZoneNum).NumInletNodes; ++NodeNum) { @@ -144,21 +145,21 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest) // Test here - if zone equipment exhausts slightly more than it supplies, there should be no unbalanced exhaust flow warning Node(ZoneEquipConfig(ZoneNum).ExhaustNode(1)).MassFlowRate = 1.000000001; - CalcZoneMassBalance(state, false); + CalcZoneMassBalance(*state, false); EXPECT_FALSE(has_err_output()); // Add excess balanced zone exhaust from exhaust fan, still no warning ZoneEquipConfig(ZoneNum).ZoneExh = 0.5; ZoneEquipConfig(ZoneNum).ZoneExhBalanced = 0.5; Node(ZoneEquipConfig(ZoneNum).ExhaustNode(2)).MassFlowRate = 0.5; - CalcZoneMassBalance(state, false); + CalcZoneMassBalance(*state, false); EXPECT_FALSE(has_err_output()); // Add excess unbalanced zone exhaust from exhaust fan, now there should be warning ZoneEquipConfig(ZoneNum).ZoneExh = 0.5; ZoneEquipConfig(ZoneNum).ZoneExhBalanced = 0.0; Node(ZoneEquipConfig(ZoneNum).ExhaustNode(2)).MassFlowRate = 0.5; - CalcZoneMassBalance(state, false); + CalcZoneMassBalance(*state, false); EXPECT_TRUE(has_err_output()); // Deallocate everything - should all be taken care of in clear_states @@ -377,25 +378,25 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_MultiCrossMixingTest) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); bool ErrorsFound = false; - ScheduleManager::ProcessScheduleInput(state); - GetZoneData(state, ErrorsFound); - DataHeatBalFanSys::ZoneReOrder.allocate(state.dataGlobal->NumOfZones); + ScheduleManager::ProcessScheduleInput(*state); + GetZoneData(*state, ErrorsFound); + DataHeatBalFanSys::ZoneReOrder.allocate(state->dataGlobal->NumOfZones); - GetSimpleAirModelInputs(state, ErrorsFound); + GetSimpleAirModelInputs(*state, ErrorsFound); EXPECT_FALSE(ErrorsFound); - DataHeatBalFanSys::MAT.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::ZoneAirHumRat.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MCPM.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MCPTM.allocate(state.dataGlobal->NumOfZones); + DataHeatBalFanSys::MAT.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::ZoneAirHumRat.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPM.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPTM.allocate(state->dataGlobal->NumOfZones); - DataHeatBalFanSys::MCPI.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::OAMFL.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MCPTI.allocate(state.dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPI.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::OAMFL.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MCPTI.allocate(state->dataGlobal->NumOfZones); - DataHeatBalFanSys::MixingMassFlowZone.allocate(state.dataGlobal->NumOfZones); - DataHeatBalFanSys::MixingMassFlowXHumRat.allocate(state.dataGlobal->NumOfZones); + DataHeatBalFanSys::MixingMassFlowZone.allocate(state->dataGlobal->NumOfZones); + DataHeatBalFanSys::MixingMassFlowXHumRat.allocate(state->dataGlobal->NumOfZones); DataHeatBalFanSys::MAT(1) = 21.0; DataHeatBalFanSys::MAT(2) = 22.0; @@ -409,17 +410,17 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_MultiCrossMixingTest) DataHeatBalFanSys::ZoneAirHumRat(5) = 0.001; DataHeatBalance::AirFlowFlag = 1; - ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(state, "MIXINGAVAILSCHED")).CurrentValue = 1.0; - ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(state, "MININDOORTEMP")).CurrentValue = 18.0; - ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(state, "MAXINDOORTEMP")).CurrentValue = 100.0; - ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(state, "DELTATEMP")).CurrentValue = 2.0; - ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(state, "MINOUTDOORTEMP")).CurrentValue = -100.0; - ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(state, "MAXOUTDOORTEMP")).CurrentValue = 100.0; + ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(*state, "MIXINGAVAILSCHED")).CurrentValue = 1.0; + ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(*state, "MININDOORTEMP")).CurrentValue = 18.0; + ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(*state, "MAXINDOORTEMP")).CurrentValue = 100.0; + ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(*state, "DELTATEMP")).CurrentValue = 2.0; + ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(*state, "MINOUTDOORTEMP")).CurrentValue = -100.0; + ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(*state, "MAXOUTDOORTEMP")).CurrentValue = 100.0; DataEnvironment::OutBaroPress = 101325.0; - InitSimpleMixingConvectiveHeatGains(state); + InitSimpleMixingConvectiveHeatGains(*state); - CalcAirFlowSimple(state, 2); + CalcAirFlowSimple(*state, 2); EXPECT_NEAR(720.738493, DataHeatBalFanSys::MCPM(1), 0.00001); EXPECT_NEAR(119.818784, DataHeatBalFanSys::MCPM(2), 0.00001); @@ -509,11 +510,11 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest2) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); - AllocateHeatBalArrays(state); - GetZoneEquipmentData1(state); + GetZoneData(*state, ErrorsFound); + AllocateHeatBalArrays(*state); + GetZoneEquipmentData1(*state); ZoneEquipInputsFilled = true; - GetSimpleAirModelInputs(state, ErrorsFound); + GetSimpleAirModelInputs(*state, ErrorsFound); int ZoneNum = 1; for (int NodeNum = 1; NodeNum <= ZoneEquipConfig(ZoneNum).NumInletNodes; ++NodeNum) { @@ -542,17 +543,17 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest2) Node(ZoneEquipConfig(ZoneNum).ZoneNode).HumRat = 0.004; DataHVACGlobals::NumPrimaryAirSys = 3; - state.dataAirSystemsData->PrimaryAirSystems.allocate(3); - state.dataAirLoop->AirLoopFlow.allocate(3); - - state.dataAirSystemsData->PrimaryAirSystems(1).OASysExists = false; - state.dataAirLoop->AirLoopFlow(1).DesReturnFrac = 1.0; - state.dataAirSystemsData->PrimaryAirSystems(2).OASysExists = false; - state.dataAirLoop->AirLoopFlow(2).DesReturnFrac = 1.0; - state.dataAirSystemsData->PrimaryAirSystems(3).OASysExists = false; - state.dataAirLoop->AirLoopFlow(3).DesReturnFrac = 1.0; - state.dataGlobal->DoingSizing = false; - state.dataGlobal->isPulseZoneSizing = false; + state->dataAirSystemsData->PrimaryAirSystems.allocate(3); + state->dataAirLoop->AirLoopFlow.allocate(3); + + state->dataAirSystemsData->PrimaryAirSystems(1).OASysExists = false; + state->dataAirLoop->AirLoopFlow(1).DesReturnFrac = 1.0; + state->dataAirSystemsData->PrimaryAirSystems(2).OASysExists = false; + state->dataAirLoop->AirLoopFlow(2).DesReturnFrac = 1.0; + state->dataAirSystemsData->PrimaryAirSystems(3).OASysExists = false; + state->dataAirLoop->AirLoopFlow(3).DesReturnFrac = 1.0; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->isPulseZoneSizing = false; // Case 1 - send zero, expect zero back Node(inletNode1).MassFlowRate = 0.0; @@ -565,7 +566,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest2) Real64 StdTotalReturnMassFlow = 0.0; Real64 FinalTotalReturnMassFlow = 0.0; - CalcZoneReturnFlows(state, ZoneNum, StdTotalReturnMassFlow, FinalTotalReturnMassFlow); + CalcZoneReturnFlows(*state, ZoneNum, StdTotalReturnMassFlow, FinalTotalReturnMassFlow); EXPECT_EQ(FinalTotalReturnMassFlow, 0.0); EXPECT_EQ(Node(returnNode1).MassFlowRate, 0.0); EXPECT_EQ(Node(returnNode2).MassFlowRate, 0.0); @@ -582,7 +583,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest2) StdTotalReturnMassFlow = 0.0; FinalTotalReturnMassFlow = 0.0; - CalcZoneReturnFlows(state, ZoneNum, StdTotalReturnMassFlow, FinalTotalReturnMassFlow); + CalcZoneReturnFlows(*state, ZoneNum, StdTotalReturnMassFlow, FinalTotalReturnMassFlow); EXPECT_EQ(FinalTotalReturnMassFlow, 6.0); EXPECT_EQ(Node(returnNode1).MassFlowRate, 2.0); EXPECT_EQ(Node(returnNode2).MassFlowRate, 1.0); @@ -643,11 +644,11 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest3) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); - AllocateHeatBalArrays(state); - GetZoneEquipmentData1(state); + GetZoneData(*state, ErrorsFound); + AllocateHeatBalArrays(*state); + GetZoneEquipmentData1(*state); ZoneEquipInputsFilled = true; - GetSimpleAirModelInputs(state, ErrorsFound); + GetSimpleAirModelInputs(*state, ErrorsFound); int ZoneNum = 1; int NodeNum; for (NodeNum = 1; NodeNum <= ZoneEquipConfig(ZoneNum).NumInletNodes; ++NodeNum) { @@ -655,13 +656,13 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest3) } DataHVACGlobals::NumPrimaryAirSys = 1; - state.dataAirSystemsData->PrimaryAirSystems.allocate(1); - state.dataAirLoop->AirLoopFlow.allocate(1); + state->dataAirSystemsData->PrimaryAirSystems.allocate(1); + state->dataAirLoop->AirLoopFlow.allocate(1); - state.dataAirSystemsData->PrimaryAirSystems(1).OASysExists = false; - state.dataAirLoop->AirLoopFlow(1).DesReturnFrac = 1.0; - state.dataGlobal->DoingSizing = false; - state.dataGlobal->isPulseZoneSizing = false; + state->dataAirSystemsData->PrimaryAirSystems(1).OASysExists = false; + state->dataAirLoop->AirLoopFlow(1).DesReturnFrac = 1.0; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->isPulseZoneSizing = false; ZoneEquipConfig(ZoneNum).ReturnNodeAirLoopNum(1) = 1; ZoneEquipConfig(ZoneNum).ReturnNodeInletNum(1) = 1; @@ -677,14 +678,14 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest3) for (NodeNum = 1; NodeNum <= ZoneEquipConfig(ZoneNum).NumReturnFlowBasisNodes; ++NodeNum) { Node(ZoneEquipConfig(ZoneNum).ReturnFlowBasisNode(NodeNum)).MassFlowRate = 0.0; } - CalcZoneMassBalance(state, false); + CalcZoneMassBalance(*state, false); EXPECT_EQ(Node(ZoneEquipConfig(ZoneNum).ReturnNode(1)).MassFlowRate,0.0); // Set return node basis node flows to non-zero values, return flow should be the sum Node(ZoneEquipConfig(ZoneNum).ReturnFlowBasisNode(1)).MassFlowRate = 0.05; Node(ZoneEquipConfig(ZoneNum).ReturnFlowBasisNode(2)).MassFlowRate = 0.10; Node(ZoneEquipConfig(ZoneNum).ReturnFlowBasisNode(3)).MassFlowRate = 0.20; - CalcZoneMassBalance(state, false); + CalcZoneMassBalance(*state, false); EXPECT_NEAR(Node(ZoneEquipConfig(ZoneNum).ReturnNode(1)).MassFlowRate, 0.35, 0.00001); } @@ -743,11 +744,11 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest4) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); - AllocateHeatBalArrays(state); - GetZoneEquipmentData1(state); + GetZoneData(*state, ErrorsFound); + AllocateHeatBalArrays(*state); + GetZoneEquipmentData1(*state); ZoneEquipInputsFilled = true; - GetSimpleAirModelInputs(state, ErrorsFound); + GetSimpleAirModelInputs(*state, ErrorsFound); int ZoneNum = 1; for (int NodeNum = 1; NodeNum <= ZoneEquipConfig(ZoneNum).NumInletNodes; ++NodeNum) { @@ -776,20 +777,20 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest4) Node(ZoneEquipConfig(ZoneNum).ZoneNode).HumRat = 0.004; DataHVACGlobals::NumPrimaryAirSys = 3; - state.dataAirSystemsData->PrimaryAirSystems.allocate(3); - state.dataAirLoop->AirLoopFlow.allocate(3); + state->dataAirSystemsData->PrimaryAirSystems.allocate(3); + state->dataAirLoop->AirLoopFlow.allocate(3); // Add an outdoor air system to airloop 2 - state.dataAirSystemsData->PrimaryAirSystems(1).OASysExists = false; - state.dataAirLoop->AirLoopFlow(1).DesReturnFrac = 1.0; - state.dataAirSystemsData->PrimaryAirSystems(2).OASysExists = true; - state.dataAirLoop->AirLoopFlow(2).DesReturnFrac = 0.9; - state.dataAirLoop->AirLoopFlow(2).MaxOutAir = 0.1; - state.dataAirLoop->AirLoopFlow(2).OAFlow = 0.1; - state.dataAirSystemsData->PrimaryAirSystems(3).OASysExists = false; - state.dataAirLoop->AirLoopFlow(3).DesReturnFrac = 1.0; - state.dataGlobal->DoingSizing = false; - state.dataGlobal->isPulseZoneSizing = false; + state->dataAirSystemsData->PrimaryAirSystems(1).OASysExists = false; + state->dataAirLoop->AirLoopFlow(1).DesReturnFrac = 1.0; + state->dataAirSystemsData->PrimaryAirSystems(2).OASysExists = true; + state->dataAirLoop->AirLoopFlow(2).DesReturnFrac = 0.9; + state->dataAirLoop->AirLoopFlow(2).MaxOutAir = 0.1; + state->dataAirLoop->AirLoopFlow(2).OAFlow = 0.1; + state->dataAirSystemsData->PrimaryAirSystems(3).OASysExists = false; + state->dataAirLoop->AirLoopFlow(3).DesReturnFrac = 1.0; + state->dataGlobal->DoingSizing = false; + state->dataGlobal->isPulseZoneSizing = false; // Case 1 - send zero, expect zero back Node(inletNode1).MassFlowRate = 0.0; @@ -802,7 +803,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest4) Real64 StdTotalReturnMassFlow = 0.0; Real64 FinalTotalReturnMassFlow = 0.0; - CalcZoneReturnFlows(state, ZoneNum, StdTotalReturnMassFlow, FinalTotalReturnMassFlow); + CalcZoneReturnFlows(*state, ZoneNum, StdTotalReturnMassFlow, FinalTotalReturnMassFlow); EXPECT_EQ(FinalTotalReturnMassFlow, 0.0); EXPECT_EQ(Node(returnNode1).MassFlowRate, 0.0); EXPECT_EQ(Node(returnNode2).MassFlowRate, 0.0); @@ -819,7 +820,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest4) StdTotalReturnMassFlow = 6.0; FinalTotalReturnMassFlow = 0.0; - CalcZoneReturnFlows(state, ZoneNum, StdTotalReturnMassFlow, FinalTotalReturnMassFlow); + CalcZoneReturnFlows(*state, ZoneNum, StdTotalReturnMassFlow, FinalTotalReturnMassFlow); EXPECT_EQ(FinalTotalReturnMassFlow, 5.9); EXPECT_EQ(Node(returnNode1).MassFlowRate, 2.0); EXPECT_EQ(Node(returnNode2).MassFlowRate, 0.9); @@ -827,10 +828,10 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest4) // Case 3 - add exhaust flow, but set system 2 MaxOutAir to zero, expect sum of inlet flow back Node(ZoneEquipConfig(ZoneNum).ExhaustNode(1)).MassFlowRate = 1.000000001; - state.dataAirSystemsData->PrimaryAirSystems(2).OASysExists = true; - state.dataAirLoop->AirLoopFlow(2).DesReturnFrac = 0.9; - state.dataAirLoop->AirLoopFlow(2).MaxOutAir = 0.0; - state.dataAirLoop->AirLoopFlow(2).OAFlow = 0.0; + state->dataAirSystemsData->PrimaryAirSystems(2).OASysExists = true; + state->dataAirLoop->AirLoopFlow(2).DesReturnFrac = 0.9; + state->dataAirLoop->AirLoopFlow(2).MaxOutAir = 0.0; + state->dataAirLoop->AirLoopFlow(2).OAFlow = 0.0; Node(inletNode2).MassFlowRate = 2.0; Node(inletNode1).MassFlowRate = 1.0; @@ -842,7 +843,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_CalcZoneMassBalanceTest4) StdTotalReturnMassFlow = 6.0; FinalTotalReturnMassFlow = 0.0; - CalcZoneReturnFlows(state, ZoneNum, StdTotalReturnMassFlow, FinalTotalReturnMassFlow); + CalcZoneReturnFlows(*state, ZoneNum, StdTotalReturnMassFlow, FinalTotalReturnMassFlow); EXPECT_EQ(FinalTotalReturnMassFlow, 6.0); EXPECT_EQ(Node(returnNode1).MassFlowRate, 2.0); EXPECT_EQ(Node(returnNode2).MassFlowRate, 1.0); @@ -936,9 +937,9 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); - AllocateHeatBalArrays(state); - GetZoneEquipmentData1(state); + GetZoneData(*state, ErrorsFound); + AllocateHeatBalArrays(*state); + GetZoneEquipmentData1(*state); ZoneEquipInputsFilled = true; int ZoneNum = 1; DataZoneEnergyDemands::CurDeadBandOrSetback.allocate(1); @@ -955,14 +956,14 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad) DataZoneEnergyDemands::ZoneSysMoistureDemand(1).SequencedOutputRequiredToHumidSP.allocate(3); DataZoneEnergyDemands::ZoneSysMoistureDemand(1).SequencedOutputRequiredToDehumidSP.allocate(3); auto &energy(DataZoneEnergyDemands::ZoneSysEnergyDemand(ZoneNum)); - state.dataZoneEquipmentManager->PrioritySimOrder.allocate(3); + state->dataZoneEquipmentManager->PrioritySimOrder.allocate(3); // Sequential Test 1 - Heating, FirstHVACIteration = true energy.TotalOutputRequired = 1000.0; energy.OutputRequiredToHeatingSP = 1000.0; energy.OutputRequiredToCoolingSP = 2000.0; bool firstHVACIteration = true; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration, true); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration, true); EXPECT_EQ(energy.SequencedOutputRequired(1), energy.TotalOutputRequired); EXPECT_EQ(energy.SequencedOutputRequired(2), energy.TotalOutputRequired); EXPECT_EQ(energy.SequencedOutputRequired(3), energy.TotalOutputRequired); @@ -975,7 +976,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad) // Sequential Test 2 - Heating, FirstHVACIteration = false firstHVACIteration = false; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration, true); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration, true); EXPECT_EQ(energy.SequencedOutputRequired(1), energy.TotalOutputRequired); EXPECT_EQ(energy.SequencedOutputRequired(2), energy.TotalOutputRequired); EXPECT_EQ(energy.SequencedOutputRequired(3), energy.TotalOutputRequired); @@ -995,7 +996,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad) energy.OutputRequiredToHeatingSP = -1000.0; energy.OutputRequiredToCoolingSP = -2000.0; firstHVACIteration = true; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration, true); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration, true); EXPECT_EQ(energy.SequencedOutputRequired(1), energy.TotalOutputRequired); EXPECT_EQ(energy.SequencedOutputRequired(2), energy.TotalOutputRequired); EXPECT_EQ(energy.SequencedOutputRequired(3), energy.TotalOutputRequired); @@ -1008,7 +1009,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad) // Sequential Test 4 - Cooling, FirstHVACIteration = false firstHVACIteration = false; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration, true); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration, true); EXPECT_EQ(energy.SequencedOutputRequired(1), energy.TotalOutputRequired); EXPECT_EQ(energy.SequencedOutputRequired(2), energy.TotalOutputRequired); EXPECT_EQ(energy.SequencedOutputRequired(3), energy.TotalOutputRequired); @@ -1111,9 +1112,9 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformLoad) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); - AllocateHeatBalArrays(state); - GetZoneEquipmentData1(state); + GetZoneData(*state, ErrorsFound); + AllocateHeatBalArrays(*state); + GetZoneEquipmentData1(*state); ZoneEquipInputsFilled = true; int ZoneNum = 1; DataZoneEnergyDemands::CurDeadBandOrSetback.allocate(1); @@ -1136,8 +1137,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformLoad) energy.OutputRequiredToHeatingSP = 1000.0; energy.OutputRequiredToCoolingSP = 2000.0; bool firstHVACIteration = true; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), energy.TotalOutputRequired / 3.0); EXPECT_EQ(energy.SequencedOutputRequired(2), energy.TotalOutputRequired / 3.0); EXPECT_EQ(energy.SequencedOutputRequired(3), energy.TotalOutputRequired / 3.0); @@ -1154,8 +1155,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformLoad) // UniformLoad Test 2 - Heating, FirstHVACIteration = false firstHVACIteration = false; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), energy.TotalOutputRequired / 3.0); EXPECT_EQ(energy.SequencedOutputRequired(2), energy.TotalOutputRequired / 3.0); EXPECT_EQ(energy.SequencedOutputRequired(3), energy.TotalOutputRequired / 3.0); @@ -1175,8 +1176,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformLoad) energy.OutputRequiredToHeatingSP = -1000.0; energy.OutputRequiredToCoolingSP = -2000.0; firstHVACIteration = true; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), energy.TotalOutputRequired / 2.0); EXPECT_EQ(energy.SequencedOutputRequired(2), energy.TotalOutputRequired / 2.0); EXPECT_EQ(energy.SequencedOutputRequired(3), 0.0); @@ -1193,8 +1194,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformLoad) // UniformLoad Test 4 - Cooling, FirstHVACIteration = false, only 2 pieces of equipment are active for cooling firstHVACIteration = false; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), energy.TotalOutputRequired / 2.0); EXPECT_EQ(energy.SequencedOutputRequired(2), energy.TotalOutputRequired / 2.0); EXPECT_EQ(energy.SequencedOutputRequired(3), 0.0); @@ -1297,9 +1298,9 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformPLR) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); - AllocateHeatBalArrays(state); - GetZoneEquipmentData1(state); + GetZoneData(*state, ErrorsFound); + AllocateHeatBalArrays(*state); + GetZoneEquipmentData1(*state); ZoneEquipInputsFilled = true; int ZoneNum = 1; DataZoneEnergyDemands::CurDeadBandOrSetback.allocate(1); @@ -1339,8 +1340,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformPLR) energy.OutputRequiredToHeatingSP = 1000.0; energy.OutputRequiredToCoolingSP = 2000.0; bool firstHVACIteration = true; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), DataSizing::FinalZoneSizing(ZoneNum).DesHeatLoad); EXPECT_EQ(energy.SequencedOutputRequired(2), DataSizing::FinalZoneSizing(ZoneNum).DesHeatLoad); EXPECT_EQ(energy.SequencedOutputRequired(3), DataSizing::FinalZoneSizing(ZoneNum).DesHeatLoad); @@ -1352,7 +1353,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformPLR) EXPECT_EQ(energy.SequencedOutputRequiredToCoolingSP(3), DataSizing::FinalZoneSizing(ZoneNum).DesHeatLoad); // Check sequenced load processing for unitary systems // EquipIndex doesn't get set until the units are simulated, so hard-wire them here - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); DataZoneEquipment::ZoneEquipList(1).EquipIndex(1) = 1; DataZoneEquipment::ZoneEquipList(1).EquipIndex(2) = 2; DataZoneEquipment::ZoneEquipList(1).EquipIndex(3) = 3; @@ -1375,8 +1376,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformPLR) // UniformPLR Test 2 - Heating, FirstHVACIteration = false firstHVACIteration = false; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), thisZEqList.HeatingCapacity(1) * plr); EXPECT_EQ(energy.SequencedOutputRequired(2), thisZEqList.HeatingCapacity(2) * plr); EXPECT_EQ(energy.SequencedOutputRequired(3), thisZEqList.HeatingCapacity(3) * plr); @@ -1397,8 +1398,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformPLR) energy.OutputRequiredToHeatingSP = -1000.0; energy.OutputRequiredToCoolingSP = -2000.0; firstHVACIteration = true; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), -DataSizing::FinalZoneSizing(ZoneNum).DesCoolLoad); EXPECT_EQ(energy.SequencedOutputRequired(2), -DataSizing::FinalZoneSizing(ZoneNum).DesCoolLoad); EXPECT_EQ(energy.SequencedOutputRequired(3), -DataSizing::FinalZoneSizing(ZoneNum).DesCoolLoad); @@ -1411,8 +1412,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeUniformPLR) // UniformPLR Test 4 - Cooling, FirstHVACIteration = false, only 2 pieces of equipment are active for cooling firstHVACIteration = false; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), thisZEqList.CoolingCapacity(1) * plr); EXPECT_EQ(energy.SequencedOutputRequired(2), thisZEqList.CoolingCapacity(2) * plr); EXPECT_EQ(energy.SequencedOutputRequired(3), 0.0); @@ -1515,9 +1516,9 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); - AllocateHeatBalArrays(state); - GetZoneEquipmentData1(state); + GetZoneData(*state, ErrorsFound); + AllocateHeatBalArrays(*state); + GetZoneEquipmentData1(*state); ZoneEquipInputsFilled = true; int ZoneNum = 1; DataZoneEnergyDemands::CurDeadBandOrSetback.allocate(1); @@ -1557,8 +1558,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) energy.OutputRequiredToHeatingSP = 1000.0; energy.OutputRequiredToCoolingSP = 2000.0; bool firstHVACIteration = true; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), DataSizing::FinalZoneSizing(ZoneNum).DesHeatLoad); EXPECT_EQ(energy.SequencedOutputRequired(2), DataSizing::FinalZoneSizing(ZoneNum).DesHeatLoad); EXPECT_EQ(energy.SequencedOutputRequired(3), DataSizing::FinalZoneSizing(ZoneNum).DesHeatLoad); @@ -1570,7 +1571,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) EXPECT_EQ(energy.SequencedOutputRequiredToCoolingSP(3), DataSizing::FinalZoneSizing(ZoneNum).DesHeatLoad); // Check sequenced load processing for unitary systems // EquipIndex doesn't get set until the units are simulated, so hard-wire them here - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); DataZoneEquipment::ZoneEquipList(1).EquipIndex(1) = 1; DataZoneEquipment::ZoneEquipList(1).EquipIndex(2) = 2; DataZoneEquipment::ZoneEquipList(1).EquipIndex(3) = 3; @@ -1597,8 +1598,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) plr = energy.TotalOutputRequired / thisZEqList.HeatingCapacity(1); energy.OutputRequiredToHeatingSP = 1000.0; energy.OutputRequiredToCoolingSP = 2000.0; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), thisZEqList.HeatingCapacity(1) * plr); EXPECT_EQ(energy.SequencedOutputRequired(2), 0.0); EXPECT_EQ(energy.SequencedOutputRequired(3), 0.0); @@ -1619,8 +1620,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) plr = energy.TotalOutputRequired / (thisZEqList.HeatingCapacity(1) + thisZEqList.HeatingCapacity(2)); energy.OutputRequiredToHeatingSP = 2100.0; energy.OutputRequiredToCoolingSP = 2200.0; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), thisZEqList.HeatingCapacity(1) * plr); EXPECT_EQ(energy.SequencedOutputRequired(2), thisZEqList.HeatingCapacity(2) * plr); EXPECT_EQ(energy.SequencedOutputRequired(3), 0.0); @@ -1641,8 +1642,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) plr = energy.TotalOutputRequired / (thisZEqList.HeatingCapacity(1) + thisZEqList.HeatingCapacity(2) + thisZEqList.HeatingCapacity(3)); energy.OutputRequiredToHeatingSP = 3600.0; energy.OutputRequiredToCoolingSP = 3800.0; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), thisZEqList.HeatingCapacity(1) * plr); EXPECT_EQ(energy.SequencedOutputRequired(2), thisZEqList.HeatingCapacity(2) * plr); EXPECT_EQ(energy.SequencedOutputRequired(3), thisZEqList.HeatingCapacity(3) * plr); @@ -1663,8 +1664,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) energy.OutputRequiredToHeatingSP = -1000.0; energy.OutputRequiredToCoolingSP = -2000.0; firstHVACIteration = true; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), -DataSizing::FinalZoneSizing(ZoneNum).DesCoolLoad); EXPECT_EQ(energy.SequencedOutputRequired(2), -DataSizing::FinalZoneSizing(ZoneNum).DesCoolLoad); EXPECT_EQ(energy.SequencedOutputRequired(3), -DataSizing::FinalZoneSizing(ZoneNum).DesCoolLoad); @@ -1681,8 +1682,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) plr = energy.TotalOutputRequired / (thisZEqList.CoolingCapacity(1)); energy.OutputRequiredToHeatingSP = -1000.0; energy.OutputRequiredToCoolingSP = -1200.0; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), thisZEqList.CoolingCapacity(1) * plr); EXPECT_EQ(energy.SequencedOutputRequired(2), 0.0); EXPECT_EQ(energy.SequencedOutputRequired(3), 0.0); @@ -1703,8 +1704,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) plr = energy.TotalOutputRequired / (thisZEqList.CoolingCapacity(1) + thisZEqList.CoolingCapacity(2)); energy.OutputRequiredToHeatingSP = -1500.0; energy.OutputRequiredToCoolingSP = -1600.0; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), thisZEqList.CoolingCapacity(1) * plr); EXPECT_EQ(energy.SequencedOutputRequired(2), thisZEqList.CoolingCapacity(2) * plr); EXPECT_EQ(energy.SequencedOutputRequired(3), 0.0); @@ -1726,8 +1727,8 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialUniformPLR) plr = energy.TotalOutputRequired / (thisZEqList.CoolingCapacity(1) + thisZEqList.CoolingCapacity(2)); energy.OutputRequiredToHeatingSP = -2500.0; energy.OutputRequiredToCoolingSP = -2600.0; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); EXPECT_EQ(energy.SequencedOutputRequired(1), thisZEqList.CoolingCapacity(1) * plr); EXPECT_EQ(energy.SequencedOutputRequired(2), thisZEqList.CoolingCapacity(2) * plr); EXPECT_EQ(energy.SequencedOutputRequired(3), 0.0); @@ -1841,9 +1842,9 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); - AllocateHeatBalArrays(state); - GetZoneEquipmentData1(state); + GetZoneData(*state, ErrorsFound); + AllocateHeatBalArrays(*state); + GetZoneEquipmentData1(*state); ZoneEquipInputsFilled = true; int ZoneNum = 1; DataZoneEnergyDemands::CurDeadBandOrSetback.allocate(1); @@ -1864,14 +1865,14 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu DataZoneEnergyDemands::ZoneSysMoistureDemand(1).SequencedOutputRequiredToHumidSP.allocate(NumEquip); DataZoneEnergyDemands::ZoneSysMoistureDemand(1).SequencedOutputRequiredToDehumidSP.allocate(NumEquip); auto &energy(DataZoneEnergyDemands::ZoneSysEnergyDemand(ZoneNum)); - state.dataZoneEquipmentManager->PrioritySimOrder.allocate(NumEquip); + state->dataZoneEquipmentManager->PrioritySimOrder.allocate(NumEquip); // Sequential Test 1 - Heating, FirstHVACIteration = true energy.TotalOutputRequired = 1000.0; energy.OutputRequiredToHeatingSP = 1000.0; energy.OutputRequiredToCoolingSP = 2000.0; bool firstHVACIteration = true; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration, true); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration, true); EXPECT_EQ(energy.SequencedOutputRequired(1), energy.TotalOutputRequired); EXPECT_EQ(energy.SequencedOutputRequired(2), energy.TotalOutputRequired); EXPECT_EQ(energy.SequencedOutputRequired(3), energy.TotalOutputRequired); @@ -1887,7 +1888,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu // Check sequenced load processing for unitary systems // EquipIndex doesn't get set until the units are simulated, so hard-wire them here - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); DataZoneEquipment::ZoneEquipList(1).EquipIndex(1) = 1; DataZoneEquipment::ZoneEquipList(1).EquipIndex(2) = 1; DataZoneEquipment::ZoneEquipList(1).EquipIndex(3) = 2; @@ -1911,14 +1912,14 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu // Sequential Test 2 - Heating, FirstHVACIteration = false firstHVACIteration = false; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration); - SetZoneEquipSimOrder(state, ZoneNum, ZoneNum); - DistributeSystemOutputRequired(state, ZoneNum, firstHVACIteration); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration); + SetZoneEquipSimOrder(*state, ZoneNum, ZoneNum); + DistributeSystemOutputRequired(*state, ZoneNum, firstHVACIteration); // Equipment 1 provides 100W of heating Real64 SysOutputProvided = 100.0; Real64 LatOutputProvided = 0.0; int EquipNum = 1; - UpdateSystemOutputRequired(state, ZoneNum, SysOutputProvided, LatOutputProvided, EquipNum); + UpdateSystemOutputRequired(*state, ZoneNum, SysOutputProvided, LatOutputProvided, EquipNum); // Expect next sequenced load #2 to be Total minus SysOutputProvided here, others unchanged Real64 expectedHeatLoad = energy.OutputRequiredToHeatingSP - SysOutputProvided; @@ -2067,9 +2068,9 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu ASSERT_TRUE(process_idf(idf_objects)); EXPECT_FALSE(has_err_output()); bool ErrorsFound = false; - GetZoneData(state, ErrorsFound); - AllocateHeatBalArrays(state); - GetZoneEquipmentData1(state); + GetZoneData(*state, ErrorsFound); + AllocateHeatBalArrays(*state); + GetZoneEquipmentData1(*state); ZoneEquipInputsFilled = true; int ZoneNum = 1; DataZoneEnergyDemands::CurDeadBandOrSetback.allocate(1); @@ -2090,19 +2091,19 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu DataZoneEnergyDemands::ZoneSysMoistureDemand(1).SequencedOutputRequiredToHumidSP.allocate(NumEquip); DataZoneEnergyDemands::ZoneSysMoistureDemand(1).SequencedOutputRequiredToDehumidSP.allocate(NumEquip); auto &energy(DataZoneEnergyDemands::ZoneSysEnergyDemand(ZoneNum)); - state.dataZoneEquipmentManager->PrioritySimOrder.allocate(NumEquip); + state->dataZoneEquipmentManager->PrioritySimOrder.allocate(NumEquip); - ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(state, "AIR TERMINAL 1 ADU COOLING FRACTION")).CurrentValue = 0.3; - ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(state, "AIR TERMINAL 1 ADU HEATING FRACTION")).CurrentValue = 0.4; - ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(state, "IDEAL SYSTEM A COOLING FRACTION")).CurrentValue = 0.5; - ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(state, "IDEAL SYSTEM A HEATING FRACTION")).CurrentValue = 0.6; + ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(*state, "AIR TERMINAL 1 ADU COOLING FRACTION")).CurrentValue = 0.3; + ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(*state, "AIR TERMINAL 1 ADU HEATING FRACTION")).CurrentValue = 0.4; + ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(*state, "IDEAL SYSTEM A COOLING FRACTION")).CurrentValue = 0.5; + ScheduleManager::Schedule(ScheduleManager::GetScheduleIndex(*state, "IDEAL SYSTEM A HEATING FRACTION")).CurrentValue = 0.6; // Sequential Test 1 - Heating, FirstHVACIteration = true energy.TotalOutputRequired = 1000.0; energy.OutputRequiredToHeatingSP = 1000.0; energy.OutputRequiredToCoolingSP = 2000.0; bool firstHVACIteration = true; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration, true); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration, true); EXPECT_EQ(energy.SequencedOutputRequired(1), energy.TotalOutputRequired * 0.4); EXPECT_EQ(energy.SequencedOutputRequired(2), energy.TotalOutputRequired); EXPECT_EQ(energy.SequencedOutputRequired(3), energy.TotalOutputRequired); @@ -2118,7 +2119,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu // Check sequenced load processing for unitary systems // EquipIndex doesn't get set until the units are simulated, so hard-wire them here - ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(state); + ZoneAirLoopEquipmentManager::GetZoneAirLoopEquipment(*state); DataZoneEquipment::ZoneEquipList(1).EquipIndex(1) = 1; DataZoneEquipment::ZoneEquipList(1).EquipIndex(2) = 1; DataZoneEquipment::ZoneEquipList(1).EquipIndex(3) = 2; @@ -2142,12 +2143,12 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_DistributeSequentialLoad_MixedEqu // Sequential Test 2 - Heating, FirstHVACIteration = false firstHVACIteration = false; - InitSystemOutputRequired(state, ZoneNum, firstHVACIteration, true); + InitSystemOutputRequired(*state, ZoneNum, firstHVACIteration, true); // Equipment 1 provides 100W of heating Real64 SysOutputProvided = 100.0; Real64 LatOutputProvided = 0.0; int EquipNum = 1; - UpdateSystemOutputRequired(state, ZoneNum, SysOutputProvided, LatOutputProvided, EquipNum); + UpdateSystemOutputRequired(*state, ZoneNum, SysOutputProvided, LatOutputProvided, EquipNum); // Expect next sequenced load fractions to be applied here on the first and second equipments Real64 expectedHeatLoad = energy.UnadjRemainingOutputReqToHeatSP * 0.6; @@ -2169,14 +2170,14 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_RezeroZoneSizingArrays) { DataEnvironment::TotDesDays = 12; DataEnvironment::TotRunDesPersDays = 3; int totDesDays = DataEnvironment::TotDesDays + DataEnvironment::TotRunDesPersDays; - state.dataGlobal->NumOfZones = 5; - state.dataZoneEquipmentManager->NumOfTimeStepInDay = 4; - DataSizing::ZoneSizing.allocate(totDesDays, state.dataGlobal->NumOfZones); - DataSizing::CalcZoneSizing.allocate(totDesDays, state.dataGlobal->NumOfZones); - DataSizing::FinalZoneSizing.allocate(state.dataGlobal->NumOfZones); - DataSizing::CalcFinalZoneSizing.allocate(state.dataGlobal->NumOfZones); - - for (int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum) { + state->dataGlobal->NumOfZones = 5; + state->dataZoneEquipmentManager->NumOfTimeStepInDay = 4; + DataSizing::ZoneSizing.allocate(totDesDays, state->dataGlobal->NumOfZones); + DataSizing::CalcZoneSizing.allocate(totDesDays, state->dataGlobal->NumOfZones); + DataSizing::FinalZoneSizing.allocate(state->dataGlobal->NumOfZones); + DataSizing::CalcFinalZoneSizing.allocate(state->dataGlobal->NumOfZones); + + for (int CtrlZoneNum = 1; CtrlZoneNum <= state->dataGlobal->NumOfZones; ++CtrlZoneNum) { for (int DesDayNum = 1; DesDayNum <= DataEnvironment::TotDesDays + DataEnvironment::TotRunDesPersDays; ++DesDayNum) { auto &thisSizingType(DataSizing::ZoneSizing(DesDayNum, CtrlZoneNum)); thisSizingType.ZoneName = "test"; @@ -2315,36 +2316,36 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_RezeroZoneSizingArrays) { thisSizingType.DOASSupHumRat = 1.0; thisSizingType.DOASTotCoolLoad = 1.0; - thisSizingType.DOASHeatLoadSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.DOASCoolLoadSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.DOASHeatAddSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.DOASLatAddSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.DOASSupMassFlowSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.DOASSupTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.DOASSupHumRatSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.DOASTotCoolLoadSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.HeatFlowSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.HeatFlowSeqNoOA.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.CoolFlowSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.CoolFlowSeqNoOA.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.HeatLoadSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.CoolLoadSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.HeatZoneTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.HeatOutTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.HeatZoneRetTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.HeatTstatTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.DesHeatSetPtSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.CoolZoneTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.CoolOutTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.CoolZoneRetTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.CoolTstatTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.DesCoolSetPtSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.HeatZoneHumRatSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.CoolZoneHumRatSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.HeatOutHumRatSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType.CoolOutHumRatSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - - for (int TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) { + thisSizingType.DOASHeatLoadSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.DOASCoolLoadSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.DOASHeatAddSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.DOASLatAddSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.DOASSupMassFlowSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.DOASSupTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.DOASSupHumRatSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.DOASTotCoolLoadSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.HeatFlowSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.HeatFlowSeqNoOA.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.CoolFlowSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.CoolFlowSeqNoOA.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.HeatLoadSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.CoolLoadSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.HeatZoneTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.HeatOutTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.HeatZoneRetTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.HeatTstatTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.DesHeatSetPtSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.CoolZoneTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.CoolOutTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.CoolZoneRetTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.CoolTstatTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.DesCoolSetPtSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.HeatZoneHumRatSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.CoolZoneHumRatSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.HeatOutHumRatSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType.CoolOutHumRatSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + + for (int TimeStepIndex = 1; TimeStepIndex <= state->dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex) { thisSizingType.DOASHeatLoadSeq(TimeStepIndex) = 1.0; thisSizingType.DOASCoolLoadSeq(TimeStepIndex) = 1.0; thisSizingType.DOASHeatAddSeq(TimeStepIndex) = 1.0; @@ -2512,36 +2513,36 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_RezeroZoneSizingArrays) { thisSizingType2.DOASSupHumRat = 1.0; thisSizingType2.DOASTotCoolLoad = 1.0; - thisSizingType2.DOASHeatLoadSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.DOASCoolLoadSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.DOASHeatAddSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.DOASLatAddSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.DOASSupMassFlowSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.DOASSupTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.DOASSupHumRatSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.DOASTotCoolLoadSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.HeatFlowSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.HeatFlowSeqNoOA.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.CoolFlowSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.CoolFlowSeqNoOA.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.HeatLoadSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.CoolLoadSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.HeatZoneTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.HeatOutTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.HeatZoneRetTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.HeatTstatTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.DesHeatSetPtSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.CoolZoneTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.CoolOutTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.CoolZoneRetTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.CoolTstatTempSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.DesCoolSetPtSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.HeatZoneHumRatSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.CoolZoneHumRatSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.HeatOutHumRatSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - thisSizingType2.CoolOutHumRatSeq.allocate(state.dataZoneEquipmentManager->NumOfTimeStepInDay); - - for ( int TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex ) { + thisSizingType2.DOASHeatLoadSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.DOASCoolLoadSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.DOASHeatAddSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.DOASLatAddSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.DOASSupMassFlowSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.DOASSupTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.DOASSupHumRatSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.DOASTotCoolLoadSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.HeatFlowSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.HeatFlowSeqNoOA.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.CoolFlowSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.CoolFlowSeqNoOA.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.HeatLoadSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.CoolLoadSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.HeatZoneTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.HeatOutTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.HeatZoneRetTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.HeatTstatTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.DesHeatSetPtSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.CoolZoneTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.CoolOutTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.CoolZoneRetTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.CoolTstatTempSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.DesCoolSetPtSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.HeatZoneHumRatSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.CoolZoneHumRatSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.HeatOutHumRatSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + thisSizingType2.CoolOutHumRatSeq.allocate(state->dataZoneEquipmentManager->NumOfTimeStepInDay); + + for ( int TimeStepIndex = 1; TimeStepIndex <= state->dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex ) { thisSizingType2.DOASHeatLoadSeq(TimeStepIndex) = 1.0; thisSizingType2.DOASCoolLoadSeq(TimeStepIndex) = 1.0; thisSizingType2.DOASHeatAddSeq(TimeStepIndex) = 1.0; @@ -2574,9 +2575,9 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_RezeroZoneSizingArrays) { } } - ZoneEquipmentManager::RezeroZoneSizingArrays(state); + ZoneEquipmentManager::RezeroZoneSizingArrays(*state); - for ( int CtrlZoneNum = 1; CtrlZoneNum <= state.dataGlobal->NumOfZones; ++CtrlZoneNum ) { + for ( int CtrlZoneNum = 1; CtrlZoneNum <= state->dataGlobal->NumOfZones; ++CtrlZoneNum ) { for ( int DesDayNum = 1; DesDayNum <= DataEnvironment::TotDesDays + DataEnvironment::TotRunDesPersDays; ++DesDayNum ) { auto &thisSizingType(DataSizing::ZoneSizing(DesDayNum, CtrlZoneNum)); //EXPECT_EQ(thisSizingType.ZoneName, ""); @@ -2715,7 +2716,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_RezeroZoneSizingArrays) { EXPECT_EQ(thisSizingType.DOASSupHumRat, 0.0); EXPECT_EQ(thisSizingType.DOASTotCoolLoad, 0.0); - for ( int TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex ) { + for ( int TimeStepIndex = 1; TimeStepIndex <= state->dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex ) { EXPECT_EQ(thisSizingType.DOASHeatLoadSeq(TimeStepIndex), 0.0); EXPECT_EQ(thisSizingType.DOASCoolLoadSeq(TimeStepIndex), 0.0); EXPECT_EQ(thisSizingType.DOASHeatAddSeq(TimeStepIndex), 0.0); @@ -2883,7 +2884,7 @@ TEST_F(EnergyPlusFixture, ZoneEquipmentManager_RezeroZoneSizingArrays) { EXPECT_EQ(thisSizingType2.DOASSupHumRat, 0.0); EXPECT_EQ(thisSizingType2.DOASTotCoolLoad, 0.0); - for ( int TimeStepIndex = 1; TimeStepIndex <= state.dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex ) { + for ( int TimeStepIndex = 1; TimeStepIndex <= state->dataZoneEquipmentManager->NumOfTimeStepInDay; ++TimeStepIndex ) { EXPECT_EQ(thisSizingType2.DOASHeatLoadSeq(TimeStepIndex), 0.0); EXPECT_EQ(thisSizingType2.DOASCoolLoadSeq(TimeStepIndex), 0.0); EXPECT_EQ(thisSizingType2.DOASHeatAddSeq(TimeStepIndex), 0.0); diff --git a/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc b/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc index ae5a0c22365..ed8b1abc007 100644 --- a/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc +++ b/tst/EnergyPlus/unit/ZoneHVACEvaporativeCooler.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include "Fixtures/EnergyPlusFixture.hh" #include #include @@ -86,17 +87,17 @@ class ZoneHVACEvapCoolerUnitTest : public EnergyPlusFixture DataSizing::ZoneEqSizing.allocate(1); DataEnvironment::OutBaroPress = 101325.0; - DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(state, DataEnvironment::OutBaroPress, 20.0, 0.0); + DataEnvironment::StdRhoAir = Psychrometrics::PsyRhoAirFnPbTdbW(*state, DataEnvironment::OutBaroPress, 20.0, 0.0); DataEnvironment::OutDryBulbTemp = 20.0; DataEnvironment::OutHumRat = 0.0075; DataEnvironment::OutWetBulbTemp = - Psychrometrics::PsyTwbFnTdbWPb(state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat, DataEnvironment::OutBaroPress); + Psychrometrics::PsyTwbFnTdbWPb(*state, DataEnvironment::OutDryBulbTemp, DataEnvironment::OutHumRat, DataEnvironment::OutBaroPress); - state.dataGlobal->NumOfZones = 1; - DataHeatBalance::Zone.allocate(state.dataGlobal->NumOfZones); - DataZoneEquipment::ZoneEquipConfig.allocate(state.dataGlobal->NumOfZones); - DataZoneEquipment::ZoneEquipList.allocate(state.dataGlobal->NumOfZones); + state->dataGlobal->NumOfZones = 1; + DataHeatBalance::Zone.allocate(state->dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipConfig.allocate(state->dataGlobal->NumOfZones); + DataZoneEquipment::ZoneEquipList.allocate(state->dataGlobal->NumOfZones); DataLoopNode::Node.allocate(NumOfNodes); DataZoneEnergyDemands::ZoneSysEnergyDemand.allocate(1); DataHeatBalFanSys::ZoneThermostatSetPointHi.allocate(1); @@ -195,17 +196,17 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, DirectCelDekPad_CyclingUnit_Sim) }); ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(state); + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; - Fans::GetFanInput(state); + Fans::GetFanInput(*state); ASSERT_FALSE(ErrorsFound); - EvaporativeCoolers::GetEvapInput(state); + EvaporativeCoolers::GetEvapInput(*state); ASSERT_FALSE(ErrorsFound); - EvaporativeCoolers::GetInputZoneEvaporativeCoolerUnit(state); + EvaporativeCoolers::GetInputZoneEvaporativeCoolerUnit(*state); ASSERT_FALSE(ErrorsFound); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataZoneEquipment::ZoneEquipInputsFilled = true; auto &thisZoneEvapCooler(ZoneEvapUnit(UnitNum)); @@ -233,37 +234,37 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, DirectCelDekPad_CyclingUnit_Sim) // Evap Cooler Unit Control Method = Zone Temperature Dead Band OnOff Cycling EXPECT_EQ(thisZoneEvapCooler.OpMode, DataHVACGlobals::CycFanCycCoil); EXPECT_EQ(thisZoneEvapCooler.ControlSchemeType, ZoneTemperatureDeadBandOnOffCycling); - EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); + EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(*state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); Real64 FullSensibleOutput = 0.0; Real64 FullLatentOutput = 0.0; Real64 PartLoadRatio = 1.0; - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); EXPECT_NEAR(FullSensibleOutput, SensOutputProvided, 0.01); EXPECT_NEAR(FullSensibleOutput, -thisZoneEvapCooler.UnitSensibleCoolingRate, 0.01); // test the unit at half of the full flow capacity Real64 HalfOfFullLoad = 0.50 * FullSensibleOutput; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = HalfOfFullLoad; // calculate part load ratio for cycling fan - EvaporativeCoolers::ControlZoneEvapUnitOutput(state, UnitNum, HalfOfFullLoad); + EvaporativeCoolers::ControlZoneEvapUnitOutput(*state, UnitNum, HalfOfFullLoad); EXPECT_NEAR(0.4747010, thisZoneEvapCooler.UnitPartLoadRatio, 0.000001); - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); EXPECT_NEAR(HalfOfFullLoad, SensOutputProvided, 0.01); // Evap Cooler Unit Control Method = Zone Cooling Load OnOff Cycling thisZoneEvapCooler.ControlSchemeType = ZoneCoolingLoadOnOffCycling; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -15000.0; - EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); + EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(*state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); PartLoadRatio = 1.0; - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); EXPECT_NEAR(FullSensibleOutput, SensOutputProvided, 0.01); EXPECT_NEAR(FullSensibleOutput, -thisZoneEvapCooler.UnitSensibleCoolingRate, 0.01); // test the unit at half of the full flow capacity HalfOfFullLoad = 0.50 * FullSensibleOutput; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = HalfOfFullLoad; // calculate part load ratio for cycling fan - EvaporativeCoolers::ControlZoneEvapUnitOutput(state, UnitNum, HalfOfFullLoad); + EvaporativeCoolers::ControlZoneEvapUnitOutput(*state, UnitNum, HalfOfFullLoad); EXPECT_NEAR(0.4747010, thisZoneEvapCooler.UnitPartLoadRatio, 0.000001); - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); EXPECT_NEAR(HalfOfFullLoad, SensOutputProvided, 0.01); } @@ -319,17 +320,17 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, DirectResearchSpecial_CyclingUnit_Sim) }); ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(state); + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; - Fans::GetFanInput(state); + Fans::GetFanInput(*state); ASSERT_FALSE(ErrorsFound); - EvaporativeCoolers::GetEvapInput(state); + EvaporativeCoolers::GetEvapInput(*state); ASSERT_FALSE(ErrorsFound); - EvaporativeCoolers::GetInputZoneEvaporativeCoolerUnit(state); + EvaporativeCoolers::GetInputZoneEvaporativeCoolerUnit(*state); ASSERT_FALSE(ErrorsFound); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataZoneEquipment::ZoneEquipInputsFilled = true; auto &thisZoneEvapCooler(ZoneEvapUnit(UnitNum)); @@ -356,37 +357,37 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, DirectResearchSpecial_CyclingUnit_Sim) // Evap Cooler Unit Control Method = Zone Temperature Dead Band OnOff Cycling EXPECT_EQ(thisZoneEvapCooler.OpMode, DataHVACGlobals::CycFanCycCoil); EXPECT_EQ(thisZoneEvapCooler.ControlSchemeType, ZoneTemperatureDeadBandOnOffCycling); - EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); + EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(*state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); Real64 FullSensibleOutput = 0.0; Real64 FullLatentOutput = 0.0; Real64 PartLoadRatio = 1.0; - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); EXPECT_NEAR(FullSensibleOutput, SensOutputProvided, 0.01); EXPECT_NEAR(FullSensibleOutput, -thisZoneEvapCooler.UnitSensibleCoolingRate, 0.01); // test the unit at half of the full flow capacity Real64 HalfOfFullLoad = 0.50 * FullSensibleOutput; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = HalfOfFullLoad; // calculate part load ratio for cycling fan - EvaporativeCoolers::ControlZoneEvapUnitOutput(state, UnitNum, HalfOfFullLoad); + EvaporativeCoolers::ControlZoneEvapUnitOutput(*state, UnitNum, HalfOfFullLoad); EXPECT_NEAR(0.500000, thisZoneEvapCooler.UnitPartLoadRatio, 0.000001); - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); EXPECT_NEAR(HalfOfFullLoad, SensOutputProvided, 0.01); // Evap Cooler Unit Control Method = Zone Cooling Load OnOff Cycling thisZoneEvapCooler.ControlSchemeType = ZoneCoolingLoadOnOffCycling; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -15000.0; - EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); + EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(*state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); PartLoadRatio = 1.0; - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); EXPECT_NEAR(FullSensibleOutput, SensOutputProvided, 0.01); EXPECT_NEAR(FullSensibleOutput, -thisZoneEvapCooler.UnitSensibleCoolingRate, 0.01); // test the unit at half of the full flow capacity HalfOfFullLoad = 0.50 * FullSensibleOutput; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = HalfOfFullLoad; // calculate part load ratio for cycling fan - EvaporativeCoolers::ControlZoneEvapUnitOutput(state, UnitNum, HalfOfFullLoad); + EvaporativeCoolers::ControlZoneEvapUnitOutput(*state, UnitNum, HalfOfFullLoad); EXPECT_NEAR(0.500000, thisZoneEvapCooler.UnitPartLoadRatio, 0.000001); - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); EXPECT_NEAR(HalfOfFullLoad, SensOutputProvided, 0.01); } @@ -448,19 +449,19 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, IndirectWetCoil_CyclingUnit_Sim) }); ASSERT_TRUE(process_idf(idf_objects)); - ScheduleManager::ProcessScheduleInput(state); + ScheduleManager::ProcessScheduleInput(*state); ScheduleManager::ScheduleInputProcessed = true; - Fans::GetFanInput(state); + Fans::GetFanInput(*state); ASSERT_FALSE(ErrorsFound); - EvaporativeCoolers::GetEvapInput(state); + EvaporativeCoolers::GetEvapInput(*state); ASSERT_FALSE(ErrorsFound); - EvaporativeCoolers::GetInputZoneEvaporativeCoolerUnit(state); + EvaporativeCoolers::GetInputZoneEvaporativeCoolerUnit(*state); ASSERT_FALSE(ErrorsFound); - OutAirNodeManager::SetOutAirNodes(state); + OutAirNodeManager::SetOutAirNodes(*state); - state.dataGlobal->BeginEnvrnFlag = true; + state->dataGlobal->BeginEnvrnFlag = true; DataZoneEquipment::ZoneEquipInputsFilled = true; auto &thisZoneEvapCooler(ZoneEvapUnit(UnitNum)); @@ -493,36 +494,36 @@ TEST_F(ZoneHVACEvapCoolerUnitTest, IndirectWetCoil_CyclingUnit_Sim) // Evap Cooler Unit Control Method = Zone Temperature Dead Band OnOff Cycling EXPECT_EQ(thisZoneEvapCooler.OpMode, DataHVACGlobals::CycFanCycCoil); EXPECT_EQ(thisZoneEvapCooler.ControlSchemeType, ZoneTemperatureDeadBandOnOffCycling); - EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); + EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(*state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); Real64 FullSensibleOutput = 0.0; Real64 FullLatentOutput = 0.0; Real64 PartLoadRatio = 1.0; - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); EXPECT_NEAR(FullSensibleOutput, SensOutputProvided, 0.01); EXPECT_NEAR(FullSensibleOutput, -thisZoneEvapCooler.UnitSensibleCoolingRate, 0.01); // test the unit at half of the full flow capacity Real64 HalfOfFullLoad = 0.50 * FullSensibleOutput; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = HalfOfFullLoad; // calculate part load ratio for cycling fan - EvaporativeCoolers::ControlZoneEvapUnitOutput(state, UnitNum, HalfOfFullLoad); + EvaporativeCoolers::ControlZoneEvapUnitOutput(*state, UnitNum, HalfOfFullLoad); EXPECT_NEAR(0.500000, thisZoneEvapCooler.UnitPartLoadRatio, 0.000001); - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); EXPECT_NEAR(HalfOfFullLoad, SensOutputProvided, 0.01); // Evap Cooler Unit Control Method = Zone Cooling Load OnOff Cycling thisZoneEvapCooler.ControlSchemeType = ZoneCoolingLoadOnOffCycling; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = -15000.0; - EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); + EvaporativeCoolers::SimZoneEvaporativeCoolerUnit(*state, thisZoneEvapCooler.Name, ActualZoneNum, SensOutputProvided, LatOutputProvided, ZoneEquipIndex); PartLoadRatio = 1.0; - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, PartLoadRatio, FullSensibleOutput, FullLatentOutput); EXPECT_NEAR(FullSensibleOutput, SensOutputProvided, 0.01); EXPECT_NEAR(FullSensibleOutput, -thisZoneEvapCooler.UnitSensibleCoolingRate, 0.01); // test the unit at half of the full flow capacity HalfOfFullLoad = 0.50 * FullSensibleOutput; DataZoneEnergyDemands::ZoneSysEnergyDemand(1).RemainingOutputReqToCoolSP = HalfOfFullLoad; // calculate part load ratio for cycling fan - EvaporativeCoolers::ControlZoneEvapUnitOutput(state, UnitNum, HalfOfFullLoad); + EvaporativeCoolers::ControlZoneEvapUnitOutput(*state, UnitNum, HalfOfFullLoad); EXPECT_NEAR(0.500000, thisZoneEvapCooler.UnitPartLoadRatio, 0.000001); - EvaporativeCoolers::CalcZoneEvapUnitOutput(state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); + EvaporativeCoolers::CalcZoneEvapUnitOutput(*state, UnitNum, thisZoneEvapCooler.UnitPartLoadRatio, SensOutputProvided, LatOutputProvided); EXPECT_NEAR(HalfOfFullLoad, SensOutputProvided, 0.01); } diff --git a/tst/EnergyPlus/unit/ZonePlenum.unit.cc b/tst/EnergyPlus/unit/ZonePlenum.unit.cc index d1789a22ce3..0a06c49b8fa 100644 --- a/tst/EnergyPlus/unit/ZonePlenum.unit.cc +++ b/tst/EnergyPlus/unit/ZonePlenum.unit.cc @@ -51,6 +51,7 @@ #include // EnergyPlus Headers +#include #include #include #include @@ -66,98 +67,98 @@ using DataContaminantBalance::Contaminant; TEST_F(EnergyPlusFixture, ZonePlenum_InitAirZoneReturnPlenumTest) { - state.dataGlobal->BeginEnvrnFlag = false; + state->dataGlobal->BeginEnvrnFlag = false; Contaminant.CO2Simulation = true; Contaminant.GenericContamSimulation = true; - state.dataZonePlenum->NumZoneReturnPlenums = 1; - state.dataZonePlenum->ZoneRetPlenCond.allocate(state.dataZonePlenum->NumZoneReturnPlenums); + state->dataZonePlenum->NumZoneReturnPlenums = 1; + state->dataZonePlenum->ZoneRetPlenCond.allocate(state->dataZonePlenum->NumZoneReturnPlenums); int ZonePlenumNum = 1; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInletNodes = 0; // To avoid initializing extra zone equip config and ADU data - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes = 2; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InletNode.allocate(1); // Needed for the Update routine - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode.allocate(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRate.allocate(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMaxAvail.allocate(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMinAvail.allocate(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedTemp.allocate(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedHumRat.allocate(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedEnthalpy.allocate(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedPressure.allocate(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedCO2.allocate(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedGenContam.allocate(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InletNode(1) = 1; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRate = 0.0; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMaxAvail = 0.0; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMinAvail = 0.0; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedTemp = 0.0; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedHumRat = 0.0; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedEnthalpy = 0.0; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedPressure = 0.0; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedCO2 = 0.0; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedGenContam = 0.0; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInletNodes = 0; // To avoid initializing extra zone equip config and ADU data + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes = 2; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InletNode.allocate(1); // Needed for the Update routine + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode.allocate(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRate.allocate(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMaxAvail.allocate(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMinAvail.allocate(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedTemp.allocate(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedHumRat.allocate(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedEnthalpy.allocate(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedPressure.allocate(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedCO2.allocate(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedGenContam.allocate(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InletNode(1) = 1; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRate = 0.0; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMaxAvail = 0.0; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMinAvail = 0.0; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedTemp = 0.0; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedHumRat = 0.0; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedEnthalpy = 0.0; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedPressure = 0.0; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedCO2 = 0.0; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedGenContam = 0.0; Node.allocate(4); // One node per plenum plus total of NumInducedNodes for all plenums) int ZoneNodeNum = 1; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneNodeNum = ZoneNodeNum; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneNodeNum = ZoneNodeNum; Node(ZoneNodeNum).Temp = 24.2; Node(ZoneNodeNum).HumRat = 0.0003; Node(ZoneNodeNum).Enthalpy = 40000.0; Node(ZoneNodeNum).Press = 99000.0; Node(ZoneNodeNum).CO2 = 950.0; Node(ZoneNodeNum).GenContam = 100.0; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletPressure = 99000.0; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletPressure = 99000.0; int InducedNodeIndex = 1; int InducedNodeNum = 2; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode(InducedNodeIndex) = InducedNodeNum; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode(InducedNodeIndex) = InducedNodeNum; Node(InducedNodeNum).MassFlowRate = 0.20; Node(InducedNodeNum).MassFlowRateMaxAvail = 0.25; Node(InducedNodeNum).MassFlowRateMinAvail = 0.10; InducedNodeIndex = 2; InducedNodeNum = 3; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode(InducedNodeIndex) = InducedNodeNum; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode(InducedNodeIndex) = InducedNodeNum; Node(InducedNodeNum).MassFlowRate = 0.40; Node(InducedNodeNum).MassFlowRateMaxAvail = 0.50; Node(InducedNodeNum).MassFlowRateMinAvail = 0.22; - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletNode = 4; + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletNode = 4; - InitAirZoneReturnPlenum(state, ZonePlenumNum); - UpdateAirZoneReturnPlenum(state, ZonePlenumNum); + InitAirZoneReturnPlenum(*state, ZonePlenumNum); + UpdateAirZoneReturnPlenum(*state, ZonePlenumNum); - EXPECT_EQ(Node(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneNodeNum).CO2, Node(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletNode).CO2); - EXPECT_EQ(Node(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneNodeNum).CO2, Node(state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletNode).CO2); + EXPECT_EQ(Node(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneNodeNum).CO2, Node(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletNode).CO2); + EXPECT_EQ(Node(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneNodeNum).CO2, Node(state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).OutletNode).CO2); - for (InducedNodeIndex = 1; InducedNodeIndex <= state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes; ++InducedNodeIndex) { - InducedNodeNum = state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode(InducedNodeIndex); - EXPECT_EQ(Node(InducedNodeNum).MassFlowRate, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRate(InducedNodeIndex)); - EXPECT_EQ(Node(InducedNodeNum).MassFlowRateMaxAvail, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMaxAvail(InducedNodeIndex)); - EXPECT_EQ(Node(InducedNodeNum).MassFlowRateMinAvail, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMinAvail(InducedNodeIndex)); - EXPECT_EQ(Node(ZoneNodeNum).Temp, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedTemp(InducedNodeIndex)); - EXPECT_EQ(Node(ZoneNodeNum).HumRat, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedHumRat(InducedNodeIndex)); - EXPECT_EQ(Node(ZoneNodeNum).Enthalpy, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedEnthalpy(InducedNodeIndex)); - EXPECT_EQ(Node(ZoneNodeNum).Press, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedPressure(InducedNodeIndex)); - EXPECT_EQ(Node(ZoneNodeNum).CO2, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedCO2(InducedNodeIndex)); - EXPECT_EQ(Node(ZoneNodeNum).GenContam, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedGenContam(InducedNodeIndex)); - EXPECT_EQ(Node(ZoneNodeNum).Temp, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneTemp); - EXPECT_EQ(Node(ZoneNodeNum).HumRat, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneHumRat); - EXPECT_EQ(Node(ZoneNodeNum).Enthalpy, state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneEnthalpy); + for (InducedNodeIndex = 1; InducedNodeIndex <= state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).NumInducedNodes; ++InducedNodeIndex) { + InducedNodeNum = state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode(InducedNodeIndex); + EXPECT_EQ(Node(InducedNodeNum).MassFlowRate, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRate(InducedNodeIndex)); + EXPECT_EQ(Node(InducedNodeNum).MassFlowRateMaxAvail, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMaxAvail(InducedNodeIndex)); + EXPECT_EQ(Node(InducedNodeNum).MassFlowRateMinAvail, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMinAvail(InducedNodeIndex)); + EXPECT_EQ(Node(ZoneNodeNum).Temp, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedTemp(InducedNodeIndex)); + EXPECT_EQ(Node(ZoneNodeNum).HumRat, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedHumRat(InducedNodeIndex)); + EXPECT_EQ(Node(ZoneNodeNum).Enthalpy, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedEnthalpy(InducedNodeIndex)); + EXPECT_EQ(Node(ZoneNodeNum).Press, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedPressure(InducedNodeIndex)); + EXPECT_EQ(Node(ZoneNodeNum).CO2, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedCO2(InducedNodeIndex)); + EXPECT_EQ(Node(ZoneNodeNum).GenContam, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedGenContam(InducedNodeIndex)); + EXPECT_EQ(Node(ZoneNodeNum).Temp, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneTemp); + EXPECT_EQ(Node(ZoneNodeNum).HumRat, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneHumRat); + EXPECT_EQ(Node(ZoneNodeNum).Enthalpy, state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).ZoneEnthalpy); } // Deallocate everything - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InletNode.deallocate(); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode.deallocate(); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRate.deallocate(); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMaxAvail.deallocate(); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMinAvail.deallocate(); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedTemp.deallocate(); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedHumRat.deallocate(); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedEnthalpy.deallocate(); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedPressure.deallocate(); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedCO2.deallocate(); - state.dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedGenContam.deallocate(); - state.dataZonePlenum->ZoneRetPlenCond.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InletNode.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedNode.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRate.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMaxAvail.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedMassFlowRateMinAvail.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedTemp.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedHumRat.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedEnthalpy.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedPressure.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedCO2.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond(ZonePlenumNum).InducedGenContam.deallocate(); + state->dataZonePlenum->ZoneRetPlenCond.deallocate(); Node.deallocate(); } diff --git a/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc b/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc index 80b7ca0c581..51c97523cca 100644 --- a/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc +++ b/tst/EnergyPlus/unit/ZoneTempPredictorCorrector.unit.cc @@ -53,6 +53,7 @@ #include "Fixtures/EnergyPlusFixture.hh" // EnergyPlus Headers +#include #include #include #include @@ -147,8 +148,8 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) Zone(1).SurfaceLast = 2; Surface.allocate(2); - state.dataZonePlenum->NumZoneReturnPlenums = 0; - state.dataZonePlenum->NumZoneSupplyPlenums = 0; + state->dataZonePlenum->NumZoneReturnPlenums = 0; + state->dataZonePlenum->NumZoneSupplyPlenums = 0; OAMFL.allocate(1); VAMFL.allocate(1); @@ -197,7 +198,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) // HybridModel HybridModelZone(1).PeopleCountCalc_H = false; - CorrectZoneHumRat(state, 1); + CorrectZoneHumRat(*state, 1); EXPECT_NEAR(0.008, Node(5).HumRat, 0.00001); // Case 2 - Unbalanced exhaust flow @@ -224,7 +225,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) MixingMassFlowZone(1) = 0.0; MDotOA(1) = 0.0; - CorrectZoneHumRat(state, 1); + CorrectZoneHumRat(*state, 1); EXPECT_NEAR(0.008, Node(5).HumRat, 0.00001); // Case 3 - Balanced exhaust flow with proper source flow from mixing @@ -251,7 +252,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) MixingMassFlowZone(1) = 0.02; MDotOA(1) = 0.0; - CorrectZoneHumRat(state, 1); + CorrectZoneHumRat(*state, 1); EXPECT_NEAR(0.008, Node(5).HumRat, 0.00001); // Case 4 - Balanced exhaust flow without source flow from mixing @@ -278,16 +279,16 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CorrectZoneHumRatTest) MixingMassFlowZone(1) = 0.0; MDotOA(1) = 0.0; - CorrectZoneHumRat(state, 1); + CorrectZoneHumRat(*state, 1); EXPECT_NEAR(0.008, Node(5).HumRat, 0.00001); // Add a section to check #6119 by L. Gu on 5/16/17 - CorrectZoneHumRat(state, 1); + CorrectZoneHumRat(*state, 1); EXPECT_NEAR(0.008, Node(5).HumRat, 0.00001); // Issue 6233 Zone(1).IsControlled = true; - CorrectZoneHumRat(state, 1); + CorrectZoneHumRat(*state, 1); EXPECT_NEAR(0.008, Node(5).HumRat, 0.00001); } @@ -469,7 +470,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) ASSERT_TRUE(process_idf(idf_objects)); bool ErrorsFound(false); // If errors detected in input - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); int HeatZoneNum(1); @@ -477,25 +478,25 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) int CoolHeatZoneNum(3); int DualZoneNum(4); - state.dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized - state.dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized - ProcessScheduleInput(state); // read schedules + state->dataGlobal->NumOfTimeStepInHour = 1; // must initialize this to get schedules initialized + state->dataGlobal->MinutesPerTimeStep = 60; // must initialize this to get schedules initialized + ProcessScheduleInput(*state); // read schedules - GetZoneAirSetPoints(state); + GetZoneAirSetPoints(*state); DeadBandOrSetback.allocate(NumTempControlledZones); CurDeadBandOrSetback.allocate(NumTempControlledZones); TempControlType.allocate(NumTempControlledZones); ZoneSysEnergyDemand.allocate(NumTempControlledZones); TempZoneThermostatSetPoint.allocate(NumTempControlledZones); - state.dataZoneTempPredictorCorrector->ZoneSetPointLast.allocate(NumTempControlledZones); + state->dataZoneTempPredictorCorrector->ZoneSetPointLast.allocate(NumTempControlledZones); Setback.allocate(NumTempControlledZones); ZoneThermostatSetPointLo.allocate(NumTempControlledZones); ZoneThermostatSetPointHi.allocate(NumTempControlledZones); - state.dataZoneTempPredictorCorrector->TempDepZnLd.allocate(NumTempControlledZones); - state.dataZoneTempPredictorCorrector->TempIndZnLd.allocate(NumTempControlledZones); - state.dataZoneTempPredictorCorrector->TempDepZnLd = 0.0; - state.dataZoneTempPredictorCorrector->TempIndZnLd = 0.0; + state->dataZoneTempPredictorCorrector->TempDepZnLd.allocate(NumTempControlledZones); + state->dataZoneTempPredictorCorrector->TempIndZnLd.allocate(NumTempControlledZones); + state->dataZoneTempPredictorCorrector->TempDepZnLd = 0.0; + state->dataZoneTempPredictorCorrector->TempIndZnLd = 0.0; SNLoadPredictedRate.allocate(NumTempControlledZones); LoadCorrectionFactor.allocate(NumTempControlledZones); @@ -519,8 +520,8 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) Schedule(TempControlledZone(DualZoneNum).CTSchedIndex).CurrentValue = 0; // simulate no thermostat or non-controlled zone ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired = 0.0; // no load and no thermostat since control type is set to 0 above - CalcZoneAirTempSetPoints(state); - CalcPredictedSystemLoad(state, DualZoneNum, 1.0); + CalcZoneAirTempSetPoints(*state); + CalcPredictedSystemLoad(*state, DualZoneNum, 1.0); EXPECT_EQ(0.0, TempZoneThermostatSetPoint(DualZoneNum)); // Set point initialized to 0 and never set since thermostat control type = 0 @@ -532,14 +533,14 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) // LoadToHeatingSetPoint = ( TempDepZnLd( ZoneNum ) * ( TempZoneThermostatSetPoint( ZoneNum ) ) - TempIndZnLd( ZoneNum ) ); // LoadToCoolingSetPoint = ( TempDepZnLd( ZoneNum ) * ( TempZoneThermostatSetPoint( ZoneNum ) ) - TempIndZnLd( ZoneNum ) ); int SetPointTempSchedIndex = - state.dataZoneTempPredictorCorrector->SetPointSingleHeating(TempControlledZone(HeatZoneNum).ControlTypeSchIndx(TempControlledZone(HeatZoneNum).SchIndx_SingleHeatSetPoint)) + state->dataZoneTempPredictorCorrector->SetPointSingleHeating(TempControlledZone(HeatZoneNum).ControlTypeSchIndx(TempControlledZone(HeatZoneNum).SchIndx_SingleHeatSetPoint)) .TempSchedIndex; Schedule(SetPointTempSchedIndex).CurrentValue = 20.0; ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired = -1000.0; // cooling load - state.dataZoneTempPredictorCorrector->TempDepZnLd(HeatZoneNum) = ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneTempPredictorCorrector->TempDepZnLd(HeatZoneNum) = ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; - CalcZoneAirTempSetPoints(state); - CalcPredictedSystemLoad(state, HeatZoneNum, 1.0); + CalcZoneAirTempSetPoints(*state); + CalcPredictedSystemLoad(*state, HeatZoneNum, 1.0); EXPECT_EQ(20.0, TempZoneThermostatSetPoint(HeatZoneNum)); EXPECT_EQ(-1000.0, @@ -547,54 +548,54 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) EXPECT_TRUE(CurDeadBandOrSetback(HeatZoneNum)); // Tstat should show there is no load on a single heating SP SetPointTempSchedIndex = - state.dataZoneTempPredictorCorrector->SetPointSingleHeating(TempControlledZone(HeatZoneNum).ControlTypeSchIndx(TempControlledZone(HeatZoneNum).SchIndx_SingleHeatSetPoint)) + state->dataZoneTempPredictorCorrector->SetPointSingleHeating(TempControlledZone(HeatZoneNum).ControlTypeSchIndx(TempControlledZone(HeatZoneNum).SchIndx_SingleHeatSetPoint)) .TempSchedIndex; Schedule(SetPointTempSchedIndex).CurrentValue = 21.0; ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired = 1000.0; // heating load - state.dataZoneTempPredictorCorrector->TempDepZnLd(HeatZoneNum) = ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneTempPredictorCorrector->TempDepZnLd(HeatZoneNum) = ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; SetPointTempSchedIndex = - state.dataZoneTempPredictorCorrector->SetPointSingleCooling(TempControlledZone(CoolZoneNum).ControlTypeSchIndx(TempControlledZone(CoolZoneNum).SchIndx_SingleCoolSetPoint)) + state->dataZoneTempPredictorCorrector->SetPointSingleCooling(TempControlledZone(CoolZoneNum).ControlTypeSchIndx(TempControlledZone(CoolZoneNum).SchIndx_SingleCoolSetPoint)) .TempSchedIndex; Schedule(SetPointTempSchedIndex).CurrentValue = 23.0; ZoneSysEnergyDemand(CoolZoneNum).TotalOutputRequired = -3000.0; // cooling load - state.dataZoneTempPredictorCorrector->TempDepZnLd(CoolZoneNum) = ZoneSysEnergyDemand(CoolZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneTempPredictorCorrector->TempDepZnLd(CoolZoneNum) = ZoneSysEnergyDemand(CoolZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; SetPointTempSchedIndex = - state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool( + state->dataZoneTempPredictorCorrector->SetPointSingleHeatCool( TempControlledZone(CoolHeatZoneNum).ControlTypeSchIndx(TempControlledZone(CoolHeatZoneNum).SchIndx_SingleHeatCoolSetPoint)) .TempSchedIndex; Schedule(SetPointTempSchedIndex).CurrentValue = 22.0; ZoneSysEnergyDemand(CoolHeatZoneNum).TotalOutputRequired = -4000.0; // cooling load - state.dataZoneTempPredictorCorrector->TempDepZnLd(CoolHeatZoneNum) = ZoneSysEnergyDemand(CoolHeatZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneTempPredictorCorrector->TempDepZnLd(CoolHeatZoneNum) = ZoneSysEnergyDemand(CoolHeatZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; SetPointTempSchedIndex = - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(TempControlledZone(DualZoneNum).ControlTypeSchIndx(TempControlledZone(DualZoneNum).SchIndx_DualSetPointWDeadBand)) + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(TempControlledZone(DualZoneNum).ControlTypeSchIndx(TempControlledZone(DualZoneNum).SchIndx_DualSetPointWDeadBand)) .CoolTempSchedIndex; Schedule(SetPointTempSchedIndex).CurrentValue = 24.0; SetPointTempSchedIndex = - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(TempControlledZone(DualZoneNum).ControlTypeSchIndx(TempControlledZone(DualZoneNum).SchIndx_DualSetPointWDeadBand)) + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(TempControlledZone(DualZoneNum).ControlTypeSchIndx(TempControlledZone(DualZoneNum).SchIndx_DualSetPointWDeadBand)) .HeatTempSchedIndex; Schedule(SetPointTempSchedIndex).CurrentValue = 20.0; ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired = 2500.0; // heating load - state.dataZoneTempPredictorCorrector->TempDepZnLd(DualZoneNum) = ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneTempPredictorCorrector->TempDepZnLd(DualZoneNum) = ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; - CalcZoneAirTempSetPoints(state); - CalcPredictedSystemLoad(state, HeatZoneNum, 1.0); + CalcZoneAirTempSetPoints(*state); + CalcPredictedSystemLoad(*state, HeatZoneNum, 1.0); EXPECT_EQ(21.0, TempZoneThermostatSetPoint(HeatZoneNum)); EXPECT_FALSE(CurDeadBandOrSetback(HeatZoneNum)); // Tstat should show there is load on a single heating SP EXPECT_EQ(1000.0, ZoneSysEnergyDemand(HeatZoneNum).TotalOutputRequired); // TotalOutputRequired gets updated in CalcPredictedSystemLoad based on the load - CalcPredictedSystemLoad(state, CoolZoneNum, 1.0); + CalcPredictedSystemLoad(*state, CoolZoneNum, 1.0); EXPECT_EQ(23.0, TempZoneThermostatSetPoint(CoolZoneNum)); EXPECT_FALSE(CurDeadBandOrSetback(CoolZoneNum)); // Tstat should show there is load on a single cooling SP EXPECT_EQ(-3000.0, ZoneSysEnergyDemand(CoolZoneNum).TotalOutputRequired); // TotalOutputRequired gets updated in CalcPredictedSystemLoad based on the load - CalcPredictedSystemLoad(state, CoolHeatZoneNum, 1.0); + CalcPredictedSystemLoad(*state, CoolHeatZoneNum, 1.0); ASSERT_EQ(22.0, TempZoneThermostatSetPoint(CoolHeatZoneNum)); EXPECT_FALSE(CurDeadBandOrSetback(CoolHeatZoneNum)); // Tstat should show there is load on a single heating or cooling SP @@ -602,7 +603,7 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) -4000.0, ZoneSysEnergyDemand(CoolHeatZoneNum).TotalOutputRequired); // TotalOutputRequired gets updated in CalcPredictedSystemLoad based on the load - CalcPredictedSystemLoad(state, DualZoneNum, 1.0); + CalcPredictedSystemLoad(*state, DualZoneNum, 1.0); EXPECT_EQ(20.0, TempZoneThermostatSetPoint(DualZoneNum)); EXPECT_FALSE(CurDeadBandOrSetback(DualZoneNum)); // Tstat should show there is load on a dual SP @@ -610,16 +611,16 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_ReportingTest) ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired); // TotalOutputRequired gets updated in CalcPredictedSystemLoad based on the load SetPointTempSchedIndex = - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(TempControlledZone(DualZoneNum).ControlTypeSchIndx(TempControlledZone(DualZoneNum).SchIndx_DualSetPointWDeadBand)) + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(TempControlledZone(DualZoneNum).ControlTypeSchIndx(TempControlledZone(DualZoneNum).SchIndx_DualSetPointWDeadBand)) .CoolTempSchedIndex; Schedule(SetPointTempSchedIndex).CurrentValue = 25.0; ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired = 1000.0; // LoadToCoolingSetPoint = ( TempDepZnLd( ZoneNum ) * ( TempZoneThermostatSetPoint( ZoneNum ) ) - TempIndZnLd( ZoneNum ) ); - state.dataZoneTempPredictorCorrector->TempDepZnLd(DualZoneNum) = ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; - state.dataZoneTempPredictorCorrector->TempIndZnLd(DualZoneNum) = 3500.0; // results in a cooling load + state->dataZoneTempPredictorCorrector->TempDepZnLd(DualZoneNum) = ZoneSysEnergyDemand(DualZoneNum).TotalOutputRequired / Schedule(SetPointTempSchedIndex).CurrentValue; + state->dataZoneTempPredictorCorrector->TempIndZnLd(DualZoneNum) = 3500.0; // results in a cooling load - CalcZoneAirTempSetPoints(state); - CalcPredictedSystemLoad(state, DualZoneNum, 1.0); + CalcZoneAirTempSetPoints(*state); + CalcPredictedSystemLoad(*state, DualZoneNum, 1.0); EXPECT_EQ(25.0, TempZoneThermostatSetPoint(DualZoneNum)); EXPECT_FALSE(CurDeadBandOrSetback(DualZoneNum)); // Tstat should show there is load on a dual SP @@ -824,71 +825,71 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_AdaptiveThermostat) int const CEN15251_CENTRAL(5); DayOfYear = 1; - state.dataWeatherManager->Envrn = 1; - state.dataWeatherManager->Environment.allocate(1); - state.dataWeatherManager->DesDayInput.allocate(1); - state.dataWeatherManager->Environment(state.dataWeatherManager->Envrn).KindOfEnvrn = DataGlobalConstants::KindOfSim::RunPeriodWeather; - state.dataWeatherManager->DesDayInput(state.dataWeatherManager->Envrn).DayType = summerDesignDayTypeIndex; - state.dataWeatherManager->DesDayInput(state.dataWeatherManager->Envrn).MaxDryBulb = 30.0; - state.dataWeatherManager->DesDayInput(state.dataWeatherManager->Envrn).DailyDBRange = 10.0; + state->dataWeatherManager->Envrn = 1; + state->dataWeatherManager->Environment.allocate(1); + state->dataWeatherManager->DesDayInput.allocate(1); + state->dataWeatherManager->Environment(state->dataWeatherManager->Envrn).KindOfEnvrn = DataGlobalConstants::KindOfSim::RunPeriodWeather; + state->dataWeatherManager->DesDayInput(state->dataWeatherManager->Envrn).DayType = summerDesignDayTypeIndex; + state->dataWeatherManager->DesDayInput(state->dataWeatherManager->Envrn).MaxDryBulb = 30.0; + state->dataWeatherManager->DesDayInput(state->dataWeatherManager->Envrn).DailyDBRange = 10.0; Real64 ZoneAirSetPoint = 0.0; bool ErrorsFound(false); // If errors detected in input - GetZoneData(state, ErrorsFound); + GetZoneData(*state, ErrorsFound); ASSERT_FALSE(ErrorsFound); // Tstat should show if there is error in zone processing - ASSERT_FALSE(state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.initialized); // Tstat should show there adaptive model is not initialized + ASSERT_FALSE(state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.initialized); // Tstat should show there adaptive model is not initialized Array1D runningAverageASH_1(365, 0.0); Array1D runningAverageCEN_1(365, 0.0); - CalculateAdaptiveComfortSetPointSchl(state, runningAverageASH_1, runningAverageCEN_1); + CalculateAdaptiveComfortSetPointSchl(*state, runningAverageASH_1, runningAverageCEN_1); // Tstat should show flage that adaptive comfort is not applicable (-1) - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III(DayOfYear)); Array1D runningAverageASH_2(365, 40.0); Array1D runningAverageCEN_2(365, 40.0); - CalculateAdaptiveComfortSetPointSchl(state, runningAverageASH_2, runningAverageCEN_2); + CalculateAdaptiveComfortSetPointSchl(*state, runningAverageASH_2, runningAverageCEN_2); // Tstat should show flage that adaptive comfort is not applicable (-1) - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II(DayOfYear)); - ASSERT_EQ(-1, state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II(DayOfYear)); + ASSERT_EQ(-1, state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III(DayOfYear)); Array1D runningAverageASH(365, 25.0); Array1D runningAverageCEN(365, 25.0); - CalculateAdaptiveComfortSetPointSchl(state, runningAverageASH, runningAverageCEN); - ASSERT_TRUE(state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.initialized); // Tstat should show there adaptive model is initialized + CalculateAdaptiveComfortSetPointSchl(*state, runningAverageASH, runningAverageCEN); + ASSERT_TRUE(state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.initialized); // Tstat should show there adaptive model is initialized ASSERT_EQ( 25.55, - state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(DayOfYear)); // Tstat should show ASH 55 CENTRAL LINE model set point + state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(DayOfYear)); // Tstat should show ASH 55 CENTRAL LINE model set point ASSERT_EQ( 28.05, - state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90(DayOfYear)); // Tstat should show ASH 55 Upper 90 LINE model set point + state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_90(DayOfYear)); // Tstat should show ASH 55 Upper 90 LINE model set point ASSERT_EQ( 29.05, - state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80(DayOfYear)); // Tstat should show ASH 55 Upper 80 LINE model set point + state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Upper_80(DayOfYear)); // Tstat should show ASH 55 Upper 80 LINE model set point ASSERT_EQ(27.05, - state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central( + state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Central( DayOfYear)); // Tstat should show CEN 15251 CENTRAL LINE model set point ASSERT_EQ(29.05, - state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I( + state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_I( DayOfYear)); // Tstat should show CEN 15251 Upper I LINE model set point ASSERT_EQ(30.05, - state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II( + state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_II( DayOfYear)); // Tstat should show CEN 15251 Upper II LINE model set point ASSERT_EQ(31.05, - state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III( + state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveCEN15251_Upper_III( DayOfYear)); // Tstat should show CEN 15251 Upper III LINE model set point - ASSERT_EQ(25.55, state.dataZoneTempPredictorCorrector->AdapComfortSetPointSummerDesDay(1)); // Tstat should show ASH 55 CENTRAL LINE model set point - ASSERT_EQ(27.05, state.dataZoneTempPredictorCorrector->AdapComfortSetPointSummerDesDay(4)); // Tstat should show CEN 15251 CENTRAL LINE model set point + ASSERT_EQ(25.55, state->dataZoneTempPredictorCorrector->AdapComfortSetPointSummerDesDay(1)); // Tstat should show ASH 55 CENTRAL LINE model set point + ASSERT_EQ(27.05, state->dataZoneTempPredictorCorrector->AdapComfortSetPointSummerDesDay(4)); // Tstat should show CEN 15251 CENTRAL LINE model set point TempControlledZone.allocate(ZoneNum); TempControlledZone(CoolZoneASHNum).AdaptiveComfortTempControl = true; @@ -901,20 +902,20 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_AdaptiveThermostat) TempControlledZone(DualZoneNum).AdaptiveComfortModelTypeIndex = ASH55_CENTRAL; ZoneAirSetPoint = 0.0; - AdjustOperativeSetPointsforAdapComfort(state, CoolZoneASHNum, ZoneAirSetPoint); + AdjustOperativeSetPointsforAdapComfort(*state, CoolZoneASHNum, ZoneAirSetPoint); ASSERT_EQ(25.55, ZoneAirSetPoint); // Tstat should show set point overwritten by ASH 55 CENTRAL LINE model ZoneAirSetPoint = 0.0; - AdjustOperativeSetPointsforAdapComfort(state, CoolZoneCENNum, ZoneAirSetPoint); + AdjustOperativeSetPointsforAdapComfort(*state, CoolZoneCENNum, ZoneAirSetPoint); ASSERT_EQ(27.05, ZoneAirSetPoint); // Tstat should show set point overwritten by CEN 15251 CENTRAL LINE model ZoneAirSetPoint = 0.0; - state.dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(DayOfYear) = -1; - AdjustOperativeSetPointsforAdapComfort(state, NoneAdapZoneNum, ZoneAirSetPoint); + state->dataZoneTempPredictorCorrector->AdapComfortDailySetPointSchedule.ThermalComfortAdaptiveASH55_Central(DayOfYear) = -1; + AdjustOperativeSetPointsforAdapComfort(*state, NoneAdapZoneNum, ZoneAirSetPoint); ASSERT_EQ(0, ZoneAirSetPoint); // Tstat should show set point is not overwritten ZoneAirSetPoint = 26.0; - AdjustOperativeSetPointsforAdapComfort(state, DualZoneNum, ZoneAirSetPoint); + AdjustOperativeSetPointsforAdapComfort(*state, DualZoneNum, ZoneAirSetPoint); ASSERT_EQ(26.0, ZoneAirSetPoint); // Tstat should show set point is not overwritten } @@ -1039,28 +1040,28 @@ TEST_F(EnergyPlusFixture, ZoneTempPredictorCorrector_CalcZoneSums_SurfConvection HConvIn(2) = 0.5; HConvIn(3) = 0.5; - state.dataZonePlenum->NumZoneReturnPlenums = 0; - state.dataZonePlenum->NumZoneSupplyPlenums = 0; + state->dataZonePlenum->NumZoneReturnPlenums = 0; + state->dataZonePlenum->NumZoneSupplyPlenums = 0; - CalcZoneSums(state, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT); + CalcZoneSums(*state, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT); EXPECT_EQ(5.0, SumHA); EXPECT_EQ(300.0, SumHATsurf); EXPECT_EQ(150.0, SumHATref); Node(1).MassFlowRate = 0.0; Node(2).MassFlowRate = 0.0; - CalcZoneSums(state, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT); + CalcZoneSums(*state, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT); EXPECT_EQ(10.0, SumHA); EXPECT_EQ(300.0, SumHATsurf); EXPECT_EQ(50.0, SumHATref); Node(1).MassFlowRate = 0.1; Node(2).MassFlowRate = 0.2; - CalcZoneSums(state, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT); + CalcZoneSums(*state, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT); EXPECT_NEAR(302.00968500, SumSysMCp, 0.0001); EXPECT_NEAR(6040.1937, SumSysMCpT,0.0001); - CalcZoneSums(state, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT, false); + CalcZoneSums(*state, ZoneNum, SumIntGain, SumHA, SumHATsurf, SumHATref, SumMCp, SumMCpT, SumSysMCp, SumSysMCpT, false); EXPECT_EQ(0.0, SumSysMCp); EXPECT_EQ(0.0, SumSysMCpT); } @@ -1147,8 +1148,8 @@ TEST_F(EnergyPlusFixture, temperatureAndCountInSch_test) ASSERT_TRUE(process_idf(idf_objects)); - state.dataGlobal->NumOfTimeStepInHour = 4; - state.dataGlobal->MinutesPerTimeStep = 15; + state->dataGlobal->NumOfTimeStepInHour = 4; + state->dataGlobal->MinutesPerTimeStep = 15; DataEnvironment::CurrentYearIsLeapYear = false; Real64 valueAtTime; @@ -1157,52 +1158,52 @@ TEST_F(EnergyPlusFixture, temperatureAndCountInSch_test) const int wednesday = 4; DataEnvironment::Latitude = 30.; // northern hemisphere - int sched1Index = GetScheduleIndex(state, "SCHED1"); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(state, sched1Index, false, wednesday, 11); + int sched1Index = GetScheduleIndex(*state, "SCHED1"); + std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched1Index, false, wednesday, 11); EXPECT_EQ(20, valueAtTime); EXPECT_EQ(365, numDays); EXPECT_EQ("January", monthAssumed); // test month selected based on hemisphere and isSummer flag. - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(state, sched1Index, true, wednesday, 11); + std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched1Index, true, wednesday, 11); EXPECT_EQ("July", monthAssumed); DataEnvironment::Latitude = -30.; // southern hemisphere - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(state, sched1Index, false, wednesday, 11); + std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched1Index, false, wednesday, 11); EXPECT_EQ("July", monthAssumed); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(state, sched1Index, true, wednesday, 11); + std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched1Index, true, wednesday, 11); EXPECT_EQ("January", monthAssumed); DataEnvironment::Latitude = 30.; // northern hemisphere - int sched2Index = GetScheduleIndex(state, "SCHED2"); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(state, sched2Index, false, wednesday, 11); + int sched2Index = GetScheduleIndex(*state, "SCHED2"); + std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched2Index, false, wednesday, 11); EXPECT_EQ(24, valueAtTime); EXPECT_EQ(31, numDays); EXPECT_EQ("January", monthAssumed); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(state, sched2Index, true, wednesday, 11); + std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched2Index, true, wednesday, 11); EXPECT_EQ(26, valueAtTime); EXPECT_EQ(334, numDays); EXPECT_EQ("July", monthAssumed); - int sched3Index = GetScheduleIndex(state, "SCHED3"); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(state, sched3Index, false, wednesday, 11); + int sched3Index = GetScheduleIndex(*state, "SCHED3"); + std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched3Index, false, wednesday, 11); EXPECT_EQ(26, valueAtTime); EXPECT_EQ(365, numDays); EXPECT_EQ("January", monthAssumed); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(state, sched3Index, true, wednesday, 11); + std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched3Index, true, wednesday, 11); EXPECT_EQ(26, valueAtTime); EXPECT_EQ(365, numDays); EXPECT_EQ("July", monthAssumed); - std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(state, sched3Index, false, wednesday, 19); + std::tie(valueAtTime, numDays, monthAssumed) = temperatureAndCountInSch(*state, sched3Index, false, wednesday, 19); EXPECT_EQ(24, valueAtTime); EXPECT_EQ(31, numDays); @@ -1225,11 +1226,11 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) ZoneT1.allocate(1); ZoneSysEnergyDemand.allocate(1); AIRRAT.allocate(1); - state.dataZoneTempPredictorCorrector->TempDepZnLd.allocate(1); - state.dataZoneTempPredictorCorrector->TempIndZnLd.allocate(1); + state->dataZoneTempPredictorCorrector->TempDepZnLd.allocate(1); + state->dataZoneTempPredictorCorrector->TempIndZnLd.allocate(1); DeadBandOrSetback.allocate(1); DataHeatBalance::Zone.allocate(1); - state.dataZoneTempPredictorCorrector->ZoneSetPointLast.allocate(1); + state->dataZoneTempPredictorCorrector->ZoneSetPointLast.allocate(1); DataZoneEnergyDemands::Setback.allocate(1); SNLoadPredictedRate.allocate(1); @@ -1249,25 +1250,25 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) TempControlledZone(1).SchIndx_SingleHeatSetPoint = 2; TempControlledZone(1).ControlTypeSchIndx.allocate(4); TempControlledZone(1).ControlTypeSchIndx(2) = 1; - state.dataZoneTempPredictorCorrector->SetPointSingleHeating.allocate(1); - state.dataZoneTempPredictorCorrector->SetPointSingleHeating(1).TempSchedIndex = 3; + state->dataZoneTempPredictorCorrector->SetPointSingleHeating.allocate(1); + state->dataZoneTempPredictorCorrector->SetPointSingleHeating(1).TempSchedIndex = 3; Schedule(3).CurrentValue = 22.0; AIRRAT(1) = 2000; - state.dataZoneTempPredictorCorrector->TempDepZnLd(1) = 1.0; - state.dataZoneTempPredictorCorrector->TempIndZnLd(1) = 1.0; + state->dataZoneTempPredictorCorrector->TempDepZnLd(1) = 1.0; + state->dataZoneTempPredictorCorrector->TempIndZnLd(1) = 1.0; MAT(1) = 20.0; ZoneT1(1) = MAT(1); - state.dataZoneTempPredictorCorrector->NumOnOffCtrZone = 1; + state->dataZoneTempPredictorCorrector->NumOnOffCtrZone = 1; - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(24.0, ZoneThermostatSetPointLo(1)); MAT(1) = 23.0; ZoneT1(1) = MAT(1); TempControlledZone(1).HeatModeLast = true; - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(22.0, ZoneThermostatSetPointLo(1)); TempControlledZone(1).HeatModeLast = false; @@ -1275,46 +1276,46 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) Schedule(1).CurrentValue = 2; TempControlledZone(1).SchIndx_SingleCoolSetPoint = 2; TempControlledZone(1).ControlTypeSchIndx(2) = 1; - state.dataZoneTempPredictorCorrector->SetPointSingleCooling.allocate(1); - state.dataZoneTempPredictorCorrector->SetPointSingleCooling(1).TempSchedIndex = 3; + state->dataZoneTempPredictorCorrector->SetPointSingleCooling.allocate(1); + state->dataZoneTempPredictorCorrector->SetPointSingleCooling(1).TempSchedIndex = 3; Schedule(3).CurrentValue = 26.0; MAT(1) = 25.0; ZoneT1(1) = MAT(1); TempControlledZone(1).CoolModeLast = true; - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(26.0, ZoneThermostatSetPointHi(1)); TempControlledZone(1).CoolModeLast = false; MAT(1) = 27.0; ZoneT1(1) = MAT(1); - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(24.0, ZoneThermostatSetPointHi(1)); // SingleHeatCoolSetPoint Schedule(1).CurrentValue = 3; TempControlledZone(1).SchIndx_SingleHeatCoolSetPoint = 2; TempControlledZone(1).ControlTypeSchIndx(2) = 1; - state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool.allocate(1); - state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool(1).TempSchedIndex = 3; + state->dataZoneTempPredictorCorrector->SetPointSingleHeatCool.allocate(1); + state->dataZoneTempPredictorCorrector->SetPointSingleHeatCool(1).TempSchedIndex = 3; Schedule(3).CurrentValue = 24.0; MAT(1) = 25.0; ZoneT1(1) = MAT(1); - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(24.0, ZoneThermostatSetPointLo(1)); EXPECT_EQ(24.0, ZoneThermostatSetPointHi(1)); // DualSetPointWithDeadBand : Adjust cooling setpoint - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool.allocate(1); + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool.allocate(1); Schedule(1).CurrentValue = 4; TempControlledZone(1).SchIndx_DualSetPointWDeadBand = 2; TempControlledZone(1).ControlTypeSchIndx(2) = 1; - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).HeatTempSchedIndex = 2; - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).CoolTempSchedIndex = 3; + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).HeatTempSchedIndex = 2; + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).CoolTempSchedIndex = 3; Schedule(2).CurrentValue = 22.0; Schedule(3).CurrentValue = 26.0; MAT(1) = 25.0; @@ -1322,8 +1323,8 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) TempControlledZone(1).CoolModeLast = true; TempControlledZone(1).HeatModeLast = true; - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(22.0, ZoneThermostatSetPointLo(1)); EXPECT_EQ(26.0, ZoneThermostatSetPointHi(1)); TempControlledZone(1).HeatModeLast = false; @@ -1331,8 +1332,8 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) // DualSetPointWithDeadBand : Adjust heating setpoint MAT(1) = 21.0; ZoneT1(1) = MAT(1); - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(24.0, ZoneThermostatSetPointLo(1)); EXPECT_EQ(26.0, ZoneThermostatSetPointHi(1)); @@ -1340,8 +1341,8 @@ TEST_F(EnergyPlusFixture, SetPointWithCutoutDeltaT_test) TempControlledZone(1).CoolModeLast = true; MAT(1) = 27.0; ZoneT1(1) = MAT(1); - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(22.0, ZoneThermostatSetPointLo(1)); EXPECT_EQ(24.0, ZoneThermostatSetPointHi(1)); } @@ -1360,11 +1361,11 @@ TEST_F(EnergyPlusFixture, TempAtPrevTimeStepWithCutoutDeltaT_test) XMPT.allocate(1); ZoneSysEnergyDemand.allocate(1); AIRRAT.allocate(1); - state.dataZoneTempPredictorCorrector->TempDepZnLd.allocate(1); - state.dataZoneTempPredictorCorrector->TempIndZnLd.allocate(1); + state->dataZoneTempPredictorCorrector->TempDepZnLd.allocate(1); + state->dataZoneTempPredictorCorrector->TempIndZnLd.allocate(1); DeadBandOrSetback.allocate(1); DataHeatBalance::Zone.allocate(1); - state.dataZoneTempPredictorCorrector->ZoneSetPointLast.allocate(1); + state->dataZoneTempPredictorCorrector->ZoneSetPointLast.allocate(1); DataZoneEnergyDemands::Setback.allocate(1); SNLoadPredictedRate.allocate(1); @@ -1384,68 +1385,68 @@ TEST_F(EnergyPlusFixture, TempAtPrevTimeStepWithCutoutDeltaT_test) TempControlledZone(1).SchIndx_SingleHeatSetPoint = 2; TempControlledZone(1).ControlTypeSchIndx.allocate(4); TempControlledZone(1).ControlTypeSchIndx(2) = 1; - state.dataZoneTempPredictorCorrector->SetPointSingleHeating.allocate(1); - state.dataZoneTempPredictorCorrector->SetPointSingleHeating(1).TempSchedIndex = 3; + state->dataZoneTempPredictorCorrector->SetPointSingleHeating.allocate(1); + state->dataZoneTempPredictorCorrector->SetPointSingleHeating(1).TempSchedIndex = 3; Schedule(3).CurrentValue = 22.0; AIRRAT(1) = 2000; - state.dataZoneTempPredictorCorrector->TempDepZnLd(1) = 1.0; - state.dataZoneTempPredictorCorrector->TempIndZnLd(1) = 1.0; + state->dataZoneTempPredictorCorrector->TempDepZnLd(1) = 1.0; + state->dataZoneTempPredictorCorrector->TempIndZnLd(1) = 1.0; MAT(1) = 20.0; XMPT(1) = 23.0; - state.dataZoneTempPredictorCorrector->NumOnOffCtrZone = 1; + state->dataZoneTempPredictorCorrector->NumOnOffCtrZone = 1; - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(24.0, ZoneThermostatSetPointLo(1)); TempControlledZone(1).HeatModeLastSave = true; - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, true, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, true, false, 0.01); EXPECT_EQ(22.0, ZoneThermostatSetPointLo(1)); // SingleCoolingSetPoint Schedule(1).CurrentValue = 2; TempControlledZone(1).SchIndx_SingleCoolSetPoint = 2; TempControlledZone(1).ControlTypeSchIndx(2) = 1; - state.dataZoneTempPredictorCorrector->SetPointSingleCooling.allocate(1); - state.dataZoneTempPredictorCorrector->SetPointSingleCooling(1).TempSchedIndex = 3; + state->dataZoneTempPredictorCorrector->SetPointSingleCooling.allocate(1); + state->dataZoneTempPredictorCorrector->SetPointSingleCooling(1).TempSchedIndex = 3; Schedule(3).CurrentValue = 26.0; MAT(1) = 25.0; XMPT(1) = 27; TempControlledZone(1).CoolModeLast = true; - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(26.0, ZoneThermostatSetPointHi(1)); TempControlledZone(1).CoolModeLast = false; TempControlledZone(1).CoolModeLastSave = true; - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, true, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, true, false, 0.01); EXPECT_EQ(24.0, ZoneThermostatSetPointHi(1)); // SingleHeatCoolSetPoint Schedule(1).CurrentValue = 3; TempControlledZone(1).SchIndx_SingleHeatCoolSetPoint = 2; TempControlledZone(1).ControlTypeSchIndx(2) = 1; - state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool.allocate(1); - state.dataZoneTempPredictorCorrector->SetPointSingleHeatCool(1).TempSchedIndex = 3; + state->dataZoneTempPredictorCorrector->SetPointSingleHeatCool.allocate(1); + state->dataZoneTempPredictorCorrector->SetPointSingleHeatCool(1).TempSchedIndex = 3; Schedule(3).CurrentValue = 24.0; MAT(1) = 25.0; XMPT(1) = MAT(1); - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(24.0, ZoneThermostatSetPointLo(1)); EXPECT_EQ(24.0, ZoneThermostatSetPointHi(1)); // DualSetPointWithDeadBand : Adjust cooling setpoint - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool.allocate(1); + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool.allocate(1); Schedule(1).CurrentValue = 4; TempControlledZone(1).SchIndx_DualSetPointWDeadBand = 2; TempControlledZone(1).ControlTypeSchIndx(2) = 1; - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).HeatTempSchedIndex = 2; - state.dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).CoolTempSchedIndex = 3; + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).HeatTempSchedIndex = 2; + state->dataZoneTempPredictorCorrector->SetPointDualHeatCool(1).CoolTempSchedIndex = 3; Schedule(2).CurrentValue = 22.0; Schedule(3).CurrentValue = 26.0; MAT(1) = 25.0; @@ -1453,24 +1454,24 @@ TEST_F(EnergyPlusFixture, TempAtPrevTimeStepWithCutoutDeltaT_test) TempControlledZone(1).CoolModeLast = true; TempControlledZone(1).HeatModeLast = true; - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, false, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, false, false, 0.01); EXPECT_EQ(22.0, ZoneThermostatSetPointLo(1)); EXPECT_EQ(26.0, ZoneThermostatSetPointHi(1)); TempControlledZone(1).HeatModeLast = false; // DualSetPointWithDeadBand : Adjust heating setpoint TempControlledZone(1).HeatModeLastSave = true; - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, true, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, true, false, 0.01); EXPECT_EQ(24.0, ZoneThermostatSetPointLo(1)); EXPECT_EQ(26.0, ZoneThermostatSetPointHi(1)); // DualSetPointWithDeadBand : Adjust cooling setpoint TempControlledZone(1).CoolModeLastSave = true; XMPT(1) = 27.0; - CalcZoneAirTempSetPoints(state); - PredictSystemLoads(state, true, false, 0.01); + CalcZoneAirTempSetPoints(*state); + PredictSystemLoads(*state, true, false, 0.01); EXPECT_EQ(22.0, ZoneThermostatSetPointLo(1)); EXPECT_EQ(24.0, ZoneThermostatSetPointHi(1)); } diff --git a/tst/EnergyPlus/unit/api/datatransfer.unit.cc b/tst/EnergyPlus/unit/api/datatransfer.unit.cc index 90a6fd520dd..25fdd2b693f 100644 --- a/tst/EnergyPlus/unit/api/datatransfer.unit.cc +++ b/tst/EnergyPlus/unit/api/datatransfer.unit.cc @@ -69,7 +69,7 @@ using namespace EnergyPlus; class DataExchangeAPIUnitTestFixture : public EnergyPlusFixture { // create a plugin manager instance - EnergyPlus::PluginManagement::PluginManager pluginManager = EnergyPlus::PluginManagement::PluginManager(state); + EnergyPlus::PluginManagement::PluginManager pluginManager = EnergyPlus::PluginManagement::PluginManager(*state); struct DummyRealVariable { @@ -148,8 +148,8 @@ class DataExchangeAPIUnitTestFixture : public EnergyPlusFixture { EnergyPlusFixture::SetUp(); Real64 timeStep = 1.0; - OutputProcessor::SetupTimePointers(state, "Zone", timeStep); - OutputProcessor::SetupTimePointers(state, "HVAC", timeStep); + OutputProcessor::SetupTimePointers(*state, "Zone", timeStep); + OutputProcessor::SetupTimePointers(*state, "HVAC", timeStep); *OutputProcessor::TimeValue.at(OutputProcessor::TimeStepType::TimeStepZone).TimeStep = 60; *OutputProcessor::TimeValue.at(OutputProcessor::TimeStepType::TimeStepSystem).TimeStep = 60; } @@ -176,17 +176,17 @@ class DataExchangeAPIUnitTestFixture : public EnergyPlusFixture void setupVariablesOnceAllAreRequested() { - inputProcessor->preScanReportingVariables(state); + inputProcessor->preScanReportingVariables(*state); for (auto &val : this->realVariablePlaceholders) { if (val.meterType) { - SetupOutputVariable(state, + SetupOutputVariable(*state, val.varName, OutputProcessor::Unit::kg_s, val.value, "Zone", "Sum", val.varKey, _, "ELECTRICITY", "HEATING", _, "System"); } else { - SetupOutputVariable(state, val.varName, OutputProcessor::Unit::kg_s, val.value, "Zone", "Average", val.varKey); + SetupOutputVariable(*state, val.varName, OutputProcessor::Unit::kg_s, val.value, "Zone", "Average", val.varKey); } } for (auto &val : this->intVariablePlaceholders) { - SetupOutputVariable(state, val.varName, OutputProcessor::Unit::kg_s, val.value, "Zone", "Average", val.varKey); + SetupOutputVariable(*state, val.varName, OutputProcessor::Unit::kg_s, val.value, "Zone", "Average", val.varKey); } } @@ -232,7 +232,7 @@ class DataExchangeAPIUnitTestFixture : public EnergyPlusFixture void setupInternalVariablesOnceAllAreRequested() { for (auto &iv : this->internalVarPlaceholders) { - SetupEMSInternalVariable(state, iv.varName, iv.varKey, "kg/s", iv.value); + SetupEMSInternalVariable(*state, iv.varName, iv.varKey, "kg/s", iv.value); } } @@ -244,14 +244,14 @@ class DataExchangeAPIUnitTestFixture : public EnergyPlusFixture void addTrendWithNewGlobal(std::string const &newGlobalVarName, std::string const &trendName, int numTrendValues) { this->pluginManager.addGlobalVariable(newGlobalVarName); - int i = EnergyPlus::PluginManagement::PluginManager::getGlobalVariableHandle(state, newGlobalVarName, true); - EnergyPlus::PluginManagement::trends.emplace_back(state, trendName, numTrendValues, i); + int i = EnergyPlus::PluginManagement::PluginManager::getGlobalVariableHandle(*state, newGlobalVarName, true); + EnergyPlus::PluginManagement::trends.emplace_back(*state, trendName, numTrendValues, i); } void simulateTimeStepAndReport() { - UpdateMeterReporting(state); - UpdateDataandReport(state, OutputProcessor::TimeStepType::TimeStepZone); + UpdateMeterReporting(*state); + UpdateDataandReport(*state, OutputProcessor::TimeStepType::TimeStepZone); } }; @@ -657,12 +657,12 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_Python_EMS_Override) }); ASSERT_TRUE(process_idf(idf_objects)); - OutAirNodeManager::SetOutAirNodes(state); - EMSManager::CheckIfAnyEMS(state); + OutAirNodeManager::SetOutAirNodes(*state); + EMSManager::CheckIfAnyEMS(*state); EMSManager::FinishProcessingUserInput = true; bool anyRan; // Calls SetupNodeSetpointsAsActuator (via InitEMS, which calls GetEMSInput too) - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyRan); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyRan); EXPECT_GT(EnergyPlus::DataRuntimeLanguage::numEMSActuatorsAvailable, 0); EXPECT_EQ(1, DataRuntimeLanguage::numActuatorsUsed); @@ -702,12 +702,12 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_Python_Python_Override) }); ASSERT_TRUE(process_idf(idf_objects)); - OutAirNodeManager::SetOutAirNodes(state); - EMSManager::CheckIfAnyEMS(state); + OutAirNodeManager::SetOutAirNodes(*state); + EMSManager::CheckIfAnyEMS(*state); EMSManager::FinishProcessingUserInput = true; bool anyRan; // Calls SetupNodeSetpointsAsActuator (via InitEMS, which calls GetEMSInput too) - EMSManager::ManageEMS(state, EMSManager::EMSCallFrom::SetupSimulation, anyRan); + EMSManager::ManageEMS(*state, EMSManager::EMSCallFrom::SetupSimulation, anyRan); EXPECT_GT(EnergyPlus::DataRuntimeLanguage::numEMSActuatorsAvailable, 0); EXPECT_EQ(0, DataRuntimeLanguage::numActuatorsUsed); From eadf80df6fc0047efd2113e3cd1229e66cce603e Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Wed, 18 Nov 2020 22:04:11 -0600 Subject: [PATCH 2/5] Add missing solar reflection clear_state call, fix state address passing in api unit tests --- src/EnergyPlus/Data/EnergyPlusData.cc | 1 + tst/EnergyPlus/unit/api/datatransfer.unit.cc | 237 +++++++++---------- 2 files changed, 119 insertions(+), 119 deletions(-) diff --git a/src/EnergyPlus/Data/EnergyPlusData.cc b/src/EnergyPlus/Data/EnergyPlusData.cc index ce33d609ddf..b992c6ebcea 100644 --- a/src/EnergyPlus/Data/EnergyPlusData.cc +++ b/src/EnergyPlus/Data/EnergyPlusData.cc @@ -159,6 +159,7 @@ namespace EnergyPlus { this->dataPipes->clear_state(); this->dataPlantChillers->clear_state(); this->dataSolarCollectors->clear_state(); + this->dataSolarReflectionManager->clear_state(); this->dataSolarShading->clear_state(); this->dataSplitterComponent->clear_state(); this->dataSteamBaseboardRadiator->clear_state(); diff --git a/tst/EnergyPlus/unit/api/datatransfer.unit.cc b/tst/EnergyPlus/unit/api/datatransfer.unit.cc index 25fdd2b693f..4313754a6cf 100644 --- a/tst/EnergyPlus/unit/api/datatransfer.unit.cc +++ b/tst/EnergyPlus/unit/api/datatransfer.unit.cc @@ -61,7 +61,7 @@ #include #include #include - +#include #include "../Fixtures/EnergyPlusFixture.hh" using namespace EnergyPlus; @@ -165,13 +165,13 @@ class DataExchangeAPIUnitTestFixture : public EnergyPlusFixture void preRequestRealVariable(std::string const &varName, std::string const &key, Real64 initialValue = 0.0, bool meterType = false) { this->realVariablePlaceholders.emplace_back(varName, key, initialValue, meterType); - requestVariable((void*)&this->state, varName.c_str(), key.c_str()); + requestVariable((void*)this->state, varName.c_str(), key.c_str()); } void preRequestIntegerVariable(std::string const &varName, std::string const &key, int initialValue = 0) { this->intVariablePlaceholders.emplace_back(varName, key, initialValue); - requestVariable((void*)&this->state, varName.c_str(), key.c_str()); + requestVariable((void*)this->state, varName.c_str(), key.c_str()); } void setupVariablesOnceAllAreRequested() @@ -262,7 +262,7 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestListAllDataInCSV) ASSERT_TRUE(process_idf(idf_objects, false)); // this had to be here or I was getting a strange segfault during a JSON string dtor // first off, the function should return, even if there isn't anything meaningful in it (it will have headers) - char * charCsvDataEmpty = listAllAPIDataCSV((void*)&this->state); + char * charCsvDataEmpty = listAllAPIDataCSV((void*)this->state); std::string strCsvDataEmpty = std::string(charCsvDataEmpty); free(charCsvDataEmpty); // free the char* @@ -276,7 +276,7 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestListAllDataInCSV) this->setupInternalVariablesOnceAllAreRequested(); this->addPluginGlobal("Plugin_Global_Var_Name"); this->addTrendWithNewGlobal("NewGlobalVarHere", "Trend 1", 3); - char * charCsvDataFull = listAllAPIDataCSV((void*)&this->state); + char * charCsvDataFull = listAllAPIDataCSV((void*)this->state); std::string csvData = std::string(charCsvDataFull); free(charCsvDataFull); // free the char* std::size_t foundAddedBoiler = csvData.find("BOILER 1") != std::string::npos; // Note output variables only keep UC, so we should check UC here @@ -297,7 +297,7 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestListAllDataInCSV) TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestApiDataFullyReady) { // basically, the data should not be ready at the beginning of a unit test -- ever, so just check that for now - EXPECT_EQ(1, apiDataFullyReady((void*)&this->state)); // 1 is false + EXPECT_EQ(1, apiDataFullyReady((void*)this->state)); // 1 is false } TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetVariableHandlesRealTypes) @@ -305,8 +305,8 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetVariableHandlesRealTy this->preRequestRealVariable("Chiller Heat Transfer", "Chiller 1"); this->preRequestRealVariable("Zone Mean Temperature", "Zone 1"); this->setupVariablesOnceAllAreRequested(); - int hChillerHT = getVariableHandle((void*)&this->state, "Chiller Heat Transfer", "Chiller 1"); - int hZoneTemp = getVariableHandle((void*)&this->state, "Zone Mean Temperature", "Zone 1"); + int hChillerHT = getVariableHandle((void*)this->state, "Chiller Heat Transfer", "Chiller 1"); + int hZoneTemp = getVariableHandle((void*)this->state, "Zone Mean Temperature", "Zone 1"); EXPECT_GT(hChillerHT, -1); EXPECT_GT(hZoneTemp, -1); } @@ -316,8 +316,8 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetVariableHandlesIntege this->preRequestIntegerVariable("Chiller Operating Mode", "Chiller 1"); this->preRequestIntegerVariable("Chiller Operating Mode", "Chiller 2"); this->setupVariablesOnceAllAreRequested(); - int hChillerMode1 = getVariableHandle((void*)&this->state, "Chiller Operating Mode", "Chiller 1"); - int hChillerMode2 = getVariableHandle((void*)&this->state, "Chiller Operating Mode", "Chiller 2"); + int hChillerMode1 = getVariableHandle((void*)this->state, "Chiller Operating Mode", "Chiller 1"); + int hChillerMode2 = getVariableHandle((void*)this->state, "Chiller Operating Mode", "Chiller 2"); EXPECT_GT(hChillerMode1, -1); EXPECT_GT(hChillerMode2, -1); } @@ -330,15 +330,15 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetVariableHandlesMixedT this->preRequestIntegerVariable("Chiller Operating Mode", "Chiller 1"); this->setupVariablesOnceAllAreRequested(); // Then try to get their handles - int hChillerHT = getVariableHandle((void*)&this->state, "Chiller Heat Transfer", "Chiller 1"); - int hZoneTemp = getVariableHandle((void*)&this->state, "Zone Mean Temperature", "Zone 1"); - int hChillerMode = getVariableHandle((void*)&this->state, "Chiller Operating Mode", "Chiller 1"); + int hChillerHT = getVariableHandle((void*)this->state, "Chiller Heat Transfer", "Chiller 1"); + int hZoneTemp = getVariableHandle((void*)this->state, "Zone Mean Temperature", "Zone 1"); + int hChillerMode = getVariableHandle((void*)this->state, "Chiller Operating Mode", "Chiller 1"); EXPECT_GT(hChillerHT, -1); EXPECT_GT(hZoneTemp, -1); EXPECT_GT(hChillerMode, -1); // now try to get handles to variables that doesn't exist - int hChiller2HT = getVariableHandle((void*)&this->state, "Chiller Heat Transfer", "Chiller 2"); - int hZone2Temp = getVariableHandle((void*)&this->state, "Zone Mean Radiant Temperature", "Zone 1"); + int hChiller2HT = getVariableHandle((void*)this->state, "Chiller Heat Transfer", "Chiller 2"); + int hZone2Temp = getVariableHandle((void*)this->state, "Zone Mean Radiant Temperature", "Zone 1"); EXPECT_EQ(-1, hChiller2HT); EXPECT_EQ(-1, hZone2Temp); } @@ -348,24 +348,24 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetVariableValuesRealTyp this->preRequestRealVariable("Chiller Heat Transfer", "Chiller 1", 3.14); this->preRequestRealVariable("Zone Mean Temperature", "Zone 1", 2.718); this->setupVariablesOnceAllAreRequested(); - int hChillerHT = getVariableHandle((void*)&this->state, "Chiller Heat Transfer", "Chiller 1"); - int hZoneTemp = getVariableHandle((void*)&this->state, "Zone Mean Temperature", "Zone 1"); + int hChillerHT = getVariableHandle((void*)this->state, "Chiller Heat Transfer", "Chiller 1"); + int hZoneTemp = getVariableHandle((void*)this->state, "Zone Mean Temperature", "Zone 1"); // pretend like E+ ran a time step this->simulateTimeStepAndReport(); // get the values for valid handles - Real64 curHeatTransfer = getVariableValue((void*)&this->state, hChillerHT); - Real64 curZoneTemp = getVariableValue((void*)&this->state, hZoneTemp); + Real64 curHeatTransfer = getVariableValue((void*)this->state, hChillerHT); + Real64 curZoneTemp = getVariableValue((void*)this->state, hZoneTemp); EXPECT_NEAR(3.14, curHeatTransfer, 0.0001); EXPECT_NEAR(2.718, curZoneTemp, 0.0001); // now test invalid handles - getVariableValue((void*)&this->state, -1); - EXPECT_EQ(1,apiErrorFlag((void*)&this->state)); - resetErrorFlag((void*)&this->state); - getVariableValue((void*)&this->state, 3); - EXPECT_EQ(1,apiErrorFlag((void*)&this->state)); + getVariableValue((void*)this->state, -1); + EXPECT_EQ(1,apiErrorFlag((void*)this->state)); + resetErrorFlag((void*)this->state); + getVariableValue((void*)this->state, 3); + EXPECT_EQ(1,apiErrorFlag((void*)this->state)); } TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetMeterHandles) @@ -373,10 +373,10 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetMeterHandles) this->preRequestRealVariable("Chiller Electric Energy", "Chiller 1", 3.14, true); this->setupVariablesOnceAllAreRequested(); // Then try to get the meter handle - int hFacilityElectricity = getMeterHandle((void*)&this->state, "Electricity:Facility"); + int hFacilityElectricity = getMeterHandle((void*)this->state, "Electricity:Facility"); EXPECT_GT(hFacilityElectricity, -1); // now try to get handles to meters that doesn't exist - int hDummyMeter = getMeterHandle((void*)&this->state, "EnergySomething"); + int hDummyMeter = getMeterHandle((void*)this->state, "EnergySomething"); EXPECT_EQ(-1, hDummyMeter); } @@ -384,21 +384,21 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetMeterValues) { this->preRequestRealVariable("Chiller Electric Energy", "Chiller 1", 3.14, true); this->setupVariablesOnceAllAreRequested(); - int hFacilityElectricity = getMeterHandle((void*)&this->state, "Electricity:Facility"); + int hFacilityElectricity = getMeterHandle((void*)this->state, "Electricity:Facility"); EXPECT_GT(hFacilityElectricity, -1); // pretend like E+ ran a time step this->simulateTimeStepAndReport(); // get the value for a valid meter - Real64 curFacilityElectricity = getMeterValue((void*)&this->state, hFacilityElectricity); + Real64 curFacilityElectricity = getMeterValue((void*)this->state, hFacilityElectricity); EXPECT_NEAR(3.14, curFacilityElectricity, 0.001); // TODO: Figure out how to get accrued meter value and test that here // test invalid handles - getMeterValue((void*)&this->state, -1); - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); - resetErrorFlag((void*)&this->state); - getMeterValue((void*)&this->state, 5); - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); + getMeterValue((void*)this->state, -1); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); + resetErrorFlag((void*)this->state); + getMeterValue((void*)this->state, 5); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); } TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetRealActuatorHandles) @@ -407,9 +407,9 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetRealActuatorHandles) this->preRequestActuator("Chiller", "Max Flow", "Chiller 2", ActuatorType::REAL); this->setupActuatorsOnceAllAreRequested(); // Then try to get the actuator handle - int hActuator = getActuatorHandle((void*)&this->state, "Chiller", "Max Flow", "Chiller 1"); + int hActuator = getActuatorHandle((void*)this->state, "Chiller", "Max Flow", "Chiller 1"); EXPECT_GT(hActuator, -1); - int hActuator2 = getActuatorHandle((void*)&this->state, "Chiller", "Max Flow", "Chiller 2"); + int hActuator2 = getActuatorHandle((void*)this->state, "Chiller", "Max Flow", "Chiller 2"); EXPECT_GT(hActuator2, -1); EXPECT_NE(hActuator, hActuator2); } @@ -420,9 +420,9 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetIntActuatorHandles) this->preRequestActuator("Chiller", "Max Flow", "Chiller 2", ActuatorType::INTEGER); this->setupActuatorsOnceAllAreRequested(); // Then try to get the actuator handle - int hActuator = getActuatorHandle((void*)&this->state, "Chiller", "Max Flow", "Chiller 1"); + int hActuator = getActuatorHandle((void*)this->state, "Chiller", "Max Flow", "Chiller 1"); EXPECT_GT(hActuator, -1); - int hActuator2 = getActuatorHandle((void*)&this->state, "Chiller", "Max Flow", "Chiller 2"); + int hActuator2 = getActuatorHandle((void*)this->state, "Chiller", "Max Flow", "Chiller 2"); EXPECT_GT(hActuator2, -1); EXPECT_NE(hActuator, hActuator2); } @@ -433,9 +433,9 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetBoolActuatorHandles) this->preRequestActuator("Chiller", "Max Flow", "Chiller 2", ActuatorType::BOOL); this->setupActuatorsOnceAllAreRequested(); // Then try to get the actuator handle - int hActuator = getActuatorHandle((void*)&this->state, "Chiller", "Max Flow", "Chiller 1"); + int hActuator = getActuatorHandle((void*)this->state, "Chiller", "Max Flow", "Chiller 1"); EXPECT_GT(hActuator, -1); - int hActuator2 = getActuatorHandle((void*)&this->state, "Chiller", "Max Flow", "Chiller 2"); + int hActuator2 = getActuatorHandle((void*)this->state, "Chiller", "Max Flow", "Chiller 2"); EXPECT_GT(hActuator2, -1); EXPECT_NE(hActuator, hActuator2); } @@ -447,11 +447,11 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetMixedActuatorHandles) this->preRequestActuator("Chiller", "Max Flow", "Chiller 3", ActuatorType::REAL); this->setupActuatorsOnceAllAreRequested(); // Then try to get the actuator handle - int hActuator = getActuatorHandle((void*)&this->state, "Chiller", "Max Flow", "Chiller 1"); + int hActuator = getActuatorHandle((void*)this->state, "Chiller", "Max Flow", "Chiller 1"); EXPECT_GT(hActuator, -1); - int hActuator2 = getActuatorHandle((void*)&this->state, "Chiller", "Max Flow", "Chiller 2"); + int hActuator2 = getActuatorHandle((void*)this->state, "Chiller", "Max Flow", "Chiller 2"); EXPECT_GT(hActuator2, -1); - int hActuator3 = getActuatorHandle((void*)&this->state, "Chiller", "Max Flow", "Chiller 3"); + int hActuator3 = getActuatorHandle((void*)this->state, "Chiller", "Max Flow", "Chiller 3"); EXPECT_GT(hActuator2, -1); // cross check EXPECT_NE(hActuator, hActuator2); @@ -464,19 +464,19 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetBadActuatorHandles) this->preRequestActuator("Chiller:Electric", "Max Flow Rate", "Chiller 1", ActuatorType::REAL); this->setupActuatorsOnceAllAreRequested(); // Then try to get the actuator handle - int hActuator = getActuatorHandle((void*)&this->state, "Chiller:Electric", "Max Flow Rate", "Chiller 1"); + int hActuator = getActuatorHandle((void*)this->state, "Chiller:Electric", "Max Flow Rate", "Chiller 1"); EXPECT_GT(hActuator, -1); // now try to get handles to invalid actuators { - int hActuatorBad = getActuatorHandle((void*)&this->state, "Chiller:Electric", "Max Flow Rate", "InvalidInstance"); + int hActuatorBad = getActuatorHandle((void*)this->state, "Chiller:Electric", "Max Flow Rate", "InvalidInstance"); EXPECT_EQ(hActuatorBad, -1); } { - int hActuatorBad = getActuatorHandle((void*)&this->state, "Chiller:Electric", "InvalidVar", "Chiller 1"); + int hActuatorBad = getActuatorHandle((void*)this->state, "Chiller:Electric", "InvalidVar", "Chiller 1"); EXPECT_EQ(hActuatorBad, -1); } { - int hActuatorBad = getActuatorHandle((void*)&this->state, "InvalidType", "Max Flow Rate", "Chiller 1"); + int hActuatorBad = getActuatorHandle((void*)this->state, "InvalidType", "Max Flow Rate", "Chiller 1"); EXPECT_EQ(hActuatorBad, -1); } } @@ -488,26 +488,26 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetAndSetRealActuators) this->preRequestActuator("d", "e", "f", ActuatorType::REAL); this->setupActuatorsOnceAllAreRequested(); // Then try to get the actuator handle - int hActuator1 = getActuatorHandle((void*)&this->state, "a", "b", "c"); - int hActuator2 = getActuatorHandle((void*)&this->state, "d", "e", "f"); + int hActuator1 = getActuatorHandle((void*)this->state, "a", "b", "c"); + int hActuator2 = getActuatorHandle((void*)this->state, "d", "e", "f"); // just for good measure here EXPECT_GT(hActuator1, -1); EXPECT_GT(hActuator2, -1); // now let's set the values of the actuators - setActuatorValue((void*)&this->state, hActuator1, 3.14); - setActuatorValue((void*)&this->state, hActuator2, 6.28); + setActuatorValue((void*)this->state, hActuator1, 3.14); + setActuatorValue((void*)this->state, hActuator2, 6.28); // now make sure we don't get them mixed up - Real64 val1 = getActuatorValue((void*)&this->state, hActuator1); - Real64 val2 = getActuatorValue((void*)&this->state, hActuator2); + Real64 val1 = getActuatorValue((void*)this->state, hActuator1); + Real64 val2 = getActuatorValue((void*)this->state, hActuator2); EXPECT_DOUBLE_EQ(3.14, val1); EXPECT_DOUBLE_EQ(6.28, val2); // invalid handles - getActuatorValue((void*)&this->state, -1); - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); - resetErrorFlag((void*)&this->state); - getActuatorValue((void*)&this->state, 3); - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); + getActuatorValue((void*)this->state, -1); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); + resetErrorFlag((void*)this->state); + getActuatorValue((void*)this->state, 3); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); } TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetAndSetIntActuators) @@ -517,27 +517,27 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetAndSetIntActuators) this->preRequestActuator("d", "e", "f", ActuatorType::INTEGER); this->setupActuatorsOnceAllAreRequested(); // Then try to get the actuator handle - int hActuator1 = getActuatorHandle((void*)&this->state, "a", "b", "c"); - int hActuator2 = getActuatorHandle((void*)&this->state, "d", "e", "f"); + int hActuator1 = getActuatorHandle((void*)this->state, "a", "b", "c"); + int hActuator2 = getActuatorHandle((void*)this->state, "d", "e", "f"); // just for good measure here EXPECT_GT(hActuator1, -1); EXPECT_GT(hActuator2, -1); // now let's set the values of the actuators - setActuatorValue((void*)&this->state, hActuator1, 3); - setActuatorValue((void*)&this->state, hActuator2, -6.1); // should get rounded + setActuatorValue((void*)this->state, hActuator1, 3); + setActuatorValue((void*)this->state, hActuator2, -6.1); // should get rounded // now make sure we don't get them mixed up - Real64 val1 = getActuatorValue((void*)&this->state, hActuator1); - Real64 val2 = getActuatorValue((void*)&this->state, hActuator2); + Real64 val1 = getActuatorValue((void*)this->state, hActuator1); + Real64 val2 = getActuatorValue((void*)this->state, hActuator2); EXPECT_DOUBLE_EQ(3, val1); EXPECT_DOUBLE_EQ(-6, val2); // invalid handles - getActuatorValue((void*)&this->state, -1); + getActuatorValue((void*)this->state, -1); // but the flag should be set - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); - resetErrorFlag((void*)&this->state); - getActuatorValue((void*)&this->state, 3); - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); + resetErrorFlag((void*)this->state); + getActuatorValue((void*)this->state, 3); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); } TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetAndSetBoolActuators) @@ -547,26 +547,26 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestGetAndSetBoolActuators) this->preRequestActuator("d", "e", "f", ActuatorType::BOOL); this->setupActuatorsOnceAllAreRequested(); // Then try to get the actuator handle - int hActuator1 = getActuatorHandle((void*)&this->state, "a", "b", "c"); - int hActuator2 = getActuatorHandle((void*)&this->state, "d", "e", "f"); + int hActuator1 = getActuatorHandle((void*)this->state, "a", "b", "c"); + int hActuator2 = getActuatorHandle((void*)this->state, "d", "e", "f"); // just for good measure here EXPECT_GT(hActuator1, -1); EXPECT_GT(hActuator2, -1); // now let's set the values of the actuators - setActuatorValue((void*)&this->state, hActuator1, 0); // false - setActuatorValue((void*)&this->state, hActuator2, 1); // true + setActuatorValue((void*)this->state, hActuator1, 0); // false + setActuatorValue((void*)this->state, hActuator2, 1); // true // now make sure we don't get them mixed up - Real64 val1 = getActuatorValue((void*)&this->state, hActuator1); - Real64 val2 = getActuatorValue((void*)&this->state, hActuator2); + Real64 val1 = getActuatorValue((void*)this->state, hActuator1); + Real64 val2 = getActuatorValue((void*)this->state, hActuator2); EXPECT_DOUBLE_EQ(0, val1); EXPECT_DOUBLE_EQ(1, val2); // invalid handles - getActuatorValue((void*)&this->state, -1); - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); - resetErrorFlag((void*)&this->state); - getActuatorValue((void*)&this->state, 3); - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); + getActuatorValue((void*)this->state, -1); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); + resetErrorFlag((void*)this->state); + getActuatorValue((void*)this->state, 3); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); } TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestResetActuators) @@ -576,19 +576,19 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestResetActuators) this->preRequestActuator("d", "e", "f", ActuatorType::INTEGER); this->preRequestActuator("g", "h", "i", ActuatorType::BOOL); this->setupActuatorsOnceAllAreRequested(); - int hActuator1 = getActuatorHandle((void*)&this->state, "a", "b", "c"); - int hActuator2 = getActuatorHandle((void*)&this->state, "d", "e", "f"); - int hActuator3 = getActuatorHandle((void*)&this->state, "g", "h", "i"); - resetActuator((void*)&this->state, hActuator1); - resetActuator((void*)&this->state, hActuator2); - resetActuator((void*)&this->state, hActuator3); + int hActuator1 = getActuatorHandle((void*)this->state, "a", "b", "c"); + int hActuator2 = getActuatorHandle((void*)this->state, "d", "e", "f"); + int hActuator3 = getActuatorHandle((void*)this->state, "g", "h", "i"); + resetActuator((void*)this->state, hActuator1); + resetActuator((void*)this->state, hActuator2); + resetActuator((void*)this->state, hActuator3); // invalid handles - resetActuator((void*)&this->state, -1); - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); - resetErrorFlag((void*)&this->state); - resetActuator((void*)&this->state, 8); - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); + resetActuator((void*)this->state, -1); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); + resetErrorFlag((void*)this->state); + resetActuator((void*)this->state, 8); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); } TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestAccessingInternalVariables) @@ -597,21 +597,21 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestAccessingInternalVariabl this->preRequestInternalVariable("a", "b", 1.0); this->preRequestInternalVariable("c", "d", 2.0); this->setupInternalVariablesOnceAllAreRequested(); - int hIntVar1 = getInternalVariableHandle((void*)&this->state, "a", "b"); - int hIntVar2 = getInternalVariableHandle((void*)&this->state, "c", "d"); + int hIntVar1 = getInternalVariableHandle((void*)this->state, "a", "b"); + int hIntVar2 = getInternalVariableHandle((void*)this->state, "c", "d"); EXPECT_GT(hIntVar1, -1); EXPECT_GT(hIntVar2, -1); - Real64 val1 = getInternalVariableValue((void*)&this->state, hIntVar1); - Real64 val2 = getInternalVariableValue((void*)&this->state, hIntVar2); + Real64 val1 = getInternalVariableValue((void*)this->state, hIntVar1); + Real64 val2 = getInternalVariableValue((void*)this->state, hIntVar2); EXPECT_DOUBLE_EQ(1.0, val1); EXPECT_DOUBLE_EQ(2.0, val2); // invalid handles - getInternalVariableValue((void*)&this->state, -1); - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); - resetErrorFlag((void*)&this->state); - getInternalVariableValue((void*)&this->state, 3); - EXPECT_EQ(1, apiErrorFlag((void*)&this->state)); + getInternalVariableValue((void*)this->state, -1); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); + resetErrorFlag((void*)this->state); + getInternalVariableValue((void*)this->state, 3); + EXPECT_EQ(1, apiErrorFlag((void*)this->state)); } TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestMiscSimData) @@ -622,22 +622,22 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_TestMiscSimData) // just stabilizing the API itself. // so make calls into these functions, don't worry about testing the individual values, if something throws then this unit test will fail - year((void*)&this->state); - month((void*)&this->state); - dayOfMonth((void*)&this->state); - dayOfWeek((void*)&this->state); - dayOfYear((void*)&this->state); - daylightSavingsTimeIndicator((void*)&this->state); - hour((void*)&this->state); - currentTime((void*)&this->state); - minutes((void*)&this->state); - systemTimeStep((void*)&this->state); - holidayIndex((void*)&this->state); - sunIsUp((void*)&this->state); - isRaining((void*)&this->state); - warmupFlag((void*)&this->state); - kindOfSim((void*)&this->state); - currentEnvironmentNum((void*)&this->state); + year((void*)this->state); + month((void*)this->state); + dayOfMonth((void*)this->state); + dayOfWeek((void*)this->state); + dayOfYear((void*)this->state); + daylightSavingsTimeIndicator((void*)this->state); + hour((void*)this->state); + currentTime((void*)this->state); + minutes((void*)this->state); + systemTimeStep((void*)this->state); + holidayIndex((void*)this->state); + sunIsUp((void*)this->state); + isRaining((void*)this->state); + warmupFlag((void*)this->state); + kindOfSim((void*)this->state); + currentEnvironmentNum((void*)this->state); // getConstructionHandle(); } @@ -669,9 +669,8 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_Python_EMS_Override) // no error message until now EXPECT_TRUE(compare_err_stream("", true)); - // Then try to get the actuator handle - int hActuator = getActuatorHandle(&state, "System Node Setpoint", "Temperature Minimum Setpoint", "Test node"); + int hActuator = getActuatorHandle(state, "System Node Setpoint", "Temperature Minimum Setpoint", "Test node"); EXPECT_GT(hActuator, -1); // Both the EMS one and the Plugin one point to the same handle, which is the index into the DataRuntimeLanguage::EMSActuatorAvailable array @@ -716,14 +715,14 @@ TEST_F(DataExchangeAPIUnitTestFixture, DataTransfer_Python_Python_Override) // Then try to get the actuator handle - int hActuator = getActuatorHandle(&state, "System Node Setpoint", "Temperature Minimum Setpoint", "Test node"); + int hActuator = getActuatorHandle(state, "System Node Setpoint", "Temperature Minimum Setpoint", "Test node"); EXPECT_GT(hActuator, -1); // no error message until now EXPECT_TRUE(compare_err_stream("", true)); // Then try to get the actuator handle a SECOND time - int hActuator2 = getActuatorHandle(&state, "System Node Setpoint", "Temperature Minimum Setpoint", "Test node"); + int hActuator2 = getActuatorHandle(state, "System Node Setpoint", "Temperature Minimum Setpoint", "Test node"); EXPECT_GT(hActuator2, -1); // Both Plugin ones point to the same handle, which is the index into the DataRuntimeLanguage::EMSActuatorAvailable array From e30ed20ca9b8c5f2a657b625fe5f2c94e55323d6 Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Thu, 19 Nov 2020 10:52:19 -0600 Subject: [PATCH 3/5] Clean up bad state use in overriding fixtures --- tst/EnergyPlus/unit/UnitarySystem.unit.cc | 10 +++++----- tst/EnergyPlus/unit/WaterCoils.unit.cc | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tst/EnergyPlus/unit/UnitarySystem.unit.cc b/tst/EnergyPlus/unit/UnitarySystem.unit.cc index 97f46628d4e..d4f3d9432fb 100644 --- a/tst/EnergyPlus/unit/UnitarySystem.unit.cc +++ b/tst/EnergyPlus/unit/UnitarySystem.unit.cc @@ -286,9 +286,9 @@ class AirloopUnitarySysTest : public EnergyPlusFixture { EnergyPlusFixture::TearDown(); // Remember to tear down the base fixture after cleaning up derived fixture! - state->dataWaterCoils->NumWaterCoils = 0; - state->dataWaterCoils->WaterCoil.clear(); - state->dataWaterCoils->WaterCoilNumericFields.clear(); +// state->dataWaterCoils->NumWaterCoils = 0; +// state->dataWaterCoils->WaterCoil.clear(); +// state->dataWaterCoils->WaterCoilNumericFields.clear(); DataPlant::PlantLoop.clear(); DataSizing::PlantSizData.clear(); DataSizing::ZoneEqSizing.clear(); @@ -299,8 +299,8 @@ class AirloopUnitarySysTest : public EnergyPlusFixture DataSizing::FinalSysSizing.clear(); DataSizing::SysSizPeakDDNum.clear(); DataHVACGlobals::NumPrimaryAirSys = 0; - state->dataAirSystemsData->PrimaryAirSystems.clear(); - state->dataAirLoop->AirLoopControlInfo.clear(); +// state->dataAirSystemsData->PrimaryAirSystems.clear(); +// state->dataAirLoop->AirLoopControlInfo.clear(); Psychrometrics::cached_Twb.clear(); Psychrometrics::cached_Psat.clear(); DataLoopNode::Node.clear(); diff --git a/tst/EnergyPlus/unit/WaterCoils.unit.cc b/tst/EnergyPlus/unit/WaterCoils.unit.cc index 117c913246c..baf299f66bf 100644 --- a/tst/EnergyPlus/unit/WaterCoils.unit.cc +++ b/tst/EnergyPlus/unit/WaterCoils.unit.cc @@ -164,9 +164,9 @@ class WaterCoilsTest : public EnergyPlusFixture { EnergyPlusFixture::TearDown(); // Remember to tear down the base fixture after cleaning up derived fixture! - state->dataWaterCoils->NumWaterCoils = 0; - state->dataWaterCoils->WaterCoil.clear(); - state->dataWaterCoils->WaterCoilNumericFields.clear(); +// state->dataWaterCoils->NumWaterCoils = 0; +// state->dataWaterCoils->WaterCoil.clear(); +// state->dataWaterCoils->WaterCoilNumericFields.clear(); PlantLoop.clear(); PlantSizData.clear(); ZoneEqSizing.clear(); @@ -176,8 +176,8 @@ class WaterCoilsTest : public EnergyPlusFixture SysSizPeakDDNum.clear(); FinalSysSizing.clear(); SysSizPeakDDNum.clear(); - state->dataAirSystemsData->PrimaryAirSystems.clear(); - state->dataAirLoop->AirLoopControlInfo.clear(); +// state->dataAirSystemsData->PrimaryAirSystems.clear(); +// state->dataAirLoop->AirLoopControlInfo.clear(); cached_Twb.clear(); cached_Psat.clear(); } From 4841aabb64efd202a4a481ebcfd4da7fbdad5a5a Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Sat, 21 Nov 2020 16:09:36 -0600 Subject: [PATCH 4/5] Tidy up a few state usages --- tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc | 8 ++++---- tst/EnergyPlus/unit/PlantManager.unit.cc | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc b/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc index 3953200ae44..632e5b87a6e 100644 --- a/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc +++ b/tst/EnergyPlus/unit/PlantCondLoopOperation.unit.cc @@ -842,8 +842,8 @@ TEST_F(EnergyPlusFixture, ThermalEnergyStorageWithIceForceDualOp) { DataPlant::PlantLoop(1).OpScheme.allocate(1); DataPlant::PlantLoop(1).OpScheme(1).Name = "TEST PLANTOP SCHEME"; - state.dataSetPointManager->NumAllSetPtMgrs = 0; - state.dataSetPointManager->NumSchTESSetPtMgrs = 0; + state->dataSetPointManager->NumAllSetPtMgrs = 0; + state->dataSetPointManager->NumSchTESSetPtMgrs = 0; bool ErrorsFound = false; int TESSPBO = 1; @@ -894,7 +894,7 @@ TEST_F(EnergyPlusFixture, ThermalEnergyStorageWithIceForceDualOp) { } // We should now alos have two TES SPMs created, and that's all of them - EXPECT_EQ(state.dataSetPointManager->NumSchTESSetPtMgrs, 2); - EXPECT_EQ(state.dataSetPointManager->NumAllSetPtMgrs, 2); + EXPECT_EQ(state->dataSetPointManager->NumSchTESSetPtMgrs, 2); + EXPECT_EQ(state->dataSetPointManager->NumAllSetPtMgrs, 2); } diff --git a/tst/EnergyPlus/unit/PlantManager.unit.cc b/tst/EnergyPlus/unit/PlantManager.unit.cc index 177c808c8f0..e08884b13c6 100644 --- a/tst/EnergyPlus/unit/PlantManager.unit.cc +++ b/tst/EnergyPlus/unit/PlantManager.unit.cc @@ -212,15 +212,15 @@ namespace PlantManager { GetPlantLoopData(*state); ASSERT_FALSE(ErrorsFound); // there two setpoint amanegrs in the loop - EXPECT_EQ(1, state.dataSetPointManager->NumSchSetPtMgrs); // SetpointManager:Scheduled - EXPECT_EQ(1, state.dataSetPointManager->NumOutAirSetPtMgrs); // SetpointManager:OutdoorAirReset - EXPECT_EQ(2, state.dataSetPointManager->NumAllSetPtMgrs); + EXPECT_EQ(1, state->dataSetPointManager->NumSchSetPtMgrs); // SetpointManager:Scheduled + EXPECT_EQ(1, state->dataSetPointManager->NumOutAirSetPtMgrs); // SetpointManager:OutdoorAirReset + EXPECT_EQ(2, state->dataSetPointManager->NumAllSetPtMgrs); // Schedule Setpoint Manager assigned at a plant loop supply outlet node - EXPECT_EQ(state.dataSetPointManager->SchSetPtMgr(1).CtrlVarType, "TEMPERATURE"); - EXPECT_EQ(state.dataSetPointManager->SchSetPtMgr(1).CtrlNodeListName, "CHILLED WATER LOOP SUPPLY OUTLET"); + EXPECT_EQ(state->dataSetPointManager->SchSetPtMgr(1).CtrlVarType, "TEMPERATURE"); + EXPECT_EQ(state->dataSetPointManager->SchSetPtMgr(1).CtrlNodeListName, "CHILLED WATER LOOP SUPPLY OUTLET"); // OAReset Setpoint Manager assigned at a plant loop supply inlet node - EXPECT_EQ(state.dataSetPointManager->OutAirSetPtMgr(1).CtrlVarType, "TEMPERATURE"); - EXPECT_EQ(state.dataSetPointManager->OutAirSetPtMgr(1).CtrlNodeListName, "CHILLED WATER LOOP SUPPLY INLET"); + EXPECT_EQ(state->dataSetPointManager->OutAirSetPtMgr(1).CtrlVarType, "TEMPERATURE"); + EXPECT_EQ(state->dataSetPointManager->OutAirSetPtMgr(1).CtrlNodeListName, "CHILLED WATER LOOP SUPPLY INLET"); } } // namespace PlantManager } // namespace EnergyPlus From 940e6eda3db1da32f9bc7a0458af925f7ca8907c Mon Sep 17 00:00:00 2001 From: Edwin Lee Date: Sun, 22 Nov 2020 07:50:49 -0600 Subject: [PATCH 5/5] Fix missing include --- src/EnergyPlus/SingleDuct.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/EnergyPlus/SingleDuct.hh b/src/EnergyPlus/SingleDuct.hh index 0ccc35b7c3b..1786470c6f2 100644 --- a/src/EnergyPlus/SingleDuct.hh +++ b/src/EnergyPlus/SingleDuct.hh @@ -48,6 +48,8 @@ #ifndef SingleDuct_hh_INCLUDED #define SingleDuct_hh_INCLUDED +#include + // ObjexxFCL Headers #include #include