Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions src/EnergyPlus/AirLoopHVACDOAS.cc
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ namespace AirLoopHVACDOAS {
if (Util::SameString(CompType, "COIL:HEATING:WATER")) {
WaterCoils::SimulateWaterCoilComponents(state, CompName, FirstHVACIteration, this->m_HeatCoilNum);
Real64 const CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Heating:Water", CompName, ErrorsFound);
rho = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);
rho = this->HWPlantLoc.loop->glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the standard simplification, just use the direct pointer rather than the lookup index. You will see this another 200 times.

PlantUtilities::InitComponentNodes(state,
0.0,
CoilMaxVolFlowRate * rho,
Expand All @@ -925,7 +925,7 @@ namespace AirLoopHVACDOAS {
if (Util::SameString(CompType, "COIL:COOLING:WATER")) {
WaterCoils::SimulateWaterCoilComponents(state, CompName, FirstHVACIteration, this->m_CoolCoilNum);
Real64 const CoilMaxVolFlowRate = WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Cooling:Water", CompName, ErrorsFound);
rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
rho = this->CWPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
PlantUtilities::InitComponentNodes(state,
0.0,
CoilMaxVolFlowRate * rho,
Expand All @@ -936,7 +936,7 @@ namespace AirLoopHVACDOAS {
WaterCoils::SimulateWaterCoilComponents(state, CompName, FirstHVACIteration, this->m_CoolCoilNum);
Real64 const CoilMaxVolFlowRate =
WaterCoils::GetCoilMaxWaterFlowRate(state, "Coil:Cooling:Water:DetailedGeometry", CompName, ErrorsFound);
rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
rho = this->CWPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
PlantUtilities::InitComponentNodes(state,
0.0,
CoilMaxVolFlowRate * rho,
Expand Down
9 changes: 4 additions & 5 deletions src/EnergyPlus/Boilers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ void BoilerSpecs::oneTimeInit(EnergyPlusData &state)
void BoilerSpecs::initEachEnvironment(EnergyPlusData &state)
{
static constexpr std::string_view RoutineName("BoilerSpecs::initEachEnvironment");
Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);
Real64 const rho = this->plantLoc.loop->glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);
this->DesMassFlowRate = this->VolFlowRate * rho;

PlantUtilities::InitComponentNodes(state, 0.0, this->DesMassFlowRate, this->BoilerInletNodeNum, this->BoilerOutletNodeNum);
Expand Down Expand Up @@ -604,8 +604,8 @@ void BoilerSpecs::SizeBoiler(EnergyPlusData &state)
if (PltSizNum > 0) {
if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) {

Real64 const rho = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);
Real64 const Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName);
Real64 const rho = this->plantLoc.loop->glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);
Real64 const Cp = this->plantLoc.loop->glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName);
tmpNomCap =
Cp * rho * this->SizFac * state.dataSize->PlantSizData(PltSizNum).DeltaT * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate;
} else {
Expand Down Expand Up @@ -791,8 +791,7 @@ void BoilerSpecs::CalcBoilerModel(EnergyPlusData &state,
Real64 const TempUpLimitBout = this->TempUpLimitBoilerOut; // C - boiler high temperature limit
Real64 const BoilerMassFlowRateMax = this->DesMassFlowRate; // Max Design Boiler Mass Flow Rate converted from Volume Flow Rate

Real64 Cp = state.dataPlnt->PlantLoop(this->plantLoc.loopNum)
.glycol->getSpecificHeat(state, state.dataLoopNodes->Node(BoilerInletNode).Temp, RoutineName);
Real64 Cp = this->plantLoc.loop->glycol->getSpecificHeat(state, state.dataLoopNodes->Node(BoilerInletNode).Temp, RoutineName);

// If the specified load is 0.0 or the boiler should not run then we leave this subroutine. Before leaving
// if the component control is SERIESACTIVE we set the component flow to inlet flow so that flow resolver
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/CTElectricGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ namespace CTElectricGenerator {
int heatRecInNode = this->HeatRecInletNodeNum;
heatRecInTemp = state.dataLoopNodes->Node(heatRecInNode).Temp;

heatRecCp = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getSpecificHeat(state, heatRecInTemp, RoutineName);
heatRecCp = this->HRPlantLoc.loop->glycol->getSpecificHeat(state, heatRecInTemp, RoutineName);
if (FirstHVACIteration && RunFlag) {
heatRecMdot = this->DesignHeatRecMassFlowRate;
} else {
Expand Down Expand Up @@ -800,7 +800,7 @@ namespace CTElectricGenerator {
int HeatRecOutletNode = this->HeatRecOutletNodeNum;

// size mass flow rate
Real64 rho = state.dataPlnt->PlantLoop(this->HRPlantLoc.loopNum).glycol->getDensity(state, Constant::InitConvTemp, RoutineName);
Real64 rho = this->HRPlantLoc.loop->glycol->getDensity(state, Constant::InitConvTemp, RoutineName);

this->DesignHeatRecMassFlowRate = rho * this->DesignHeatRecVolFlowRate;

Expand Down
38 changes: 17 additions & 21 deletions src/EnergyPlus/ChillerAbsorption.cc
Original file line number Diff line number Diff line change
Expand Up @@ -754,13 +754,13 @@ void BLASTAbsorberSpecs::initEachEnvironment(EnergyPlusData &state)
{
constexpr std::string_view RoutineName("BLASTAbsorberSpecs::initEachEnvironment");

Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
Real64 rho = this->CWPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);

this->EvapMassFlowRateMax = this->EvapVolFlowRate * rho;

PlantUtilities::InitComponentNodes(state, 0.0, this->EvapMassFlowRateMax, this->EvapInletNodeNum, this->EvapOutletNodeNum);

rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
rho = this->CDPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);

this->CondMassFlowRateMax = rho * this->CondVolFlowRate;

Expand All @@ -770,7 +770,7 @@ void BLASTAbsorberSpecs::initEachEnvironment(EnergyPlusData &state)
if (this->GeneratorInletNodeNum > 0) {

if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) {
rho = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);
rho = this->GenPlantLoc.loop->glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);

this->GenMassFlowRateMax = rho * this->GeneratorVolFlowRate;
} else if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Steam) {
Expand Down Expand Up @@ -929,9 +929,9 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state)
if (PltSizNum > 0) {
if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) {

Real64 Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName);
Real64 Cp = this->CWPlantLoc.loop->glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName);

Real64 rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
Real64 rho = this->CWPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
tmpNomCap =
Cp * rho * state.dataSize->PlantSizData(PltSizNum).DeltaT * state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate * this->SizFac;
if (!this->NomCapWasAutoSized) {
Expand Down Expand Up @@ -1097,9 +1097,9 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state)
if (this->EvapVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) {
// QCondenser = QEvaporator + QGenerator + PumpingPower

Real64 Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->TempDesCondIn, RoutineName);
Real64 Cp = this->CDPlantLoc.loop->glycol->getSpecificHeat(state, this->TempDesCondIn, RoutineName);

Real64 rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
Real64 rho = this->CDPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
tmpCondVolFlowRate =
tmpNomCap * (1.0 + SteamInputRatNom + tmpNomPumpPower / tmpNomCap) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho);
if (!this->CondVolFlowRateWasAutoSized) {
Expand Down Expand Up @@ -1171,12 +1171,11 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state)
(PltSizHeatingNum > 0 && this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water)) {
if (this->EvapVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) {
if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) {
Real64 CpWater = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum)
.glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp, RoutineName);
Real64 CpWater =
this->GenPlantLoc.loop->glycol->getSpecificHeat(state, state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp, RoutineName);
Real64 SteamDeltaT = max(0.5, state.dataSize->PlantSizData(PltSizHeatingNum).DeltaT);
Real64 RhoWater =
state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum)
.glycol->getDensity(state, (state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp - SteamDeltaT), RoutineName);
Real64 RhoWater = this->GenPlantLoc.loop->glycol->getDensity(
state, (state.dataSize->PlantSizData(PltSizHeatingNum).ExitTemp - SteamDeltaT), RoutineName);
tmpGeneratorVolFlowRate = (this->NomCap * SteamInputRatNom) / (CpWater * SteamDeltaT * RhoWater);
if (!this->GeneratorVolFlowRateWasAutoSized) {
tmpGeneratorVolFlowRate = this->GeneratorVolFlowRate;
Expand Down Expand Up @@ -1328,9 +1327,8 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state)
this->GeneratorDeltaTemp = max(0.5, state.dataSize->PlantSizData(PltSizHeatingNum).DeltaT);
} else if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) {
if (state.dataPlnt->PlantFirstSizesOkayToFinalize) {
Real64 Cp =
state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName);
Real64 rho = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);
Real64 Cp = this->GenPlantLoc.loop->glycol->getSpecificHeat(state, Constant::HWInitConvTemp, RoutineName);
Real64 rho = this->GenPlantLoc.loop->glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);

