Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global DataBranchNodeConnections #8385

Merged
merged 7 commits into from
Nov 20, 2020
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
18 changes: 8 additions & 10 deletions src/EnergyPlus/AirflowNetworkBalanceManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9470,8 +9470,6 @@ namespace AirflowNetworkBalanceManager {
using MixedAir::GetOAMixerReliefNodeNumber;
using SingleDuct::GetHVACSingleDuctSysIndex;
using namespace DataLoopNode;
using DataBranchNodeConnections::NodeConnections;
using DataBranchNodeConnections::NumOfNodeConnections;
using DataHVACGlobals::NumPrimaryAirSys;
using DXCoils::SetDXCoilAirLoopNumber;
using Fans::SetFanAirLoopNumber;
Expand Down Expand Up @@ -9560,10 +9558,10 @@ namespace AirflowNetworkBalanceManager {
}

// Eliminate node not related to AirLoopHVAC
for (k = 1; k <= NumOfNodeConnections; ++k) {
if (NodeFound(NodeConnections(k).NodeNumber)) continue;
if (NodeConnections(k).FluidStream == 2) {
NodeFound(NodeConnections(k).NodeNumber) = true;
for (k = 1; k <= state.dataBranchNodeConnections->NumOfNodeConnections; ++k) {
if (NodeFound(state.dataBranchNodeConnections->NodeConnections(k).NodeNumber)) continue;
if (state.dataBranchNodeConnections->NodeConnections(k).FluidStream == 2) {
NodeFound(state.dataBranchNodeConnections->NodeConnections(k).NodeNumber) = true;
}
}

Expand Down Expand Up @@ -10983,9 +10981,9 @@ namespace AirflowNetworkBalanceManager {
if (state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(NumOfComp).NumSubComps == 0) {
std::string TypeOfComp = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(NumOfComp).TypeOf;
std::string NameOfComp = state.dataAirSystemsData->PrimaryAirSystems(AirLoopNum).Branch(BranchNum).Comp(NumOfComp).Name;
if (IsParentObject(TypeOfComp, NameOfComp)) {
if (IsParentObject(state, TypeOfComp, NameOfComp)) {

int NumChildren = GetNumChildren(TypeOfComp, NameOfComp);
int NumChildren = GetNumChildren(state, TypeOfComp, NameOfComp);
Array1D_string SubCompTypes;
Array1D_string SubCompNames;
Array1D_string InletNodeNames;
Expand Down Expand Up @@ -11035,9 +11033,9 @@ namespace AirflowNetworkBalanceManager {
for (NumOfSubComp = 1; NumOfSubComp <= NumChildren; ++NumOfSubComp) {
std::string TypeOfComp = SubCompTypes(NumOfSubComp);
std::string NameOfComp = SubCompNames(NumOfSubComp);
if (IsParentObject(TypeOfComp, NameOfComp)) {
if (IsParentObject(state, TypeOfComp, NameOfComp)) {

int NumGrandChildren = GetNumChildren(TypeOfComp, NameOfComp);
int NumGrandChildren = GetNumChildren(state, TypeOfComp, NameOfComp);
Array1D_string SubSubCompTypes;
Array1D_string SubSubCompNames;
Array1D_string SubSubInletNodeNames;
Expand Down
615 changes: 306 additions & 309 deletions src/EnergyPlus/BranchNodeConnections.cc

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions src/EnergyPlus/BranchNodeConnections.hh
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ namespace BranchNodeConnections {

void CheckNodeConnections(EnergyPlusData &state, bool &ErrorsFound);

bool IsParentObject(std::string const &ComponentType, std::string const &ComponentName);
bool IsParentObject(EnergyPlusData &state, std::string const &ComponentType, std::string const &ComponentName);

int WhichParentSet(std::string const &ComponentType, std::string const &ComponentName);
int WhichParentSet(EnergyPlusData &state, std::string const &ComponentType, std::string const &ComponentName);

void GetParentData(EnergyPlusData &state, std::string const &ComponentType,
std::string const &ComponentName,
Expand All @@ -103,13 +103,14 @@ namespace BranchNodeConnections {
int &OutletNodeNum,
bool &ErrorsFound);

bool IsParentObjectCompSet(std::string const &ComponentType, std::string const &ComponentName);
bool IsParentObjectCompSet(EnergyPlusData &state, std::string const &ComponentType, std::string const &ComponentName);

int WhichCompSet(std::string const &ComponentType, std::string const &ComponentName);
int WhichCompSet(EnergyPlusData &state, std::string const &ComponentType, std::string const &ComponentName);

int GetNumChildren(std::string const &ComponentType, std::string const &ComponentName);
int GetNumChildren(EnergyPlusData &state, std::string const &ComponentType, std::string const &ComponentName);

void GetComponentData(EnergyPlusData &state, std::string const &ComponentType,
void GetComponentData(EnergyPlusData &state,
std::string const &ComponentType,
std::string const &ComponentName,
bool &IsParent, // true or false
int &NumInlets,
Expand Down
3 changes: 1 addition & 2 deletions src/EnergyPlus/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@ SET( SRC
DataBSDFWindow.cc
DataBSDFWindow.hh
DataBranchAirLoopPlant.hh
DataBranchNodeConnections.cc
DataBranchNodeConnections.hh
DataBranchNodeConnections.hh
DataComplexFenestration.cc
DataComplexFenestration.hh
DataContaminantBalance.cc
Expand Down
48 changes: 22 additions & 26 deletions src/EnergyPlus/DXCoils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14669,10 +14669,6 @@ namespace DXCoils {
// PURPOSE OF THIS FUNCTION:
// This function looks up the given DX heating coil and returns the companion DX cooling coil.

// Using/Aliasing
using DataBranchNodeConnections::CompSets;
using DataBranchNodeConnections::NumCompSets;

// Return value
int DXCoolingCoilIndex; // Index of HP DX cooling coil returned from this function

Expand All @@ -14687,45 +14683,45 @@ namespace DXCoils {

DXCoolingCoilIndex = 0;

for (WhichComp = 1; WhichComp <= NumCompSets; ++WhichComp) {
if (!UtilityRoutines::SameString(HeatingCoilType, CompSets(WhichComp).CType) ||
!UtilityRoutines::SameString(HeatingCoilName, CompSets(WhichComp).CName))
for (WhichComp = 1; WhichComp <= state.dataBranchNodeConnections->NumCompSets; ++WhichComp) {
if (!UtilityRoutines::SameString(HeatingCoilType, state.dataBranchNodeConnections->CompSets(WhichComp).CType) ||
!UtilityRoutines::SameString(HeatingCoilName, state.dataBranchNodeConnections->CompSets(WhichComp).CName))
continue;
CompSetsParentType = CompSets(WhichComp).ParentCType;
CompSetsParentName = CompSets(WhichComp).ParentCName;
CompSetsParentType = state.dataBranchNodeConnections->CompSets(WhichComp).ParentCType;
CompSetsParentName = state.dataBranchNodeConnections->CompSets(WhichComp).ParentCName;
if (UtilityRoutines::SameString(CompSetsParentType, "AirLoopHVAC:UnitaryHeatPump:AirToAir") ||
UtilityRoutines::SameString(CompSetsParentType, "ZoneHVAC:PackagedTerminalHeatPump") ||
UtilityRoutines::SameString(CompSetsParentType, "AirLoopHVAC:UnitaryHeatPump:AirToAir:MultiSpeed") ||
UtilityRoutines::SameString(CompSetsParentType, "AirLoopHVAC:UnitaryHeatCool:VAVChangeoverBypass") ||
UtilityRoutines::SameString(CompSetsParentType, "AirLoopHVAC:UnitarySystem")) {
// Search for DX cooling coils
for (WhichCompanionComp = 1; WhichCompanionComp <= NumCompSets; ++WhichCompanionComp) {
if (!UtilityRoutines::SameString(CompSets(WhichCompanionComp).ParentCName, CompSetsParentName) ||
!UtilityRoutines::SameString(CompSets(WhichCompanionComp).CType, "Coil:Cooling:DX:SingleSpeed"))
for (WhichCompanionComp = 1; WhichCompanionComp <= state.dataBranchNodeConnections->NumCompSets; ++WhichCompanionComp) {
if (!UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).ParentCName, CompSetsParentName) ||
!UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CType, "Coil:Cooling:DX:SingleSpeed"))
continue;
DXCoolingCoilIndex = UtilityRoutines::FindItemInList(CompSets(WhichCompanionComp).CName, DXCoil);
DXCoolingCoilIndex = UtilityRoutines::FindItemInList(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CName, DXCoil);
break;
}
for (WhichCompanionComp = 1; WhichCompanionComp <= NumCompSets; ++WhichCompanionComp) {
if (!UtilityRoutines::SameString(CompSets(WhichCompanionComp).ParentCName, CompSetsParentName) ||
!UtilityRoutines::SameString(CompSets(WhichCompanionComp).CType, "Coil:Cooling:DX:MultiSpeed"))
for (WhichCompanionComp = 1; WhichCompanionComp <= state.dataBranchNodeConnections->NumCompSets; ++WhichCompanionComp) {
if (!UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).ParentCName, CompSetsParentName) ||
!UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CType, "Coil:Cooling:DX:MultiSpeed"))
continue;
DXCoolingCoilIndex = UtilityRoutines::FindItemInList(CompSets(WhichCompanionComp).CName, DXCoil);
DXCoolingCoilIndex = UtilityRoutines::FindItemInList(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CName, DXCoil);
break;
}
// Search for Heat Exchanger Assisted DX cooling coils
if (DXCoolingCoilIndex == 0) {
for (WhichHXAssistedComp = 1; WhichHXAssistedComp <= NumCompSets; ++WhichHXAssistedComp) {
if (!UtilityRoutines::SameString(CompSets(WhichHXAssistedComp).ParentCName, CompSetsParentName) ||
!UtilityRoutines::SameString(CompSets(WhichHXAssistedComp).CType, "CoilSystem:Cooling:DX:HeatExchangerAssisted"))
for (WhichHXAssistedComp = 1; WhichHXAssistedComp <= state.dataBranchNodeConnections->NumCompSets; ++WhichHXAssistedComp) {
if (!UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichHXAssistedComp).ParentCName, CompSetsParentName) ||
!UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichHXAssistedComp).CType, "CoilSystem:Cooling:DX:HeatExchangerAssisted"))
continue;
HXCompSetsParentType = CompSets(WhichHXAssistedComp).CType;
HXCompSetsParentName = CompSets(WhichHXAssistedComp).CName;
for (WhichCompanionComp = 1; WhichCompanionComp <= NumCompSets; ++WhichCompanionComp) {
if (!UtilityRoutines::SameString(CompSets(WhichCompanionComp).ParentCName, HXCompSetsParentName) ||
!UtilityRoutines::SameString(CompSets(WhichCompanionComp).CType, "Coil:Cooling:DX:SingleSpeed"))
HXCompSetsParentType = state.dataBranchNodeConnections->CompSets(WhichHXAssistedComp).CType;
HXCompSetsParentName = state.dataBranchNodeConnections->CompSets(WhichHXAssistedComp).CName;
for (WhichCompanionComp = 1; WhichCompanionComp <= state.dataBranchNodeConnections->NumCompSets; ++WhichCompanionComp) {
if (!UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).ParentCName, HXCompSetsParentName) ||
!UtilityRoutines::SameString(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CType, "Coil:Cooling:DX:SingleSpeed"))
continue;
DXCoolingCoilIndex = UtilityRoutines::FindItemInList(CompSets(WhichCompanionComp).CName, DXCoil);
DXCoolingCoilIndex = UtilityRoutines::FindItemInList(state.dataBranchNodeConnections->CompSets(WhichCompanionComp).CName, DXCoil);
break;
}
break;
Expand Down
1 change: 1 addition & 0 deletions src/EnergyPlus/Data/CommonIncludes.hh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
#include <EnergyPlus/DataAirLoop.hh>
#include <EnergyPlus/DataAirSystems.hh>
#include <EnergyPlus/DataBranchAirLoopPlant.hh>
#include <EnergyPlus/DataBranchNodeConnections.hh>
#include <EnergyPlus/DataGlobals.hh>
#include <EnergyPlus/DataWater.hh>
#include <EnergyPlus/DataTimings.hh>
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/Data/EnergyPlusData.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ namespace EnergyPlus {
this->dataBoilerSteam = std::unique_ptr<BoilerSteamData>(new BoilerSteamData);
this->dataBranchAirLoopPlant = std::unique_ptr<DataBranchAirLoopPlantData>(new DataBranchAirLoopPlantData);
this->dataBranchInputManager = std::unique_ptr<BranchInputManagerData>(new BranchInputManagerData);
this->dataBranchNodeConnections = std::unique_ptr<BranchNodeConnectionsData>(new BranchNodeConnectionsData);
this->dataChilledCeilingPanelSimple = std::unique_ptr<ChilledCeilingPanelSimpleData>(new ChilledCeilingPanelSimpleData);
this->dataChillerAbsorber = std::unique_ptr<ChillerAbsorberData>(new ChillerAbsorberData);
this->dataChillerElectricEIR = std::unique_ptr<ChillerElectricEIRData>(new ChillerElectricEIRData);
Expand Down Expand Up @@ -140,6 +141,7 @@ namespace EnergyPlus {
this->dataBoilerSteam->clear_state();
this->dataBranchAirLoopPlant->clear_state();
this->dataBranchInputManager->clear_state();
this->dataBranchNodeConnections->clear_state();
this->dataChilledCeilingPanelSimple->clear_state();
this->dataChillerAbsorber->clear_state();
this->dataChillerElectricEIR->clear_state();
Expand Down
2 changes: 2 additions & 0 deletions src/EnergyPlus/Data/EnergyPlusData.hh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ struct BaseboardRadiatorData;
struct BoilersData;
struct BoilerSteamData;
struct BranchInputManagerData;
struct BranchNodeConnectionsData;
struct ChilledCeilingPanelSimpleData;
struct ChillerAbsorberData;
struct ChillerElectricEIRData;
Expand Down Expand Up @@ -149,6 +150,7 @@ struct EnergyPlusData : BaseGlobalStruct {
std::unique_ptr<BaseboardRadiatorData> dataBaseboardRadiator;
std::unique_ptr<BoilersData> dataBoilers;
std::unique_ptr<BoilerSteamData> dataBoilerSteam;
std::unique_ptr<BranchNodeConnectionsData> dataBranchNodeConnections;
std::unique_ptr<DataBranchAirLoopPlantData> dataBranchAirLoopPlant;
std::unique_ptr<BranchInputManagerData> dataBranchInputManager;
std::unique_ptr<ChilledCeilingPanelSimpleData> dataChilledCeilingPanelSimple;
Expand Down
3 changes: 2 additions & 1 deletion src/EnergyPlus/DataBranchAirLoopPlant.hh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ namespace DataBranchAirLoopPlant {
Real64 ConstantF; // - Constant value of f (if applicable) [-]
bool EMSOverrideOn; // if TRUE, then EMS is calling to override curve value
Real64 EMSOverrideCurveValue; // Value of curve result EMS is directing to use
// report variables.

// report variables.
Real64 CurveOutput;
Real64 CurveInput1; // - MassFlow [kg/s]
Real64 CurveInput2; // - Density [kg/m3]
Expand Down
Loading