Skip to content
Open
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
58 changes: 58 additions & 0 deletions src/EnergyPlus/ChillerElectricEIR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2617,4 +2617,62 @@ bool ElectricEIRChillerSpecs::thermosiphonDisabled(EnergyPlusData &state)
return true;
}

std::tuple<Real64, bool> ElectricEIRChillerSpecs::getDynamicMaxCapacity(EnergyPlusData &state)
{
Real64 sourceInletTemp = state.dataLoopNodes->Node(this->CondInletNodeNum).Temp;
if (this->HeatRecActive && (this->QHeatRecovered + this->QCondenser) > 0.0) {
sourceInletTemp =
(this->QHeatRecovered * this->HeatRecInletTemp + this->QCondenser * this->CondInletTemp) / (this->QHeatRecovered + this->QCondenser);
}
Real64 loadSideOutletSetpointTemp = state.dataLoopNodes->Node(this->EvapOutletNodeNum).Temp;
switch (state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).LoopDemandCalcScheme) {
case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
if ((this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) ||
(DataPlant::CompData::getPlantComponent(state, this->CWPlantLoc).CurOpSchemeType == DataPlant::OpScheme::CompSetPtBased) ||
(state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint != Node::SensedNodeFlagValue)) {
// there will be a valid setpoint on outlet
loadSideOutletSetpointTemp = state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPoint;
} else { // use plant loop overall setpoint
loadSideOutletSetpointTemp =
state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).TempSetPointNodeNum).TempSetPoint;
}
} break;
case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: {
if ((this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) ||
(DataPlant::CompData::getPlantComponent(state, this->CWPlantLoc).CurOpSchemeType == DataPlant::OpScheme::CompSetPtBased) ||
(state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi != Node::SensedNodeFlagValue)) {
// there will be a valid setpoint on outlet
loadSideOutletSetpointTemp = state.dataLoopNodes->Node(this->EvapOutletNodeNum).TempSetPointHi;
} else { // use plant loop overall setpoint
loadSideOutletSetpointTemp =
state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).TempSetPointNodeNum).TempSetPointHi;
}
} break;
default: {
assert(false);
} break;
}

// If there is a fault of Chiller SWT Sensor
if (this->FaultyChillerSWTFlag && (!state.dataGlobal->WarmupFlag) && (!state.dataGlobal->DoingSizing) && (!state.dataGlobal->KickOffSimulation)) {
int FaultIndex = this->FaultyChillerSWTIndex;
Real64 EvapOutletTempSetPoint_ff = loadSideOutletSetpointTemp;

// calculate the sensor offset using fault information
this->FaultyChillerSWTOffset = state.dataFaultsMgr->FaultsChillerSWTSensor(FaultIndex).CalFaultOffsetAct(state);
// update the EvapOutletTempSetPoint
loadSideOutletSetpointTemp =
max(this->TempLowLimitEvapOut,
min(state.dataLoopNodes->Node(this->EvapInletNodeNum).Temp, EvapOutletTempSetPoint_ff - this->FaultyChillerSWTOffset));
this->FaultyChillerSWTOffset = EvapOutletTempSetPoint_ff - loadSideOutletSetpointTemp;
}
if ((this->FlowMode == DataPlant::FlowMode::LeavingSetpointModulated) && this->ModulatedFlowSetToLoop) {
loadSideOutletSetpointTemp = state.dataLoopNodes->Node(state.dataPlnt->PlantLoop(this->CWPlantLoc.loopNum).TempSetPointNodeNum).TempSetPoint;
}
// evaluate capacity modifier curve and determine load side heat transfer
Real64 capacityModifierFuncTemp =
(this->ChillerCapFTIndex > 0) ? Curve::CurveValue(state, this->ChillerCapFTIndex, loadSideOutletSetpointTemp, sourceInletTemp) : 1.0;
return {this->RefCap * capacityModifierFuncTemp, true};
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I added this new function, wrote a unit test that tested this function, and then tried to prove the value using a test file. I found no changes at all between develop and this branch and then realized that the Plant Manager was not calling the getDynamicMaxCapacity function in places that mattered. The new calls were added to PlantCondLoopOperation such that the plant manager now knows the dynamic capacity of the EIR chiller.

} // namespace EnergyPlus::ChillerElectricEIR
2 changes: 2 additions & 0 deletions src/EnergyPlus/ChillerElectricEIR.hh
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ namespace ChillerElectricEIR {
virtual void update(EnergyPlusData &state, Real64 MyLoad, bool RunFlag);

bool thermosiphonDisabled(EnergyPlusData &state);

std::tuple<Real64, bool> getDynamicMaxCapacity(EnergyPlusData &state) override;
};

void GetElectricEIRChillerInput(EnergyPlusData &state);
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/CondenserLoopTowers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6278,7 +6278,7 @@ namespace CondenserLoopTowers {
}
}

Real64 CoolingTower::getDynamicMaxCapacity(EnergyPlusData &state)
std::tuple<Real64, bool> CoolingTower::getDynamicMaxCapacity(EnergyPlusData &state)
{
// TODO: does not include faults object impact
static constexpr std::string_view routineName("getDynamicMaxCapacity");
Expand Down Expand Up @@ -6347,7 +6347,7 @@ namespace CondenserLoopTowers {
default:
assert(false);
}
return waterMassFlowRate * CpWater * (state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp - outletWaterTemp);
return {waterMassFlowRate * CpWater * (state.dataLoopNodes->Node(this->WaterInletNodeNum).Temp - outletWaterTemp), true};
}

} // namespace CondenserLoopTowers
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/CondenserLoopTowers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ namespace CondenserLoopTowers {

static CoolingTower *factory(EnergyPlusData &state, std::string_view objectName);

Real64 getDynamicMaxCapacity(EnergyPlusData &state) override;
std::tuple<Real64, bool> getDynamicMaxCapacity(EnergyPlusData &state) override;
};

