Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/NREL/EnergyPlus into Ste…
Browse files Browse the repository at this point in the history
…amPart1Followup
  • Loading branch information
dareumnam committed Sep 20, 2023
2 parents a335e07 + 9819321 commit cc427fd
Show file tree
Hide file tree
Showing 209 changed files with 10,430 additions and 28,115 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ \subsection{Built-In Variables}\label{built-in-variables}
\midrule
\endhead

Year & 1900--2100 \tabularnewline
Year & 1900--2100 (Read from EPW) \tabularnewline
CalendarYear & 1900--2100 (Assigned from RunPeriod - only valid for Weather File Run Periods) \tabularnewline
Month & 1--12 \tabularnewline
DayOfMonth & 1--31 \tabularnewline
DayOfWeek & 1--7 (1 = Sun, 2 = Mon, \ldots) \tabularnewline
Expand Down
3 changes: 2 additions & 1 deletion doc/readthedocs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
sphinx-rtd-theme
sphinx>3
urllib3==1.26.15
Jinja2<3.1 # cannot import name 'environmentfilter' from 'jinja2'
urllib3==1.26.15
2 changes: 1 addition & 1 deletion doc/readthedocs/sphinx/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
# # OK, now we need to make sure the epJSON schema is generated so we can process it
# Since this will primarily just be run by readthedocs, I'm just going to re-run the schema generator
try:
check_call(['python3', 'scripts/dev/generate_epJSON_schema/generate_epJSON_schema.py', 'idd'], cwd=repo_root)
check_call(['python3', 'idd/schema/generate_epJSON_schema.py', 'idd'], cwd=repo_root)
except CalledProcessError as e:
raise Exception(f"Schema Generation failed! Exception string: {str(e)}") from None
except FileNotFoundError as e:
Expand Down
8 changes: 6 additions & 2 deletions idd/Energy+.idd.in
Original file line number Diff line number Diff line change
Expand Up @@ -100940,7 +100940,9 @@ LifeCycleCost:UsePriceEscalation,
\key ElectricitySurplusSold
\key ElectricityNet
\key NaturalGas
\key Steam
\key DistrictCooling
\key DistrictHeatingWater
\key DistrictHeatingSteam
\key Gasoline
\key Diesel
\key Coal
Expand Down Expand Up @@ -101028,7 +101030,9 @@ LifeCycleCost:UseAdjustment,
\key ElectricitySurplusSold
\key ElectricityNet
\key NaturalGas
\key Steam
\key DistrictCooling
\key DistrictHeatingWater
\key DistrictHeatingSteam
\key Gasoline
\key Diesel
\key Coal
Expand Down
112 changes: 45 additions & 67 deletions src/EnergyPlus/ChillerExhaustAbsorption.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1874,86 +1874,64 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo
// all variables that are local copies of data structure
// variables are prefaced with an "l" for local.
// Local copies of ExhaustAbsorberReportVars Type
Real64 lHotWaterReturnTemp(0.0);
Real64 lHeatingLoad(0.0); // heating load on the chiller
Real64 lHeatThermalEnergyUseRate(0.0); // instantaneous use of thermal energy for period for heating
Real64 lHeatElectricPower(0.0); // parasitic electric power used for heating
Real64 lHotWaterSupplyTemp(0.0); // reporting: hot water supply (outlet) temperature
Real64 lHotWaterMassFlowRate(0.0); // reporting: hot water mass flow rate
Real64 lHeatPartLoadRatio(0.0); // operating part load ratio (load/capacity for heating)
Real64 lAvailableHeatingCapacity(0.0); // current heating capacity
Real64 lFractionOfPeriodRunning(0.0);
Real64 lExhaustInTemp(0.0); // Exhaust inlet temperature
Real64 lExhaustInFlow(0.0); // Exhaust inlet flow rate
Real64 lExhHeatRecPotentialHeat(0.0); // Exhaust heat recovery potential
Real64 lExhaustAirHumRat(0.0);
// other local variables
Real64 HeatSupplySetPointTemp(0.0);

// set node values to data structure values for nodes

