Skip to content

Commit

Permalink
GetInput cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
amirroth committed Jul 20, 2024
1 parent 907bf19 commit a242572
Show file tree
Hide file tree
Showing 18 changed files with 1,739 additions and 4,209 deletions.
831 changes: 0 additions & 831 deletions src/EnergyPlus/Data/EnergyPlusData.cc-e

This file was deleted.

586 changes: 0 additions & 586 deletions src/EnergyPlus/Data/EnergyPlusData.hh-e

This file was deleted.

4,212 changes: 1,603 additions & 2,609 deletions src/EnergyPlus/FluidProperties.cc

Large diffs are not rendered by default.

153 changes: 58 additions & 95 deletions src/EnergyPlus/FluidProperties.hh

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/EnergyPlus/NodeInputManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ void CalcMoreNodeInfo(EnergyPlusData &state)
} else if (state.dataLoopNodes->Node(iNode).FluidType == DataLoopNode::NodeFluidType::Water) {

if (!((state.dataLoopNodes->Node(iNode).FluidIndex > 0) &&
(state.dataLoopNodes->Node(iNode).FluidIndex <= state.dataFluidProps->NumOfGlycols))) {
(state.dataLoopNodes->Node(iNode).FluidIndex <= state.dataFluidProps->glycols.isize()))) {
rho = RhoWaterStdInit;
rhoStd = RhoWaterStdInit;
Cp = CPCW(state.dataLoopNodes->Node(iNode).Temp);
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/OutdoorAirUnit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ namespace OutdoorAirUnit {
thisOutAirUnit.OAEquip(CompNum).MinVolWaterFlow = 0.0;
// below: no extra error needed if steam properties not in input
// file because getting the steam coil will have done that.
thisOutAirUnit.OAEquip(CompNum).FluidIndex = FluidProperties::GetRefrigNum(state, "Steam");
thisOutAirUnit.OAEquip(CompNum).FluidIndex = FluidProperties::GetRefrigNum(state, "STEAM");
break;
}
case CompType::WaterCoil_DetailedCool: {
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/PoweredInductionUnits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ void GetPIUs(EnergyPlusData &state)
}
case HtgCoilType::SteamAirHeating: {
thisPIU.HCoil_PlantType = DataPlant::PlantEquipmentType::CoilSteamAirHeating;
thisPIU.HCoil_FluidIndex = FluidProperties::GetRefrigNum(state, "Steam");
thisPIU.HCoil_FluidIndex = FluidProperties::GetRefrigNum(state, "STEAM");
if (thisPIU.HCoil_FluidIndex == 0) {
ShowSevereError(state, format("{} Steam Properties for {} not found.", RoutineName, thisPIU.Name));
if (SteamMessageNeeded) {
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/SteamBaseboardRadiator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ namespace SteamBaseboardRadiator {
}

if (state.dataSteamBaseboardRadiator->SteamIndex == 0 && BaseboardNum == 1) {
state.dataSteamBaseboardRadiator->SteamIndex = FluidProperties::GetRefrigNum(state, "Steam");
state.dataSteamBaseboardRadiator->SteamIndex = FluidProperties::GetRefrigNum(state, "STEAM");
if (state.dataSteamBaseboardRadiator->SteamIndex == 0) {
ShowSevereError(state, format("{}Steam Properties for {} not found.", RoutineName, state.dataIPShortCut->cAlphaArgs(1)));
if (SteamMessageNeeded) ShowContinueError(state, "Steam Fluid Properties should have been included in the input file.");
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/SteamCoils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ namespace SteamCoils {
TestCompSet(state, CurrentModuleObject, AlphArray(1), AlphArray(5), AlphArray(6), "Air Nodes");

if (state.dataSteamCoils->SteamIndex == 0 && CoilNum == 1) {
state.dataSteamCoils->SteamIndex = FluidProperties::GetRefrigNum(state, "Steam");
state.dataSteamCoils->SteamIndex = FluidProperties::GetRefrigNum(state, "STEAM");
if (state.dataSteamCoils->SteamIndex == 0) {
ShowSevereError(state, format("{}Steam Properties for {} not found.", RoutineName, AlphArray(1)));
ShowContinueError(state, "Steam Fluid Properties should have been included in the input file.");
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/VentilatedSlab.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ namespace VentilatedSlab {
}
case HeatingCoilType::Steam: {
ventSlab.heatingCoilType = DataPlant::PlantEquipmentType::CoilSteamAirHeating;
ventSlab.heatingCoil_FluidIndex = FluidProperties::GetRefrigNum(state, "Steam");
ventSlab.heatingCoil_FluidIndex = FluidProperties::GetRefrigNum(state, "STEAM");
if (ventSlab.heatingCoil_FluidIndex == 0) {
ShowSevereError(state, format("{}=\"{}Steam Properties not found.", CurrentModuleObject, ventSlab.Name));
if (SteamMessageNeeded) ShowContinueError(state, "Steam Fluid Properties should have been included in the input file.");
Expand Down
1 change: 0 additions & 1 deletion tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ bool EnergyPlusFixture::process_idf(std::string_view const idf_snippet, bool use
inputProcessor->initializeMaps();
SimulationManager::PostIPProcessing(*state);

FluidProperties::GetFluidPropertiesData(*state);
state->init_state(*state);

if (state->dataSQLiteProcedures->sqlite) {
Expand Down
8 changes: 4 additions & 4 deletions tst/EnergyPlus/unit/HVACVariableRefrigerantFlow.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2356,12 +2356,12 @@ TEST_F(EnergyPlusFixture, VRF_FluidTCtrl_VRFOU_Compressor)
Curve::GetCurveInput(*state); // read curves
// test consecutive call to fluid properties getInput
FluidProperties::GetFluidPropertiesData(*state); // read refrigerant properties
EXPECT_EQ(2, state->dataFluidProps->NumOfRefrigerants);
EXPECT_EQ(1, state->dataFluidProps->NumOfGlycols);
EXPECT_EQ(2, state->dataFluidProps->refrigs.isize());
EXPECT_EQ(1, state->dataFluidProps->glycols.isize());

FluidProperties::GetFluidPropertiesData(*state); // should never happen but if it does it's safe
EXPECT_EQ(2, state->dataFluidProps->NumOfRefrigerants);
EXPECT_EQ(1, state->dataFluidProps->NumOfGlycols);
EXPECT_EQ(2, state->dataFluidProps->refrigs.isize());
EXPECT_EQ(1, state->dataFluidProps->glycols.isize());

// set up ZoneEquipConfig data
state->dataGlobal->NumOfZones = 1;
Expand Down
8 changes: 4 additions & 4 deletions tst/EnergyPlus/unit/PlantUtilities.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ TEST_F(EnergyPlusFixture, TestRegulateCondenserCompFlowReqOp)
{
// test consecutive call to fluid properties getInput
FluidProperties::GetFluidPropertiesData(*state);
EXPECT_EQ(1, state->dataFluidProps->NumOfRefrigerants);
EXPECT_EQ(1, state->dataFluidProps->NumOfGlycols);
EXPECT_EQ(1, state->dataFluidProps->refrigs.isize());
EXPECT_EQ(1, state->dataFluidProps->glycols.isize());

FluidProperties::GetFluidPropertiesData(*state); // should never happen but if it does it's safe
EXPECT_EQ(1, state->dataFluidProps->NumOfRefrigerants);
EXPECT_EQ(1, state->dataFluidProps->NumOfGlycols);
EXPECT_EQ(1, state->dataFluidProps->refrigs.isize());
EXPECT_EQ(1, state->dataFluidProps->glycols.isize());

// This test captures all code paths through the RegulateCondenserCompFlowReqOp function
// We only need a single component to check here
Expand Down
8 changes: 4 additions & 4 deletions tst/EnergyPlus/unit/SetPointManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ TEST_F(EnergyPlusFixture, SetPointManager_DefineReturnWaterChWSetPointManager_Fl

ASSERT_TRUE(process_idf(idf_objects));

EXPECT_EQ(2, state->dataFluidProps->NumOfGlycols);
const auto &thisGlycol = state->dataFluidProps->GlycolData(2);
EXPECT_EQ("ETHYLENEGLYCOL40PERCENT", thisGlycol.Name);
EXPECT_EQ("ETHYLENEGLYCOL", thisGlycol.GlycolName);
EXPECT_EQ(2, state->dataFluidProps->glycols.isize());
const auto *glycol = state->dataFluidProps->glycols(2);
EXPECT_EQ("ETHYLENEGLYCOL40PERCENT", glycol->Name);
EXPECT_EQ("ETHYLENEGLYCOL", glycol->GlycolName);

// Set up the required plant loop data
state->dataPlnt->TotNumLoops = 1;
Expand Down
1 change: 0 additions & 1 deletion tst/EnergyPlus/unit/UnitarySystem.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ TEST_F(AirloopUnitarySysTest, MultipleWaterCoolingCoilSizing)
state->dataPlnt->PlantLoop(1).LoopSide(DataPlant::LoopSideLocation::Demand).Branch(1).Comp(1).Name =
state->dataWaterCoils->WaterCoil(CoilNum).Name;
state->dataSize->DataWaterLoopNum = 1;
state->dataFluidProps->NumOfGlycols = 1;

createCoilSelectionReportObj(*state);
WaterCoils::SizeWaterCoil(*state, CoilNum);
Expand Down
9 changes: 0 additions & 9 deletions tst/EnergyPlus/unit/WaterCoils.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ TEST_F(WaterCoilsTest, WaterCoolingCoilSizing)
state->dataSize->PlantSizData(1).DeltaT = 5.0;
state->dataSize->FinalSysSizing(1).MassFlowAtCoolPeak = state->dataSize->FinalSysSizing(1).DesMainVolFlow * state->dataEnvrn->StdRhoAir;
state->dataSize->DataWaterLoopNum = 1;
state->dataFluidProps->NumOfGlycols = 1;

createCoilSelectionReportObj(*state);
SizeWaterCoil(*state, CoilNum);
Expand Down Expand Up @@ -465,7 +464,6 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizing)
state->dataSize->CurSysNum = 1;
state->dataSize->CurOASysNum = 0;
state->dataSize->DataWaterLoopNum = 1;
state->dataFluidProps->NumOfGlycols = 1;

state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1);
state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true;
Expand Down Expand Up @@ -622,7 +620,6 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterLowAirFlowUASizing)
state->dataSize->CurSysNum = 1;
state->dataSize->CurOASysNum = 0;
state->dataSize->DataWaterLoopNum = 1;
state->dataFluidProps->NumOfGlycols = 1;

state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1);
state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true;
Expand Down Expand Up @@ -783,7 +780,6 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterUASizingLowHwaterInletTemp)
state->dataSize->CurOASysNum = 0;

state->dataSize->DataWaterLoopNum = 1;
state->dataFluidProps->NumOfGlycols = 1;

state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1);
state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true;
Expand Down Expand Up @@ -904,7 +900,6 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterSimpleSizing)
state->dataSize->PlantSizData(1).DeltaT = 5.0;

state->dataSize->DataWaterLoopNum = 1;
state->dataFluidProps->NumOfGlycols = 1;

// run water coil sizing
createCoilSelectionReportObj(*state);
Expand Down Expand Up @@ -1023,7 +1018,6 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailedSizing)
state->dataSize->PlantSizData(1).ExitTemp = 5.7;
state->dataSize->PlantSizData(1).DeltaT = 5.0;
state->dataSize->DataWaterLoopNum = 1;
state->dataFluidProps->NumOfGlycols = 1;

// run water coil sizing
createCoilSelectionReportObj(*state);
Expand Down Expand Up @@ -1149,7 +1143,6 @@ TEST_F(WaterCoilsTest, CoilCoolingWaterDetailed_WarningMath)
state->dataSize->PlantSizData(1).ExitTemp = 5.7;
state->dataSize->PlantSizData(1).DeltaT = 5.0;
state->dataSize->DataWaterLoopNum = 1;
state->dataFluidProps->NumOfGlycols = 1;

OutputReportPredefined::SetPredefinedTables(*state);

Expand Down Expand Up @@ -1306,7 +1299,6 @@ TEST_F(WaterCoilsTest, CoilHeatingWaterSimpleSizing)
state->dataSize->PlantSizData(1).DeltaT = 10.0;

state->dataSize->DataWaterLoopNum = 1;
state->dataFluidProps->NumOfGlycols = 1;

// run water coil sizing
createCoilSelectionReportObj(*state);
Expand Down Expand Up @@ -1403,7 +1395,6 @@ TEST_F(WaterCoilsTest, HotWaterHeatingCoilAutoSizeTempTest)
state->dataSize->CurOASysNum = 0;

state->dataSize->DataWaterLoopNum = 1;
state->dataFluidProps->NumOfGlycols = 1;

state->dataWaterCoils->MyUAAndFlowCalcFlag.allocate(1);
state->dataWaterCoils->MyUAAndFlowCalcFlag(1) = true;
Expand Down
2 changes: 1 addition & 1 deletion tst/EnergyPlus/unit/WaterThermalTanks.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ TEST_F(EnergyPlusFixture, HPWHEnergyBalance)
state->dataWaterThermalTanks->mdotAir = 0.0993699992873531;

int GlycolIndex = 0;
const Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, FluidProperties::Water, Tank.TankTemp, GlycolIndex, "HPWHEnergyBalance");
const Real64 Cp = FluidProperties::GetSpecificHeatGlycol(*state, "WATER", Tank.TankTemp, GlycolIndex, "HPWHEnergyBalance");

Tank.CalcHeatPumpWaterHeater(*state, false);

Expand Down
117 changes: 59 additions & 58 deletions tst/EnergyPlus/unit/WaterToAirHeatPump.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,63 +137,64 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpTest_SimWaterToAir)

ASSERT_TRUE(process_idf(idf_objects));

state->dataFluidProps->RefrigData.allocate(1);
auto &refrig = state->dataFluidProps->RefrigData(1);
refrig.Name = "R22";
refrig.Num = 1;
refrig.PsLowTempIndex = 1;
refrig.PsHighTempIndex = 2;
refrig.PsTemps.allocate(2);
refrig.PsTemps(1) = -157.42;
refrig.PsTemps(2) = 96.145;
refrig.PsValues.allocate(2);
refrig.PsValues(1) = 0.3795;
refrig.PsValues(2) = 4990000.0;

refrig.HfLowTempIndex = 1;
refrig.HfHighTempIndex = 2;
refrig.PsLowPresIndex = 1;
refrig.PsHighPresIndex = 2;
refrig.HTemps.allocate(2);
refrig.HfValues.allocate(2);
refrig.HfgValues.allocate(2);

refrig.HTemps(1) = -157.42;
refrig.HTemps(2) = 96.145;
refrig.HfValues(1) = 29600.0;
refrig.HfValues(2) = 366900.0;
refrig.HfgValues(1) = 332700.0;
refrig.HfgValues(2) = 366900.0;
refrig.NumSuperTempPts = 2;
refrig.NumSuperPressPts = 2;
refrig.SHTemps.allocate(2);
refrig.SHPress.allocate(2);
refrig.SHTemps(1) = -157.15;
refrig.SHTemps(2) = 152.85;
refrig.SHPress(1) = 0.4043;
refrig.SHPress(2) = 16500000.0;
refrig.HshValues.allocate(2, 2);
refrig.HshValues(1, 1) = 332800.0;
refrig.HshValues(1, 2) = 537000.0;
refrig.HshValues(2, 1) = 332800.0;
refrig.HshValues(2, 2) = 537000.0;
refrig.RhoshValues.allocate(2, 2);
refrig.RhoshValues(1, 1) = 0.00003625;
refrig.RhoshValues(1, 2) = 0.0;
refrig.RhoshValues(2, 1) = 0.00003625;
refrig.RhoshValues(2, 2) = 0.0;

refrig.RhofLowTempIndex = 1;
refrig.RhofHighTempIndex = 2;
refrig.RhoTemps.allocate(2);
refrig.RhoTemps(1) = -157.42;
refrig.RhoTemps(2) = 96.145;
refrig.RhofValues.allocate(2);
refrig.RhofValues(1) = 1721.0;
refrig.RhofValues(2) = 523.8;
refrig.RhofgValues.allocate(2);
refrig.RhofgValues(1) = 0.341;
refrig.RhofgValues(2) = 523.8;
auto *refrig = new FluidProperties::RefrigProps;
refrig->Name = "R22";
state->dataFluidProps->refrigs.push_back(refrig);
refrig->Num = state->dataFluidProps->refrigs.isize();

refrig->PsLowTempIndex = 1;
refrig->PsHighTempIndex = 2;
refrig->PsTemps.allocate(2);
refrig->PsTemps(1) = -157.42;
refrig->PsTemps(2) = 96.145;
refrig->PsValues.allocate(2);
refrig->PsValues(1) = 0.3795;
refrig->PsValues(2) = 4990000.0;

refrig->HfLowTempIndex = 1;
refrig->HfHighTempIndex = 2;
refrig->PsLowPresIndex = 1;
refrig->PsHighPresIndex = 2;
refrig->HTemps.allocate(2);
refrig->HfValues.allocate(2);
refrig->HfgValues.allocate(2);

refrig->HTemps(1) = -157.42;
refrig->HTemps(2) = 96.145;
refrig->HfValues(1) = 29600.0;
refrig->HfValues(2) = 366900.0;
refrig->HfgValues(1) = 332700.0;
refrig->HfgValues(2) = 366900.0;
refrig->NumSupTempPoints = 2;
refrig->NumSupPressPoints = 2;
refrig->SupTemps.allocate(2);
refrig->SupPress.allocate(2);
refrig->SupTemps(1) = -157.15;
refrig->SupTemps(2) = 152.85;
refrig->SupPress(1) = 0.4043;
refrig->SupPress(2) = 16500000.0;
refrig->HshValues.allocate(2, 2);
refrig->HshValues(1, 1) = 332800.0;
refrig->HshValues(1, 2) = 537000.0;
refrig->HshValues(2, 1) = 332800.0;
refrig->HshValues(2, 2) = 537000.0;
refrig->RhoshValues.allocate(2, 2);
refrig->RhoshValues(1, 1) = 0.00003625;
refrig->RhoshValues(1, 2) = 0.0;
refrig->RhoshValues(2, 1) = 0.00003625;
refrig->RhoshValues(2, 2) = 0.0;

refrig->RhofLowTempIndex = 1;
refrig->RhofHighTempIndex = 2;
refrig->RhoTemps.allocate(2);
refrig->RhoTemps(1) = -157.42;
refrig->RhoTemps(2) = 96.145;
refrig->RhofValues.allocate(2);
refrig->RhofValues(1) = 1721.0;
refrig->RhofValues(2) = 523.8;
refrig->RhofgValues.allocate(2);
refrig->RhofgValues(1) = 0.341;
refrig->RhofgValues(2) = 523.8;

GetWatertoAirHPInput(*state);

Expand Down Expand Up @@ -308,5 +309,5 @@ TEST_F(EnergyPlusFixture, WaterToAirHeatPumpTest_SimWaterToAir)

// clean up
state->dataWaterToAirHeatPump->WatertoAirHP.deallocate();
state->dataFluidProps->RefrigData.deallocate();
delete state->dataFluidProps->refrigs(1);
}

1 comment on commit a242572

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

FluidAPI (amirroth) - x86_64-MacOS-10.18-clang-15.0.0: OK (3632 of 3644 tests passed, 114 test warnings)

Messages:\n

  • 91 tests had: ESO small diffs.
  • 64 tests had: MTR small diffs.
  • 55 tests had: EIO diffs.
  • 42 tests had: Table small diffs.
  • 2 tests had: Table big diffs.
  • 31 tests had: ERR diffs.
  • 1 test had: ESO big diffs.
  • 4 tests had: Table string diffs.

Failures:\n

API Test Summary

  • Passed: 13
  • Subprocess aborted: 2

integration Test Summary

  • Passed: 791
  • Failed: 3

regression Test Summary

  • Passed: 784
  • Failed: 7

Build Badge Test Badge

Please sign in to comment.