-
Notifications
You must be signed in to change notification settings - Fork 422
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
Absorption chillerheater plant loop fixes #8556
Changes from all commits
57ca95f
80f1fb1
a4d9b98
e301d27
46ae933
19e0e99
cccf8f7
5c67cc0
0d5d356
c3940d6
1bc932d
d016c33
5608c82
0dec544
01507f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,23 +131,47 @@ namespace EnergyPlus::ChillerExhaustAbsorption { | |
|
||
void ExhaustAbsorberSpecs::simulate(EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) | ||
{ | ||
DataPlant::BrLoopType brIdentity(DataPlant::BrLoopType::NoMatch); | ||
|
||
int branchTotalComp = state.dataPlnt->PlantLoop(calledFromLocation.loopNum) | ||
.LoopSide(calledFromLocation.loopSideNum) | ||
.Branch(calledFromLocation.branchNum) | ||
.TotalComponents; | ||
|
||
for (int iComp = 1; iComp <= branchTotalComp; iComp++) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The revised code checks all the elements in an (exhaust or gas-fired) absorption chiller heat plant loop branch, to identity which (chilled water, hot water, or condensing water) branch it is simulating. This is in contrast to the original code where only head branch component is checked. |
||
// kind of a hacky way to find the location of this, but it's what plantloopequip was doing | ||
int compInletNodeNum = state.dataPlnt->PlantLoop(calledFromLocation.loopNum) | ||
.LoopSide(calledFromLocation.loopSideNum) | ||
.Branch(calledFromLocation.branchNum) | ||
.Comp(iComp) | ||
.NodeNumIn; | ||
|
||
// Match inlet node name of calling branch to determine if this call is for heating or cooling | ||
if (compInletNodeNum == this->ChillReturnNodeNum) { // Operate as chiller | ||
brIdentity = DataPlant::BrLoopType::Chiller; // chiller | ||
break; | ||
} else if (compInletNodeNum == this->HeatReturnNodeNum) { // Operate as heater | ||
brIdentity = DataPlant::BrLoopType::Heater; // heater | ||
break; | ||
} else if (compInletNodeNum == this->CondReturnNodeNum) { // called from condenser loop | ||
brIdentity = DataPlant::BrLoopType::Condenser; // condenser | ||
break; | ||
} else { | ||
brIdentity = DataPlant::BrLoopType::NoMatch; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use an integer number ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is kinda odd. If it is just an identifier and the value doesn't matter, this should be an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Much nicer than the magic numbers, thank you! |
||
|
||
// kind of a hacky way to find the location of this, but it's what plantloopequip was doing | ||
int BranchInletNodeNum = | ||
state.dataPlnt->PlantLoop(calledFromLocation.loopNum).LoopSide(calledFromLocation.loopSideNum).Branch(calledFromLocation.branchNum).NodeNumIn; | ||
|
||
// Match inlet node name of calling branch to determine if this call is for heating or cooling | ||
if (BranchInletNodeNum == this->ChillReturnNodeNum) { // Operate as chiller | ||
if (brIdentity == DataPlant::BrLoopType::Chiller) { | ||
this->InCoolingMode = RunFlag != 0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After the current branch is identified, run the corresponding functions/code blocks to execute the simulation. Slightly reorganized from the original code. |
||
this->initialize(state); | ||
this->calcChiller(state, CurLoad); | ||
this->updateCoolRecords(state, CurLoad, RunFlag); | ||
} else if (BranchInletNodeNum == this->HeatReturnNodeNum) { // Operate as heater | ||
} else if (brIdentity == DataPlant::BrLoopType::Heater) { | ||
this->InHeatingMode = RunFlag != 0; | ||
this->initialize(state); | ||
this->calcHeater(state, CurLoad, RunFlag); | ||
this->updateHeatRecords(state, CurLoad, RunFlag); | ||
} else if (BranchInletNodeNum == this->CondReturnNodeNum) { // called from condenser loop | ||
} else if (brIdentity == DataPlant::BrLoopType::Condenser) { | ||
if (this->CDLoopNum > 0) { | ||
PlantUtilities::UpdateChillerComponentCondenserSide(state, | ||
this->CDLoopNum, | ||
|
@@ -161,8 +185,8 @@ namespace EnergyPlus::ChillerExhaustAbsorption { | |
this->CondWaterFlowRate, | ||
FirstHVACIteration); | ||
} | ||
|
||
} else { // Error, nodes do not match | ||
} else { | ||
// Error, nodes do not match | ||
ShowSevereError(state, "Invalid call to Exhaust Absorber Chiller " + this->Name); | ||
ShowContinueError(state, "Node connections in branch are not consistent with object nodes."); | ||
ShowFatalError(state, "Preceding conditions cause termination."); | ||
|
@@ -171,26 +195,48 @@ namespace EnergyPlus::ChillerExhaustAbsorption { | |
|
||
void ExhaustAbsorberSpecs::getDesignCapacities(EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) | ||
{ | ||
|
||
// kind of a hacky way to find the location of this, but it's what plantloopequip was doing | ||
int BranchInletNodeNum = | ||
state.dataPlnt->PlantLoop(calledFromLocation.loopNum).LoopSide(calledFromLocation.loopSideNum).Branch(calledFromLocation.branchNum).NodeNumIn; | ||
|
||
// Match inlet node name of calling branch to determine if this call is for heating or cooling | ||
if (BranchInletNodeNum == this->ChillReturnNodeNum) { // Operate as chiller | ||
MinLoad = this->NomCoolingCap * this->MinPartLoadRat; | ||
MaxLoad = this->NomCoolingCap * this->MaxPartLoadRat; | ||
OptLoad = this->NomCoolingCap * this->OptPartLoadRat; | ||
} else if (BranchInletNodeNum == this->HeatReturnNodeNum) { // Operate as heater | ||
Real64 Sim_HeatCap = this->NomCoolingCap * this->NomHeatCoolRatio; // W - nominal heating capacity | ||
MinLoad = Sim_HeatCap * this->MinPartLoadRat; | ||
MaxLoad = Sim_HeatCap * this->MaxPartLoadRat; | ||
OptLoad = Sim_HeatCap * this->OptPartLoadRat; | ||
} else if (BranchInletNodeNum == this->CondReturnNodeNum) { // called from condenser loop | ||
MinLoad = 0.0; | ||
MaxLoad = 0.0; | ||
OptLoad = 0.0; | ||
} else { // Error, nodes do not match | ||
bool matchfound(false); | ||
|
||
int branchTotalComp = state.dataPlnt->PlantLoop(calledFromLocation.loopNum) | ||
.LoopSide(calledFromLocation.loopSideNum) | ||
.Branch(calledFromLocation.branchNum) | ||
.TotalComponents; | ||
|
||
for (int iComp = 1; iComp <= branchTotalComp; iComp++) { | ||
// kind of a hacky way to find the location of this, but it's what plantloopequip was doing | ||
int compInletNodeNum = state.dataPlnt->PlantLoop(calledFromLocation.loopNum) | ||
.LoopSide(calledFromLocation.loopSideNum) | ||
.Branch(calledFromLocation.branchNum) | ||
.Comp(iComp) | ||
.NodeNumIn; | ||
|
||
// Match inlet node name of calling branch to determine if this call is for heating or cooling | ||
if (compInletNodeNum == this->ChillReturnNodeNum) { // Operate as chiller | ||
MinLoad = this->NomCoolingCap * this->MinPartLoadRat; | ||
MaxLoad = this->NomCoolingCap * this->MaxPartLoadRat; | ||
OptLoad = this->NomCoolingCap * this->OptPartLoadRat; | ||
matchfound = true; | ||
break; | ||
} else if (compInletNodeNum == this->HeatReturnNodeNum) { // Operate as heater | ||
Real64 Sim_HeatCap = this->NomCoolingCap * this->NomHeatCoolRatio; // W - nominal heating capacity | ||
MinLoad = Sim_HeatCap * this->MinPartLoadRat; | ||
MaxLoad = Sim_HeatCap * this->MaxPartLoadRat; | ||
OptLoad = Sim_HeatCap * this->OptPartLoadRat; | ||
matchfound = true; | ||
break; | ||
} else if (compInletNodeNum == this->CondReturnNodeNum) { // called from condenser loop | ||
MinLoad = 0.0; | ||
MaxLoad = 0.0; | ||
OptLoad = 0.0; | ||
matchfound = true; | ||
break; | ||
} else { | ||
matchfound = false; | ||
} | ||
} | ||
|
||
if(!matchfound) { | ||
// Error, nodes do not match | ||
ShowSevereError(state, "SimExhaustAbsorber: Invalid call to Exhaust Absorbtion Chiller-Heater " + this->Name); | ||
ShowContinueError(state, "Node connections in branch are not consistent with object nodes."); | ||
ShowFatalError(state, "Preceding conditions cause termination."); | ||
|
@@ -1629,7 +1675,7 @@ namespace EnergyPlus::ChillerExhaustAbsorption { | |
} else { | ||
ShowSevereError(state, "CalcExhaustAbsorberChillerModel: Condenser flow = 0, for Exhaust Absorber Chiller=" + this->Name); | ||
ShowContinueErrorTimeStamp(state, ""); | ||
ShowFatalError(state, "Program Terminates due to previous error condition."); | ||
// ShowFatalError(state, "Program Terminates due to previous error condition."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now do not show the fatal message and terminate any more--this is aligned with the kind of common treatment used in other type of chiller (electric or absorption) models. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm.... OK, so if we show a severe then we need to fatal. If we aren't going to fatal then this needs to be a warning. But if it's a warning that could occur multiple times should we do a recurring warning message to avoid huge error files? |
||
} | ||
} else { | ||
lCondSupplyTemp = lCondReturnTemp; // if air cooled condenser just set supply and return to same temperature | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,27 +130,50 @@ namespace EnergyPlus::ChillerGasAbsorption { | |
|
||
void GasAbsorberSpecs::simulate(EnergyPlusData &state, const PlantLocation &calledFromLocation, bool FirstHVACIteration, Real64 &CurLoad, bool RunFlag) | ||
{ | ||
DataPlant::BrLoopType brIdentity(DataPlant::BrLoopType::NoMatch); | ||
|
||
int branchTotalComp = state.dataPlnt->PlantLoop(calledFromLocation.loopNum) | ||
.LoopSide(calledFromLocation.loopSideNum) | ||
.Branch(calledFromLocation.branchNum) | ||
.TotalComponents; | ||
|
||
for (int iComp = 1; iComp <= branchTotalComp; iComp++) { | ||
// kind of a hacky way to find the location of this, but it's what plantloopequip was doing | ||
int compInletNodeNum = state.dataPlnt->PlantLoop(calledFromLocation.loopNum) | ||
.LoopSide(calledFromLocation.loopSideNum) | ||
.Branch(calledFromLocation.branchNum) | ||
.Comp(iComp) | ||
.NodeNumIn; | ||
// Match inlet node name of calling branch to determine if this call is for heating or cooling | ||
if (compInletNodeNum == this->ChillReturnNodeNum) { // Operate as chiller | ||
brIdentity = DataPlant::BrLoopType::Chiller; | ||
break; | ||
} else if (compInletNodeNum == this->HeatReturnNodeNum) { // Operate as heater | ||
brIdentity = DataPlant::BrLoopType::Heater; | ||
break; | ||
} else if (compInletNodeNum == this->CondReturnNodeNum) { // called from condenser loop | ||
brIdentity = DataPlant::BrLoopType::Condenser; | ||
break; | ||
} else { | ||
brIdentity = DataPlant::BrLoopType::NoMatch; | ||
} | ||
} | ||
|
||
// kind of a hacky way to find the location of this, but it's what plantloopequip was doing | ||
int BranchInletNodeNum = | ||
state.dataPlnt->PlantLoop(calledFromLocation.loopNum).LoopSide(calledFromLocation.loopSideNum).Branch(calledFromLocation.branchNum).NodeNumIn; | ||
|
||
// Match inlet node name of calling branch to determine if this call is for heating or cooling | ||
if (BranchInletNodeNum == this->ChillReturnNodeNum) { // Operate as chiller | ||
if (brIdentity == DataPlant::BrLoopType::Chiller) { | ||
// Calculate Node Values | ||
// Calculate Equipment and Update Variables | ||
this->InCoolingMode = RunFlag != 0; | ||
this->initialize(state); | ||
this->calculateChiller(state, CurLoad); | ||
this->updateCoolRecords(state, CurLoad, RunFlag); | ||
} else if (BranchInletNodeNum == this->HeatReturnNodeNum) { // Operate as heater | ||
} else if (brIdentity == DataPlant::BrLoopType::Heater) { | ||
// Calculate Node Values | ||
// Calculate Equipment and Update Variables | ||
this->InHeatingMode = RunFlag != 0; | ||
this->initialize(state); | ||
this->calculateHeater(state, CurLoad, RunFlag); | ||
this->updateHeatRecords(state, CurLoad, RunFlag); | ||
} else if (BranchInletNodeNum == this->CondReturnNodeNum) { // called from condenser loop | ||
} else if (brIdentity == DataPlant::BrLoopType::Condenser) { | ||
if (this->CDLoopNum > 0) { | ||
PlantUtilities::UpdateChillerComponentCondenserSide(state, | ||
this->CDLoopNum, | ||
|
@@ -164,7 +187,8 @@ namespace EnergyPlus::ChillerGasAbsorption { | |
this->CondWaterFlowRate, | ||
FirstHVACIteration); | ||
} | ||
} else { // Error, nodes do not match | ||
} else { | ||
// Error, nodes do not match | ||
ShowSevereError(state, "Invalid call to Gas Absorber Chiller " + this->Name); | ||
ShowContinueError(state, "Node connections in branch are not consistent with object nodes."); | ||
ShowFatalError(state, "Preceding conditions cause termination."); | ||
|
@@ -173,24 +197,47 @@ namespace EnergyPlus::ChillerGasAbsorption { | |
|
||
void GasAbsorberSpecs::getDesignCapacities(EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) | ||
{ | ||
// kind of a hacky way to find the location of this, but it's what plantloopequip was doing | ||
int BranchInletNodeNum = | ||
state.dataPlnt->PlantLoop(calledFromLocation.loopNum).LoopSide(calledFromLocation.loopSideNum).Branch(calledFromLocation.branchNum).NodeNumIn; | ||
bool matchfound(false); | ||
|
||
int branchTotalComp = state.dataPlnt->PlantLoop(calledFromLocation.loopNum) | ||
.LoopSide(calledFromLocation.loopSideNum) | ||
.Branch(calledFromLocation.branchNum) | ||
.TotalComponents; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The revised code will check all components in a branch, rather than just checking the branch head element as before. |
||
for (int iComp = 1; iComp <= branchTotalComp; iComp++) { | ||
// kind of a hacky way to find the location of this, but it's what plantloopequip was doing | ||
int compInletNodeNum = state.dataPlnt->PlantLoop(calledFromLocation.loopNum) | ||
.LoopSide(calledFromLocation.loopSideNum) | ||
.Branch(calledFromLocation.branchNum) | ||
.Comp(iComp) | ||
.NodeNumIn; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still using the `hacky' way, but applied to all the components in the loop branch. |
||
if (compInletNodeNum == this->ChillReturnNodeNum) { // Operate as chiller | ||
MinLoad = this->NomCoolingCap * this->MinPartLoadRat; | ||
MaxLoad = this->NomCoolingCap * this->MaxPartLoadRat; | ||
OptLoad = this->NomCoolingCap * this->OptPartLoadRat; | ||
matchfound = true; | ||
break; | ||
} else if (compInletNodeNum == this->HeatReturnNodeNum) { // Operate as heater | ||
Real64 Sim_HeatCap = this->NomCoolingCap * this->NomHeatCoolRatio; | ||
MinLoad = Sim_HeatCap * this->MinPartLoadRat; | ||
MaxLoad = Sim_HeatCap * this->MaxPartLoadRat; | ||
OptLoad = Sim_HeatCap * this->OptPartLoadRat; | ||
matchfound = true; | ||
break; | ||
} else if (compInletNodeNum == this->CondReturnNodeNum) { // called from condenser loop | ||
MinLoad = 0.0; | ||
MaxLoad = 0.0; | ||
OptLoad = 0.0; | ||
matchfound = true; | ||
break; | ||
} else { | ||
matchfound = false; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If match found, update the loads values accordingly, break and return. Otherwise, continue to the next component check. |
||
|
||
if (BranchInletNodeNum == this->ChillReturnNodeNum) { // Operate as chiller | ||
MinLoad = this->NomCoolingCap * this->MinPartLoadRat; | ||
MaxLoad = this->NomCoolingCap * this->MaxPartLoadRat; | ||
OptLoad = this->NomCoolingCap * this->OptPartLoadRat; | ||
} else if (BranchInletNodeNum == this->HeatReturnNodeNum) { // Operate as heater | ||
Real64 Sim_HeatCap = this->NomCoolingCap * this->NomHeatCoolRatio; | ||
MinLoad = Sim_HeatCap * this->MinPartLoadRat; | ||
MaxLoad = Sim_HeatCap * this->MaxPartLoadRat; | ||
OptLoad = Sim_HeatCap * this->OptPartLoadRat; | ||
} else if (BranchInletNodeNum == this->CondReturnNodeNum) { // called from condenser loop | ||
MinLoad = 0.0; | ||
MaxLoad = 0.0; | ||
OptLoad = 0.0; | ||
} else { // Error, nodes do not match | ||
if (!matchfound) { | ||
// Error, nodes do not match | ||
ShowSevereError(state, "SimGasAbsorber: Invalid call to Gas Absorbtion Chiller-Heater " + this->Name); | ||
ShowContinueError(state, "Node connections in branch are not consistent with object nodes."); | ||
ShowFatalError(state, "Preceding conditions cause termination."); | ||
|
@@ -1565,7 +1612,7 @@ namespace EnergyPlus::ChillerGasAbsorption { | |
} else { | ||
ShowSevereError(state, "CalcGasAbsorberChillerModel: Condenser flow = 0, for Gas Absorber Chiller=" + this->Name); | ||
ShowContinueErrorTimeStamp(state, ""); | ||
ShowFatalError(state, "Program Terminates due to previous error condition."); | ||
// ShowFatalError(state, "Program Terminates due to previous error condition."); | ||
} | ||
} else { | ||
lCondSupplyTemp = lCondReturnTemp; // if air cooled condenser just set supply and return to same temperature | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,6 +189,15 @@ namespace EnergyPlus::DataPlant { | |
DualOp, // Constant for Cooling or Heating Operation | ||
}; | ||
|
||
// branch loop type for absorption chillerheater models | ||
enum class BrLoopType | ||
{ | ||
Chiller, | ||
Heater, | ||
Condenser, | ||
NoMatch | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, great! In a future set of changes the actual type name might be tailored a little more to the actual application, but this is fine for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Myoldmopar Thanks! Yes, the warnings are usually recurring. So it makes sense to condense them. |
||
|
||
} // namespace EnergyPlus | ||
|
||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes are applied to both the Exhaust fired absorption chiller heater, and the gas fired absorption chiller heater. For each types of absorption chiller heater, the getDesignCapacities() and the simulate() functions would be check to identity the loop/branch type (chilled water, hot water, or condenser water).