Skip to content

Commit 7b79952

Browse files
authored
Merge pull request #11454 from NatLabRockies/PlantShortcut3
Propagate Plant Location Shortcuts (phase 3)
2 parents bf225bc + a130050 commit 7b79952

52 files changed

Lines changed: 516 additions & 951 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,7 @@ design/FY2023/earth_tube_solution_space_diagram.pdf
103103

104104
# node modules in release/
105105
release/node_modules/*
106+
107+
# virtual environments
108+
venv/
109+
.venv/

src/EnergyPlus/Boilers.cc

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -566,12 +566,12 @@ void BoilerSpecs::InitBoiler(EnergyPlusData &state) // number of the current boi
566566
if ((this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) && this->ModulatedFlowSetToLoop) {
567567
// fix for clumsy old input that worked because loop setpoint was spread.
568568
// could be removed with transition, testing , model change, period of being obsolete.
569-
if (state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::SingleSetPoint) {
569+
if (this->plantLoc.loop->LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::SingleSetPoint) {
570570
state.dataLoopNodes->Node(this->BoilerOutletNodeNum).TempSetPoint =
571-
state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->plantLoc.loopNum).TempSetPointNodeNum).TempSetPoint;
571+
state.dataLoopNodes->Node(this->plantLoc.loop->TempSetPointNodeNum).TempSetPoint;
572572
} else { // DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand
573573
state.dataLoopNodes->Node(this->BoilerOutletNodeNum).TempSetPointLo =
574-
state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->plantLoc.loopNum).TempSetPointNodeNum).TempSetPointLo;
574+
state.dataLoopNodes->Node(this->plantLoc.loop->TempSetPointNodeNum).TempSetPointLo;
575575
}
576576
}
577577
}
@@ -602,7 +602,7 @@ void BoilerSpecs::SizeBoiler(EnergyPlusData &state)
602602
Real64 tmpNomCap = this->NomCap; // local nominal capacity cooling power
603603
Real64 tmpBoilerVolFlowRate = this->VolFlowRate; // local boiler design volume flow rate
604604

605-
int const PltSizNum = state.dataPlnt->PlantLoop(this->plantLoc.loopNum).PlantSizNum; // Plant Sizing index corresponding to CurLoopNum
605+
int const PltSizNum = this->plantLoc.loop->PlantSizNum; // Plant Sizing index corresponding to CurLoopNum
606606

607607
if (PltSizNum > 0) {
608608
if (state.dataSize->PlantSizData(PltSizNum).DesVolFlowRate >= HVAC::SmallWaterVolFlow) {
@@ -739,14 +739,11 @@ void BoilerSpecs::SizeBoiler(EnergyPlusData &state)
739739
OutputReportPredefined::PreDefTableEntry(state,
740740
state.dataOutRptPredefined->pdchBoilerPlantloopName,
741741
equipName,
742-
this->plantLoc.loopNum > 0 ? state.dataPlnt->PlantLoop(this->plantLoc.loopNum).Name : "N/A");
743-
OutputReportPredefined::PreDefTableEntry(
744-
state,
745-
state.dataOutRptPredefined->pdchBoilerPlantloopBranchName,
746-
equipName,
747-
this->plantLoc.loopNum > 0
748-
? state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopSide(this->plantLoc.loopSideNum).Branch(this->plantLoc.branchNum).Name
749-
: "N/A");
742+
this->plantLoc.loop != nullptr ? this->plantLoc.loop->Name : "N/A");
743+
OutputReportPredefined::PreDefTableEntry(state,
744+
state.dataOutRptPredefined->pdchBoilerPlantloopBranchName,
745+
equipName,
746+
this->plantLoc.loop != nullptr ? this->plantLoc.branch->Name : "N/A");
750747
OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchBoilerMinPLR, equipName, this->MinPartLoadRat);
751748
OutputReportPredefined::PreDefTableEntry(
752749
state, state.dataOutRptPredefined->pdchBoilerFuelType, equipName, Constant::eFuelNames[static_cast<int>(this->FuelType)]);
@@ -831,7 +828,7 @@ void BoilerSpecs::CalcBoilerModel(EnergyPlusData &state,
831828
// Initialize the delta temperature to zero
832829
Real64 BoilerDeltaTemp; // C - boiler inlet to outlet temperature difference, set in all necessary code paths so no initialization required
833830

834-
if (state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopSide(this->plantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Unlocked) {
831+
if (this->plantLoc.side->FlowLock == DataPlant::FlowLock::Unlocked) {
835832
// Either set the flow to the Constant value or calculate the flow for the variable volume
836833
if ((this->FlowMode == DataPlant::FlowMode::Constant) || (this->FlowMode == DataPlant::FlowMode::NotModulated)) {
837834
// Then find the flow rate and outlet temp
@@ -849,7 +846,7 @@ void BoilerSpecs::CalcBoilerModel(EnergyPlusData &state,
849846
// Calculate the Delta Temp from the inlet temp to the boiler outlet setpoint
850847
// Then find the flow rate and outlet temp
851848

852-
if (state.dataPlnt->PlantLoop(this->plantLoc.loopNum).LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::SingleSetPoint) {
849+
if (this->plantLoc.loop->LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::SingleSetPoint) {
853850
BoilerDeltaTemp = state.dataLoopNodes->Node(BoilerOutletNode).TempSetPoint - state.dataLoopNodes->Node(BoilerInletNode).Temp;
854851
} else { // DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand
855852
BoilerDeltaTemp = state.dataLoopNodes->Node(BoilerOutletNode).TempSetPointLo - state.dataLoopNodes->Node(BoilerInletNode).Temp;

src/EnergyPlus/ChillerAbsorption.cc

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,7 @@ void BLASTAbsorberSpecs::simulate(
126126
EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag)
127127
{
128128

129-
this->EquipFlowCtrl = state.dataPlnt->PlantLoop(calledFromLocation.loopNum)
130-
.LoopSide(calledFromLocation.loopSideNum)
131-
.Branch(calledFromLocation.branchNum)
132-
.Comp(calledFromLocation.compNum)
133-
.FlowCtrl;
129+
this->EquipFlowCtrl = calledFromLocation.comp->FlowCtrl;
134130

135131
if (calledFromLocation.loopNum == this->CWPlantLoc.loopNum) {
136132
// called from dominant chilled water connection loop side
@@ -757,9 +753,9 @@ void BLASTAbsorberSpecs::oneTimeInit(EnergyPlusData &state)
757753

758754
this->ModulatedFlowSetToLoop = true;
759755
state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint =
760-
state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).TempSetPointNodeNum).TempSetPoint;
756+
state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPoint;
761757
state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi =
762-
state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).TempSetPointNodeNum).TempSetPointHi;
758+
state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPointHi;
763759
}
764760
}
765761
}
@@ -844,9 +840,9 @@ void BLASTAbsorberSpecs::initialize(EnergyPlusData &state,
844840
// fix for clumsy old input that worked because loop setpoint was spread.
845841
// could be removed with transition, testing , model change, period of being obsolete.
846842
state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint =
847-
state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).TempSetPointNodeNum).TempSetPoint;
843+
state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPoint;
848844
state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi =
849-
state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).TempSetPointNodeNum).TempSetPointHi;
845+
state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPointHi;
850846
}
851847

852848
Real64 mdotEvap = 0.0; // local fluid mass flow rate thru evaporator
@@ -913,8 +909,8 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state)
913909
Real64 tmpGeneratorVolFlowRate = this->GeneratorVolFlowRate;
914910

915911
// find the appropriate Plant Sizing object
916-
int PltSizNum = state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).PlantSizNum;
917-
int PltSizCondNum = state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).PlantSizNum;
912+
int PltSizNum = this->CWPlantLoc.loop->PlantSizNum;
913+
int PltSizCondNum = this->CDPlantLoc.loop->PlantSizNum;
918914

919915
if (this->GenHeatSourceType == DataLoopNode::NodeFluidType::Steam) {
920916
if (this->GeneratorInletNodeNum > 0 && this->GeneratorOutletNodeNum > 0) {
@@ -1385,25 +1381,19 @@ void BLASTAbsorberSpecs::sizeChiller(EnergyPlusData &state)
13851381
OutputReportPredefined::PreDefTableEntry(state,
13861382
state.dataOutRptPredefined->pdchChillerPlantloopName,
13871383
this->Name,
1388-
this->CWPlantLoc.loopNum > 0 ? state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).Name : "N/A");
1389-
OutputReportPredefined::PreDefTableEntry(
1390-
state,
1391-
state.dataOutRptPredefined->pdchChillerPlantloopBranchName,
1392-
this->Name,
1393-
this->CWPlantLoc.loopNum > 0
1394-
? state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).LoopSide(this->CWPlantLoc.loopSideNum).Branch(this->CWPlantLoc.branchNum).Name
1395-
: "N/A");
1384+
this->CWPlantLoc.loop != nullptr ? this->CWPlantLoc.loop->Name : "N/A");
1385+
OutputReportPredefined::PreDefTableEntry(state,
1386+
state.dataOutRptPredefined->pdchChillerPlantloopBranchName,
1387+
this->Name,
1388+
this->CWPlantLoc.loop != nullptr ? this->CWPlantLoc.branch->Name : "N/A");
13961389
OutputReportPredefined::PreDefTableEntry(state,
13971390
state.dataOutRptPredefined->pdchChillerCondLoopName,
13981391
this->Name,
1399-
this->CDPlantLoc.loopNum > 0 ? state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).Name : "N/A");
1400-
OutputReportPredefined::PreDefTableEntry(
1401-
state,
1402-
state.dataOutRptPredefined->pdchChillerCondLoopBranchName,
1403-
this->Name,
1404-
this->CDPlantLoc.loopNum > 0
1405-
? state.dataPlnt->PlantLoop(this->CDPlantLoc.loopNum).LoopSide(this->CDPlantLoc.loopSideNum).Branch(this->CDPlantLoc.branchNum).Name
1406-
: "N/A");
1392+
this->CDPlantLoc.loop != nullptr ? this->CDPlantLoc.loop->Name : "N/A");
1393+
OutputReportPredefined::PreDefTableEntry(state,
1394+
state.dataOutRptPredefined->pdchChillerCondLoopBranchName,
1395+
this->Name,
1396+
this->CDPlantLoc.loop != nullptr ? this->CDPlantLoc.branch->Name : "N/A");
14071397
OutputReportPredefined::PreDefTableEntry(state, state.dataOutRptPredefined->pdchChillerMinPLR, this->Name, this->MinPartLoadRat);
14081398
OutputReportPredefined::PreDefTableEntry(state,
14091399
state.dataOutRptPredefined->pdchChillerFuelType,
@@ -1483,7 +1473,7 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R
14831473

14841474
// If FlowLock is True, the new resolved mdot is used to update Power, QEvap, Qcond, and
14851475
// condenser side outlet temperature.
1486-
if (state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).LoopSide(this->CWPlantLoc.loopSideNum).FlowLock == DataPlant::FlowLock::Unlocked) {
1476+
if (this->CWPlantLoc.side->FlowLock == DataPlant::FlowLock::Unlocked) {
14871477
this->PossibleSubcooling = false;
14881478
this->QEvaporator = std::abs(MyLoad);
14891479
// limit by max capacity
@@ -1502,7 +1492,7 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R
15021492

15031493
} else if (this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) {
15041494
// Calculate the Delta Temp from the inlet temp to the chiller outlet setpoint
1505-
switch (state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).LoopDemandCalcScheme) {
1495+
switch (this->CWPlantLoc.loop->LoopDemandCalcScheme) {
15061496
case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
15071497
EvapDeltaTemp =
15081498
state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp - state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint;
@@ -1525,7 +1515,7 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R
15251515
this->EvapMassFlowRate = min(this->EvapMassFlowRateMax, this->EvapMassFlowRate);
15261516
PlantUtilities::SetComponentFlowRate(
15271517
state, this->EvapMassFlowRate, this->EvapInletNodeNum, this->EvapOutletNodeNum, this->CWPlantLoc);
1528-
switch (state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).LoopDemandCalcScheme) {
1518+
switch (this->CWPlantLoc.loop->LoopDemandCalcScheme) {
15291519
case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
15301520
this->EvapOutletTemp = state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint;
15311521
} break;
@@ -1576,15 +1566,14 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R
15761566
this->EvapOutletTemp = state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp - EvapDeltaTemp;
15771567
} else {
15781568
Real64 TempEvapOutSetPoint{0}; // C - evaporator outlet temperature setpoint
1579-
switch (state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).LoopDemandCalcScheme) {
1569+
switch (this->CWPlantLoc.loop->LoopDemandCalcScheme) {
15801570
case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
15811571
if ((this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) ||
15821572
(DataPlant::CompData::getPlantComponent(state, this->CWPlantLoc).CurOpSchemeType == DataPlant::OpScheme::CompSetPtBased) ||
15831573
(state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint != DataLoopNode::SensedNodeFlagValue)) {
15841574
TempEvapOutSetPoint = state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint;
15851575
} else {
1586-
TempEvapOutSetPoint =
1587-
state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).TempSetPointNodeNum).TempSetPoint;
1576+
TempEvapOutSetPoint = state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPoint;
15881577
}
15891578
} break;
15901579
case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: {
@@ -1593,8 +1582,7 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R
15931582
(state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi != DataLoopNode::SensedNodeFlagValue)) {
15941583
TempEvapOutSetPoint = state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi;
15951584
} else {
1596-
TempEvapOutSetPoint =
1597-
state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).TempSetPointNodeNum).TempSetPointHi;
1585+
TempEvapOutSetPoint = state.dataLoopNodes->Node(this->CWPlantLoc.loop->TempSetPointNodeNum).TempSetPointHi;
15981586
}
15991587
} break;
16001588
default: {
@@ -1716,8 +1704,7 @@ void BLASTAbsorberSpecs::calculate(EnergyPlusData &state, Real64 &MyLoad, bool R
17161704
// Hot water plant is used for the generator
17171705
CpFluid =
17181706
this->GenPlantLoc.loop->glycol->getSpecificHeat(state, state.dataLoopNodes->Node(this->GeneratorInletNodeNum).Temp, RoutineName);
1719-
if (state.dataPlnt->PlantLoop(this->GenPlantLoc.loopNum).LoopSide(this->GenPlantLoc.loopSideNum).FlowLock ==
1720-
DataPlant::FlowLock::Unlocked) {
1707+
if (this->GenPlantLoc.side->FlowLock == DataPlant::FlowLock::Unlocked) {
17211708
if ((this->FlowMode == DataPlant::FlowMode::Constant) || (this->FlowMode == DataPlant::FlowMode::NotModulated)) {
17221709
GenMassFlowRate = this->GenMassFlowRateMax;
17231710
} else { // LeavingSetpointModulated

0 commit comments

Comments
 (0)