Skip to content

Commit

Permalink
Merge pull request #8384 from NREL/global_dataBranchAirLoopPlant
Browse files Browse the repository at this point in the history
Global DataBranchAirLoopPlant
  • Loading branch information
mitchute authored Nov 19, 2020
2 parents 5fbd15c + dbefd10 commit 36b8851
Show file tree
Hide file tree
Showing 64 changed files with 432 additions and 627 deletions.
2 changes: 0 additions & 2 deletions src/EnergyPlus/AirflowNetwork/src/Solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ namespace AirflowNetwork {

int const NrInt(20); // Number of intervals for a large opening

static std::string const BlankString;

// Common block AFEDAT
Array1D<Real64> AFECTL;
Array1D<Real64> AFLOW2;
Expand Down
6 changes: 3 additions & 3 deletions src/EnergyPlus/AirflowNetworkBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1575,9 +1575,9 @@ namespace AirflowNetworkBalanceManager {
Array1D<Real64> Numbers; // Numeric input items for object
Array1D_bool lAlphaBlanks; // Logical array, alpha field input BLANK = .TRUE.
Array1D_bool lNumericBlanks; // Logical array, numeric field input BLANK = .TRUE.
static int MaxNums(0); // Maximum number of numeric input fields
static int MaxAlphas(0); // Maximum number of alpha input fields
static int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a
int MaxNums(0); // Maximum number of numeric input fields
int MaxAlphas(0); // Maximum number of alpha input fields
int TotalArgs(0); // Total number of alpha and numeric arguments (max) for a
bool Errorfound1;
Real64 minHeight;
Real64 maxHeight;
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/BoilerSteam.cc
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ namespace BoilerSteam {
void BoilerSpecs::calculate(EnergyPlusData &state,
Real64 &MyLoad, // W - hot water demand to be met by boiler
bool const RunFlag, // TRUE if boiler operating
int const EquipFlowCtrl // Flow control mode for the equipment
DataBranchAirLoopPlant::ControlTypeEnum const EquipFlowCtrl // Flow control mode for the equipment
)
{
// SUBROUTINE INFORMATION:
Expand Down Expand Up @@ -596,7 +596,7 @@ namespace BoilerSteam {
// if the component control is SERIESACTIVE we set the component flow to inlet flow so that flow resolver
// will not shut down the branch
if (MyLoad <= 0.0 || !RunFlag) {
if (EquipFlowCtrl == DataBranchAirLoopPlant::ControlType_SeriesActive)
if (EquipFlowCtrl == DataBranchAirLoopPlant::ControlTypeEnum::SeriesActive)
this->BoilerMassFlowRate = DataLoopNode::Node(this->BoilerInletNodeNum).MassFlowRate;
return;
}
Expand Down
3 changes: 2 additions & 1 deletion src/EnergyPlus/BoilerSteam.hh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

// EnergyPlus Headers
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/DataBranchAirLoopPlant.hh>
#include <EnergyPlus/DataGlobals.hh>
#include <EnergyPlus/EnergyPlus.hh>
#include <EnergyPlus/PlantComponent.hh>
Expand Down Expand Up @@ -132,7 +133,7 @@ namespace BoilerSteam {
void calculate(EnergyPlusData &state,
Real64 &MyLoad, // W - hot water demand to be met by boiler
bool RunFlag, // TRUE if boiler operating
int EquipFlowCtrl // Flow control mode for the equipment
DataBranchAirLoopPlant::ControlTypeEnum EquipFlowCtrl // Flow control mode for the equipment
);

void update(Real64 MyLoad, // boiler operating load
Expand Down
20 changes: 8 additions & 12 deletions src/EnergyPlus/Boilers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@
#include <EnergyPlus/PlantUtilities.hh>
#include <EnergyPlus/UtilityRoutines.hh>

namespace EnergyPlus {

namespace Boilers {
namespace EnergyPlus::Boilers {

// Module containing the routines dealing with the Boilers

Expand Down Expand Up @@ -164,7 +162,7 @@ namespace Boilers {
// standard EnergyPlus input retrieval using input Processor

// Locals
static std::string const RoutineName("GetBoilerInput: ");
constexpr auto RoutineName("GetBoilerInput: ");

// LOCAL VARIABLES
bool ErrorsFound(false); // Flag to show errors were found during GetInput
Expand Down Expand Up @@ -355,7 +353,7 @@ namespace Boilers {
}

if (ErrorsFound) {
ShowFatalError(state, RoutineName + "Errors found in processing " + DataIPShortCuts::cCurrentModuleObject + " input.");
ShowFatalError(state, format("{}{}", RoutineName, "Errors found in processing " + DataIPShortCuts::cCurrentModuleObject + " input."));
}
}

Expand Down Expand Up @@ -424,7 +422,7 @@ namespace Boilers {
// Uses the status flags to trigger initializations.

// SUBROUTINE PARAMETER DEFINITIONS:
static std::string const RoutineName("InitBoiler");
constexpr auto RoutineName("InitBoiler");

// Init more variables
if (this->MyFlag) {
Expand Down Expand Up @@ -549,7 +547,7 @@ namespace Boilers {
// the hot water flow rate and the hot water loop design delta T.

// SUBROUTINE PARAMETER DEFINITIONS:
static std::string const RoutineName("SizeBoiler");
constexpr auto RoutineName("SizeBoiler");

// SUBROUTINE LOCAL VARIABLE DECLARATIONS:
bool ErrorsFound(false); // If errors detected in input
Expand Down Expand Up @@ -694,7 +692,7 @@ namespace Boilers {
void BoilerSpecs::CalcBoilerModel(EnergyPlusData &state,
Real64 const MyLoad, // W - hot water demand to be met by boiler
bool const RunFlag, // TRUE if boiler operating
int const EquipFlowCtrl // Flow control mode for the equipment
DataBranchAirLoopPlant::ControlTypeEnum const EquipFlowCtrl // Flow control mode for the equipment
)
{
// SUBROUTINE INFORMATION:
Expand All @@ -716,7 +714,7 @@ namespace Boilers {
// load performance

// SUBROUTINE PARAMETER DEFINITIONS:
static std::string const RoutineName("CalcBoilerModel");
constexpr auto RoutineName("CalcBoilerModel");

// clean up some operating conditions, may not be necessary
this->BoilerLoad = 0.0;
Expand All @@ -742,7 +740,7 @@ namespace Boilers {
// if the component control is SERIESACTIVE we set the component flow to inlet flow so that flow resolver
// will not shut down the branch
if (MyLoad <= 0.0 || !RunFlag) {
if (EquipFlowCtrl == DataBranchAirLoopPlant::ControlType_SeriesActive)
if (EquipFlowCtrl == DataBranchAirLoopPlant::ControlTypeEnum::SeriesActive)
this->BoilerMassFlowRate = DataLoopNode::Node(BoilerInletNode).MassFlowRate;
return;
}
Expand Down Expand Up @@ -951,6 +949,4 @@ namespace Boilers {
this->ParasiticElecConsumption = this->ParasiticElecPower * ReportingConstant;
}

} // namespace Boilers

} // namespace EnergyPlus
3 changes: 2 additions & 1 deletion src/EnergyPlus/Boilers.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <ObjexxFCL/Array1D.hh>

// EnergyPlus Headers
#include <EnergyPlus/DataBranchAirLoopPlant.hh>
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/Plant/DataPlant.hh>
#include <EnergyPlus/DataGlobals.hh>
Expand Down Expand Up @@ -168,7 +169,7 @@ namespace Boilers {
void CalcBoilerModel(EnergyPlusData &state,
Real64 MyLoad, // W - hot water demand to be met by boiler
bool RunFlag, // TRUE if boiler operating
int EquipFlowCtrl // Flow control mode for the equipment
DataBranchAirLoopPlant::ControlTypeEnum EquipFlowCtrl // Flow control mode for the equipment
);

void UpdateBoilerRecords(Real64 MyLoad, // boiler operating load
Expand Down
16 changes: 8 additions & 8 deletions src/EnergyPlus/BranchInputManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ namespace BranchInputManager {
void GetBranchData(EnergyPlusData &state,
std::string const &LoopName, // Loop Name of this Branch
std::string const &BranchName, // Requested Branch Name
int &PressCurveType, // Index of a pressure curve object
DataBranchAirLoopPlant::PressureCurveType &PressCurveType, // Index of a pressure curve object
int &PressCurveIndex, // Index of a pressure curve object
int &NumComps, // Number of Components on Branch
Array1D_string &CompType, // Component Type for each item on Branch
Expand Down Expand Up @@ -428,7 +428,7 @@ namespace BranchInputManager {
void GetInternalBranchData(EnergyPlusData &state,
std::string const &LoopName, // Loop Name for Branch
std::string const &BranchName, // Requested Branch Name
int &PressCurveType, // Index of pressure curve object
DataBranchAirLoopPlant::PressureCurveType &PressCurveType, // Index of pressure curve object
int &PressCurveIndex, // Index of pressure curve object
int &NumComps, // Number of Components on Branch
Array1D<ComponentData> &BComponents, // Component data returned
Expand Down Expand Up @@ -618,7 +618,7 @@ namespace BranchInputManager {
int Count; // Loop Counter
int Loop; // Loop Counter
int NumComps; // Number of Components on this Branch
int PressCurveType;
DataBranchAirLoopPlant::PressureCurveType PressCurveType;
int PressCurveIndex;
bool errFlag; // Error flag from RegisterNodeConnection
int NumParams;
Expand Down Expand Up @@ -761,7 +761,7 @@ namespace BranchInputManager {
int Count; // Loop Counter
int Loop; // Loop Counter
int NumComps; // Number of Components on this Branch
int PressCurveType;
DataBranchAirLoopPlant::PressureCurveType PressCurveType;
int PressCurveIndex;
bool errFlag; // Error flag from RegisterNodeConnection
int NumParams;
Expand Down Expand Up @@ -1090,7 +1090,7 @@ namespace BranchInputManager {
using General::RoundSigDigits;

// Locals
int PressureCurveType;
PressureCurveType pressureCurveType;
int PressureCurveIndex;
bool ErrFound; // Flag for error detection
int Comp; // Loop Counter
Expand All @@ -1102,16 +1102,16 @@ namespace BranchInputManager {
std::string CurrentModuleObject = "Branch";

state.dataBranchInputManager->Branch(BCount).Name = Alphas(1);
GetPressureCurveTypeAndIndex(state, Alphas(2), PressureCurveType, PressureCurveIndex);
if (PressureCurveType == PressureCurve_Error) {
GetPressureCurveTypeAndIndex(state, Alphas(2), pressureCurveType, PressureCurveIndex);
if (pressureCurveType == DataBranchAirLoopPlant::PressureCurveType::Error) {
ShowSevereError(state, RoutineName + CurrentModuleObject + "=\"" + Alphas(1) + "\", invalid data.");
ShowContinueError(state, "..Invalid " + cAlphaFields(2) + "=\"" + Alphas(2) + "\".");
ShowContinueError(state, "This curve could not be found in the input deck. Ensure that this curve has been entered");
ShowContinueError(state, " as either a Curve:Functional:PressureDrop or one of Curve:{Linear,Quadratic,Cubic,Exponent}");
ShowContinueError(state, "This error could be caused by a misspelled curve name");
ErrFound = true;
}
state.dataBranchInputManager->Branch(BCount).PressureCurveType = PressureCurveType;
state.dataBranchInputManager->Branch(BCount).PressureCurveType = pressureCurveType;
state.dataBranchInputManager->Branch(BCount).PressureCurveIndex = PressureCurveIndex;
state.dataBranchInputManager->Branch(BCount).NumOfComponents = (NumAlphas - 2) / 4;
if (state.dataBranchInputManager->Branch(BCount).NumOfComponents * 4 != (NumAlphas - 2)) ++state.dataBranchInputManager->Branch(BCount).NumOfComponents;
Expand Down
9 changes: 5 additions & 4 deletions src/EnergyPlus/BranchInputManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

// EnergyPlus Headers
#include <EnergyPlus/Data/BaseData.hh>
#include <EnergyPlus/DataBranchAirLoopPlant.hh>
#include <EnergyPlus/DataGlobals.hh>
#include <EnergyPlus/DataLoopNode.hh>
#include <EnergyPlus/EnergyPlus.hh>
Expand Down Expand Up @@ -129,14 +130,14 @@ namespace BranchInputManager {
// Members
std::string Name; // Name for this Branch
std::string AssignedLoopName; // Loop Name for this branch
int PressureCurveType; // Integer index of pressure curve type
DataBranchAirLoopPlant::PressureCurveType PressureCurveType; // Integer index of pressure curve type
int PressureCurveIndex; // Integer index of pressure curve
int FluidType; // Fluid type (see DataLoopNode)
int NumOfComponents; // Number of Components on this Branch
Array1D<ComponentData> Component; // Component definitions for each component

// Default Constructor
BranchData() : PressureCurveType(0), PressureCurveIndex(0), FluidType(DataLoopNode::NodeType_Unknown), NumOfComponents(0)
BranchData() : PressureCurveType(DataBranchAirLoopPlant::PressureCurveType::Unassigned), PressureCurveIndex(0), FluidType(DataLoopNode::NodeType_Unknown), NumOfComponents(0)
{
}

Expand Down Expand Up @@ -195,7 +196,7 @@ namespace BranchInputManager {
void GetBranchData(EnergyPlusData &state,
std::string const &LoopName, // Loop Name of this Branch
std::string const &BranchName, // Requested Branch Name
int &PressCurveType, // Index of a pressure curve object
DataBranchAirLoopPlant::PressureCurveType &PressCurveType, // Index of a pressure curve object
int &PressCurveIndex, // Index of a pressure curve object
int &NumComps, // Number of Components on Branch
Array1D_string &CompType, // Component Type for each item on Branch
Expand All @@ -219,7 +220,7 @@ namespace BranchInputManager {
void GetInternalBranchData(EnergyPlusData &state,
std::string const &LoopName, // Loop Name for Branch
std::string const &BranchName, // Requested Branch Name
int &PressCurveType, // Index of pressure curve object
DataBranchAirLoopPlant::PressureCurveType &PressCurveType, // Index of pressure curve object
int &PressCurveIndex, // Index of pressure curve object
int &NumComps, // Number of Components on Branch
Array1D<ComponentData> &BComponents, // Component data returned
Expand Down
Loading

5 comments on commit 36b8851

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

develop (mitchute) - x86_64-MacOS-10.15-clang-11.0.0: OK (2277 of 2277 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.

develop (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (2297 of 2297 tests passed, 0 test warnings)

Build Badge Test 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.

develop (mitchute) - 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-2c
Copy link

Choose a reason for hiding this comment

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

develop (mitchute) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (721 of 722 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 721
  • Timeout: 1

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.

develop (mitchute) - Win64-Windows-10-VisualStudio-16: OK (2250 of 2250 tests passed, 0 test warnings)

Build Badge Test Badge

Please sign in to comment.