this->GeneratorDeltaTemp = (SteamInputRatNom * this->NomCap) / (Cp * rho * this->GeneratorVolFlowRate);
}
Expand Down Expand Up @@ -1441,8 +1439,7 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R

Real64 TempEvapOut = state.dataLoopNodes->Node(this->EvapOutletNodeNum).Temp;

Real64 CpFluid = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum)
.glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName);
Real64 CpFluid = this->CWPlantLoc.loop->glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, RoutineName);

// If there is a fault of Chiller SWT Sensor
if (this->FaultyChillerSWTFlag && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing) && (!state.dataGlobal->KickOffSimulation)) {
Expand Down Expand Up @@ -1670,8 +1667,7 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R

this->QCondenser = this->QEvaporator + this->QGenerator + this->PumpingPower;

CpFluid = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum)
.glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->CondInletNodeNum).Temp, RoutineName);
CpFluid = this->CDPlantLoc.loop->glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->CondInletNodeNum).Temp, RoutineName);

if (this->CondMassFlowRate > DataBranchAirLoopPlant::MassFlowTolerance) {
this->CondOutletTemp = this->QCondenser / this->CondMassFlowRate / CpFluid + state.dataLoopNodes->Node(this->CondInletNodeNum).Temp;
Expand All @@ -1691,8 +1687,8 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R
if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Water) {
Real64 GenMassFlowRate = 0.0;
// Hot water plant is used for the generator
CpFluid = state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum)
.glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, RoutineName);
CpFluid =
this->GenPlantLoc.loop->glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, RoutineName);
if (state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).LoopSide(this->GenPlantLoc.loopSideNum).FlowLock ==
DataPlant::FlowLock::Unlocked) {
if ((this->FlowMode == DataPlant::FlowMode::Constant) || (this->FlowMode == DataPlant::FlowMode::NotModulated)) {
Expand Down
18 changes: 9 additions & 9 deletions src/EnergyPlus/ChillerExhaustAbsorption.cc
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ void ExhaustAbsorberSpecs::initialize(EnergyPlusData &state)
if (this->isWaterCooled) {
// init max available condenser water flow rate
if (this->CDPlantLoc.loopNum > 0) {
rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
rho = this->CDPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
} else {
rho = Psychrometrics::RhoH2O(Constant::InitConvTemp);
}
Expand All @@ -1005,7 +1005,7 @@ void ExhaustAbsorberSpecs::initialize(EnergyPlusData &state)
}

if (this->HWPlantLoc.loopNum > 0) {
rho = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum).glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);
rho = this->HWPlantLoc.loop->glycol->getDensity(state, Constant::HWInitConvTemp, RoutineName);
} else {
rho = Psychrometrics::RhoH2O(Constant::InitConvTemp);
}
Expand All @@ -1014,7 +1014,7 @@ void ExhaustAbsorberSpecs::initialize(EnergyPlusData &state)
PlantUtilities::InitComponentNodes(state, 0.0, this->DesHeatMassFlowRate, HeatInletNode, HeatOutletNode);

