Skip to content

Commit

Permalink
rest of the extern variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jmythms committed Mar 16, 2021
1 parent 8b886b7 commit f9c7b05
Show file tree
Hide file tree
Showing 16 changed files with 665 additions and 712 deletions.
97 changes: 60 additions & 37 deletions src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,42 +214,6 @@ namespace AirflowNetwork {
int constexpr AirflowNetworkControlMultiADS(5); // Perform distribution system during system on time
// and multizone calculations during off time

extern Array1D_bool AirflowNetworkZoneFlag;

extern int NumOfNodesMultiZone; // Number of nodes for multizone calculation
extern int NumOfNodesDistribution; // Number of nodes for distribution system calculation
extern int NumOfLinksMultiZone; // Number of links for multizone calculation
extern int NumOfLinksDistribution; // Number of links for distribution system calculation
extern int NumOfNodesIntraZone; // Number of nodes for intrazone calculation
extern int NumOfLinksIntraZone; // Number of links for intrazone calculation

extern int AirflowNetworkNumOfNodes; // Number of nodes for AirflowNetwork calculation
// = NumOfNodesMultiZone+NumOfNodesDistribution
extern int AirflowNetworkNumOfComps; // Number of components for AirflowNetwork calculation
extern int AirflowNetworkNumOfLinks; // Number of links for AirflowNetwork calculation
// = NumOfLinksMultiZone+NumOfLinksDistribution
// RoomAirManager use
extern int AirflowNetworkNumOfSurfaces; // The number of surfaces for multizone calculation
extern int AirflowNetworkNumOfZones; // The number of zones for multizone calculation

extern bool RollBackFlag; // Roll back flag when system time step down shifting
extern Array1D<Real64> ANZT; // Local zone air temperature for roll back use
extern Array1D<Real64> ANZW; // Local zone air humidity ratio for roll back use
extern Array1D<Real64> ANCO; // Local zone air CO2 for roll back use
extern Array1D<Real64> ANGC; // Local zone air generic contaminant for roll back use
extern int AirflowNetworkNumOfExhFan; // Number of zone exhaust fans
extern Array1D_bool AirflowNetworkZoneExhaustFan; // Logical to use zone exhaust fans
extern bool AirflowNetworkFanActivated; // Supply fan activation flag
extern bool AirflowNetworkUnitarySystem; // set to TRUE for unitary systems (to make answers equal, will remove eventually)
// Multispeed HP only
extern int MultiSpeedHPIndicator; // Indicator for multispeed heat pump use
// Addiitonal airflow needed for an VAV fan to compensate the leakage losses and supply pathway pressure losses [kg/s]
extern Real64 VAVTerminalRatio; // The terminal flow ratio when a supply VAV fan reach its max flow rate
extern bool VAVSystem; // This flag is used to represent a VAV system
extern Real64 ExhaustFanMassFlowRate; // Exhaust fan flow rate used in PressureStat
extern int PressureSetFlag; // PressureSet flag
extern Real64 ReliefMassFlowRate; // OA Mixer relief node flow rate used in PressureStat

// Types

struct AirflowNetworkSimuProp // Basic parameters for AirflowNetwork simulation
Expand Down Expand Up @@ -1659,6 +1623,42 @@ struct AirflowNetworkData : BaseGlobalStruct {

int SimulateAirflowNetwork = 1;

Array1D_bool AirflowNetworkZoneFlag;

int NumOfNodesMultiZone = 0; // Number of nodes for multizone calculation
int NumOfNodesDistribution = 0; // Number of nodes for distribution system calculation
int NumOfLinksMultiZone = 0; // Number of links for multizone calculation
int NumOfLinksDistribution = 0; // Number of links for distribution system calculation
int NumOfNodesIntraZone = 0; // Number of nodes for intrazone calculation
int NumOfLinksIntraZone = 0; // Number of links for intrazone calculation

int AirflowNetworkNumOfNodes = 0; // Number of nodes for AirflowNetwork calculation
// = NumOfNodesMultiZone+NumOfNodesDistribution
int AirflowNetworkNumOfComps = 0; // Number of components for AirflowNetwork calculation
int AirflowNetworkNumOfLinks = 0; // Number of links for AirflowNetwork calculation
// = NumOfLinksMultiZone+NumOfLinksDistribution
// RoomAirManager use
int AirflowNetworkNumOfSurfaces = 0; // The number of surfaces for multizone calculation
int AirflowNetworkNumOfZones = 0; // The number of zones for multizone calculation

bool RollBackFlag = false; // Roll back flag when system time step down shifting
Array1D<Real64> ANZT; // Local zone air temperature for roll back use
Array1D<Real64> ANZW; // Local zone air humidity ratio for roll back use
Array1D<Real64> ANCO; // Local zone air CO2 for roll back use
Array1D<Real64> ANGC; // Local zone air generic contaminant for roll back use
int AirflowNetworkNumOfExhFan = 0; // Number of zone exhaust fans
Array1D_bool AirflowNetworkZoneExhaustFan; // Logical to use zone exhaust fans
bool AirflowNetworkFanActivated = false; // Supply fan activation flag
bool AirflowNetworkUnitarySystem = false; // set to TRUE for unitary systems (to make answers equal, will remove eventually)
// Multispeed HP only
int MultiSpeedHPIndicator = 0; // Indicator for multispeed heat pump use
// Additional airflow needed for an VAV fan to compensate the leakage losses and supply pathway pressure losses [kg/s]
Real64 VAVTerminalRatio = 0.0; // The terminal flow ratio when a supply VAV fan reach its max flow rate
bool VAVSystem = false; // This flag is used to represent a VAV system
Real64 ExhaustFanMassFlowRate = 0.0; // Exhaust fan flow rate used in PressureStat
int PressureSetFlag = 0; // PressureSet flag
Real64 ReliefMassFlowRate = 0.0; // OA Mixer relief node flow rate used in PressureStat

Array1D<AirflowNetwork::AirflowNetworkNodeSimuData> AirflowNetworkNodeSimu;
Array1D<AirflowNetwork::AirflowNetworkLinkSimuData> AirflowNetworkLinkSimu;

Expand Down Expand Up @@ -1709,7 +1709,30 @@ struct AirflowNetworkData : BaseGlobalStruct {
this->SimulateAirflowNetwork = 1;
this->AirflowNetworkNodeSimu.clear();
this->AirflowNetworkLinkSimu.clear();

this->AirflowNetworkZoneFlag.clear();
this->NumOfNodesMultiZone = 0;
this->NumOfNodesDistribution = 0;
this->NumOfLinksMultiZone = 0;
this->NumOfLinksDistribution = 0;
this->NumOfNodesIntraZone = 0;
this->NumOfLinksIntraZone = 0;
this->AirflowNetworkNumOfNodes = 0;
this->AirflowNetworkNumOfComps = 0;
this->AirflowNetworkNumOfLinks = 0;
this->AirflowNetworkNumOfSurfaces = 0;
this->AirflowNetworkNumOfZones = 0;
this->RollBackFlag = false;
this->ANZT.clear();
this->ANZW.clear();
this->ANCO.clear();
this->ANGC.clear();
this->AirflowNetworkNumOfExhFan = 0;
this->AirflowNetworkZoneExhaustFan.clear();
this->AirflowNetworkFanActivated = false;
this->AirflowNetworkUnitarySystem = false;
this->MultiSpeedHPIndicator = 0;
this->VAVTerminalRatio = 0.0;
this->VAVSystem = false;
this->AirflowNetworkSimu = AirflowNetwork::AirflowNetworkSimuProp();
this->AirflowNetworkNodeData.clear();
this->AirflowNetworkCompData.clear();
Expand Down
98 changes: 14 additions & 84 deletions src/EnergyPlus/AirflowNetwork/src/Elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,52 +85,6 @@ namespace AirflowNetwork {
// Link simulation variable in air distribution system
// Sensible and latent exchange variable in air distribution system

// Vent Control DistSys Control Flag Description
// NONE NONE 0 No AirflowNetwork and SIMPLE
// SIMPLE NONE 1 Simple calculations only
// MULTIZONE NONE 2 Perform multizone calculations only
// NONE DISTSYS 3 Perform distribution system during system on time only
// SIMPLE DISTSYS 4 Perform distribution system during system on time and simple calculations during off time
// MULTIZONE DISTSYS 5 Perform distribution system during system on time and multizone calculations during off time



Array1D_bool AirflowNetworkZoneFlag;

int NumOfNodesMultiZone(0); // Number of nodes for multizone calculation
int NumOfNodesDistribution(0); // Number of nodes for distribution system calculation
int NumOfLinksMultiZone(0); // Number of links for multizone calculation
int NumOfLinksDistribution(0); // Number of links for distribution system calculation
int NumOfNodesIntraZone(0); // Number of nodes for intrazone calculation
int NumOfLinksIntraZone(0); // Number of links for intrazone calculation

int AirflowNetworkNumOfNodes(0); // Number of nodes for AirflowNetwork calculation
// = NumOfNodesMultiZone+NumOfNodesDistribution
int AirflowNetworkNumOfComps(0); // Number of components for AirflowNetwork calculation
int AirflowNetworkNumOfLinks(0); // Number of links for AirflowNetwork calculation
// = NumOfLinksMultiZone+NumOfLinksDistribution
// RoomAirManager use
int AirflowNetworkNumOfSurfaces(0); // The number of surfaces for multizone calculation
int AirflowNetworkNumOfZones(0); // The number of zones for multizone calculation

bool RollBackFlag(false); // Roll back flag when system time step down shifting
Array1D<Real64> ANZT; // Local zone air temperature for roll back use
Array1D<Real64> ANZW; // Local zone air humidity ratio for roll back use
Array1D<Real64> ANCO; // Local zone air CO2 for roll back use
Array1D<Real64> ANGC; // Local zone air generic contaminant for roll back use
int AirflowNetworkNumOfExhFan(0); // Number of zone exhaust fans
Array1D_bool AirflowNetworkZoneExhaustFan; // Logical to use zone exhaust fans
bool AirflowNetworkFanActivated(false); // Supply fan activation flag
bool AirflowNetworkUnitarySystem(false); // set to TRUE for unitary systems (to make answers equal, will remove eventually)
// Multispeed HP only
int MultiSpeedHPIndicator(0); // Indicator for multispeed heat pump use
// Additional airflow needed for an VAV fan to compensate the leakage losses and supply pathway pressure losses [kg/s]
Real64 VAVTerminalRatio(0.0); // The terminal flow ratio when a supply VAV fan reach its max flow rate
bool VAVSystem(false); // This flag is used to represent a VAV system
Real64 ExhaustFanMassFlowRate(0.0); // Exhaust fan flow rate used in PressureStat
int PressureSetFlag(0); // PressureSet flag
Real64 ReliefMassFlowRate(0.0); // OA Mixer relief node flow rate used in PressureStat

// Object Data
//Array1D<AirflowNetworkExchangeProp> AirflowNetworkExchangeData;
//Array1D<AirflowNetworkExchangeProp> AirflowNetworkMultiExchangeData;
Expand Down Expand Up @@ -487,7 +441,7 @@ namespace AirflowNetwork {


// Crack standard condition from given inputs
if (i > NetworkNumOfLinks - NumOfLinksIntraZone) {
if (i > NetworkNumOfLinks - state.dataAirflowNetwork->NumOfLinksIntraZone) {
Corr = 1.0;
} else {
Corr = state.dataAirflowNetwork->MultizoneSurfaceData(i).Factor;
Expand Down Expand Up @@ -604,7 +558,7 @@ namespace AirflowNetwork {


// Crack standard condition from given inputs
//if (i > NetworkNumOfLinks - NumOfLinksIntraZone) {
//if (i > NetworkNumOfLinks - state.dataAirflowNetwork->NumOfLinksIntraZone) {
// Corr = 1.0;
//} else {
// Corr = state.dataAirflowNetwork->MultizoneSurfaceData(i).Factor;
Expand Down Expand Up @@ -905,7 +859,7 @@ namespace AirflowNetwork {
F[0] = state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopSystemOnMassFlowrate;
} else {
F[0] = state.dataLoopNodes->Node(InletNode).MassFlowRate * Ctrl;
if (MultiSpeedHPIndicator == 2) {
if (state.dataAirflowNetwork->MultiSpeedHPIndicator == 2) {
F[0] = state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopSystemOnMassFlowrate * state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopCompCycRatio +
state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopSystemOffMassFlowrate * (1.0 - state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopCompCycRatio);
}
Expand All @@ -917,7 +871,7 @@ namespace AirflowNetwork {
NF = GenericDuct(0.1, 0.001, LFLAG, PDROP, propN, propM, F, DF);
}

if (MultiSpeedHPIndicator == 2) {
if (state.dataAirflowNetwork->MultiSpeedHPIndicator == 2) {
F[0] = state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopSystemOnMassFlowrate;
}
} else if (FanTypeNum == FanType_SimpleVAV) {
Expand All @@ -942,9 +896,9 @@ namespace AirflowNetwork {
}
}
F[0] = SumTermFlow / (1.0 - SumFracSuppLeak);
VAVTerminalRatio = 0.0;
state.dataAirflowNetwork->VAVTerminalRatio = 0.0;
if (F[0] > MaxAirMassFlowRate) {
VAVTerminalRatio = MaxAirMassFlowRate / F[0];
state.dataAirflowNetwork->VAVTerminalRatio = MaxAirMassFlowRate / F[0];
F[0] = MaxAirMassFlowRate;
}
}
Expand Down Expand Up @@ -2810,8 +2764,8 @@ namespace AirflowNetwork {
// If damper, setup the airflows from nodal values calculated from terminal
if (state.dataAirflowNetwork->AirflowNetworkLinkageData(i).VAVTermDamper) {
F[0] = state.dataLoopNodes->Node(DamperInletNode).MassFlowRate;
if (VAVTerminalRatio > 0.0) {
F[0] *= VAVTerminalRatio;
if (state.dataAirflowNetwork->VAVTerminalRatio > 0.0) {
F[0] *= state.dataAirflowNetwork->VAVTerminalRatio;
}
DF[0] = 0.0;
}
Expand Down Expand Up @@ -3157,8 +3111,8 @@ namespace AirflowNetwork {

if (state.dataLoopNodes->Node(InletNode).MassFlowRate > VerySmallMassFlow) {
// Treat the component as an exhaust fan
if (PressureSetFlag == PressureCtrlExhaust) {
F[0] = ExhaustFanMassFlowRate;
if (state.dataAirflowNetwork->PressureSetFlag == PressureCtrlExhaust) {
F[0] = state.dataAirflowNetwork->ExhaustFanMassFlowRate;
} else {
F[0] = state.dataLoopNodes->Node(InletNode).MassFlowRate;
}
Expand Down Expand Up @@ -3284,8 +3238,8 @@ namespace AirflowNetwork {

if (state.dataLoopNodes->Node(InletNode).MassFlowRate > VerySmallMassFlow) {
// Treat the component as an exhaust fan
if (PressureSetFlag == PressureCtrlExhaust) {
F[0] = ExhaustFanMassFlowRate;
if (state.dataAirflowNetwork->PressureSetFlag == PressureCtrlExhaust) {
F[0] = state.dataAirflowNetwork->ExhaustFanMassFlowRate;
} else {
F[0] = state.dataLoopNodes->Node(InletNode).MassFlowRate;
}
Expand Down Expand Up @@ -3640,8 +3594,8 @@ namespace AirflowNetwork {
if (state.dataLoopNodes->Node(OutletNode).MassFlowRate > VerySmallMassFlow) {
// Treat the component as an exhaust fan
DF[0] = 0.0;
if (PressureSetFlag == PressureCtrlRelief) {
F[0] = ReliefMassFlowRate;
if (state.dataAirflowNetwork->PressureSetFlag == PressureCtrlRelief) {
F[0] = state.dataAirflowNetwork->ReliefMassFlowRate;
} else {
F[0] = state.dataLoopNodes->Node(OutletNode).MassFlowRate;
if (state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopFanOperationMode == CycFanCycComp && state.dataAirLoop->AirLoopAFNInfo(AirLoopNum).LoopOnOffFanPartLoadRatio > 0.0) {
Expand Down Expand Up @@ -3721,30 +3675,6 @@ namespace AirflowNetwork {

void clear_state()
{
AirflowNetworkZoneFlag.deallocate();
NumOfNodesMultiZone = 0;
NumOfNodesDistribution = 0;
NumOfLinksMultiZone = 0;
NumOfLinksDistribution = 0;
NumOfNodesIntraZone = 0;
NumOfLinksIntraZone = 0;
AirflowNetworkNumOfNodes = 0;
AirflowNetworkNumOfComps = 0;
AirflowNetworkNumOfLinks = 0;
AirflowNetworkNumOfSurfaces = 0;
AirflowNetworkNumOfZones = 0;
RollBackFlag = false;
ANZT.deallocate();
ANZW.deallocate();
ANCO.deallocate();
ANGC.deallocate();
AirflowNetworkNumOfExhFan = 0;
AirflowNetworkZoneExhaustFan.deallocate();
AirflowNetworkFanActivated = false;
AirflowNetworkUnitarySystem = false;
MultiSpeedHPIndicator = 0;
VAVTerminalRatio = 0.0;
VAVSystem = false;
//AirflowNetworkExchangeData.deallocate();
//AirflowNetworkMultiExchangeData.deallocate();
//AirflowNetworkLinkReport.deallocate();
Expand Down
Loading

0 comments on commit f9c7b05

Please sign in to comment.