int lHeatReturnNodeNum = this->HeatReturnNodeNum;
int lHeatSupplyNodeNum = this->HeatSupplyNodeNum;
int lExhaustAirInletNodeNum = this->ExhaustAirInletNodeNum;

// set local copies of data from rest of input structure

Real64 lNomCoolingCap = this->NomCoolingCap; // W - design nominal capacity of Absorber
Real64 lNomHeatCoolRatio = this->NomHeatCoolRatio; // ratio of heating to cooling capacity
Real64 lThermalEnergyHeatRatio = this->ThermalEnergyHeatRatio; // ratio of ThermalEnergy input to heating output
Real64 lElecHeatRatio = this->ElecHeatRatio; // ratio of electricity input to heating output
Real64 lMinPartLoadRat = this->MinPartLoadRat; // min allowed operating frac full load
Real64 lMaxPartLoadRat = this->MaxPartLoadRat; // max allowed operating frac full load
int lHeatCapFCoolCurve = this->HeatCapFCoolCurve; // Heating Capacity Function of Cooling Capacity Curve
int lThermalEnergyHeatFHPLRCurve = this->ThermalEnergyHeatFHPLRCurve; // ThermalEnergy Input to heat output ratio during heating only function
int LoopNum = this->HWPlantLoc.loopNum;
DataPlant::LoopSideLocation LoopSideNum = this->HWPlantLoc.loopSideNum;

Real64 Cp_HW = FluidProperties::GetSpecificHeatGlycol(
state, state.dataPlnt->PlantLoop(LoopNum).FluidName, lHotWaterReturnTemp, state.dataPlnt->PlantLoop(LoopNum).FluidIndex, RoutineName);

Real64 lCoolElectricPower = this->CoolElectricPower; // parasitic electric power used for cooling
Real64 lCoolThermalEnergyUseRate = this->CoolThermalEnergyUseRate; // instantaneous use of thermal energy for period for cooling
Real64 lCoolPartLoadRatio = this->CoolPartLoadRatio;

// initialize entering conditions
lHotWaterReturnTemp = state.dataLoopNodes->Node(lHeatReturnNodeNum).Temp;
lHotWaterMassFlowRate = state.dataLoopNodes->Node(lHeatReturnNodeNum).MassFlowRate;
switch (state.dataPlnt->PlantLoop(LoopNum).LoopDemandCalcScheme) {
case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
HeatSupplySetPointTemp = state.dataLoopNodes->Node(lHeatSupplyNodeNum).TempSetPoint;
} break;
case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: {
HeatSupplySetPointTemp = state.dataLoopNodes->Node(lHeatSupplyNodeNum).TempSetPointLo;
} break;
default: {
assert(false);
} break;
}
Real64 HeatDeltaTemp = std::abs(lHotWaterReturnTemp - HeatSupplySetPointTemp);
auto &hwPlantLoop = state.dataPlnt->PlantLoop(this->HWPlantLoc.loopNum);
const Real64 HeatSupplySetPointTemp = [this, &hwPlantLoop, &state]() {
switch (hwPlantLoop.LoopDemandCalcScheme) {
case DataPlant::LoopDemandCalcScheme::SingleSetPoint: {
return state.dataLoopNodes->Node(this->HeatSupplyNodeNum).TempSetPoint;
}
case DataPlant::LoopDemandCalcScheme::DualSetPointDeadBand: {
return state.dataLoopNodes->Node(this->HeatSupplyNodeNum).TempSetPointLo;
}
default: {
assert(false);
return 0.0;
}
}
}();

auto const &heatReturnNode = state.dataLoopNodes->Node(this->HeatReturnNodeNum);
Real64 const HeatDeltaTemp = std::abs(heatReturnNode.Temp - HeatSupplySetPointTemp);
// reporting: hot water mass flow rate
Real64 lHotWaterMassFlowRate = heatReturnNode.MassFlowRate;

