Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into global_dataEnviron…
Browse files Browse the repository at this point in the history
…ment
  • Loading branch information
Myoldmopar committed Dec 5, 2020
2 parents 90a9ada + d66e036 commit ca197de
Show file tree
Hide file tree
Showing 19 changed files with 264 additions and 3,717 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
python-version: 3.7

- name: Set up LaTeX
run: sudo apt-get install texlive texlive-xetex texlive-science
run: sudo apt update && sudo apt install -y texlive texlive-xetex texlive-science

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/EnergyPlus/doc/build
Expand Down
2 changes: 1 addition & 1 deletion src/EnergyPlus/CTElectricGenerator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ namespace CTElectricGenerator {
// PURPOSE OF THIS SUBROUTINE:
// This subroutine is for initializations of the CT generators.

static std::string const RoutineName("InitICEngineGenerators");
auto constexpr RoutineName("InitICEngineGenerators");

bool errFlag;

Expand Down
19 changes: 17 additions & 2 deletions src/EnergyPlus/DataRuntimeLanguage.hh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ namespace DataRuntimeLanguage {
// Data module should be available to other modules and routines.
// Thus, all variables in this module must be PUBLIC.

enum class ErlKeywordParam // keyword parameters for types of Erl statements
{
KeywordNone, // statement type not set
KeywordReturn, // Return statement, as in leave program
KeywordGoto, // Goto statement, used in parsing to manage IF-ElseIf-Else-EndIf and nesting
KeywordSet, // Set statement, as in assign RHS to LHS
KeywordRun, // Run statement, used to call a subroutine from a main program
KeywordIf, // If statement, begins an IF-ElseIf-Else-EndIf logic block
KeywordElseIf, // ElseIf statement, begins an ElseIf block
KeywordElse, // Else statement, begins an Else block
KeywordEndIf, // EndIf statement, terminates an IF-ElseIf-Else-EndIf logic block
KeywordWhile, // While statement, begins a While block
KeywordEndWhile, // EndWhile statement, terminates a While block
};

// MODULE PARAMETER DEFINITIONS:
extern int const ValueNull; // Erl entity type, "Null" value
extern int const ValueNumber; // Erl entity type, hard numeric value
Expand Down Expand Up @@ -421,12 +436,12 @@ namespace DataRuntimeLanguage {
// Members
// nested structure inside ErlStack that holds program instructions
int LineNum; // Erl program line number reference
int Keyword; // type of instruction for this line, e.g. KeywordSet, KeywordIf, etc
DataRuntimeLanguage::ErlKeywordParam Keyword; // type of instruction for this line, e.g. KeywordSet, KeywordIf, etc
int Argument1; // Index to a variable, function, expression, or stack
int Argument2; // Index to a variable, function, expression, or stack

// Default Constructor
InstructionType() : LineNum(0), Keyword(0), Argument1(0), Argument2(0)
InstructionType() : LineNum(0), Keyword(DataRuntimeLanguage::ErlKeywordParam::KeywordNone), Argument1(0), Argument2(0)
{
}
};
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/ExteriorEnergyUse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace ExteriorEnergyUse {
using ScheduleManager::GetScheduleName;
using namespace OutputReportPredefined;
// SUBROUTINE PARAMETER DEFINITIONS:
static std::string const RoutineName("GetExteriorEnergyUseInput: ");
auto constexpr RoutineName("GetExteriorEnergyUseInput: ");

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
int Item; // Item to be "gotten"
Expand Down Expand Up @@ -438,7 +438,7 @@ namespace ExteriorEnergyUse {
}

if (ErrorsFound) {
ShowFatalError(state, RoutineName + "Errors found in input. Program terminates.");
ShowFatalError(state, format("{}Errors found in input. Program terminates.", RoutineName));
}
}

Expand Down
66 changes: 31 additions & 35 deletions src/EnergyPlus/Furnaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,6 @@ namespace Furnaces {
// MODULE PARAMETER DEFINITIONS
static std::string const BlankString;

// Last mode of operation
int const CoolingMode(1); // last compressor operating mode was in cooling
int const HeatingMode(2); // last compressor operating mode was in heating
int const NoCoolHeat(3); // last operating mode was coil off
// Airflow control for contant fan mode
int const UseCompressorOnFlow(1); // set compressor OFF air flow rate equal to compressor ON air flow rate
int const UseCompressorOffFlow(2); // set compressor OFF air flow rate equal to user defined value
Expand Down Expand Up @@ -4893,9 +4889,9 @@ namespace Furnaces {
int OutNode; // Outlet node number in MSHP loop
Real64 RhoAir; // Air density at InNode
int IHPIndex(0); // coil id of IHP coil
int OperatingMode; // track cooling, heating, and no cooling or heating modes
int OperatingModeMinusOne;
int OperatingModeMinusTwo;
Furnaces::ModeOfOperation OperatingMode; // track cooling, heating, and no cooling or heating modes
Furnaces::ModeOfOperation OperatingModeMinusOne;
Furnaces::ModeOfOperation OperatingModeMinusTwo;
bool Oscillate; // detection of oscillating operating modes

InNode = Furnace(FurnaceNum).FurnaceInletNodeNum;
Expand Down Expand Up @@ -5836,19 +5832,19 @@ namespace Furnaces {

if (FirstHVACIteration) {
Furnace(FurnaceNum).iterationCounter = 0;
Furnace(FurnaceNum).iterationMode = 0;
Furnace(FurnaceNum).iterationMode = Furnaces::ModeOfOperation::NoCoolHeat;
}
Furnace(FurnaceNum).iterationCounter += 1;

// push iteration mode stack and set current mode
Furnace(FurnaceNum).iterationMode(3) = Furnace(FurnaceNum).iterationMode(2);
Furnace(FurnaceNum).iterationMode(2) = Furnace(FurnaceNum).iterationMode(1);
if (CoolingLoad) {
Furnace(FurnaceNum).iterationMode(1) = CoolingMode;
Furnace(FurnaceNum).iterationMode(1) = Furnaces::ModeOfOperation::CoolingMode;
} else if (HeatingLoad) {
Furnace(FurnaceNum).iterationMode(1) = HeatingMode;
Furnace(FurnaceNum).iterationMode(1) = Furnaces::ModeOfOperation::HeatingMode;
} else {
Furnace(FurnaceNum).iterationMode(1) = NoCoolHeat;
Furnace(FurnaceNum).iterationMode(1) = Furnaces::ModeOfOperation::NoCoolHeat;
}

// IF small loads to meet or not converging, just shut down unit
Expand Down Expand Up @@ -5970,12 +5966,12 @@ namespace Furnaces {
CompOnMassFlow = Furnace(FurnaceNum).MaxHeatAirMassFlow;
CompOnFlowRatio = Furnace(FurnaceNum).HeatingSpeedRatio;
}
Furnace(FurnaceNum).LastMode = HeatingMode;
Furnace(FurnaceNum).LastMode = Furnaces::ModeOfOperation::HeatingMode;
// IF a cooling load exists, operate at the cooling mass flow rate
} else if (CoolingLoad) {
CompOnMassFlow = Furnace(FurnaceNum).MaxCoolAirMassFlow;
CompOnFlowRatio = Furnace(FurnaceNum).CoolingSpeedRatio;
Furnace(FurnaceNum).LastMode = CoolingMode;
Furnace(FurnaceNum).LastMode = Furnaces::ModeOfOperation::CoolingMode;
// If no load exists, set the compressor on mass flow rate.
// Set equal the mass flow rate when no heating or cooling is needed if no moisture load exists.
// If the user has set the off mass flow rate to 0, set according to the last operating mode.
Expand All @@ -5989,7 +5985,7 @@ namespace Furnaces {
CompOnFlowRatio = Furnace(FurnaceNum).HeatingSpeedRatio;
// User may have entered a 0 for MaxNoCoolHeatAirMassFlow
if (CompOnMassFlow == 0.0) {
if (Furnace(FurnaceNum).LastMode == HeatingMode) {
if (Furnace(FurnaceNum).LastMode == Furnaces::ModeOfOperation::HeatingMode) {
CompOnMassFlow = Furnace(FurnaceNum).MaxHeatAirMassFlow;
CompOnFlowRatio = Furnace(FurnaceNum).HeatingSpeedRatio;
} else {
Expand All @@ -6003,7 +5999,7 @@ namespace Furnaces {
// Set the compressor or coil OFF mass flow rate based on LOGICAL flag
// UseCompressorOnFlow is used when the user does not enter a value for no cooling or heating flow rate
if (Furnace(FurnaceNum).AirFlowControl == UseCompressorOnFlow) {
if (Furnace(FurnaceNum).LastMode == HeatingMode) {
if (Furnace(FurnaceNum).LastMode == Furnaces::ModeOfOperation::HeatingMode) {
if (MoistureLoad < 0.0 && Furnace(FurnaceNum).Humidistat &&
Furnace(FurnaceNum).DehumidControlType_Num == DehumidControl_CoolReheat) {
CompOffMassFlow = Furnace(FurnaceNum).MaxCoolAirMassFlow;
Expand All @@ -6030,11 +6026,11 @@ namespace Furnaces {
Furnace(FurnaceNum).DehumidControlType_Num == DehumidControl_CoolReheat) {
CompOnMassFlow = Furnace(FurnaceNum).MaxCoolAirMassFlow;
CompOnFlowRatio = Furnace(FurnaceNum).CoolingSpeedRatio;
Furnace(FurnaceNum).LastMode = CoolingMode;
Furnace(FurnaceNum).LastMode = Furnaces::ModeOfOperation::CoolingMode;
} else {
CompOnMassFlow = Furnace(FurnaceNum).MaxHeatAirMassFlow;
CompOnFlowRatio = Furnace(FurnaceNum).HeatingSpeedRatio;
Furnace(FurnaceNum).LastMode = HeatingMode;
Furnace(FurnaceNum).LastMode = Furnaces::ModeOfOperation::HeatingMode;
}
} else if (CoolingLoad) {
CompOnMassFlow = Furnace(FurnaceNum).MaxCoolAirMassFlow;
Expand Down Expand Up @@ -10030,12 +10026,12 @@ namespace Furnaces {

// Set latent load for heating
if (HeatingLoad) {
Furnace(FurnaceNum).HeatCoolMode = HeatingMode;
Furnace(FurnaceNum).HeatCoolMode = Furnaces::ModeOfOperation::HeatingMode;
// Set latent load for cooling and no sensible load condition
} else if (CoolingLoad) {
Furnace(FurnaceNum).HeatCoolMode = CoolingMode;
Furnace(FurnaceNum).HeatCoolMode = Furnaces::ModeOfOperation::CoolingMode;
} else {
Furnace(FurnaceNum).HeatCoolMode = 0;
Furnace(FurnaceNum).HeatCoolMode = Furnaces::ModeOfOperation::NoCoolHeat;
}

// set the on/off flags
Expand Down Expand Up @@ -10393,9 +10389,9 @@ namespace Furnaces {
// Get full load result
PartLoadFrac = 1.0;
SpeedRatio = 1.0;
if (Furnace(FurnaceNum).HeatCoolMode == HeatingMode) {
if (Furnace(FurnaceNum).HeatCoolMode == Furnaces::ModeOfOperation::HeatingMode) {
SpeedNum = Furnace(FurnaceNum).NumOfSpeedHeating;
} else if (Furnace(FurnaceNum).HeatCoolMode == CoolingMode) {
} else if (Furnace(FurnaceNum).HeatCoolMode == Furnaces::ModeOfOperation::CoolingMode) {
SpeedNum = Furnace(FurnaceNum).NumOfSpeedCooling;
} else if (QLatReq < -SmallLoad) {
SpeedNum = Furnace(FurnaceNum).NumOfSpeedCooling;
Expand Down Expand Up @@ -11703,7 +11699,7 @@ namespace Furnaces {
};
} else {
if (!CurDeadBandOrSetback(Furnace(FurnaceNum).ControlZoneNum) && present(SpeedNum)) {
if (Furnace(FurnaceNum).HeatCoolMode == HeatingMode) {
if (Furnace(FurnaceNum).HeatCoolMode == Furnaces::ModeOfOperation::HeatingMode) {
if (SpeedNum == 1) {
CompOnMassFlow = Furnace(FurnaceNum).HeatMassFlowRate(SpeedNum);
CompOnFlowRatio = Furnace(FurnaceNum).MSHeatingSpeedRatio(SpeedNum);
Expand All @@ -11717,7 +11713,7 @@ namespace Furnaces {
MSHPMassFlowRateLow = Furnace(FurnaceNum).HeatMassFlowRate(SpeedNum - 1);
MSHPMassFlowRateHigh = Furnace(FurnaceNum).HeatMassFlowRate(SpeedNum);
}
} else if (Furnace(FurnaceNum).HeatCoolMode == CoolingMode) {
} else if (Furnace(FurnaceNum).HeatCoolMode == Furnaces::ModeOfOperation::CoolingMode) {
if (SpeedNum == 1) {
CompOnMassFlow = Furnace(FurnaceNum).CoolMassFlowRate(SpeedNum);
CompOnFlowRatio = Furnace(FurnaceNum).MSCoolingSpeedRatio(SpeedNum);
Expand All @@ -11740,7 +11736,7 @@ namespace Furnaces {
if (SpeedNum == 1) { // LOWEST SPEED USE IDLE FLOW
CompOffMassFlow = Furnace(FurnaceNum).IdleMassFlowRate;
CompOffFlowRatio = Furnace(FurnaceNum).IdleSpeedRatio;
} else if (Furnace(FurnaceNum).LastMode == HeatingMode) {
} else if (Furnace(FurnaceNum).LastMode == Furnaces::ModeOfOperation::HeatingMode) {
CompOffMassFlow = Furnace(FurnaceNum).HeatMassFlowRate(SpeedNum);
CompOffFlowRatio = Furnace(FurnaceNum).MSHeatingSpeedRatio(SpeedNum);
} else {
Expand Down Expand Up @@ -11848,24 +11844,24 @@ namespace Furnaces {
// FLOW:

if (CoolingLoad) {
Furnace(FurnaceNum).HeatCoolMode = CoolingMode;
Furnace(FurnaceNum).HeatCoolMode = Furnaces::ModeOfOperation::CoolingMode;
} else if (HeatingLoad) {
Furnace(FurnaceNum).HeatCoolMode = HeatingMode;
Furnace(FurnaceNum).HeatCoolMode = Furnaces::ModeOfOperation::HeatingMode;
} else {
Furnace(FurnaceNum).HeatCoolMode = 0;
Furnace(FurnaceNum).HeatCoolMode = Furnaces::ModeOfOperation::NoCoolHeat;
}

// Set the inlet node mass flow rate
if (Furnace(FurnaceNum).OpMode == ContFanCycCoil) {
// constant fan mode
if ((Furnace(FurnaceNum).HeatCoolMode == HeatingMode) && !CurDeadBandOrSetback(ZoneNum)) {
if ((Furnace(FurnaceNum).HeatCoolMode == Furnaces::ModeOfOperation::HeatingMode) && !CurDeadBandOrSetback(ZoneNum)) {
CompOnMassFlow = Furnace(FurnaceNum).HeatMassFlowRate(1);
CompOnFlowRatio = Furnace(FurnaceNum).MSHeatingSpeedRatio(1);
Furnace(FurnaceNum).LastMode = HeatingMode;
} else if ((Furnace(FurnaceNum).HeatCoolMode == CoolingMode) && !CurDeadBandOrSetback(ZoneNum)) {
Furnace(FurnaceNum).LastMode = Furnaces::ModeOfOperation::HeatingMode;
} else if ((Furnace(FurnaceNum).HeatCoolMode == Furnaces::ModeOfOperation::CoolingMode) && !CurDeadBandOrSetback(ZoneNum)) {
CompOnMassFlow = Furnace(FurnaceNum).CoolMassFlowRate(1);
CompOnFlowRatio = Furnace(FurnaceNum).MSCoolingSpeedRatio(1);
Furnace(FurnaceNum).LastMode = CoolingMode;
Furnace(FurnaceNum).LastMode = Furnaces::ModeOfOperation::CoolingMode;
} else {
CompOnMassFlow = Furnace(FurnaceNum).IdleMassFlowRate;
CompOnFlowRatio = Furnace(FurnaceNum).IdleSpeedRatio;
Expand All @@ -11874,10 +11870,10 @@ namespace Furnaces {
CompOffFlowRatio = Furnace(FurnaceNum).IdleSpeedRatio;
} else {
// cycling fan mode
if ((Furnace(FurnaceNum).HeatCoolMode == HeatingMode) && !CurDeadBandOrSetback(ZoneNum)) {
if ((Furnace(FurnaceNum).HeatCoolMode == Furnaces::ModeOfOperation::HeatingMode) && !CurDeadBandOrSetback(ZoneNum)) {
CompOnMassFlow = Furnace(FurnaceNum).HeatMassFlowRate(1);
CompOnFlowRatio = Furnace(FurnaceNum).MSHeatingSpeedRatio(1);
} else if ((Furnace(FurnaceNum).HeatCoolMode == CoolingMode) && !CurDeadBandOrSetback(ZoneNum)) {
} else if ((Furnace(FurnaceNum).HeatCoolMode == Furnaces::ModeOfOperation::CoolingMode) && !CurDeadBandOrSetback(ZoneNum)) {
CompOnMassFlow = Furnace(FurnaceNum).CoolMassFlowRate(1);
CompOnFlowRatio = Furnace(FurnaceNum).MSCoolingSpeedRatio(1);
} else {
Expand All @@ -11895,7 +11891,7 @@ namespace Furnaces {
Node(InNode).MassFlowRate = CompOnMassFlow;
PartLoadRatio = 0.0;
} else {
if (Furnace(FurnaceNum).HeatCoolMode != 0) {
if (Furnace(FurnaceNum).HeatCoolMode != Furnaces::ModeOfOperation::NoCoolHeat) {
PartLoadRatio = 1.0;
} else {
PartLoadRatio = 0.0;
Expand Down
Loading

5 comments on commit ca197de

@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.

global_dataEnvironment (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3032 of 3032 tests passed, 0 test warnings)

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.

global_dataEnvironment (Myoldmopar) - x86_64-MacOS-10.15-clang-11.0.0: OK (2992 of 2992 tests passed, 0 test warnings)

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.

global_dataEnvironment (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1558 of 1558 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

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

global_dataEnvironment (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2249 of 2249 tests passed, 0 test warnings)

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.

global_dataEnvironment (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: Coverage Too Low

Build Badge Test Badge Coverage Badge

Please sign in to comment.