Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FluidAPI Continued #10872

Merged
merged 22 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 26 additions & 45 deletions src/EnergyPlus/BoilerSteam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ namespace BoilerSteam {
// PURPOSE OF THIS MODULE:
// Performs steam boiler simulation for plant simulation

const char *fluidNameSteam = "STEAM";

BoilerSpecs *BoilerSpecs::factory(EnergyPlusData &state, std::string const &objectName)
{
// Process the input data for boilers if it hasn't been done already
Expand Down Expand Up @@ -148,6 +146,7 @@ namespace BoilerSteam {

// Locals
static constexpr std::string_view RoutineName("GetBoilerInput: ");
static constexpr std::string_view routineName = "GetBoilerInput";

// LOCAL VARIABLES
int BoilerNum; // boiler identifier
Expand Down Expand Up @@ -186,6 +185,7 @@ namespace BoilerSteam {
_,
state.dataIPShortCut->cAlphaFieldNames,
state.dataIPShortCut->cNumericFieldNames);

// ErrorsFound will be set to True if problem was found, left untouched otherwise
GlobalNames::VerifyUniqueBoilerName(state,
state.dataIPShortCut->cCurrentModuleObject,
Expand Down Expand Up @@ -266,17 +266,12 @@ namespace BoilerSteam {
state.dataIPShortCut->cAlphaArgs(4),
"Hot Steam Nodes");

if (SteamFluidIndex == 0 && BoilerNum == 1) {
SteamFluidIndex = FluidProperties::GetRefrigNum(state, fluidNameSteam); // Steam is a refrigerant?
if (SteamFluidIndex == 0) {
ShowSevereError(
state, format("{}{}=\"{}\",", RoutineName, state.dataIPShortCut->cCurrentModuleObject, state.dataIPShortCut->cAlphaArgs(1)));
ShowContinueError(state, "Steam Properties not found; Steam Fluid Properties must be included in the input file.");
ErrorsFound = true;
}
thisBoiler.fluid = FluidProperties::GetSteam(state);
if (thisBoiler.fluid == nullptr && BoilerNum == 1) {
ShowSevereError(state, "Fluid Properties for STEAM not found.");
ErrorsFound = true;
}

thisBoiler.FluidIndex = SteamFluidIndex;


if (NumAlphas > 4) {
thisBoiler.EndUseSubcategory = state.dataIPShortCut->cAlphaArgs(5);
Expand Down Expand Up @@ -306,14 +301,11 @@ namespace BoilerSteam {

int BoilerInletNode = this->BoilerInletNodeNum;

Real64 EnthSteamOutDry =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->TempUpLimitBoilerOut, 1.0, this->FluidIndex, RoutineName);
Real64 EnthSteamOutWet =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->TempUpLimitBoilerOut, 0.0, this->FluidIndex, RoutineName);
Real64 EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->TempUpLimitBoilerOut, 1.0, RoutineName);
Real64 EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->TempUpLimitBoilerOut, 0.0, RoutineName);
Real64 LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet;

Real64 CpWater =
FluidProperties::GetSatSpecificHeatRefrig(state, fluidNameSteam, this->TempUpLimitBoilerOut, 0.0, this->FluidIndex, RoutineName);
Real64 CpWater = this->fluid->getSatSpecificHeat(state, this->TempUpLimitBoilerOut, 0.0, RoutineName);

this->DesMassFlowRate =
this->NomCap / (LatentEnthSteam + CpWater * (this->TempUpLimitBoilerOut - state.dataLoopNodes->Node(BoilerInletNode).Temp));
Expand Down Expand Up @@ -500,11 +492,11 @@ namespace BoilerSteam {
if (PltSizNum > 0) {
if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) {
Real64 SizingTemp = this->TempUpLimitBoilerOut;
Real64 SteamDensity = FluidProperties::GetSatDensityRefrig(state, fluidNameSteam, SizingTemp, 1.0, this->FluidIndex, RoutineName);
Real64 EnthSteamOutDry = FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, SizingTemp, 1.0, this->FluidIndex, RoutineName);
Real64 EnthSteamOutWet = FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, SizingTemp, 0.0, this->FluidIndex, RoutineName);
Real64 SteamDensity = this->fluid->getSatDensity(state, SizingTemp, 1.0, RoutineName);
Real64 EnthSteamOutDry = this->fluid->getSatEnthalpy(state, SizingTemp, 1.0, RoutineName);
Real64 EnthSteamOutWet = this->fluid->getSatEnthalpy(state, SizingTemp, 0.0, RoutineName);
Real64 LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet;
Real64 CpWater = FluidProperties::GetSatSpecificHeatRefrig(state, fluidNameSteam, SizingTemp, 0.0, this->FluidIndex, RoutineName);
Real64 CpWater = this->fluid->getSatSpecificHeat(state, SizingTemp, 0.0, RoutineName);
tmpNomCap = (CpWater * SteamDensity * this->SizFac * state.dataSize->PlantSizData(PltSizNum).DeltaT *
state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate +
state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate * SteamDensity * LatentEnthSteam);
Expand Down Expand Up @@ -677,7 +669,7 @@ namespace BoilerSteam {
// Set the current load equal to the boiler load
this->BoilerLoad = MyLoad;

this->BoilerPressCheck = FluidProperties::GetSatPressureRefrig(state, fluidNameSteam, this->BoilerOutletTemp, this->FluidIndex, RoutineName);
this->BoilerPressCheck = this->fluid->getSatPressure(state, this->BoilerOutletTemp, RoutineName);

if ((this->BoilerPressCheck) > this->BoilerMaxOperPress) {
if (this->PressErrIndex == 0) {
Expand All @@ -697,8 +689,7 @@ namespace BoilerSteam {
"[Pa]");
}

CpWater = FluidProperties::GetSatSpecificHeatRefrig(
state, fluidNameSteam, state.dataLoopNodes->Node(this->BoilerInletNodeNum).Temp, 0.0, this->FluidIndex, RoutineName);
CpWater = this->fluid->getSatSpecificHeat(state, state.dataLoopNodes->Node(this->BoilerInletNodeNum).Temp, 0.0, RoutineName);

if (state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopSide(this->plantLoc.loopSideNum).FlowLock ==
DataPlant::FlowLock::Unlocked) { // TODO: Components shouldn't check FlowLock
Expand All @@ -716,10 +707,8 @@ namespace BoilerSteam {
}
this->BoilerOutletTemp = BoilerDeltaTemp + state.dataLoopNodes->Node(this->BoilerInletNodeNum).Temp;

Real64 const EnthSteamOutDry =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 1.0, this->FluidIndex, RoutineName);
Real64 const EnthSteamOutWet =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 0.0, this->FluidIndex, RoutineName);
Real64 const EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 1.0, RoutineName);
Real64 const EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 0.0, RoutineName);
Real64 const LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet;
this->BoilerMassFlowRate = this->BoilerLoad / (LatentEnthSteam + (CpWater * BoilerDeltaTemp));

Expand Down Expand Up @@ -754,10 +743,8 @@ namespace BoilerSteam {
default:
break;
}
Real64 const EnthSteamOutDry =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 1.0, this->FluidIndex, RoutineName);
Real64 const EnthSteamOutWet =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 0.0, this->FluidIndex, RoutineName);
Real64 const EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 1.0, RoutineName);
Real64 const EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 0.0, RoutineName);
Real64 const LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet;
this->BoilerLoad = (this->BoilerMassFlowRate * LatentEnthSteam);