// If no loop demand or Absorber OFF, return
// will need to modify when absorber can act as a boiler
if (MyLoad <= 0 || !RunFlag) {
// set node temperatures
lHotWaterSupplyTemp = lHotWaterReturnTemp;
lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, lCoolPartLoadRatio) / lMinPartLoadRat);
lHotWaterSupplyTemp = heatReturnNode.Temp;
lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, this->CoolPartLoadRatio) / this->MinPartLoadRat);
} else {

Real64 const Cp_HW =
FluidProperties::GetSpecificHeatGlycol(state, hwPlantLoop.FluidName, heatReturnNode.Temp, hwPlantLoop.FluidIndex, RoutineName);

// Determine available heating capacity using the current cooling load
lAvailableHeatingCapacity =
this->NomHeatCoolRatio * this->NomCoolingCap * Curve::CurveValue(state, lHeatCapFCoolCurve, (this->CoolingLoad / this->NomCoolingCap));
lAvailableHeatingCapacity = this->NomHeatCoolRatio * this->NomCoolingCap *
Curve::CurveValue(state, this->HeatCapFCoolCurve, (this->CoolingLoad / this->NomCoolingCap));

// Calculate current load for heating
MyLoad = sign(max(std::abs(MyLoad), this->HeatingCapacity * lMinPartLoadRat), MyLoad);
MyLoad = sign(min(std::abs(MyLoad), this->HeatingCapacity * lMaxPartLoadRat), MyLoad);
MyLoad = sign(max(std::abs(MyLoad), this->HeatingCapacity * this->MinPartLoadRat), MyLoad);
MyLoad = sign(min(std::abs(MyLoad), this->HeatingCapacity * this->MaxPartLoadRat), MyLoad);

// Determine the following variables depending on if the flow has been set in
// the nodes (flowlock=1 to 2) or if the amount of load is still be determined (flowlock=0)
// chilled water flow,
// cooling load taken by the chiller, and
// supply temperature
switch (state.dataPlnt->PlantLoop(LoopNum).LoopSide(LoopSideNum).FlowLock) {
switch (hwPlantLoop.LoopSide(this->HWPlantLoc.loopSideNum).FlowLock) {
case DataPlant::FlowLock::Unlocked: { // mass flow rates may be changed by loop components
lHeatingLoad = std::abs(MyLoad);
if (HeatDeltaTemp != 0) {
Expand Down Expand Up @@ -1989,25 +1967,25 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo

// Calculate ThermalEnergy consumption for heating
// ThermalEnergy used for heating availCap * HIR * HIR-FT * HIR-FPLR

lHeatThermalEnergyUseRate =
lAvailableHeatingCapacity * lThermalEnergyHeatRatio * Curve::CurveValue(state, lThermalEnergyHeatFHPLRCurve, lHeatPartLoadRatio);
lHeatThermalEnergyUseRate = lAvailableHeatingCapacity * this->ThermalEnergyHeatRatio *
Curve::CurveValue(state, this->ThermalEnergyHeatFHPLRCurve, lHeatPartLoadRatio);

// calculate the fraction of the time period that the chiller would be running
// use maximum from heating and cooling sides
lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, lCoolPartLoadRatio) / lMinPartLoadRat);
lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, this->CoolPartLoadRatio) / this->MinPartLoadRat);

// Calculate electric parasitics used
// for heating based on nominal capacity not available capacity
lHeatElectricPower = lNomCoolingCap * lNomHeatCoolRatio * lElecHeatRatio * lFractionOfPeriodRunning;
lHeatElectricPower = this->NomCoolingCap * this->NomHeatCoolRatio * this->ElecHeatRatio * lFractionOfPeriodRunning;
// Coodinate electric parasitics for heating and cooling to avoid double counting
// Total electric is the max of heating electric or cooling electric
// If heating electric is greater, leave cooling electric and subtract if off of heating elec
// If cooling electric is greater, set heating electric to zero

lExhaustInTemp = state.dataLoopNodes->Node(lExhaustAirInletNodeNum).Temp;
lExhaustInFlow = state.dataLoopNodes->Node(lExhaustAirInletNodeNum).MassFlowRate;
Real64 CpAir = Psychrometrics::PsyCpAirFnW(lExhaustAirHumRat);
lExhaustInTemp = state.dataLoopNodes->Node(this->ExhaustAirInletNodeNum).Temp;
lExhaustInFlow = state.dataLoopNodes->Node(this->ExhaustAirInletNodeNum).MassFlowRate;
Real64 const lExhaustAirHumRat = state.dataLoopNodes->Node(this->ExhaustAirInletNodeNum).HumRat;
Real64 const CpAir = Psychrometrics::PsyCpAirFnW(lExhaustAirHumRat);
lExhHeatRecPotentialHeat = lExhaustInFlow * CpAir * (lExhaustInTemp - AbsLeavingTemp);
if (lExhHeatRecPotentialHeat < lHeatThermalEnergyUseRate) {
if (this->ExhTempLTAbsLeavingHeatingTempIndex == 0) {
Expand All @@ -2032,31 +2010,31 @@ void ExhaustAbsorberSpecs::calcHeater(EnergyPlusData &state, Real64 &MyLoad, boo
// If exhaust is not available, it means the avilable thermal energy is 0.0 and Chiller is not available
lHeatThermalEnergyUseRate = 0.0;
lHeatElectricPower = 0.0;
lHotWaterSupplyTemp = lHotWaterReturnTemp;
lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, lCoolPartLoadRatio) / lMinPartLoadRat);
lHotWaterSupplyTemp = heatReturnNode.Temp;
lFractionOfPeriodRunning = min(1.0, max(lHeatPartLoadRatio, this->CoolPartLoadRatio) / this->MinPartLoadRat);
}

if (lHeatElectricPower <= lCoolElectricPower) {
if (lHeatElectricPower <= this->CoolElectricPower) {
lHeatElectricPower = 0.0;
} else {
lHeatElectricPower -= lCoolElectricPower;
lHeatElectricPower -= this->CoolElectricPower;
}

} // IF(MyLoad==0 .OR. .NOT. RunFlag)
// Write into the Report Variables except for nodes
this->HeatingLoad = lHeatingLoad;
this->HeatThermalEnergyUseRate = lHeatThermalEnergyUseRate;
this->HeatElectricPower = lHeatElectricPower;
this->HotWaterReturnTemp = lHotWaterReturnTemp;
this->HotWaterReturnTemp = heatReturnNode.Temp;
this->HotWaterSupplyTemp = lHotWaterSupplyTemp;
this->HotWaterFlowRate = lHotWaterMassFlowRate;
this->HeatPartLoadRatio = lHeatPartLoadRatio;
this->HeatingCapacity = lAvailableHeatingCapacity;
this->FractionOfPeriodRunning = lFractionOfPeriodRunning;

// write the combined heating and cooling ThermalEnergy used and electric used
this->ThermalEnergyUseRate = lCoolThermalEnergyUseRate + lHeatThermalEnergyUseRate;
this->ElectricPower = lCoolElectricPower + lHeatElectricPower;
this->ThermalEnergyUseRate = this->CoolThermalEnergyUseRate + lHeatThermalEnergyUseRate;
this->ElectricPower = this->CoolElectricPower + lHeatElectricPower;
this->ExhaustInTemp = lExhaustInTemp;
this->ExhaustInFlow = lExhaustInFlow;
this->ExhHeatRecPotentialHeat = lExhHeatRecPotentialHeat;
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/HeatBalFiniteDiffManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2609,6 +2609,8 @@ namespace HeatBalFiniteDiffManager {
interNodeFlux - sourceFlux +
surfaceFD.CpDelXRhoS2(node) * (surfaceFD.TDT(node) - surfaceFD.TDpriortimestep(node)) / state.dataGlobal->TimeStepZoneSec;
}
if (state.dataEnvrn->IsRain)
state.dataHeatBalSurf->SurfOpaqOutFaceCondFlux(Surf) = -surfaceFD.QDreport(1); // Update the outside flux if it is raining
}

