Skip to content

Commit

Permalink
Cleanup and C API
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Roth committed Jan 8, 2025
1 parent bfa5089 commit 41374d2
Show file tree
Hide file tree
Showing 125 changed files with 598 additions and 602 deletions.
2 changes: 1 addition & 1 deletion src/EnergyPlus/BoilerSteam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ namespace BoilerSteam {
state.dataIPShortCut->cAlphaArgs(4),
"Hot Steam Nodes");

thisBoiler.fluid = FluidProperties::GetSteam(state);
thisBoiler.fluid = Fluid::GetSteam(state);
if (thisBoiler.fluid == nullptr && BoilerNum == 1) {
ShowSevereError(state, "Fluid Properties for STEAM not found.");
ErrorsFound = true;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/BoilerSteam.hh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ namespace BoilerSteam {
int TypeNum = 0; // Plant loop type identifier
PlantLocation plantLoc;
int PressErrIndex = 0; // index pointer for recurring errors
FluidProperties::RefrigProps *fluid = nullptr; // Steam fluid properties
Fluid::RefrigProps *fluid = nullptr; // Steam fluid properties
std::string EndUseSubcategory; // identifier use for the end use subcategory
bool myFlag = true;
bool myEnvrnFlag = true;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/ChillerAbsorption.cc
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ void GetBLASTAbsorberInput(EnergyPlusData &state)
state.dataIPShortCut->cAlphaArgs(7),
"Hot Water Nodes");
} else {
thisChiller.steam = FluidProperties::GetSteam(state);
thisChiller.steam = Fluid::GetSteam(state);
thisChiller.GeneratorInletNodeNum = NodeInputManager::GetOnlySingleNode(state,
state.dataIPShortCut->cAlphaArgs(6),
ErrorsFound,
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/ChillerAbsorption.hh
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace ChillerAbsorption {
Real64 GeneratorVolFlowRate = 0.0; // m3/s - hot water volumetric flow rate through generator
bool GeneratorVolFlowRateWasAutoSized = false; // true if hot water flow was autosize on input
Real64 GeneratorSubcool = 0.0; // amount of subcooling in steam generator
FluidProperties::RefrigProps *steam = nullptr; // STEAM fluid properties
Fluid::RefrigProps *steam = nullptr; // STEAM fluid properties
Real64 GeneratorDeltaTemp = -99999.0; // C - generator fluid temperature difference (water only)
bool GeneratorDeltaTempWasAutoSized = true; // true if generator delta T was autosize on input
PlantLocation CWPlantLoc; // chilled water plant loop index number
Expand Down Expand Up @@ -160,7 +160,7 @@ namespace ChillerAbsorption {
ReportVars Report;
DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid;

FluidProperties::GlycolProps *water = nullptr;
Fluid::GlycolProps *water = nullptr;

static BLASTAbsorberSpecs *factory(EnergyPlusData &state, std::string const &objectName);

Expand Down
12 changes: 6 additions & 6 deletions src/EnergyPlus/ChillerIndirectAbsorption.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ void GetIndirectAbsorberInput(EnergyPlusData &state)
// Default to Steam if left blank
} else if (Util::SameString(state.dataIPShortCut->cAlphaArgs(16), "STEAM") || state.dataIPShortCut->cAlphaArgs(16).empty()) {
thisChiller.GenHeatSourceType = DataLoopNode::NodeFluidType::Steam;
thisChiller.steam = FluidProperties::GetSteam(state);
thisChiller.steam = Fluid::GetSteam(state);
} else {
ShowWarningError(state, format("{}, Name={}", state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)));
ShowContinueError(state, "...Generator heat source type must be Steam or Hot Water.");
Expand All @@ -363,7 +363,7 @@ void GetIndirectAbsorberInput(EnergyPlusData &state)
} else {
// Default to Steam if not entered as input
thisChiller.GenHeatSourceType = DataLoopNode::NodeFluidType::Steam;
thisChiller.steam = FluidProperties::GetSteam(state);
thisChiller.steam = Fluid::GetSteam(state);
}

if ((!state.dataIPShortCut->cAlphaArgs(9).empty()) && (!state.dataIPShortCut->cAlphaArgs(10).empty())) {
Expand Down Expand Up @@ -395,7 +395,7 @@ void GetIndirectAbsorberInput(EnergyPlusData &state)
state.dataIPShortCut->cAlphaArgs(10),
"Hot Water Nodes");
} else {
if ((thisChiller.steam = FluidProperties::GetSteam(state)) == nullptr) {
if ((thisChiller.steam = Fluid::GetSteam(state)) == nullptr) {
ShowSevereError(state, "Fluid Properties for STEAM not found.");
ErrorsFound = true;
}
Expand Down Expand Up @@ -1389,7 +1389,7 @@ void IndirectAbsorberSpecs::sizeChiller(EnergyPlusData &state)
Real64 EnthSteamOutWet = this->steam->getSatEnthalpy(state, state.dataSize->PlantSizData(PltSizSteamNum).ExitTemp, 0.0,
std::string{SizeChillerAbsorptionIndirect} + this->Name);

auto *water = FluidProperties::GetWater(state);
auto *water = Fluid::GetWater(state);
Real64 CpWater = water->getSpecificHeat(state, GeneratorOutletTemp, RoutineName);
Real64 HfgSteam = EnthSteamOutDry - EnthSteamOutWet;
// calculate the mass flow rate through the generator
Expand Down Expand Up @@ -2012,7 +2012,7 @@ void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 MyLoad, bool

// heat of vaporization of steam
Real64 HfgSteam = EnthSteamOutDry - EnthSteamOutWet;
CpFluid = FluidProperties::GetWater(state)->getSpecificHeat(state, SteamOutletTemp, std::string{calcChillerAbsorptionIndirect} + this->Name);
CpFluid = Fluid::GetWater(state)->getSpecificHeat(state, SteamOutletTemp, std::string{calcChillerAbsorptionIndirect} + this->Name);
this->GenMassFlowRate = this->QGenerator / (HfgSteam + CpFluid * SteamDeltaT);
PlantUtilities::SetComponentFlowRate(
state, this->GenMassFlowRate, this->GeneratorInletNodeNum, this->GeneratorOutletNodeNum, this->GenPlantLoc);
Expand All @@ -2024,7 +2024,7 @@ void IndirectAbsorberSpecs::calculate(EnergyPlusData &state, Real64 MyLoad, bool
this->GenOutletTemp = state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp - SteamDeltaT;
this->SteamOutletEnthalpy = this->steam->getSatEnthalpy(state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, 0.0,
std::string{LoopLossesChillerAbsorptionIndirect} + this->Name);
CpFluid = FluidProperties::GetWater(state)->getSpecificHeat(state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, std::string{calcChillerAbsorptionIndirect} + this->Name);
CpFluid = Fluid::GetWater(state)->getSpecificHeat(state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, std::string{calcChillerAbsorptionIndirect} + this->Name);

this->SteamOutletEnthalpy -= CpFluid * SteamDeltaT;

Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/ChillerIndirectAbsorption.hh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ namespace ChillerIndirectAbsorption {
DataLoopNode::NodeFluidType GenHeatSourceType =
DataLoopNode::NodeFluidType::Blank; // Generator heat source type, DataLoopNode::NodeFluidType::Steam=3 or
// DataLoopNode::NodeFluidType::Water=2
FluidProperties::RefrigProps *steam = nullptr; // STEAM Fluid Properties
Fluid::RefrigProps *steam = nullptr; // STEAM Fluid Properties
bool Available = false; // need an array of logicals--load identifiers of available equipment
bool ON = false; // simulate the machine at it's operating part load ratio
DataPlant::FlowMode FlowMode = DataPlant::FlowMode::Invalid; // one of 3 modes for component flow during operation
Expand Down Expand Up @@ -178,7 +178,7 @@ namespace ChillerIndirectAbsorption {
ReportVars Report;
DataBranchAirLoopPlant::ControlType EquipFlowCtrl = DataBranchAirLoopPlant::ControlType::Invalid;

FluidProperties::GlycolProps *water = nullptr;
Fluid::GlycolProps *water = nullptr;

static IndirectAbsorberSpecs *factory(EnergyPlusData &state, std::string const &objectName);

Expand Down
6 changes: 3 additions & 3 deletions src/EnergyPlus/Data/EnergyPlusData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ EnergyPlusData::EnergyPlusData()
this->dataFans = std::make_unique<FansData>();
this->dataFaultsMgr = std::make_unique<FaultsManagerData>();
this->dataFluidCoolers = std::make_unique<FluidCoolersData>();
this->dataFluidProps = std::make_unique<FluidData>();
this->dataFluid = std::make_unique<FluidData>();
this->dataFourPipeBeam = std::make_unique<FourPipeBeamData>();
this->dataFuelCellElectGen = std::make_unique<FuelCellElectricGeneratorData>();
this->dataFurnaces = std::make_unique<FurnacesData>();
Expand Down Expand Up @@ -373,7 +373,7 @@ void EnergyPlusData::clear_state()
this->dataFans->clear_state();
this->dataFaultsMgr->clear_state();
this->dataFluidCoolers->clear_state();
this->dataFluidProps->clear_state();
this->dataFluid->clear_state();
this->dataFourPipeBeam->clear_state();
this->dataFuelCellElectGen->clear_state();
this->dataFurnaces->clear_state();
Expand Down Expand Up @@ -579,7 +579,7 @@ void EnergyPlusData::init_state(EnergyPlusData &state)
// objects that do not reference any other objects, like fluids,
// schedules, curves, etc.
this->dataSimulationManager->init_state(state); // GetProjectData
this->dataFluidProps->init_state(state); // GetFluidPropertiesData
this->dataFluid->init_state(state); // GetFluidPropertiesData
this->dataPsychrometrics->init_state(state); // InitializePsychRoutines

this->dataAirLoop->init_state(state);
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/Data/EnergyPlusData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ struct EnergyPlusData : BaseGlobalStruct
std::unique_ptr<FansData> dataFans;
std::unique_ptr<FaultsManagerData> dataFaultsMgr;
std::unique_ptr<FluidCoolersData> dataFluidCoolers;
std::unique_ptr<FluidData> dataFluidProps;
std::unique_ptr<FluidData> dataFluid;
std::unique_ptr<FourPipeBeamData> dataFourPipeBeam;
std::unique_ptr<FuelCellElectricGeneratorData> dataFuelCellElectGen;
std::unique_ptr<FurnacesData> dataFurnaces;
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/DaylightingDevices.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ namespace Dayltg {
// REFERENCES: na

// Using/Aliasing
using FluidProperties::FindArrayIndex; // USEd code could be copied here to eliminate dependence on FluidProperties
using Fluid::FindArrayIndex; // USEd code could be copied here to eliminate dependence on FluidProperties

// Return value
Real64 InterpolatePipeTransBeam;
Expand Down
8 changes: 4 additions & 4 deletions src/EnergyPlus/DesiccantDehumidifiers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ namespace DesiccantDehumidifiers {
// Get the regeneration heating Coil steam max volume flow rate
desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex, errFlag);
if (desicDehum.MaxCoilFluidFlow > 0.0) {
Real64 SteamDensity = FluidProperties::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, dehumidifierDesiccantNoFans);
Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, dehumidifierDesiccantNoFans);
desicDehum.MaxCoilFluidFlow *= SteamDensity;
}

Expand Down Expand Up @@ -978,7 +978,7 @@ namespace DesiccantDehumidifiers {
// Get the regeneration heating Coil steam max volume flow rate
desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex, errFlag);
if (desicDehum.MaxCoilFluidFlow > 0.0) {
Real64 SteamDensity = FluidProperties::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, dehumidifierDesiccantNoFans);
Real64 SteamDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, dehumidifierDesiccantNoFans);
desicDehum.MaxCoilFluidFlow *= SteamDensity;
}

Expand Down Expand Up @@ -1674,7 +1674,7 @@ namespace DesiccantDehumidifiers {
desicDehum.MaxCoilFluidFlow = SteamCoils::GetCoilMaxSteamFlowRate(state, desicDehum.RegenCoilIndex, ErrorFlag);

if (desicDehum.MaxCoilFluidFlow > 0.0) {
Real64 FluidDensity = FluidProperties::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName);
Real64 FluidDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName);
desicDehum.MaxCoilFluidFlow *= FluidDensity;
}
}
Expand Down Expand Up @@ -1779,7 +1779,7 @@ namespace DesiccantDehumidifiers {
// ErrorsFound = true;
//}
if (CoilMaxVolFlowRate != DataSizing::AutoSize) {
Real64 FluidDensity = FluidProperties::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName);
Real64 FluidDensity = Fluid::GetSteam(state)->getSatDensity(state, TempSteamIn, 1.0, RoutineName);
desicDehum.MaxCoilFluidFlow = CoilMaxVolFlowRate * FluidDensity;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/EvaporativeFluidCoolers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ namespace EvaporativeFluidCoolers {
Real64 LowSpeedUserSpecifiedDesignCapacity = 0.0; // User specified design capacity for at low speed for
// two speed fluid cooler[W]
Real64 Concentration = 0.0; // fluid/glycol concentration - percent
FluidProperties::GlycolProps *glycol = nullptr; // Index to Property arrays
Fluid::GlycolProps *glycol = nullptr; // Index to Property arrays
Real64 SizFac = 0.0; // sizing factor
int WaterInletNodeNum = 0; // Node number on the water inlet side of the evaporative fluid cooler
int WaterOutletNodeNum = 0; // Node number on the water outlet side of the evaporative fluid cooler
Expand Down
Loading

3 comments on commit 41374d2

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

FluidAPI2 (Unknown) - x86_64-Linux-Ubuntu-24.04-gcc-13.3: OK (2919 of 2919 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

FluidAPI2 (Unknown) - x86_64-Linux-Ubuntu-24.04-gcc-13.3-UnitTestsCoverage-RelWithDebInfo: OK (2101 of 2101 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

FluidAPI2 (Unknown) - x86_64-Linux-Ubuntu-24.04-gcc-13.3-IntegrationCoverage-RelWithDebInfo: OK (801 of 801 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

Please sign in to comment.