Expand All @@ -773,10 +760,8 @@ namespace BoilerSteam {
break;
}

Real64 const EnthSteamOutDry =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 1.0, this->FluidIndex, RoutineName);
Real64 const EnthSteamOutWet =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 0.0, this->FluidIndex, RoutineName);
Real64 const EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 1.0, RoutineName);
Real64 const EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 0.0, RoutineName);
Real64 const LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet;
this->BoilerLoad =
std::abs(this->BoilerMassFlowRate * LatentEnthSteam) + std::abs(this->BoilerMassFlowRate * CpWater * BoilerDeltaTemp);
Expand All @@ -798,10 +783,8 @@ namespace BoilerSteam {
break;
}

Real64 const EnthSteamOutDry =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 1.0, this->FluidIndex, RoutineName);
Real64 const EnthSteamOutWet =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 0.0, this->FluidIndex, RoutineName);
Real64 const EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 1.0, RoutineName);
Real64 const EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 0.0, RoutineName);
Real64 const LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet;
BoilerDeltaTemp = this->BoilerOutletTemp - state.dataLoopNodes->Node(this->BoilerInletNodeNum).Temp;
this->BoilerMassFlowRate = this->BoilerLoad / (LatentEnthSteam + CpWater * BoilerDeltaTemp);
Expand All @@ -815,10 +798,8 @@ namespace BoilerSteam {
if (this->BoilerMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) {
this->BoilerLoad = this->NomCap;

Real64 const EnthSteamOutDry =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 1.0, this->FluidIndex, RoutineName);
Real64 const EnthSteamOutWet =
FluidProperties::GetSatEnthalpyRefrig(state, fluidNameSteam, this->BoilerOutletTemp, 0.0, this->FluidIndex, RoutineName);
Real64 const EnthSteamOutDry = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 1.0, RoutineName);
Real64 const EnthSteamOutWet = this->fluid->getSatEnthalpy(state, this->BoilerOutletTemp, 0.0, RoutineName);
Real64 const LatentEnthSteam = EnthSteamOutDry - EnthSteamOutWet;
BoilerDeltaTemp = this->BoilerOutletTemp - state.dataLoopNodes->Node(this->BoilerInletNodeNum).Temp;
this->BoilerMassFlowRate = this->BoilerLoad / (LatentEnthSteam + CpWater * BoilerDeltaTemp);
Expand Down
3 changes: 2 additions & 1 deletion src/EnergyPlus/BoilerSteam.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
#include <EnergyPlus/DataGlobalConstants.hh>
#include <EnergyPlus/DataGlobals.hh>
#include <EnergyPlus/EnergyPlus.hh>
#include <EnergyPlus/FluidProperties.hh>
#include <EnergyPlus/Plant/Enums.hh>
#include <EnergyPlus/Plant/PlantLocation.hh>
#include <EnergyPlus/PlantComponent.hh>
Expand Down Expand Up @@ -97,7 +98,7 @@ namespace BoilerSteam {
int TypeNum = 0; // Plant loop type identifier
PlantLocation plantLoc;
int PressErrIndex = 0; // index pointer for recurring errors
int FluidIndex = 0; // Steam index
FluidProperties::RefrigProps *fluid = nullptr; // Steam fluid properties
std::string EndUseSubcategory; // identifier use for the end use subcategory
bool myFlag = true;
bool myEnvrnFlag = true;
Expand Down
Loading
Loading