void adjustPropertiesForPhaseChange(EnergyPlusData &state,
Expand Down
3 changes: 3 additions & 0 deletions src/EnergyPlus/RuntimeLanguageProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ void InitializeRuntimeLanguage(EnergyPlusData &state)

// Create dynamic built-in variables
state.dataRuntimeLangProcessor->YearVariableNum = NewEMSVariable(state, "YEAR", 0);
state.dataRuntimeLangProcessor->CalendarYearVariableNum = NewEMSVariable(state, "CALENDARYEAR", 0);
state.dataRuntimeLangProcessor->MonthVariableNum = NewEMSVariable(state, "MONTH", 0);
state.dataRuntimeLangProcessor->DayOfMonthVariableNum = NewEMSVariable(state, "DAYOFMONTH", 0); // 'DAYOFMONTH'?
state.dataRuntimeLangProcessor->DayOfWeekVariableNum = NewEMSVariable(state, "DAYOFWEEK", 0);
Expand Down Expand Up @@ -180,6 +181,8 @@ void InitializeRuntimeLanguage(EnergyPlusData &state)

// Update built-in variables
state.dataRuntimeLang->ErlVariable(state.dataRuntimeLangProcessor->YearVariableNum).Value = SetErlValueNumber(double(state.dataEnvrn->Year));
state.dataRuntimeLang->ErlVariable(state.dataRuntimeLangProcessor->CalendarYearVariableNum).Value =
SetErlValueNumber(double(state.dataGlobal->CalendarYear));
state.dataRuntimeLang->ErlVariable(state.dataRuntimeLangProcessor->MonthVariableNum).Value = SetErlValueNumber(double(state.dataEnvrn->Month));
state.dataRuntimeLang->ErlVariable(state.dataRuntimeLangProcessor->DayOfMonthVariableNum).Value =
SetErlValueNumber(double(state.dataEnvrn->DayOfMonth));
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/RuntimeLanguageProcessor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ struct RuntimeLanguageProcessorData : BaseGlobalStruct
Array1D_int CurveIndexVariableNums;
Array1D_int ConstructionIndexVariableNums;
int YearVariableNum = 0;
int CalendarYearVariableNum = 0;
int MonthVariableNum = 0;
int DayOfMonthVariableNum = 0;
int DayOfWeekVariableNum = 0;
Expand Down Expand Up @@ -259,6 +260,7 @@ struct RuntimeLanguageProcessorData : BaseGlobalStruct
this->CurveIndexVariableNums.clear();
this->ConstructionIndexVariableNums.clear();
this->YearVariableNum = 0;
this->CalendarYearVariableNum = 0;
this->MonthVariableNum = 0;
this->DayOfMonthVariableNum = 0;
this->DayOfWeekVariableNum = 0;
Expand Down
2 changes: 0 additions & 2 deletions src/EnergyPlus/SimAirServingZones.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4080,7 +4080,6 @@ void SizeAirLoopBranches(EnergyPlusData &state, int const AirLoopNum, int const
"Central Heating Maximum System Air Flow Ratio",
FinalSysSizing(AirLoopNum).SysAirMinFlowRat);
}

