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
40 changes: 27 additions & 13 deletions src/EnergyPlus/HybridEvapCoolingModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1518,19 +1518,33 @@ namespace HybridEvapCoolingModel {
thisSetting.oMode.CalculateCurveVal(state, StepIns.Tosa, Wosa, StepIns.Tra, Wra, UnscaledMsa, OSAF, WATER_USE);

// Calculate partload fraction required to meet all requirements
Real64 PartRuntimeFraction = 0;
PartRuntimeFraction = CalculatePartRuntimeFraction(MinOA_Msa,
thisSetting.Supply_Air_Ventilation_Volume * state.dataEnvrn->StdRhoAir,
StepIns.RequestedCoolingLoad,
StepIns.RequestedHeatingLoad,
SensibleRoomORZone,
StepIns.ZoneDehumidificationLoad,
StepIns.ZoneMoistureLoad,
latentRoomORZone); //

Real64 RunFractionTotalFuel =
thisSetting.ElectricalPower * PartRuntimeFraction; // fraction can be above 1 meaning its not able to do it completely in a time step.
thisSetting.Runtime_Fraction = PartRuntimeFraction;
// Fraction can be above 1 meaning its not able to do it completely in a time step
Real64 PartRuntimeFraction = CalculatePartRuntimeFraction(MinOA_Msa,
thisSetting.Supply_Air_Ventilation_Volume * state.dataEnvrn->StdRhoAir,
StepIns.RequestedCoolingLoad,
StepIns.RequestedHeatingLoad,
SensibleRoomORZone,
StepIns.ZoneDehumidificationLoad,
StepIns.ZoneMoistureLoad,
latentRoomORZone);

Real64 RunFractionTotalFuel;
switch (ObjectiveFunction) {
default:
case ObjectiveFunctionType::ElectricityUse:
RunFractionTotalFuel = thisSetting.ElectricalPower * PartRuntimeFraction;
break;
case ObjectiveFunctionType::SecondFuelUse:
RunFractionTotalFuel = thisSetting.SecondaryFuelConsumptionRate * PartRuntimeFraction;
break;
case ObjectiveFunctionType::ThirdFuelUse:
RunFractionTotalFuel = thisSetting.ThirdFuelConsumptionRate * PartRuntimeFraction;
break;
case ObjectiveFunctionType::WaterUse:
RunFractionTotalFuel = thisSetting.WaterConsumptionRate * PartRuntimeFraction;
break;
}
thisSetting.Runtime_Fraction = PartRuntimeFraction; //

if (Conditioning_load_met && Humidification_load_met) {
// store best performing mode
Expand Down
22 changes: 18 additions & 4 deletions src/EnergyPlus/HybridEvapCoolingModel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@ namespace HybridEvapCoolingModel {
Num
};

enum class ObjectiveFunctionType
{
Invalid = -1,
ElectricityUse,
SecondFuelUse,
ThirdFuelUse,
WaterUse,
Num
};

constexpr std::array<std::string_view, (int)ObjectiveFunctionType::Num> objectiveFunctionNamesUC = {
"ELECTRICITY USE", "SECOND FUEL USE", "THIRD FUEL USE", "WATER USE"};

class CModeSolutionSpace
{
public:
Expand Down Expand Up @@ -244,10 +257,11 @@ namespace HybridEvapCoolingModel {
Real64 FanHeatInAirFrac; // the fraction of fan heat in air stream to calculate fan heat gain if not in lookup tables
Real64 ScalingFactor; // taken from IDF N3, linear scaling factor.
Real64 ScaledSystemMaximumSupplyAirMassFlowRate; // the scaled system max supply mass flow rate in m3/s.
Real64 ScaledSystemMaximumSupplyAirVolumeFlowRate; // the scaled system max supply volume flow rate in m3/s.
Constant::eFuel firstFuel = Constant::eFuel::Invalid; // First fuel type, currently electricity is only option
Constant::eFuel secondFuel = Constant::eFuel::Invalid; // Second fuel type
Constant::eFuel thirdFuel = Constant::eFuel::Invalid; // Third fuel type
Real64 ScaledSystemMaximumSupplyAirVolumeFlowRate; // the scaled system max supply volume flow rate in m3/s.
Constant::eFuel firstFuel = Constant::eFuel::Invalid; // First fuel type, currently electricity is only option
Constant::eFuel secondFuel = Constant::eFuel::Invalid; // Second fuel type
Constant::eFuel thirdFuel = Constant::eFuel::Invalid; // Third fuel type
ObjectiveFunctionType ObjectiveFunction = ObjectiveFunctionType::ElectricityUse; // Objective function to minimize

int UnitOn; // feels like it should be a bool but its an output and I couldn't get it to work as a bool
Real64 UnitTotalCoolingRate; // unit output to zone, total cooling rate [W]
Expand Down
6 changes: 6 additions & 0 deletions src/EnergyPlus/HybridUnitaryAirConditioners.cc
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,12 @@ void GetInputZoneHybridUnitaryAirConditioners(EnergyPlusData &state, bool &Error
}

// A18, \field Objective Function Minimizes
if (!lAlphaBlanks(18) && (hybridUnitaryAC.ObjectiveFunction = static_cast<HybridEvapCoolingModel::ObjectiveFunctionType>(
getEnumValue(HybridEvapCoolingModel::objectiveFunctionNamesUC, Util::makeUPPER(Alphas(18))))) ==
HybridEvapCoolingModel::ObjectiveFunctionType::Invalid) {
ShowSevereInvalidKey(state, eoh, cAlphaFields(18), Alphas(18));
ErrorsFound = true;
}

// A19, \ OA requirement pointer
if (!lAlphaBlanks(19)) {
Expand Down
22 changes: 14 additions & 8 deletions tst/EnergyPlus/unit/UnitaryHybridAirConditioner.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ValidateFieldsParsing
"Electricity, !- First fuel type",
"NaturalGas, !- Second fuel type",
"DistrictCooling, !- Third fuel type",
", !- Objective Function Minimizes",
"SZ DSOA SPACE 1, !- Design Specification Outdoor Air Object Name",
"Electricity Use, !- Objective Function Minimizes",
"SZ DSOA SPACE 1, !- Design Specification Outdoor Air Object Name",
"Mode0 Standby, !- Mode0 Name",
", !- Mode0 Supply Air Temperature Lookup Table Name",
", !- Mode0 Supply Air Humidity Ratio Lookup Table Name",
Expand Down Expand Up @@ -546,8 +546,8 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ValidateFieldsParsing
"Electricity, !- First fuel type",
"NaturalGas, !- Second fuel type",
"DistrictCooling, !- Third fuel type",
", !- Objective Function Minimizes",
"SZ DSOA SPACE 2, !- Design Specification Outdoor Air Object Name",
"Water Use, !- Objective Function Minimizes",
"SZ DSOA SPACE 2, !- Design Specification Outdoor Air Object Name",
"Mode0 Standby, !- Mode0 Name",
", !- Mode0 Supply Air Temperature Lookup Table Name",
", !- Mode0 Supply Air Humidity Ratio Lookup Table Name",
Expand Down Expand Up @@ -591,12 +591,18 @@ TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ValidateFieldsParsing
bool ErrorsFound = false;
GetInputZoneHybridUnitaryAirConditioners(*state, ErrorsFound);
unsigned long expectedOperatingModesSize = 2;
auto &hybridUnit1 = state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(1);
auto &hybridUnit2 = state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(2);

// check the number of operating modes
EXPECT_EQ(state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(1).OperatingModes.size(), expectedOperatingModesSize);
EXPECT_EQ(state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(2).OperatingModes.size(), expectedOperatingModesSize);
EXPECT_EQ(hybridUnit1.OperatingModes.size(), expectedOperatingModesSize);
EXPECT_EQ(hybridUnit2.OperatingModes.size(), expectedOperatingModesSize);
// check if names for HybridUnitaryAC are converted to upper case
EXPECT_EQ("HYBRID UNIT 1", state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(1).Name);
EXPECT_EQ("HYBRID UNIT 2", state->dataHybridUnitaryAC->ZoneHybridUnitaryAirConditioner(2).Name);
EXPECT_EQ(hybridUnit1.Name, "HYBRID UNIT 1");
EXPECT_EQ(hybridUnit2.Name, "HYBRID UNIT 2");
// check that objective function was set or defaulted correctly
EXPECT_EQ(hybridUnit1.ObjectiveFunction, HybridEvapCoolingModel::ObjectiveFunctionType::ElectricityUse);
EXPECT_EQ(hybridUnit2.ObjectiveFunction, HybridEvapCoolingModel::ObjectiveFunctionType::WaterUse);
}

TEST_F(EnergyPlusFixture, Test_UnitaryHybridAirConditioner_ValidateMinimumIdfInput)
Expand Down
Loading