void GetTowerInput(EnergyPlusData &state);
Expand Down
12 changes: 7 additions & 5 deletions src/EnergyPlus/Plant/Component.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,15 @@ namespace DataPlant {
return state.dataPlnt->PlantLoop(plantLoc.loopNum).LoopSide(plantLoc.loopSideNum).Branch(plantLoc.branchNum).Comp(plantLoc.compNum);
}

Real64 CompData::getDynamicMaxCapacity(EnergyPlusData &state) const
std::tuple<Real64, bool> CompData::getDynamicMaxCapacity(EnergyPlusData &state) const
{
if (this->compPtr == NULL) {
return this->MaxLoad;
if (this->compPtr != nullptr) {
auto const [maxCapacity, maxCapacityIsKnown] = this->compPtr->getDynamicMaxCapacity(state);
if (maxCapacityIsKnown) {
return {maxCapacity, true};
}
}
Real64 possibleLoad = this->compPtr->getDynamicMaxCapacity(state);
return (possibleLoad == 0) ? this->MaxLoad : possibleLoad;
return {this->MaxLoad, this->MaxLoad > 0.0};
}
} // namespace DataPlant
} // namespace EnergyPlus
44 changes: 21 additions & 23 deletions src/EnergyPlus/Plant/Component.hh
Original file line number Diff line number Diff line change
Expand Up @@ -280,28 +280,26 @@ namespace DataPlant {
struct CompData
{
// Members
std::string TypeOf; // The 'keyWord' identifying component type
DataPlant::PlantEquipmentType Type; // Reference the "TypeOf" parameters in DataPlant
std::string Name; // Component name
int CompNum; // Component ID number
DataBranchAirLoopPlant::ControlType FlowCtrl; // flow control for splitter/mixer (ACTIVE/PASSIVE/BYPASS)
LoopFlowStatus FlowPriority; // status for overall loop flow determination
bool ON; // TRUE = designated component or operation scheme available
bool Available; // TRUE = designated component or operation scheme available
std::string NodeNameIn; // Component inlet node name
std::string NodeNameOut; // Component outlet node name
int NodeNumIn; // Component inlet node number
int NodeNumOut; // Component outlet node number
Real64 MyLoad; // Distributed Load
Real64 MaxLoad; // Maximum load
Real64 MinLoad; // Minimum Load
Real64 OptLoad; // Optimal Load
Real64 SizFac; // Sizing Fraction
DataPlant::OpScheme CurOpSchemeType; // updated pointer to
// Plant()%OpScheme(CurOpSchemeType)...
int NumOpSchemes; // number of schemes held in the pointer array
int CurCompLevelOpNum; // pointer to the OpScheme array defined next
// PlantLoop()%LoopSide()%Branch()%Comp()%OpScheme(curOpSchemePtr)
std::string TypeOf; // The 'keyWord' identifying component type
DataPlant::PlantEquipmentType Type; // Reference the "TypeOf" parameters in DataPlant
std::string Name; // Component name
int CompNum; // Component ID number
DataBranchAirLoopPlant::ControlType FlowCtrl; // flow control for splitter/mixer (ACTIVE/PASSIVE/BYPASS)
LoopFlowStatus FlowPriority; // status for overall loop flow determination
bool ON; // TRUE = designated component or operation scheme available
bool Available; // TRUE = designated component or operation scheme available
std::string NodeNameIn; // Component inlet node name
std::string NodeNameOut; // Component outlet node name
int NodeNumIn; // Component inlet node number
int NodeNumOut; // Component outlet node number
Real64 MyLoad; // Distributed Load
Real64 MaxLoad; // Maximum load
Real64 MinLoad; // Minimum Load
Real64 OptLoad; // Optimal Load
Real64 SizFac; // Sizing Fraction
DataPlant::OpScheme CurOpSchemeType; // updated pointer to
int NumOpSchemes; // number of schemes held in the pointer array
int CurCompLevelOpNum; // pointer to the OpScheme array defined next
Array1D<OpSchemePtrData> OpScheme; // Pointers to component on lists
Real64 EquipDemand; // Component load request based on inlet temp and outlet SP
bool EMSLoadOverrideOn; // EMS is calling to override load dispatched to component
Expand Down Expand Up @@ -346,7 +344,7 @@ namespace DataPlant {

static CompData &getPlantComponent(EnergyPlusData &state, PlantLocation const &plantLoc);

Real64 getDynamicMaxCapacity(EnergyPlusData &state) const;
std::tuple<Real64, bool> getDynamicMaxCapacity(EnergyPlusData &state) const;
};
} // namespace DataPlant
} // namespace EnergyPlus
Expand Down
6 changes: 3 additions & 3 deletions src/EnergyPlus/PlantComponent.hh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#ifndef PLANTCOMPONENT_HH_INCLUDED
#define PLANTCOMPONENT_HH_INCLUDED

#include <EnergyPlus/DataGlobals.hh>
#include <tuple>

namespace EnergyPlus {

Expand Down Expand Up @@ -90,9 +90,9 @@ public:
{
}

virtual Real64 getDynamicMaxCapacity([[maybe_unused]] EnergyPlusData &state)
virtual std::tuple<Real64, bool> getDynamicMaxCapacity([[maybe_unused]] EnergyPlusData &state)
{
return 0.0;
return {0.0, false};
}

virtual void getCurrentPower([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] Real64 &power)
Expand Down
Loading
Loading