if (PrimaryAirSystems(AirLoopNum).DesignVolFlowRate < SmallAirVolFlow) {
ShowSevereError(state,
format("SizeAirLoopBranches: AirLoopHVAC {} has air flow less than {:.4R} m3/s.",
Expand All @@ -4090,7 +4089,6 @@ void SizeAirLoopBranches(EnergyPlusData &state, int const AirLoopNum, int const
format("Primary air system volumetric flow rate = {:.4R} m3/s.", PrimaryAirSystems(AirLoopNum).DesignVolFlowRate));
ShowContinueError(state, "Check flow rate inputs for components in this air loop and,");
ShowContinueError(state, "if autosized, check Sizing:Zone and Sizing:System objects and related inputs.");
ShowFatalError(state, "Previous condition causes termination.");
}
}

Expand Down
Loading

5 comments on commit cc427fd

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

SteamPart1Followup (dareumnam) - Win64-Windows-10-VisualStudio-16: OK (2742 of 2743 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1469
  • Failed: 1

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

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

SteamPart1Followup (dareumnam) - x86_64-MacOS-10.17-clang-14.0.0: OK (3528 of 3529 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1471
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

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

SteamPart1Followup (dareumnam) - x86_64-Linux-Ubuntu-22.04-gcc-11.4: OK (3569 of 3570 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1471
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

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

SteamPart1Followup (dareumnam) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-IntegrationCoverage-Debug: OK (789 of 789 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

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

SteamPart1Followup (dareumnam) - x86_64-Linux-Ubuntu-22.04-gcc-11.4-UnitTestsCoverage-Debug: OK (1956 of 1957 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1471
  • Failed: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.