if (this->CWPlantLoc.loopNum > 0) {
rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
rho = this->CWPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
} else {
rho = Psychrometrics::RhoH2O(Constant::InitConvTemp);
}
Expand Down Expand Up @@ -1102,8 +1102,8 @@ void ExhaustAbsorberSpecs::size(EnergyPlusData &state)

if (PltSizCoolNum > 0) {
if (state.dataSize->PlantSizData(PltSizCoolNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) {
Cp = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName);
rho = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
Cp = this->CWPlantLoc.loop->glycol->getSpecificHeat(state, Constant::CWInitConvTemp, RoutineName);
rho = this->CWPlantLoc.loop->glycol->getDensity(state, Constant::CWInitConvTemp, RoutineName);
tmpNomCap = Cp * rho * state.dataSize->PlantSizData(PltSizCoolNum).DeltaT * state.dataSize->PlantSizData(PltSizCoolNum).DesVolFlowRate *
this->SizFac;
if (!this->NomCoolingCapWasAutoSized) {
Expand Down Expand Up @@ -1336,8 +1336,8 @@ void ExhaustAbsorberSpecs::size(EnergyPlusData &state)
if (PltSizCondNum > 0 && PltSizCoolNum > 0) {
if (state.dataSize->PlantSizData(PltSizCoolNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow && tmpNomCap > 0.0) {

Cp = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, this->TempDesCondReturn, RoutineName);
rho = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getDensity(state, this->TempDesCondReturn, RoutineName);
Cp = this->CDPlantLoc.loop->glycol->getSpecificHeat(state, this->TempDesCondReturn, RoutineName);
rho = this->CDPlantLoc.loop->glycol->getDensity(state, this->TempDesCondReturn, RoutineName);
tmpCondVolFlowRate = tmpNomCap * (1.0 + this->ThermalEnergyCoolRatio) / (state.dataSize->PlantSizData(PltSizCondNum).DeltaT * Cp * rho);
if (!this->CondVolFlowRateWasAutoSized) {
tmpCondVolFlowRate = this->CondVolFlowRate;
Expand Down Expand Up @@ -1575,9 +1575,9 @@ void ExhaustAbsorberSpecs::calcChiller(EnergyPlusData &state, Real64 &MyLoad)
Real64 lExhaustInFlow = state.dataLoopNodes->Node(lExhaustAirInletNodeNum).MassFlowRate;
Real64 lExhaustAirHumRat = state.dataLoopNodes->Node(lExhaustAirInletNodeNum).HumRat;

Real64 Cp_CW = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).glycol->getSpecificHeat(state, lChillReturnTemp, RoutineName);
Real64 Cp_CW = this->CWPlantLoc.loop->glycol->getSpecificHeat(state, lChillReturnTemp, RoutineName);
if (this->CDPlantLoc.loopNum > 0) {
Cp_CD = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).glycol->getSpecificHeat(state, lChillReturnTemp, RoutineName);
Cp_CD = this->CDPlantLoc.loop->glycol->getSpecificHeat(state, lChillReturnTemp, RoutineName);
}

// If no loop demand or Absorber OFF, return
Expand Down
Loading