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
248 changes: 78 additions & 170 deletions src/EnergyPlus/PlantLoopHeatPumpEIR.cc
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void EIRPlantLoopHeatPump::simulate(
}
} else if (this->airSource) {
this->setHeatRecoveryOperatingStatusASHP(state, FirstHVACIteration);
this->setOperatingFlowRatesASHP(state, FirstHVACIteration);
this->setOperatingFlowRatesASHP(state, FirstHVACIteration, CurLoad);

if (calledFromLocation.loopNum == this->heatRecoveryPlantLoc.loopNum) {
if (this->heatRecoveryAvailable) {
Expand Down Expand Up @@ -245,7 +245,7 @@ void EIRPlantLoopHeatPump::setOperatingFlowRatesWSHP(EnergyPlusData &state, bool
this->sourceSideMassFlowRate = (this->heatRecoveryHeatPump) ? state.dataLoopNodes->Node(this->sourceSideNodes.inlet).MassFlowRate
: this->sourceSideDesignMassFlowRate;

if (!FirstHVACIteration && this->flowControl == DataPlant::FlowMode::VariableSpeedPump) {
if (!FirstHVACIteration && this->flowMode == DataPlant::FlowMode::VariableSpeedPump) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Use flowMode to be consistent with the enum class name.

if ((this->loadVSBranchPump || this->loadVSLoopPump) && !this->heatRecoveryHeatPump) {
this->loadSideMassFlowRate *= std::max(this->partLoadRatio, this->minimumPLR);
if (this->loadVSBranchPump) {
Expand Down Expand Up @@ -285,7 +285,7 @@ void EIRPlantLoopHeatPump::setOperatingFlowRatesWSHP(EnergyPlusData &state, bool
}
}

void EIRPlantLoopHeatPump::setOperatingFlowRatesASHP(EnergyPlusData &state, bool FirstHVACIteration)
void EIRPlantLoopHeatPump::setOperatingFlowRatesASHP(EnergyPlusData &state, bool FirstHVACIteration, Real64 const currentLoad)
{
if (!this->running) {
this->loadSideMassFlowRate = 0.0;
Expand Down Expand Up @@ -317,7 +317,7 @@ void EIRPlantLoopHeatPump::setOperatingFlowRatesASHP(EnergyPlusData &state, bool
this->loadSideMassFlowRate = this->loadSideDesignMassFlowRate;
this->sourceSideMassFlowRate = this->sourceSideDesignMassFlowRate;

if (!FirstHVACIteration && this->flowControl == DataPlant::FlowMode::VariableSpeedPump) {
if (!FirstHVACIteration && this->flowMode == DataPlant::FlowMode::VariableSpeedPump) {
if (this->loadVSBranchPump || this->loadVSLoopPump) {
this->loadSideMassFlowRate *= std::max(this->partLoadRatio, this->minimumPLR);
if (this->loadVSBranchPump) {
Expand Down Expand Up @@ -361,6 +361,72 @@ void EIRPlantLoopHeatPump::setOperatingFlowRatesASHP(EnergyPlusData &state, bool
}
}

void EIRFuelFiredHeatPump::setOperatingFlowRatesASHP(EnergyPlusData &state, bool FirstHVACIteration, Real64 const currentLoad)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Set the flow rates at the same time as EIRPlantLoopHeatPumps. Move the logic from EIRFuelFiredHeatPump::doPhysics here.

{
if (!this->running) {
this->loadSideMassFlowRate = 0.0;
this->sourceSideMassFlowRate = 0.0;
PlantUtilities::SetComponentFlowRate(
state, this->loadSideMassFlowRate, this->loadSideNodes.inlet, this->loadSideNodes.outlet, this->loadSidePlantLoc);
if (this->heatRecoveryAvailable) {
// set the HR flow to zero if the heat pump is off
this->heatRecoveryMassFlowRate = 0.0;
PlantUtilities::SetComponentFlowRate(
state, this->heatRecoveryMassFlowRate, this->heatRecoveryNodes.inlet, this->heatRecoveryNodes.outlet, this->heatRecoveryPlantLoc);
}
} else { // the heat pump must run
this->loadSideMassFlowRate = this->loadSideDesignMassFlowRate;
this->sourceSideMassFlowRate = this->sourceSideDesignMassFlowRate;

if (!FirstHVACIteration && this->flowMode == DataPlant::FlowMode::LeavingSetpointModulated) {
auto &thisInletNode = state.dataLoopNodes->Node(this->loadSideNodes.inlet);
auto &thisOutletNode = state.dataLoopNodes->Node(this->loadSideNodes.outlet);
Real64 FFHPDeltaTemp = 0.0;
Real64 CpLoad = this->loadSidePlantLoc.loop->glycol->getSpecificHeat(state, thisInletNode.Temp, "PLFFHPEIR::simulate()");
if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpFuelFiredHeating) {
if (this->loadSidePlantLoc.loop->LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::SingleSetPoint) {
FFHPDeltaTemp = thisOutletNode.TempSetPoint - thisInletNode.Temp;
} else { // DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand
FFHPDeltaTemp = thisOutletNode.TempSetPointLo - thisInletNode.Temp;
}
this->loadSideOutletTemp = FFHPDeltaTemp + thisInletNode.Temp;
if ((FFHPDeltaTemp > 0.0) && currentLoad > 0.0) {
this->loadSideMassFlowRate = currentLoad / (CpLoad * FFHPDeltaTemp);
this->loadSideMassFlowRate = min(this->loadSideDesignMassFlowRate, this->loadSideMassFlowRate);
} else {
this->loadSideOutletTemp = thisInletNode.Temp;
this->loadSideMassFlowRate = 0.0;
}
} else if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpFuelFiredCooling) {
if (this->loadSidePlantLoc.loop->LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::SingleSetPoint) {
FFHPDeltaTemp = thisInletNode.Temp - thisOutletNode.TempSetPoint;
} else { // DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand
FFHPDeltaTemp = thisInletNode.Temp - thisOutletNode.TempSetPointHi;
}
this->loadSideOutletTemp = thisInletNode.Temp - FFHPDeltaTemp;
if ((FFHPDeltaTemp > 0.0) && std::abs(currentLoad) > 0.0) {
this->loadSideMassFlowRate = std::abs(currentLoad) / (CpLoad * FFHPDeltaTemp);
this->loadSideMassFlowRate = min(this->loadSideDesignMassFlowRate, this->loadSideMassFlowRate);
} else {
this->loadSideOutletTemp = thisInletNode.Temp;
this->loadSideMassFlowRate = 0.0;
}
}
}
PlantUtilities::SetComponentFlowRate(
state, this->loadSideMassFlowRate, this->loadSideNodes.inlet, this->loadSideNodes.outlet, this->loadSidePlantLoc);

// if there's no flow in one, try to turn the entire heat pump off
if (this->loadSideMassFlowRate <= 0.0) {
this->loadSideMassFlowRate = 0.0;
this->sourceSideMassFlowRate = 0.0;
this->running = false;
PlantUtilities::SetComponentFlowRate(
state, this->loadSideMassFlowRate, this->loadSideNodes.inlet, this->loadSideNodes.outlet, this->loadSidePlantLoc);
}
}
}

void EIRPlantLoopHeatPump::doPhysics(EnergyPlusData &state, Real64 currentLoad)
{
// ideally the plant is going to ensure that we don't have a runflag=true when the load is invalid, but
Expand Down Expand Up @@ -963,7 +1029,7 @@ void EIRPlantLoopHeatPump::onInitLoopEquip(EnergyPlusData &state, [[maybe_unused
}
}

if (this->flowControl == DataPlant::FlowMode::VariableSpeedPump) {
if (this->flowMode == DataPlant::FlowMode::VariableSpeedPump) {
this->loadVSPumpMinLimitMassFlow =
PlantUtilities::MinFlowIfBranchHasVSPump(state, this->loadSidePlantLoc, this->loadVSBranchPump, this->loadVSLoopPump, true);
if (this->waterSource) {
Expand Down Expand Up @@ -1777,9 +1843,9 @@ void EIRPlantLoopHeatPump::processInputForEIRPLHP(EnergyPlusData &state)
fields, schemaProps, "thermosiphon_minimum_temperature_difference");
}

std::string flowControlTypeName =
std::string flowModeTypeName =
Util::makeUPPER(state.dataInputProcessing->inputProcessor->getAlphaFieldValue(fields, schemaProps, "flow_mode"));
thisPLHP.flowControl = static_cast<DataPlant::FlowMode>(getEnumValue(DataPlant::FlowModeNamesUC, flowControlTypeName));
thisPLHP.flowMode = static_cast<DataPlant::FlowMode>(getEnumValue(DataPlant::FlowModeNamesUC, flowModeTypeName));

// fields only in heating object
if (thisPLHP.EIRHPType == DataPlant::PlantEquipmentType::HeatPumpEIRHeating) {
Expand Down Expand Up @@ -2521,160 +2587,6 @@ void EIRFuelFiredHeatPump::doPhysics(EnergyPlusData &state, Real64 currentLoad)
// Set the current load equal to the FFHP load
Real64 FFHPloadSideLoad = currentLoad; // this->loadSidePlantLoad = MyLoad;

if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpFuelFiredHeating) {

// Initialize the delta temperature to zero
Real64 FFHPDeltaTemp = 0.0; // C - FFHP inlet to outlet temperature difference, set in all necessary code paths so no initialization required

if (this->loadSidePlantLoc.side->FlowLock == DataPlant::FlowLock::Unlocked) {
// Either set the flow to the Constant value or calculate the flow for the variable volume
if (this->flowMode == DataPlant::FlowMode::Constant) {
// Then find the flow rate and outlet temp
this->loadSideMassFlowRate = this->loadSideDesignMassFlowRate;
PlantUtilities::SetComponentFlowRate(
state, this->loadSideMassFlowRate, this->loadSideNodes.inlet, this->loadSideNodes.outlet, this->loadSidePlantLoc);

if ((this->loadSideMassFlowRate != 0.0) &&
((this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpFuelFiredHeating && currentLoad > 0.0))) {
FFHPDeltaTemp = currentLoad / (this->loadSideMassFlowRate * CpLoad);
} else {
FFHPDeltaTemp = 0.0;
}
this->loadSideOutletTemp = FFHPDeltaTemp + thisInletNode.Temp;

} else if (this->flowMode == DataPlant::FlowMode::LeavingSetpointModulated) {
// Calculate the Delta Temp from the inlet temp to the FFHP outlet setpoint
// Then find the flow rate and outlet temp

if (this->loadSidePlantLoc.loop->LoopDemandCalcScheme == DataPlant::LoopDemandCalcScheme::SingleSetPoint) {
FFHPDeltaTemp = thisOutletNode.TempSetPoint - thisInletNode.Temp;
} else { // DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand
FFHPDeltaTemp = thisOutletNode.TempSetPointLo - thisInletNode.Temp;
}

this->loadSideOutletTemp = FFHPDeltaTemp + thisInletNode.Temp;

if ((FFHPDeltaTemp > 0.0) && ((this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpFuelFiredHeating && currentLoad > 0.0))) {
this->loadSideMassFlowRate = currentLoad / (CpLoad * FFHPDeltaTemp);
this->loadSideMassFlowRate = min(this->loadSideDesignMassFlowRate, this->loadSideMassFlowRate);
} else {
this->loadSideMassFlowRate = 0.0;
}
PlantUtilities::SetComponentFlowRate(
state, this->loadSideMassFlowRate, this->loadSideNodes.inlet, this->loadSideNodes.outlet, this->loadSidePlantLoc);

} // End of Constant/Variable Flow If Block
} else { // If FlowLock is True
// Set the boiler flow rate from inlet node and then check performance
this->loadSideMassFlowRate = thisInletNode.MassFlowRate;

if ((this->loadSideMassFlowRate > 0.0) &&
((this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpFuelFiredHeating && currentLoad > 0.0))) { // this FFHP has a heat load
// FFHPloadSideLoad = currentLoad;
// if (FFHPloadSideLoad > this->referenceCapacity * this->maxPLR) FFHPloadSideLoad = this->referenceCapacity * this->maxPLR;
// if (FFHPloadSideLoad < this->referenceCapacity * this->minPLR) FFHPloadSideLoad = this->referenceCapacity * this->minPLR;
FFHPloadSideLoad = std::clamp(FFHPloadSideLoad, this->referenceCapacity * this->minPLR, this->referenceCapacity * this->maxPLR);
this->loadSideOutletTemp = thisInletNode.Temp + FFHPloadSideLoad / (this->loadSideMassFlowRate * CpLoad);
} else {
FFHPloadSideLoad = 0.0;
this->loadSideOutletTemp = thisInletNode.Temp;
}
}
} else if (this->EIRHPType == DataPlant::PlantEquipmentType::HeatPumpFuelFiredCooling) {
if (this->loadSidePlantLoc.side->FlowLock == DataPlant::FlowLock::Unlocked) {
// this->PossibleSubcooling =
// !(state.dataPlnt->PlantLoop(PlantLoopNum).LoopSide(LoopSideNum).Branch(BranchNum).Comp(CompNum).CurOpSchemeType ==
// DataPlant::OpScheme::CompSetPtBased);
Real64 evapDeltaTemp = 0.0; // Evaporator temperature difference [C]

// Either set the flow to the Constant value or calculate the flow for the variable volume case
if (this->flowMode == DataPlant::FlowMode::Constant) {
// Set the evaporator mass flow rate to design
// Start by assuming max (design) flow
this->loadSideMassFlowRate = this->loadSideDesignMassFlowRate;
// Use PlantUtilities::SetComponentFlowRate to decide actual flow
PlantUtilities::SetComponentFlowRate(
state, this->loadSideMassFlowRate, this->loadSideNodes.inlet, this->loadSideNodes.outlet, this->loadSidePlantLoc);
if (this->loadSideMassFlowRate != 0.0) {
evapDeltaTemp = std::abs(currentLoad) / (this->loadSideMassFlowRate * CpLoad); // MyLoad = net evaporator capacity, QEvaporator
} else {
evapDeltaTemp = 0.0;
}
this->loadSideOutletTemp = thisInletNode.Temp - evapDeltaTemp;
} else if (this->flowMode == DataPlant::FlowMode::LeavingSetpointModulated) {
switch (this->loadSidePlantLoc.loop->LoopDemandCalcScheme) {
case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
// Calculate the Delta Temp from the inlet temp to the chiller outlet setpoint
evapDeltaTemp = thisInletNode.Temp - thisOutletNode.TempSetPoint;
} break;
case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: {
evapDeltaTemp = thisInletNode.Temp - thisOutletNode.TempSetPointHi;
} break;
default: {
assert(false);
} break;
}

if (evapDeltaTemp != 0) {
this->loadSideMassFlowRate = max(0.0, (std::abs(currentLoad) / (CpLoad * evapDeltaTemp)));
// Check to see if the Maximum is exceeded, if so set to maximum
this->loadSideMassFlowRate = min(this->loadSideDesignMassFlowRate, this->loadSideMassFlowRate);
// Use PlantUtilities::SetComponentFlowRate to decide actual flow
PlantUtilities::SetComponentFlowRate(
state, this->loadSideMassFlowRate, this->loadSideNodes.inlet, this->loadSideNodes.outlet, this->loadSidePlantLoc);
// Should we recalculate this with the corrected setpoint?
switch (this->loadSidePlantLoc.loop->LoopDemandCalcScheme) {
case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
this->loadSideOutletTemp = thisOutletNode.TempSetPoint;
} break;
case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: {
this->loadSideOutletTemp = thisOutletNode.TempSetPointHi;
} break;
default:
break;
}
} else {
// Try to request zero flow
this->loadSideMassFlowRate = 0.0;
// Use PlantUtilities::SetComponentFlowRate to decide actual flow
PlantUtilities::SetComponentFlowRate(
state, this->loadSideMassFlowRate, this->loadSideNodes.inlet, this->loadSideNodes.outlet, this->loadSidePlantLoc);
// No deltaT since component is not running
this->loadSideOutletTemp = thisInletNode.Temp;
// this->QEvaporator = 0.0;
// PartLoadRat = 0.0;
// this->ChillerPartLoadRatio = 0.0;

// if (this->DeltaTErrCount < 1 && !state.dataGlobal->WarmupFlag) {
if (!state.dataGlobal->WarmupFlag) {
// ++this->DeltaTErrCount;
ShowWarningError(state, "FFHP evaporator DeltaTemp = 0 in mass flow calculation (Tevapin = Tevapout setpoint temp).");
ShowContinueErrorTimeStamp(state, "");
// } else if (!state.dataGlobal->WarmupFlag) {
// ++this->ChillerCapFTError;
ShowWarningError( // RecurringWarningErrorAtEnd(
state,
format("{} \"{}\": FFHP evaporator DeltaTemp = 0 in mass flow calculation warning continues...",
DataPlant::PlantEquipTypeNames[static_cast<int>(this->EIRHPType)],
this->name));
// this->DeltaTErrCountIndex,
// evapDeltaTemp,
// evapDeltaTemp);
}
}
}
} else { // If FlowLock is True
this->loadSideMassFlowRate = thisInletNode.MassFlowRate;
PlantUtilities::SetComponentFlowRate(
state, this->loadSideMassFlowRate, this->loadSideNodes.inlet, this->loadSideNodes.outlet, this->loadSidePlantLoc);
// Some other component set the flow to 0. No reason to continue with calculations.
if (this->loadSideMassFlowRate == 0.0) {
FFHPloadSideLoad = 0.0;
// return;
}
} // This is the end of the FlowLock Block
}

// Determine which air variable to use for GAHP:
// Source (air) side variable to use
// auto &thisloadsideinletnode = state.dataLoopNodes->Node(this->loadSideNodes.inlet);
Expand Down Expand Up @@ -2879,17 +2791,13 @@ void EIRFuelFiredHeatPump::doPhysics(EnergyPlusData &state, Real64 currentLoad)
eirAuxElecFuncPLR = 0.0;
}

if (partLoadRatio < this->minPLR) {
this->fuelRate = 0.0;
this->powerUsage = 0.0;
} else {
this->fuelRate = this->loadSideHeatTransfer / (this->referenceCOP * CRF) * eirModifierFuncPLR * eirModifierFuncTemp * eirDefrost;
this->fuelRate = this->loadSideHeatTransfer / (this->referenceCOP * CRF) * eirModifierFuncPLR * eirModifierFuncTemp * eirDefrost;
Comment on lines -2882 to +2794
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The previous behavior was to zero out the fuel rate when the partLoadRatio was less than the minPLR which triggered instances where the unit was not using any energy.


this->powerUsage = this->nominalAuxElecPower * eirAuxElecFuncTemp * eirAuxElecFuncPLR;
if (this->defrostType == DefrostType::Timed) {
this->powerUsage += this->defrostResistiveHeaterCap * this->defrostOpTimeFrac * reportingInterval;
}
this->powerUsage = this->nominalAuxElecPower * eirAuxElecFuncTemp * eirAuxElecFuncPLR;
if (this->defrostType == DefrostType::Timed) {
this->powerUsage += this->defrostResistiveHeaterCap * this->defrostOpTimeFrac;
}

this->powerUsage += this->standbyElecPower;

// energy balance on heat pump
Expand Down
Loading
Loading