diff --git a/idd/Energy+.idd.in b/idd/Energy+.idd.in index 3c923bf076c..50bb85032d6 100644 --- a/idd/Energy+.idd.in +++ b/idd/Energy+.idd.in @@ -25597,13 +25597,18 @@ AirflowNetwork:MultiZone:Surface, \default PolygonHeight \note This field is applied to a non-rectangular window or door. The equivalent shape has \note the same area as a polygonal window or door. - N7; \field Equivalent Rectangle Aspect Ratio + N7, \field Equivalent Rectangle Aspect Ratio \note This field is used when UserDefinedAspectRatio is entered in the Equivalent \note Rectangle Method field. \units dimensionless \type real \minimum> 0.0 \default 1.0 + A9; \field Control Schedule Name + \type object-list + \object-list ScheduleNames + \note If specified, this schedule will be applied to the control parameter of the specified leakage component. + \note Not used if Ventilation Control Mode != NoVent or Occupant Ventilation Control Name is specified. AirflowNetwork:MultiZone:ReferenceCrackConditions, \min-fields 4 diff --git a/src/EnergyPlus/AirflowNetwork/CMakeLists.txt b/src/EnergyPlus/AirflowNetwork/CMakeLists.txt index 66179921c93..858750ac43d 100644 --- a/src/EnergyPlus/AirflowNetwork/CMakeLists.txt +++ b/src/EnergyPlus/AirflowNetwork/CMakeLists.txt @@ -6,9 +6,9 @@ if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER "3.0") cmake_policy(SET CMP0054 NEW) # CMake 3.1 added this policy endif() -set(HDRS include/AirflowNetwork/Solver.hpp include/AirflowNetwork/Elements.hpp include/AirflowNetwork/Properties.hpp) +set(HDRS include/AirflowNetwork/Types.hpp include/AirflowNetwork/Solver.hpp include/AirflowNetwork/Elements.hpp include/AirflowNetwork/Linkages.hpp include/AirflowNetwork/Properties.hpp include/AirflowNetwork/Nodes.hpp) -set(SRCS src/Solver.cpp src/Elements.cpp src/Properties.cpp) +set(SRCS src/Solver.cpp src/Elements.cpp src/Linkages.cpp src/Properties.cpp src/Nodes.cpp) # Create a static library # this will be linked statically to create the DLL and also the unit tests diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp index a3e9b8c3ad4..f54e0080cb8 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp @@ -49,6 +49,7 @@ #define AIRFLOWNETWORK_ELEMENTS_HPP #include "AirflowNetwork/Properties.hpp" +#include "AirflowNetwork/Types.hpp" #include #include #include @@ -61,167 +62,6 @@ struct AirflowNetworkData; namespace AirflowNetwork { - enum VentControlType // TODO: make enum class - { - None = 0, // Wrong input - Temp = 1, // Temperature venting control - Enth = 2, // Enthalpy venting control - Const = 3, // Constant venting control - ASH55 = 4, - CEN15251 = 5, - NoVent = 6, // No venting - ZoneLevel = 7, // ZoneLevel control for a heat transfer subsurface - AdjTemp = 8, // Temperature venting control based on adjacent zone conditions - AdjEnth = 9 // Enthalpy venting control based on adjacent zone conditions - }; - - enum OpenStatus // TODO: make enum class - { - FreeOperation = 0, // Free operation - MinCheckForceOpen = 1, // Force open when opening elapsed time is less than minimum opening time - MinCheckForceClose = 2 // Force open when closing elapsed time is less than minimum closing time - }; - - enum ProbabilityCheck // TODO: make enum class - { - NoAction = 0, // No action from probability check - ForceChange = 1, // Force open or close from probability check - KeepStatus = 2 // Keep status at the previous time step from probability check - }; - - enum class EquivRec - { - Height, // Effective rectangle polygonal height selection - BaseAspectRatio, // Effective rectangle base surface aspect ratio selection - UserAspectRatio // Effective rectangle user input aspect ratio selection - }; - - enum class DuctLineType - { - Invalid = -1, - SupplyTrunk, // Supply trunk - SupplyBranch, // SupplyBrnach - ReturnTrunk, // Return trunk - ReturnBranch, // ReturnBrnach - }; - - // Using/Aliasing - - // Data - // module should be available to other modules and routines. Thus, - // all variables in this module must be PUBLIC. - - // MODULE PARAMETER DEFINITIONS: - enum class iComponentTypeNum : int - { - Invalid = 0, - DOP = 1, // Detailed large opening component - SOP = 2, // Simple opening component - SCR = 3, // Surface crack component - SEL = 4, // Surface effective leakage ratio component - PLR = 5, // Distribution system crack component - DWC = 6, // Distribution system duct component - CVF = 7, // Distribution system constant volume fan component - FAN = 8, // Distribution system detailed fan component - MRR = 9, // Distribution system multiple curve fit power law resistant flow component - DMP = 10, // Distribution system damper component - ELR = 11, // Distribution system effective leakage ratio component - CPD = 12, // Distribution system constant pressure drop component - COI = 13, // Distribution system coil component - TMU = 14, // Distribution system terminal unit component - EXF = 15, // Zone exhaust fan - HEX = 16, // Distribution system heat exchanger - HOP = 17, // Horizontal opening component - RVD = 18, // Reheat VAV terminal damper - OAF = 19, // Distribution system OA - REL = 20, // Distribution system relief air - SMF = 21, // Specified mass flow component - SVF = 22, // Specified volume flow component - Num - }; - - enum class ComponentType - { - // TODO: enum check - Invalid = -1, - DOP = 1, // Detailed large opening component - SOP, // Simple opening component - SCR, // Surface crack component - SEL, // Surface effective leakage ratio component - PLR, // Distribution system crack component - DWC, // Distribution system duct component - CVF, // Distribution system constant volume fan component - FAN, // Distribution system detailed fan component - MRR, // Distribution system multiple curve fit power law resistant flow component - DMP, // Distribution system damper component - ELR, // Distribution system effective leakage ratio component - CPD, // Distribution system constant pressure drop component - COI, // Distribution system coil component - TMU, // Distribution system terminal unit component - EXF, // Zone exhaust fan - HEX, // Distribution system heat exchanger - HOP, // Horizontal opening component - RVD, // Reheat VAV terminal damper - OAF, // Distribution system OA - REL, // Distribution system relief air - SMF, // Specified mass flow component - SVF, // Specified volume flow component - Num - }; - - // EPlus component Type - enum class iEPlusComponentType : int - { - Invalid = 0, - SCN = 1, // Supply connection - RCN = 2, // Return connection - RHT = 3, // Reheat terminal - FAN = 4, // Fan - COI = 5, // Heating or cooling coil - HEX = 6, // Heat exchanger - RVD = 7, // Reheat VAV terminal damper - Num - }; - - // EPlus node type - enum class iEPlusNodeType : int - { - Invalid = 0, - ZIN = 1, // Zone inlet node - ZOU = 2, // Zone outlet node - SPL = 3, // Splitter node - MIX = 4, // Mixer node - OAN = 5, // Outside air system node - EXT = 6, // OA system inlet node - FIN = 7, // Fan Inlet node - FOU = 8, // Fan Outlet Node - COU = 9, // Coil Outlet Node - HXO = 10, // Heat exchanger Outlet Node - DIN = 11, // Damper Inlet node - DOU = 12, // Damper Outlet Node - SPI = 13, // Splitter inlet Node - SPO = 14, // Splitter Outlet Node - Num - }; - - enum class iWPCCntr : int - { - Invalid = 0, - Input = 1, - SurfAvg = 2, - Num - }; - - int constexpr PressureCtrlExhaust = 1; - int constexpr PressureCtrlRelief = 2; - - // DERIVED TYPE DEFINITIONS: - - // MODULE VARIABLE DECLARATIONS: - // Node simulation variable in air distribution system - // Link simulation variable in air distribution system - // Sensible and latent exchange variable in air distribution system - void generic_crack(Real64 const coef, // Flow coefficient Real64 const expn, // Flow exponent bool const LFLAG, // Initialization flag.If = 1, use laminar relationship @@ -242,7 +82,6 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - // Types struct MultizoneZoneProp // Zone information { // Members @@ -282,75 +121,6 @@ namespace AirflowNetwork { } }; - struct MultizoneSurfaceProp // Surface information - { - // Members - std::string SurfName; // Name of Associated EnergyPlus surface - std::string OpeningName; // Name of opening component, either simple or detailed large opening - std::string ExternalNodeName; // Name of external node, but not used at WPC="INPUT" - Real64 Factor; // Crack Actual Value or Window Open Factor for Ventilation - int SurfNum; // Surface number - std::array NodeNums; // Positive: Zone numbers; 0: External - Real64 OpenFactor; // Surface factor - Real64 OpenFactorLast; // Surface factor at previous time step - bool EMSOpenFactorActuated; // True if EMS actuation is on - Real64 EMSOpenFactor; // Surface factor value from EMS for override - Real64 Height; // Surface Height - Real64 Width; // Surface width - Real64 CHeight; // Surface central height in z direction - std::string VentControl; // Ventilation Control Mode: TEMPERATURE, ENTHALPIC, CONSTANT, ZONELEVEL or NOVENT - Real64 ModulateFactor; // Limit Value on Multiplier for Modulating Venting Open Factor - Real64 LowValueTemp; // Lower Value on Inside/Outside Temperature Difference for - // Modulating the Venting Open Factor with temp control - Real64 UpValueTemp; // Upper Value on Inside/Outside Temperature Difference for - // Modulating the Venting Open Factor with temp control - Real64 LowValueEnth; // Lower Value on Inside/Outside Temperature Difference for - // Modulating the Venting Open Factor with Enthalpic control - Real64 UpValueEnth; // Upper Value on Inside/Outside Temperature Difference for - // Modulating the Venting Open Factor with Enthalpic control - std::string VentTempControlSchName; // Name of ventilation temperature control schedule - Sched::Schedule *ventTempControlSched = nullptr; // Ventilation temperature control schedule - VentControlType VentSurfCtrNum; // Ventilation control mode number: 1 "Temperature", 2 "ENTHALPIC", 3 "CONSTANT", 4 "NOVENT" - std::string VentAvailSchName; // Ventilation availability schedule - Sched::Schedule *ventAvailSched = nullptr; // Ventilation availability schedule - int ZonePtr; // Pointer to inside face zone - bool IndVentControl; // Individual surface venting control - int ExtLargeOpeningErrCount; // Exterior large opening error count during HVAC system operation - int ExtLargeOpeningErrIndex; // Exterior large opening error index during HVAC system operation - int OpenFactorErrCount; // Large opening error count at Open factor > 1.0 - int OpenFactorErrIndex; // Large opening error error index at Open factor > 1.0 - Real64 Multiplier; // Window multiplier - bool HybridVentClose; // Hybrid ventilation window close control logical - bool HybridCtrlGlobal; // Hybrid ventilation global control logical - bool HybridCtrlMaster; // Hybrid ventilation global control master - Real64 WindModifier; // Wind modifier from hybrid ventilation control - std::string OccupantVentilationControlName; // Occupant ventilation control name - int OccupantVentilationControlNum; // Occupant ventilation control number - int OpeningStatus; // Open status at current time step - int PrevOpeningstatus; // Open status at previous time step - Real64 CloseElapsedTime; // Elapsed time during closing (min) - Real64 OpenElapsedTime; // Elapsed time during closing (min) - int ClosingProbStatus; // Closing probability status - int OpeningProbStatus; // Opening probability status - bool RAFNflag; // True if this surface is used in AirflowNetwork:IntraZone:Linkage - bool NonRectangular; // True if this surface is not rectangular - EquivRec EquivRecMethod; // Equivalent Rectangle Method input: 1 Height; 2 Base surface aspect ratio; 3 User input aspect ratio - Real64 EquivRecUserAspectRatio; // user input value when EquivRecMethod = 3 - - // Default Constructor - MultizoneSurfaceProp() - : Factor(0.0), SurfNum(0), NodeNums{{0, 0}}, OpenFactor(0.0), OpenFactorLast(0.0), EMSOpenFactorActuated(false), EMSOpenFactor(0.0), - Height(0.0), Width(0.0), CHeight(0.0), VentControl("ZONELEVEL"), ModulateFactor(0.0), LowValueTemp(0.0), UpValueTemp(100.0), - LowValueEnth(0.0), UpValueEnth(300000.0), VentSurfCtrNum(VentControlType::None), ZonePtr(0), IndVentControl(false), - ExtLargeOpeningErrCount(0), ExtLargeOpeningErrIndex(0), OpenFactorErrCount(0), OpenFactorErrIndex(0), Multiplier(1.0), - HybridVentClose(false), HybridCtrlGlobal(false), HybridCtrlMaster(false), WindModifier(1.0), OccupantVentilationControlNum(0), - OpeningStatus(OpenStatus::FreeOperation), PrevOpeningstatus(OpenStatus::FreeOperation), CloseElapsedTime(0.0), OpenElapsedTime(0.0), - ClosingProbStatus(ProbabilityCheck::NoAction), OpeningProbStatus(ProbabilityCheck::NoAction), RAFNflag(false), NonRectangular(false), - EquivRecMethod(EquivRec::Height), EquivRecUserAspectRatio(1.0) - { - } - }; - struct AirflowElement { AirflowElement() @@ -393,7 +163,7 @@ namespace AirflowNetwork { return 1; } - virtual ComponentType type() = 0; + virtual AirflowElementType type() = 0; }; int constexpr NrInt = 20; // Number of intervals for a large opening @@ -519,9 +289,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::DOP; + return AirflowElementType::DOP; } }; @@ -551,9 +321,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::SOP; + return AirflowElementType::SOP; } }; @@ -582,9 +352,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::HOP; + return AirflowElementType::HOP; } }; @@ -610,9 +380,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::SMF; + return AirflowElementType::SMF; } }; @@ -638,9 +408,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::SVF; + return AirflowElementType::SVF; } }; @@ -700,9 +470,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::SCR; + return AirflowElementType::SCR; } }; @@ -743,9 +513,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::SEL; + return AirflowElementType::SEL; } }; @@ -793,9 +563,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::EXF; + return AirflowElementType::EXF; } }; @@ -846,40 +616,6 @@ namespace AirflowNetwork { } }; - struct AirflowNetworkLinkage // AirflowNetwork linkage data base class - { - // Members - std::string Name; // Provide a unique linkage name - std::array NodeNames; // Names of nodes (limited to 2) - std::array NodeHeights; // Node heights - std::string CompName; // Name of element - int CompNum; // Element Number - std::array NodeNums; // Node numbers - int LinkNum; // Linkage number - AirflowElement *element; // Pointer to airflow element - Real64 control; // Control value - - // Default Constructor - AirflowNetworkLinkage() : NodeHeights{{0.0, 0.0}}, CompNum(0), NodeNums{{0, 0}}, LinkNum(0), element(nullptr), control(1.0) - { - } - - virtual ~AirflowNetworkLinkage() - { - } - }; - - struct IntraZoneLinkageProp : public AirflowNetworkLinkage // Intra zone linkage data - { - // Members - std::string SurfaceName; // Connection Surface Name - - // Default Constructor - IntraZoneLinkageProp() : AirflowNetworkLinkage() - { - } - }; - struct DisSysNodeProp // CP Value { // Members @@ -929,9 +665,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::PLR; + return AirflowElementType::PLR; } }; @@ -970,9 +706,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::ELR; + return AirflowElementType::ELR; } }; @@ -1028,9 +764,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::DWC; + return AirflowElementType::DWC; } }; @@ -1075,9 +811,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::DMP; + return AirflowElementType::DMP; } }; @@ -1113,9 +849,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::CVF; + return AirflowElementType::CVF; } }; @@ -1159,9 +895,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::FAN; + return AirflowElementType::FAN; } }; @@ -1200,9 +936,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::COI; + return AirflowElementType::COI; } }; @@ -1241,9 +977,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::HEX; + return AirflowElementType::HEX; } }; @@ -1274,9 +1010,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::TMU; + return AirflowElementType::TMU; } }; @@ -1303,21 +1039,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() - { - return ComponentType::CPD; - } - }; - - struct DisSysLinkageProp : public AirflowNetworkLinkage // Distribution system linkage data - { - // Members - std::string ZoneName; // Name of zone - int ZoneNum; // Zone Number - - // Default Constructor - DisSysLinkageProp() : AirflowNetworkLinkage(), ZoneNum(0) + virtual AirflowElementType type() { + return AirflowElementType::CPD; } }; @@ -1336,7 +1060,7 @@ namespace AirflowNetwork { int EPlusNodeNum; int ExtNodeNum; int OutAirNodeNum; - iEPlusNodeType EPlusTypeNum; + EPlusNodeType EPlusTypeNum; int RAFNNodeNum; // RoomAir model node number int NumOfLinks; // Number of links for RoomAir model int AirLoopNum; // AirLoop number @@ -1344,7 +1068,7 @@ namespace AirflowNetwork { // Default Constructor AirflowNetworkNodeProp() : NodeHeight(0.0), NodeNum(0), NodeTypeNum(0), EPlusZoneNum(0), EPlusNodeNum(0), ExtNodeNum(0), OutAirNodeNum(0), - EPlusTypeNum(iEPlusNodeType::Invalid), RAFNNodeNum(0), NumOfLinks(0), AirLoopNum(0) + EPlusTypeNum(EPlusNodeType::Invalid), RAFNNodeNum(0), NumOfLinks(0), AirLoopNum(0) { } }; @@ -1353,36 +1077,16 @@ namespace AirflowNetwork { { // Members std::string Name; // Provide a unique element name - iComponentTypeNum CompTypeNum; // Provide numeric equivalent for AirflowNetworkCompType + AirflowElementType CompTypeNum; // Provide numeric equivalent for AirflowNetworkCompType int TypeNum; // Component number under same component type int CompNum; // General component number std::string EPlusName; // Provide a unique element name std::string EPlusCompName; // Provide EPlus component name or Other std::string EPlusType; // Provide EPlus type, such as terminal reheat, coil, etc. 9/30/03 or Other - iEPlusComponentType EPlusTypeNum; // Provide EPlus component type + EPlusComponentType EPlusTypeNum; // Provide EPlus component type // Default Constructor - AirflowNetworkCompProp() : CompTypeNum(iComponentTypeNum::Invalid), TypeNum(0), CompNum(0), EPlusTypeNum(iEPlusComponentType::Invalid) - { - } - }; - - struct AirflowNetworkLinkageProp : public AirflowNetworkLinkage // AirflowNetwork linkage data - { - // Members - std::string ZoneName; // Name of zone - int ZoneNum; // Zone Number - int DetOpenNum; // Large Opening number - iEPlusComponentType ConnectionFlag; // Return and supply connection flag - bool VAVTermDamper; // True if this component is a damper for a VAV terminal - int LinkageViewFactorObjectNum; - int AirLoopNum; // Airloop number - DuctLineType ductLineType; - - // Default Constructor - AirflowNetworkLinkageProp() - : AirflowNetworkLinkage(), ZoneNum(0), DetOpenNum(0), ConnectionFlag(iEPlusComponentType::Invalid), VAVTermDamper(false), - LinkageViewFactorObjectNum(0), AirLoopNum(0), ductLineType(DuctLineType::Invalid) + AirflowNetworkCompProp() : CompTypeNum(AirflowElementType::Invalid), TypeNum(0), CompNum(0), EPlusTypeNum(EPlusComponentType::Invalid) { } }; @@ -1447,9 +1151,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::OAF; + return AirflowElementType::OAF; } }; @@ -1473,9 +1177,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::REL; + return AirflowElementType::REL; } }; @@ -1498,45 +1202,6 @@ namespace AirflowNetwork { } }; - struct AirflowNetworkLinkSimuData - { - // Members - Real64 FLOW; // Mass flow rate [kg/s] - Real64 FLOW2; // Mass flow rate [kg/s] for two way flow - Real64 DP; // Pressure difference across a component - Real64 VolFLOW; // Mass flow rate [m3/s] - Real64 VolFLOW2; // Mass flow rate [m3/s] for two way flow - Real64 DP1; - - // Default Constructor - AirflowNetworkLinkSimuData() : FLOW(0.0), FLOW2(0.0), DP(0.0), VolFLOW(0.0), VolFLOW2(0.0), DP1(0.0) - { - } - }; - - struct AirflowNetworkLinkReportData - { - // Members - Real64 FLOW; // Mass flow rate [kg/s] - Real64 FLOW2; // Mass flow rate [kg/s] for two way flow - Real64 VolFLOW; // Mass flow rate [m^3/s] - Real64 VolFLOW2; // Mass flow rate [m^3/s] for two way flow - Real64 FLOWOFF; // Mass flow rate during OFF cycle [kg/s] - Real64 FLOW2OFF; // Mass flow rate during OFF cycle [kg/s] for two way flow - Real64 VolFLOWOFF; // Mass flow rate during OFF cycle [m^3/s] - Real64 VolFLOW2OFF; // Mass flow rate during OFF cycle [m^3/s] for two way flow - Real64 DP; // Average Pressure difference across a component - Real64 DPON; // Pressure difference across a component with fan on - Real64 DPOFF; // Pressure difference across a component with fan off - - // Default Constructor - AirflowNetworkLinkReportData() - : FLOW(0.0), FLOW2(0.0), VolFLOW(0.0), VolFLOW2(0.0), FLOWOFF(0.0), FLOW2OFF(0.0), VolFLOWOFF(0.0), VolFLOW2OFF(0.0), DP(0.0), DPON(0.0), - DPOFF(0.0) - { - } - }; - struct AirflowNetworkNodeReportData // Node variable for simulation { // Members @@ -1661,37 +1326,6 @@ namespace AirflowNetwork { } }; - struct LinkageSurfaceProp - { - // Members - std::string SurfaceName; - int SurfaceNum; // Name of surface referenced by view factor - Real64 ViewFactor; // View factor - Real64 SurfaceResistanceFactor; // Total radiation heat transfer resistance factor - Real64 SurfaceRadLoad; // Duct radiation load from surface [W] - - // Default constructor - LinkageSurfaceProp() : SurfaceNum(0), ViewFactor(0.0), SurfaceResistanceFactor(0.0), SurfaceRadLoad(0.0) - { - } - }; - - struct AirflowNetworkLinkageViewFactorProp - { - // Members - std::string LinkageName; - Real64 DuctExposureFraction; - Real64 DuctEmittance; - Array1D LinkageSurfaceData; - int ObjectNum; - Real64 QRad; - Real64 QConv; - - AirflowNetworkLinkageViewFactorProp() : DuctExposureFraction(0.0), DuctEmittance(0.0), ObjectNum(0), QRad(0.0), QConv(0.0) - { - } - }; - } // namespace AirflowNetwork } // namespace EnergyPlus diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp new file mode 100644 index 00000000000..460bb797e4d --- /dev/null +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp @@ -0,0 +1,304 @@ +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, +// The Regents of the University of California, through Lawrence Berkeley National Laboratory +// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge +// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other +// contributors. All rights reserved. +// +// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the +// U.S. Government consequently retains certain rights. As such, the U.S. Government has been +// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, +// worldwide license in the Software to reproduce, distribute copies to the public, prepare +// derivative works, and perform publicly and display publicly, and to permit others to do so. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted +// provided that the following conditions are met: +// +// (1) Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// (2) Redistributions in binary form must reproduce the above copyright notice, this list of +// conditions and the following disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, +// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific prior +// written permission. +// +// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form +// without changes from the version obtained under this License, or (ii) Licensee makes a +// reference solely to the software portion of its product, Licensee must refer to the +// software as "EnergyPlus version X" software, where "X" is the version number Licensee +// obtained under this License and may not use a different name for the software. Except as +// specifically required in this Section (4), Licensee shall not use in a company name, a +// product name, in advertising, publicity, or other promotional activities any name, trade +// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly +// similar designation, without the U.S. Department of Energy's prior written consent. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef AIRFLOWNETWORK_LINKAGES_HPP +#define AIRFLOWNETWORK_LINKAGES_HPP + +#include "AirflowNetwork/Properties.hpp" +#include "AirflowNetwork/Types.hpp" +#include "EnergyPlus/DataHVACGlobals.hh" +#include "EnergyPlus/EPVector.hh" +#include "EnergyPlus/ScheduleManager.hh" +#include "EnergyPlus/DataSurfaces.hh" +#include + +namespace EnergyPlus { + +// Forward declarations +struct EnergyPlusData; +struct AirflowNetworkData; + +namespace AirflowNetwork { + + // Forward declaration + struct AirflowElement; + + struct MultizoneSurfaceProp // Surface information + { + // Members + std::string surface_name; // Name of associated EnergyPlus surface + int surface_number; // Surface number associated EnergyPlus surface + Real64 height; // Surface height + Real64 width; // Surface width + Real64 centroid_height; // Surface central height in z direction + + std::string opening_name; // Name of opening component, either simple or detailed large opening TO BE REMOVED + std::string external_node_name; // Name of external node, but not used at WPC="INPUT" TO BE REMOVED + Real64 factor; // Crack Actual Value or Window Open Factor for Ventilation + + // Ventilation Control - needs to be broken into a separate object or objects + VentControlType ventilation_control_type; // Ventilation control mode number: 1 "Temperature", 2 "ENTHALPIC", 3 "CONSTANT", 4 "NOVENT" + Real64 open_factor_limit; // Limit Value on Multiplier for Modulating Venting Open Factor + Real64 temperature_lower_limit; // Lower Value on Inside/Outside Temperature Difference for Modulating the Venting Open Factor with temp control + Real64 temperature_upper_limit; // Upper Value on Inside/Outside Temperature Difference for Modulating the Venting Open Factor with temp control + Real64 enthalpy_lower_limit; // Lower Value on Inside/Outside Temperature Difference for Modulating the Venting Open Factor with Enthalpic control + Real64 enthalpy_upper_limit; // Upper Value on Inside/Outside Temperature Difference for Modulating the Venting Open Factor with Enthalpic control + std::string VentTempControlSchName; // Name of ventilation temperature control schedule + Sched::Schedule *ventTempControlSched = nullptr; // Ventilation temperature control schedule + std::string VentAvailSchName; // Ventilation availability schedule + Sched::Schedule *ventAvailSched = nullptr; // Ventilation availability schedule + int ZonePtr{0}; // Pointer to inside face zone + bool IndVentControl{false}; // Individual surface venting control + + std::array NodeNums = {0, 0}; // Positive: Zone numbers; 0: External + Real64 OpenFactor = 0.0; // Surface factor + Real64 OpenFactorLast = 0.0; // Surface factor at previous time step + bool EMSOpenFactorActuated = false; // True if EMS actuation is on + Real64 EMSOpenFactor = 0.0; // Surface factor value from EMS for override + + // Occupant Ventilation Control + int occupant_control_number; // Occupant ventilation control number + int OpeningStatus = OpenStatus::FreeOperation; // Open status at current time step + int PrevOpeningstatus = OpenStatus::FreeOperation; // Open status at previous time step + Real64 CloseElapsedTime = 0.0; // Elapsed time during closing (min) + Real64 OpenElapsedTime = 0.0; // Elapsed time during closing (min) + int ClosingProbStatus = ProbabilityCheck::NoAction; // Closing probability status + int OpeningProbStatus = ProbabilityCheck::NoAction; // Opening probability status + + // Non-rectangular geometry parameters + bool nonrectangular; // True if this surface is not rectangular + EquivRec equivalent_rectangle_method; // Equivalent Rectangle Method input: 1 Height; 2 Base surface aspect ratio; 3 User input aspect ratio + Real64 user_aspect_ratio; // user input value when EquivRecMethod = 3 + + // Linkage control schedule + std::string control_schedule_name; + + Real64 Multiplier = 1.0; // Window multiplier + + // Hybrid ventilation variables + bool HybridVentClose = false; // Hybrid ventilation window close control logical + bool HybridCtrlGlobal = false; // Hybrid ventilation global control logical + bool HybridCtrlMaster = false; // Hybrid ventilation global control master + Real64 WindModifier = 1.0; // Wind modifier from hybrid ventilation control + + bool RAFNflag = false; // True if this surface is used in AirflowNetwork:IntraZone:Linkage + + // Error counters + int ExtLargeOpeningErrCount = 0; // Exterior large opening error count during HVAC system operation + int ExtLargeOpeningErrIndex = 0; // Exterior large opening error index during HVAC system operation + int OpenFactorErrCount = 0; // Large opening error count at Open factor > 1.0 + int OpenFactorErrIndex = 0; // Large opening error error index at Open factor > 1.0 + + MultizoneSurfaceProp() + : factor(0.0), surface_number(0), NodeNums{{0, 0}}, OpenFactor(0.0), OpenFactorLast(0.0), EMSOpenFactorActuated(false), EMSOpenFactor(0.0), + height(0.0), width(0.0), centroid_height(0.0), open_factor_limit(0.0), temperature_lower_limit(0.0), temperature_upper_limit(100.0), + enthalpy_lower_limit(0.0), enthalpy_upper_limit(300000.0), ventilation_control_type(VentControlType::None), ZonePtr(0), IndVentControl(false), + ExtLargeOpeningErrCount(0), ExtLargeOpeningErrIndex(0), OpenFactorErrCount(0), OpenFactorErrIndex(0), Multiplier(1.0), + HybridVentClose(false), HybridCtrlGlobal(false), HybridCtrlMaster(false), WindModifier(1.0), occupant_control_number(0), + OpeningStatus(OpenStatus::FreeOperation), PrevOpeningstatus(OpenStatus::FreeOperation), CloseElapsedTime(0.0), OpenElapsedTime(0.0), + ClosingProbStatus(ProbabilityCheck::NoAction), OpeningProbStatus(ProbabilityCheck::NoAction), RAFNflag(false), nonrectangular(false), + equivalent_rectangle_method(EquivRec::Height), user_aspect_ratio(1.0) + { + } + MultizoneSurfaceProp(const std::string &SurfName, const int SurfNum, Real64 Height, Real64 Width, Real64 CHeight, const std::string &OpeningName, + const std::string &ExternalNodeName, Real64 Factor, VentControlType VentControl, Real64 ModulateFactor, Real64 LowValueTemp, Real64 UpValueTemp, + Real64 LowValueEnth, Real64 UpValueEnth, const std::string &VentTempControlSchName, const std::string &VentAvailSchName, int OccupantVentilationControlNum, + bool NonRectangular, EquivRec EquivRectMethod, Real64 UserAspectRatio, const std::string &control_schedule_name) : surface_name(SurfName), surface_number(SurfNum), + height(Height), width(Width), centroid_height(CHeight), opening_name(OpeningName), external_node_name(ExternalNodeName), factor(Factor), + ventilation_control_type(VentControl), open_factor_limit(ModulateFactor), temperature_lower_limit(LowValueTemp), temperature_upper_limit(UpValueTemp), + enthalpy_lower_limit(LowValueEnth), enthalpy_upper_limit(UpValueEnth), VentTempControlSchName(VentTempControlSchName), + VentAvailSchName(VentAvailSchName), occupant_control_number(OccupantVentilationControlNum), nonrectangular(NonRectangular), equivalent_rectangle_method(EquivRectMethod), + user_aspect_ratio(UserAspectRatio), control_schedule_name(control_schedule_name) + + {} + }; + + struct AirflowNetworkLinkage // AirflowNetwork linkage data base class + { + // Members + std::string Name; // Provide a unique linkage name + std::array NodeNames; // Names of nodes (limited to 2) + std::array NodeHeights; // Node heights + std::string CompName; // Name of element + int CompNum; // Element Number + std::array NodeNums; // Node numbers + int LinkNum; // Linkage number + AirflowElement *element; // Pointer to airflow element + Real64 control_value; // Control value + Sched::Schedule *control_schedule; // Control schedule + + // Default Constructor + AirflowNetworkLinkage() : NodeHeights{{0.0, 0.0}}, CompNum(0), NodeNums{{0, 0}}, LinkNum(0), element(nullptr), control_value(1.0), control_schedule(nullptr) + { + } + + virtual ~AirflowNetworkLinkage() + { + } + }; + + struct IntraZoneLinkageProp : public AirflowNetworkLinkage // Intra zone linkage data + { + // Members + std::string SurfaceName; // Connection Surface Name + + // Default Constructor + IntraZoneLinkageProp() : AirflowNetworkLinkage() + { + } + }; + + struct DisSysLinkageProp : public AirflowNetworkLinkage // Distribution system linkage data + { + // Members + std::string ZoneName; // Name of zone + int ZoneNum; // Zone Number + + // Default Constructor + DisSysLinkageProp() : AirflowNetworkLinkage(), ZoneNum(0) + { + } + }; + + struct AirflowNetworkLinkageProp : public AirflowNetworkLinkage // AirflowNetwork linkage data + { + // Members + std::string ZoneName; // Name of zone + int ZoneNum; // Zone Number + int DetOpenNum; // Large Opening number + EPlusComponentType ConnectionFlag; // Return and supply connection flag + bool VAVTermDamper; // True if this component is a damper for a VAV terminal + int LinkageViewFactorObjectNum; + int AirLoopNum; // Airloop number + DuctLineType ductLineType; + + // Default Constructor + AirflowNetworkLinkageProp() + : AirflowNetworkLinkage(), ZoneNum(0), DetOpenNum(0), ConnectionFlag(EPlusComponentType::Invalid), VAVTermDamper(false), + LinkageViewFactorObjectNum(0), AirLoopNum(0), ductLineType(DuctLineType::Invalid) + { + } + }; + + struct AirflowNetworkLinkSimuData + { + // Members + Real64 FLOW; // Mass flow rate [kg/s] + Real64 FLOW2; // Mass flow rate [kg/s] for two way flow + Real64 DP; // Pressure difference across a component + Real64 VolFLOW; // Mass flow rate [m3/s] + Real64 VolFLOW2; // Mass flow rate [m3/s] for two way flow + Real64 DP1; + + // Default Constructor + AirflowNetworkLinkSimuData() : FLOW(0.0), FLOW2(0.0), DP(0.0), VolFLOW(0.0), VolFLOW2(0.0), DP1(0.0) + { + } + }; + + struct AirflowNetworkLinkReportData + { + // Members + Real64 FLOW; // Mass flow rate [kg/s] + Real64 FLOW2; // Mass flow rate [kg/s] for two way flow + Real64 VolFLOW; // Mass flow rate [m^3/s] + Real64 VolFLOW2; // Mass flow rate [m^3/s] for two way flow + Real64 FLOWOFF; // Mass flow rate during OFF cycle [kg/s] + Real64 FLOW2OFF; // Mass flow rate during OFF cycle [kg/s] for two way flow + Real64 VolFLOWOFF; // Mass flow rate during OFF cycle [m^3/s] + Real64 VolFLOW2OFF; // Mass flow rate during OFF cycle [m^3/s] for two way flow + Real64 DP; // Average Pressure difference across a component + Real64 DPON; // Pressure difference across a component with fan on + Real64 DPOFF; // Pressure difference across a component with fan off + + // Default Constructor + AirflowNetworkLinkReportData() + : FLOW(0.0), FLOW2(0.0), VolFLOW(0.0), VolFLOW2(0.0), FLOWOFF(0.0), FLOW2OFF(0.0), VolFLOWOFF(0.0), VolFLOW2OFF(0.0), DP(0.0), DPON(0.0), + DPOFF(0.0) + { + } + }; + + struct LinkageSurfaceProp + { + // Members + std::string SurfaceName; + int SurfaceNum; // Name of surface referenced by view factor + Real64 ViewFactor; // View factor + Real64 SurfaceResistanceFactor; // Total radiation heat transfer resistance factor + Real64 SurfaceRadLoad; // Duct radiation load from surface [W] + + // Default constructor + LinkageSurfaceProp() : SurfaceNum(0), ViewFactor(0.0), SurfaceResistanceFactor(0.0), SurfaceRadLoad(0.0) + { + } + }; + + struct AirflowNetworkLinkageViewFactorProp + { + // Members + std::string LinkageName; + Real64 DuctExposureFraction; + Real64 DuctEmittance; + Array1D LinkageSurfaceData; + int ObjectNum; + Real64 QRad; + Real64 QConv; + + AirflowNetworkLinkageViewFactorProp() : DuctExposureFraction(0.0), DuctEmittance(0.0), ObjectNum(0), QRad(0.0), QConv(0.0) + { + } + }; + + void handle_nonrectangular_surfaces(EquivRec equivalent_rectangle_method, EPVector Surface, const std::string &surface_name, int surface_number, + Real64 &height, Real64 &width, Real64 user_aspect_ratio, EnergyPlusData *state = nullptr); + +} // namespace AirflowNetwork + +} // namespace EnergyPlus + +#endif diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Nodes.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Nodes.hpp new file mode 100644 index 00000000000..d16b38a05df --- /dev/null +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Nodes.hpp @@ -0,0 +1,219 @@ +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, +// The Regents of the University of California, through Lawrence Berkeley National Laboratory +// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge +// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other +// contributors. All rights reserved. +// +// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the +// U.S. Government consequently retains certain rights. As such, the U.S. Government has been +// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, +// worldwide license in the Software to reproduce, distribute copies to the public, prepare +// derivative works, and perform publicly and display publicly, and to permit others to do so. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted +// provided that the following conditions are met: +// +// (1) Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// (2) Redistributions in binary form must reproduce the above copyright notice, this list of +// conditions and the following disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, +// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific prior +// written permission. +// +// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form +// without changes from the version obtained under this License, or (ii) Licensee makes a +// reference solely to the software portion of its product, Licensee must refer to the +// software as "EnergyPlus version X" software, where "X" is the version number Licensee +// obtained under this License and may not use a different name for the software. Except as +// specifically required in this Section (4), Licensee shall not use in a company name, a +// product name, in advertising, publicity, or other promotional activities any name, trade +// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly +// similar designation, without the U.S. Department of Energy's prior written consent. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef AIRFLOWNETWORK_NODES_HPP +#define AIRFLOWNETWORK_NODES_HPP + +#include "AirflowNetwork/Properties.hpp" +#include "AirflowNetwork/Types.hpp" +#include +#include +#include + +namespace EnergyPlus { + +// Forward declarations +struct EnergyPlusData; +struct AirflowNetworkData; + +namespace AirflowNetwork { + + struct MultizoneZoneProp // Zone information + { + // Members + std::string ZoneName; // Name of Associated EnergyPlus Thermal Zone + std::string VentControl; // Ventilation Control Mode: "TEMPERATURE", "ENTHALPIC", "CONSTANT", or "NOVENT" + std::string VentAvailSchName; // Ventilation availability schedule + Real64 Height; // Nodal height + Real64 OpenFactor; // Limit Value on Multiplier for Modulating Venting Open Factor, + // Not applicable if Vent Control Mode = CONSTANT or NOVENT + Real64 LowValueTemp; // Lower Value on Inside/Outside Temperature Difference for + // Modulating the Venting Open Factor with temp control + Real64 UpValueTemp; // Upper Value on Inside/Outside Temperature Difference for + // Modulating the Venting Open Factor with temp control + Real64 LowValueEnth; // Lower Value on Inside/Outside Temperature Difference for + // Modulating the Venting Open Factor with Enthalpic control + Real64 UpValueEnth; // Upper Value on Inside/Outside Temperature Difference for + // Modulating the Venting Open Factor with Enthalpic control + int ZoneNum; // Zone number associated with ZoneName + Sched::Schedule *ventTempControlSched = nullptr; // Ventilation temperature control schedule + int VentCtrNum; // Ventilation control mode number: 1 "Temperature", 2 "ENTHALPIC", 3 "CONSTANT", 4 "NOVENT" + std::string VentTempControlSchName; // Name of ventilation temperature control schedule + Sched::Schedule *ventAvailSched = nullptr; // Ventilation availability schedule + std::string SingleSidedCpType; // Type of calculation method for single sided wind pressure coefficients + Real64 BuildWidth; // The width of the building along the facade that contains this zone. + int ASH55PeopleInd; // Index of people object with ASH55 comfort calcs for ventilation control + int CEN15251PeopleInd; // Index of people object with CEN15251 comfort calcs for ventilation control + std::string OccupantVentilationControlName; // Occupant ventilation control name + int OccupantVentilationControlNum; // Occupant ventilation control number + int RAFNNodeNum; // Index of RAFN node number + + // Default Constructor + MultizoneZoneProp() + : VentControl("NoVent"), Height(0.0), OpenFactor(1.0), LowValueTemp(0.0), UpValueTemp(100.0), LowValueEnth(0.0), UpValueEnth(300000.0), + ZoneNum(0), VentCtrNum(VentControlType::None), SingleSidedCpType("STANDARD"), BuildWidth(10.0), ASH55PeopleInd(0), CEN15251PeopleInd(0), + OccupantVentilationControlNum(0), RAFNNodeNum(0) + { + } + }; + + struct MultizoneExternalNodeProp // External node properties + { + // Members + std::string Name; // Name of external node + Real64 azimuth; // Azimuthal angle of the associated surface + Real64 height; // Nodal height + int ExtNum; // External node number + int OutAirNodeNum; // Outdoor air node number + int facadeNum; // Facade number + int curve; // Curve ID, replace with pointer after curve refactor + bool symmetricCurve; // Symmtric curves are evaluated from 0 to 180, others are evaluated from 0 to 360 + bool useRelativeAngle; // Determines whether the wind angle is relative to the surface or absolute + + // Default Constructor + MultizoneExternalNodeProp() + : azimuth(0.0), height(0.0), ExtNum(0), OutAirNodeNum(0), facadeNum(0), curve(0), symmetricCurve(false), useRelativeAngle(false) + { + } + }; + + struct IntraZoneNodeProp // Intra zone node data + { + // Members + std::string Name; // Name of node + std::string RAFNNodeName; // RoomAir model node name + Real64 Height; // Nodal height + int RAFNNodeNum; // RoomAir model node number + int ZoneNum; // Zone number + int AFNZoneNum; // MultiZone number + + // Default Constructor + IntraZoneNodeProp() : Height(0.0), RAFNNodeNum(0), ZoneNum(0), AFNZoneNum(0) + { + } + }; + + struct DisSysNodeProp // CP Value + { + // Members + std::string Name; // Name of node + std::string EPlusName; // EnergyPlus node name + std::string EPlusType; // EnergyPlus node type + Real64 Height; // Nodal height + int EPlusNodeNum; // EPlus node number + int AirLoopNum; // AirLoop number + + // Default Constructor + DisSysNodeProp() : Height(0.0), EPlusNodeNum(0), AirLoopNum(0) + { + } + }; + + struct AirflowNetworkNodeProp // AirflowNetwork nodal data + { + // Members + std::string Name; // Provide a unique node name + std::string NodeType; // Provide node type "External", "Thermal Zone" or "Other" + std::string EPlusNode; // EnergyPlus node name + Real64 NodeHeight; // Node height [m] + int NodeNum; // Node number + int NodeTypeNum; // Node type with integer number: 0 - Calculated, 1 - Given pressure; + std::string EPlusZoneName; // EnergyPlus node name + int EPlusZoneNum; // E+ zone number + int EPlusNodeNum; + int ExtNodeNum; + int OutAirNodeNum; + EPlusNodeType EPlusTypeNum; + int RAFNNodeNum; // RoomAir model node number + int NumOfLinks; // Number of links for RoomAir model + int AirLoopNum; // AirLoop number + + // Default Constructor + AirflowNetworkNodeProp() + : NodeHeight(0.0), NodeNum(0), NodeTypeNum(0), EPlusZoneNum(0), EPlusNodeNum(0), ExtNodeNum(0), OutAirNodeNum(0), + EPlusTypeNum(EPlusNodeType::Invalid), RAFNNodeNum(0), NumOfLinks(0), AirLoopNum(0) + { + } + }; + + struct AirflowNetworkNodeSimuData // Node variable for simulation + { + // Members + Real64 TZ; // Temperature [C] + Real64 WZ; // Humidity ratio [kg/kg] + Real64 PZ; // Pressure [Pa] + Real64 CO2Z; // CO2 [ppm] + Real64 GCZ; // Generic contaminant [ppm] + Real64 TZlast; // Temperature [C] at previous time step + Real64 WZlast; // Humidity ratio [kg/kg] at previous time step + Real64 CO2Zlast; // CO2 [ppm] at previous time step + Real64 GCZlast; // Generic contaminant [ppm] at previous time step + + // Default Constructor + AirflowNetworkNodeSimuData() : TZ(0.0), WZ(0.0), PZ(0.0), CO2Z(0.0), GCZ(0.0), TZlast(0.0), WZlast(0.0), CO2Zlast(0.0), GCZlast(0.0) + { + } + }; + + struct AirflowNetworkNodeReportData // Node variable for simulation + { + // Members + Real64 PZ; // Average Pressure [Pa] + Real64 PZON; // Pressure with fan on [Pa] + Real64 PZOFF; // Pressure with fan off [Pa] + + // Default Constructor + AirflowNetworkNodeReportData() : PZ(0.0), PZON(0.0), PZOFF(0.0) + { + } + }; + +} // namespace AirflowNetwork + +} // namespace EnergyPlus + +#endif diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp index 32d76121a26..623fc5ad1c4 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp @@ -60,6 +60,7 @@ // EnergyPlus Headers #include +#include #include #include #include @@ -200,7 +201,7 @@ namespace AirflowNetwork { ControlType::NoMultizoneOrDistribution; // AirflowNetwork control: MULTIZONE WITH DISTRIBUTION, MULTIZONE WITHOUT DISTRIBUTION, MULTIZONE // WITH DISTRIBUTION ONLY DURING FAN OPERATION, and NO MULTIZONE OR DISTRIBUTION std::string WPCCntr = "SURFACEAVERAGECALCULATION"; // Wind pressure coefficient input control: "SURFACE-AVERAGE CALCULATION", or "INPUT" - iWPCCntr iWPCCnt = iWPCCntr::SurfAvg; // Integer equivalent for WPCCntr field + WindPressureType iWPCCnt = WindPressureType::SurfAvg; // Integer equivalent for WPCCntr field std::string BldgType = "LowRise"; // Building type: "LOWRISE" or "HIGHRISE" at WPCCntr = "SURFACE-AVERAGE CALCULATIO" std::string HeightOption = "OpeningHeight"; // Height Selection: "ExternalNode" or "OpeningHeight" at WPCCntr = "INPUT" int maximum_iterations = 500; // Maximum number of iteration, default 500 diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Types.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Types.hpp new file mode 100644 index 00000000000..4ebc3ecc0c9 --- /dev/null +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Types.hpp @@ -0,0 +1,170 @@ +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, +// The Regents of the University of California, through Lawrence Berkeley National Laboratory +// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge +// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other +// contributors. All rights reserved. +// +// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the +// U.S. Government consequently retains certain rights. As such, the U.S. Government has been +// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, +// worldwide license in the Software to reproduce, distribute copies to the public, prepare +// derivative works, and perform publicly and display publicly, and to permit others to do so. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted +// provided that the following conditions are met: +// +// (1) Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// (2) Redistributions in binary form must reproduce the above copyright notice, this list of +// conditions and the following disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, +// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific prior +// written permission. +// +// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form +// without changes from the version obtained under this License, or (ii) Licensee makes a +// reference solely to the software portion of its product, Licensee must refer to the +// software as "EnergyPlus version X" software, where "X" is the version number Licensee +// obtained under this License and may not use a different name for the software. Except as +// specifically required in this Section (4), Licensee shall not use in a company name, a +// product name, in advertising, publicity, or other promotional activities any name, trade +// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly +// similar designation, without the U.S. Department of Energy's prior written consent. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#ifndef AIRFLOWNETWORK_TYPES_HPP +#define AIRFLOWNETWORK_TYPES_HPP + +namespace EnergyPlus { + +namespace AirflowNetwork { + + enum VentControlType + { + None = 0, // Wrong input + Temp = 1, // Temperature venting control + Enth = 2, // Enthalpy venting control + Const = 3, // Constant venting control + ASH55 = 4, + CEN15251 = 5, + NoVent = 6, // No venting + ZoneLevel = 7, // ZoneLevel control for a heat transfer subsurface + AdjTemp = 8, // Temperature venting control based on adjacent zone conditions + AdjEnth = 9 // Enthalpy venting control based on adjacent zone conditions + }; + + enum OpenStatus + { + FreeOperation = 0, // Free operation + MinCheckForceOpen = 1, // Force open when opening elapsed time is less than minimum opening time + MinCheckForceClose = 2 // Force open when closing elapsed time is less than minimum closing time + }; + + enum ProbabilityCheck + { + NoAction = 0, // No action from probability check + ForceChange = 1, // Force open or close from probability check + KeepStatus = 2 // Keep status at the previous time step from probability check + }; + + enum class EquivRec : int + { + Height, // Effective rectangle polygonal height selection + BaseAspectRatio, // Effective rectangle base surface aspect ratio selection + UserAspectRatio // Effective rectangle user input aspect ratio selection + }; + + enum class DuctLineType : int + { + Invalid = -1, + SupplyTrunk, // Supply trunk + SupplyBranch, // Supply branch + ReturnTrunk, // Return trunk + ReturnBranch, // Return branch + }; + + enum class AirflowElementType : int + { + Invalid = -1, + DOP = 1, // Detailed large opening component + SOP, // Simple opening component + SCR, // Surface crack component + SEL, // Surface effective leakage ratio component + PLR, // Distribution system crack component + DWC, // Distribution system duct component + CVF, // Distribution system constant volume fan component + FAN, // Distribution system detailed fan component + MRR, // Distribution system multiple curve fit power law resistant flow component + DMP, // Distribution system damper component + ELR, // Distribution system effective leakage ratio component + CPD, // Distribution system constant pressure drop component + COI, // Distribution system coil component + TMU, // Distribution system terminal unit component + EXF, // Zone exhaust fan + HEX, // Distribution system heat exchanger + HOP, // Horizontal opening component + RVD, // Reheat VAV terminal damper + OAF, // Distribution system OA + REL, // Distribution system relief air + SMF, // Specified mass flow component + SVF // Specified volume flow component + }; + + enum class EPlusComponentType : int + { + Invalid = -1, + SCN, // Supply connection + RCN, // Return connection + RHT, // Reheat terminal + FAN, // Fan + COI, // Heating or cooling coil + HEX, // Heat exchanger + RVD // Reheat VAV terminal damper + }; + + enum class EPlusNodeType : int + { + Invalid = -1, + ZIN, // Zone inlet node + ZOU, // Zone outlet node + SPL, // Splitter node + MIX, // Mixer node + OAN, // Outside air system node + EXT, // OA system inlet node + FIN, // Fan Inlet node + FOU, // Fan Outlet Node + COU, // Coil Outlet Node + HXO, // Heat exchanger Outlet Node + DIN, // Damper Inlet node + DOU, // Damper Outlet Node + SPI, // Splitter inlet Node + SPO // Splitter Outlet Node + }; + + enum class WindPressureType : int + { + Input, + SurfAvg + }; + + int constexpr PressureCtrlExhaust = 1; + int constexpr PressureCtrlRelief = 2; + +} // namespace AirflowNetwork + +} // namespace EnergyPlus + +#endif diff --git a/src/EnergyPlus/AirflowNetwork/src/Elements.cpp b/src/EnergyPlus/AirflowNetwork/src/Elements.cpp index c68f5e27b66..ad6d54ea315 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Elements.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Elements.cpp @@ -60,18 +60,6 @@ namespace EnergyPlus { namespace AirflowNetwork { - // MODULE INFORMATION: - // AUTHOR Lixing Gu, Don Shirey, and Muthusamy V. Swami - // DATE WRITTEN Aug. 2003 - // MODIFIED na - // RE-ENGINEERED na - - // PURPOSE OF THIS MODULE: - // This module should contain the information that is needed to simulate - // performance of air distribution system, including pressure, temperature - // and moisture levels at each node, and airflow and sensible and latent energy losses - // at each element - static Real64 square(Real64 x) { return x * x; @@ -748,7 +736,7 @@ namespace AirflowNetwork { SumTermFlow += state.dataLoopNodes->Node(k1).MassFlowRate; } } - if (state.afn->AirflowNetworkCompData(state.afn->AirflowNetworkLinkageData(k).CompNum).CompTypeNum == iComponentTypeNum::ELR) { + if (state.afn->AirflowNetworkCompData(state.afn->AirflowNetworkLinkageData(k).CompNum).CompTypeNum == AirflowElementType::ELR) { // Calculate supply leak sensible losses Node1 = state.afn->AirflowNetworkLinkageData(k).NodeNums[0]; Node2 = state.afn->AirflowNetworkLinkageData(k).NodeNums[1]; @@ -1391,8 +1379,8 @@ namespace AirflowNetwork { // Get component properties DifLim = 1.0e-4; - Width = state.afn->MultizoneSurfaceData(IL).Width; - Height = state.afn->MultizoneSurfaceData(IL).Height; + Width = state.afn->MultizoneSurfaceData(IL).width; + Height = state.afn->MultizoneSurfaceData(IL).height; Fact = state.afn->MultizoneSurfaceData(IL).OpenFactor; Loc = (state.afn->AirflowNetworkLinkageData(IL).DetOpenNum - 1) * (NrInt + 2); iNum = NumFac; @@ -1456,12 +1444,12 @@ namespace AirflowNetwork { // Get opening data based on the opening factor if (Fact == 0) { - ActLw = state.afn->MultizoneSurfaceData(IL).Width; - ActLh = state.afn->MultizoneSurfaceData(IL).Height; + ActLw = state.afn->MultizoneSurfaceData(IL).width; + ActLh = state.afn->MultizoneSurfaceData(IL).height; Cfact = 0.0; } else { - ActLw = state.afn->MultizoneSurfaceData(IL).Width * WFact; - ActLh = state.afn->MultizoneSurfaceData(IL).Height * HFact; + ActLw = state.afn->MultizoneSurfaceData(IL).width * WFact; + ActLh = state.afn->MultizoneSurfaceData(IL).height * HFact; ActCD = Cfact; } @@ -1474,8 +1462,8 @@ namespace AirflowNetwork { } else if (Type == 2) { Lextra = 0.0; Axishght = LVOValue; - ActLw = state.afn->MultizoneSurfaceData(IL).Width; - ActLh = state.afn->MultizoneSurfaceData(IL).Height; + ActLw = state.afn->MultizoneSurfaceData(IL).width; + ActLh = state.afn->MultizoneSurfaceData(IL).height; } // Add window multiplier with window close @@ -1790,14 +1778,14 @@ namespace AirflowNetwork { // static gio::Fmt Format_900("(A5,9X,4E16.7)"); // static gio::Fmt Format_903("(A5,3I3,4E16.7)"); - Width = state.afn->MultizoneSurfaceData(i).Width; - Height = state.afn->MultizoneSurfaceData(i).Height; + Width = state.afn->MultizoneSurfaceData(i).width; + Height = state.afn->MultizoneSurfaceData(i).height; coeff = FlowCoef * 2.0 * (Width + Height); OpenFactor = state.afn->MultizoneSurfaceData(i).OpenFactor; if (OpenFactor > 0.0) { Width *= OpenFactor; - if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(i).SurfNum).Tilt < 90.0) { - Height *= state.dataSurface->Surface(state.afn->MultizoneSurfaceData(i).SurfNum).SinTilt; + if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(i).surface_number).Tilt < 90.0) { + Height *= state.dataSurface->Surface(state.afn->MultizoneSurfaceData(i).surface_number).SinTilt; } } @@ -2875,7 +2863,7 @@ namespace AirflowNetwork { } else { // Treat the component as a surface crack // Crack standard condition from given inputs - Corr = state.afn->MultizoneSurfaceData(i).Factor; + Corr = state.afn->MultizoneSurfaceData(i).factor; RhozNorm = state.afn->properties.density(StandardP, StandardT, StandardW); VisczNorm = 1.71432e-5 + 4.828e-8 * StandardT; @@ -3101,8 +3089,8 @@ namespace AirflowNetwork { // Get information on the horizontal opening RhozAver = (propN.density + propM.density) / 2.0; - Width = state.afn->MultizoneSurfaceData(i).Width; - Height = state.afn->MultizoneSurfaceData(i).Height; + Width = state.afn->MultizoneSurfaceData(i).width; + Height = state.afn->MultizoneSurfaceData(i).height; Fact = state.afn->MultizoneSurfaceData(i).OpenFactor; expn = FlowExpo; coef = FlowCoef; @@ -3943,7 +3931,7 @@ namespace AirflowNetwork { Real64 RhoStd; int Fromz; int Toz; - iComponentTypeNum Ltyp; + AirflowElementType Ltyp; int i; int ll; int Pprof; @@ -3969,8 +3957,8 @@ namespace AirflowNetwork { // Check surface tilt if (i <= Nl - state.afn->NumOfLinksIntraZone) { // Revised by L.Gu, on 9 / 29 / 10 if (state.afn->AirflowNetworkLinkageData(i).DetOpenNum > 0 && - state.dataSurface->Surface(state.afn->MultizoneSurfaceData(i).SurfNum).Tilt < 90) { - Hfl(i) = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(i).SurfNum).SinTilt; + state.dataSurface->Surface(state.afn->MultizoneSurfaceData(i).surface_number).Tilt < 90) { + Hfl(i) = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(i).surface_number).SinTilt; } } // Initialisation @@ -3985,8 +3973,8 @@ namespace AirflowNetwork { } Ltyp = state.afn->AirflowNetworkCompData(state.afn->AirflowNetworkLinkageData(i).CompNum).CompTypeNum; - if (Ltyp == iComponentTypeNum::DOP) { - ActLh = state.afn->MultizoneSurfaceData(i).Height; + if (Ltyp == AirflowElementType::DOP) { + ActLh = state.afn->MultizoneSurfaceData(i).height; ActLOwnh = ActLh * 1.0; } else { ActLh = 0.0; @@ -4167,7 +4155,7 @@ namespace AirflowNetwork { DpP = -psz(Pref, RhoLd(2), 0.0, 0.0, -H, G); DpL(i, 2) = (DpF(1) - DpT(1) + DpP); - if (Ltyp == iComponentTypeNum::DOP) { + if (Ltyp == AirflowElementType::DOP) { Pprof = OpenNum * (NrInt + 2); presprofile(state, i, Pprof, G, DpF, DpT, BetaStF, BetaStT, RhoStF, RhoStT, From, To, ActLh, Hfl(i)); ++OpenNum; diff --git a/src/EnergyPlus/AirflowNetwork/src/Linkages.cpp b/src/EnergyPlus/AirflowNetwork/src/Linkages.cpp new file mode 100644 index 00000000000..3e474083c0a --- /dev/null +++ b/src/EnergyPlus/AirflowNetwork/src/Linkages.cpp @@ -0,0 +1,150 @@ +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, +// The Regents of the University of California, through Lawrence Berkeley National Laboratory +// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge +// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other +// contributors. All rights reserved. +// +// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the +// U.S. Government consequently retains certain rights. As such, the U.S. Government has been +// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, +// worldwide license in the Software to reproduce, distribute copies to the public, prepare +// derivative works, and perform publicly and display publicly, and to permit others to do so. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted +// provided that the following conditions are met: +// +// (1) Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// (2) Redistributions in binary form must reproduce the above copyright notice, this list of +// conditions and the following disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, +// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific prior +// written permission. +// +// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form +// without changes from the version obtained under this License, or (ii) Licensee makes a +// reference solely to the software portion of its product, Licensee must refer to the +// software as "EnergyPlus version X" software, where "X" is the version number Licensee +// obtained under this License and may not use a different name for the software. Except as +// specifically required in this Section (4), Licensee shall not use in a company name, a +// product name, in advertising, publicity, or other promotional activities any name, trade +// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly +// similar designation, without the U.S. Department of Energy's prior written consent. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#include "AirflowNetwork/Linkages.hpp" + +namespace EnergyPlus { + +namespace AirflowNetwork { + +void handle_nonrectangular_surfaces(EquivRec equivalent_rectangle_method, EPVector Surface, const std::string &surface_name, int surface_number, + Real64 &height, Real64 &width, Real64 user_aspect_ratio, EnergyPlusData *state) +{ + if (equivalent_rectangle_method == EquivRec::Height) { + if (Surface(surface_number).Tilt < 1.0 || Surface(surface_number).Tilt > 179.0) { // horizontal surface + // check base surface shape + if (Surface(Surface(surface_number).BaseSurf).Sides == 4) { + Real64 baseratio = Surface(Surface(surface_number).BaseSurf).Width / Surface(Surface(surface_number).BaseSurf).Height; + width = sqrt(Surface(surface_number).Area * baseratio); + height = Surface(surface_number).Area / width; + if (state != nullptr) { + // Going to lie about the source of the error + ShowWarningError(*state, "AirflowNetwork::Solver::get_input: AirflowNetwork:MultiZone:Surface object = " + surface_name); + ShowContinueError(*state, + "The entered choice of Equivalent Rectangle Method is PolygonHeight. This choice is not valid for " + "a horizontal surface."); + ShowContinueError(*state, "The BaseSurfaceAspectRatio choice is used. Simulation continues."); + } + } else { + width = sqrt(Surface(surface_number).Area * user_aspect_ratio); + height = Surface(surface_number).Area / width; + // add warning + if (state != nullptr) { + // Going to lie about the source of the error + ShowWarningError(*state, "AirflowNetwork::Solver::get_input: AirflowNetwork:MultiZone:Surface object = " + surface_name); + ShowContinueError(*state, + "The entered choice of Equivalent Rectangle Method is PolygonHeight. This choice is not valid for " + "a horizontal surface with a polygonal base surface."); + ShowContinueError(*state, "The default aspect ratio at 1 is used. Simulation continues."); + } + } + } else { + Real64 minHeight = min(Surface(surface_number).Vertex(1).z, Surface(surface_number).Vertex(2).z); + Real64 maxHeight = max(Surface(surface_number).Vertex(1).z, Surface(surface_number).Vertex(2).z); + for (int j = 3; j <= Surface(surface_number).Sides; ++j) { + minHeight = min(minHeight, + min(Surface(surface_number).Vertex(j - 1).z, Surface(surface_number).Vertex(j).z)); + maxHeight = max(maxHeight, + max(Surface(surface_number).Vertex(j - 1).z, Surface(surface_number).Vertex(j).z)); + } + if (maxHeight > minHeight) { + height = maxHeight - minHeight; + width = Surface(surface_number).Area / (maxHeight - minHeight); + } + // There's no else here, this is a fall-through. This appears to agree with the original intent, which defaults the height and width to the surface values. + } + } else if (equivalent_rectangle_method == EquivRec::BaseAspectRatio) { + + if (Surface(Surface(surface_number).BaseSurf).Sides == 4) { + Real64 baseratio = Surface(Surface(surface_number).BaseSurf).Width / Surface(Surface(surface_number).BaseSurf).Height; + width = sqrt(Surface(surface_number).Area * baseratio); + height = Surface(surface_number).Area / width; + } else { + Real64 minHeight = min(Surface(surface_number).Vertex(1).z, Surface(surface_number).Vertex(2).z); + Real64 maxHeight = max(Surface(surface_number).Vertex(1).z, Surface(surface_number).Vertex(2).z); + for (int j = 3; j <= Surface(surface_number).Sides; ++j) { + minHeight = min(minHeight, min(Surface(surface_number).Vertex(j - 1).z, Surface(surface_number).Vertex(j).z)); + maxHeight = max(maxHeight, max(Surface(surface_number).Vertex(j - 1).z, Surface(surface_number).Vertex(j).z)); + } + if (maxHeight > minHeight) { + height = maxHeight - minHeight; + width = Surface(surface_number).Area / (maxHeight - minHeight); + // add warning + if (state != nullptr) { + // Going to lie about the source of the error + ShowWarningError(*state, + "AirflowNetwork::Solver::get_input: AirflowNetwork:MultiZone:Surface object = " + + surface_name); + ShowContinueError(*state, + "The entered choice of Equivalent Rectangle Method is BaseSurfaceAspectRatio. This choice is not " + "valid for a polygonal base surface."); + ShowContinueError(*state, "The PolygonHeight choice is used. Simulation continues."); + } + } else { + width = sqrt(Surface(surface_number).Area * user_aspect_ratio); + height = Surface(surface_number).Area / width; + // add warning + if (state != nullptr) { + // Going to lie about the source of the error + ShowWarningError(*state, "AirflowNetwork::Solver::get_input: AirflowNetwork:MultiZone:Surface object = " + surface_name); + ShowContinueError(*state, + "The entered choice of Equivalent Rectangle Method is BaseSurfaceAspectRatio. This choice is not " + "valid for a horizontal surface with a polygonal base surface."); + ShowContinueError(*state, "The default aspect ratio at 1 is used. Simulation continues."); + } + } + } + } else if (equivalent_rectangle_method == EquivRec::UserAspectRatio) { + width = sqrt(Surface(surface_number).Area * user_aspect_ratio); + height = Surface(surface_number).Area / width; + } + // end of handle_nonrectangular_surfaces +} + +} // namespace AirflowNetwork + +} // namespace EnergyPlus diff --git a/src/EnergyPlus/AirflowNetwork/src/Nodes.cpp b/src/EnergyPlus/AirflowNetwork/src/Nodes.cpp new file mode 100644 index 00000000000..dd8e426ffe5 --- /dev/null +++ b/src/EnergyPlus/AirflowNetwork/src/Nodes.cpp @@ -0,0 +1,56 @@ +// EnergyPlus, Copyright (c) 1996-2025, The Board of Trustees of the University of Illinois, +// The Regents of the University of California, through Lawrence Berkeley National Laboratory +// (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge +// National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other +// contributors. All rights reserved. +// +// NOTICE: This Software was developed under funding from the U.S. Department of Energy and the +// U.S. Government consequently retains certain rights. As such, the U.S. Government has been +// granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable, +// worldwide license in the Software to reproduce, distribute copies to the public, prepare +// derivative works, and perform publicly and display publicly, and to permit others to do so. +// +// Redistribution and use in source and binary forms, with or without modification, are permitted +// provided that the following conditions are met: +// +// (1) Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// (2) Redistributions in binary form must reproduce the above copyright notice, this list of +// conditions and the following disclaimer in the documentation and/or other materials +// provided with the distribution. +// +// (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory, +// the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific prior +// written permission. +// +// (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form +// without changes from the version obtained under this License, or (ii) Licensee makes a +// reference solely to the software portion of its product, Licensee must refer to the +// software as "EnergyPlus version X" software, where "X" is the version number Licensee +// obtained under this License and may not use a different name for the software. Except as +// specifically required in this Section (4), Licensee shall not use in a company name, a +// product name, in advertising, publicity, or other promotional activities any name, trade +// name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly +// similar designation, without the U.S. Department of Energy's prior written consent. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR +// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +#include "AirflowNetwork/Nodes.hpp" + +namespace EnergyPlus { + +namespace AirflowNetwork { + +} // namespace AirflowNetwork + +} // namespace EnergyPlus diff --git a/src/EnergyPlus/AirflowNetwork/src/Properties.cpp b/src/EnergyPlus/AirflowNetwork/src/Properties.cpp index 44bbe8b8076..dc55f2d3b52 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Properties.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Properties.cpp @@ -46,8 +46,8 @@ // POSSIBILITY OF SUCH DAMAGE. #include "AirflowNetwork/Properties.hpp" -#include -#include +#include "../../Data/EnergyPlusData.hh" +#include "../../General.hh" namespace EnergyPlus { diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index b8208dde3f0..0ce602a05f7 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -56,11 +56,9 @@ // ObjexxFCL Headers #include #include -// #include // EnergyPlus Headers #include -#include #include #include #include @@ -114,14 +112,15 @@ namespace AirflowNetwork { // MODULE INFORMATION: // AUTHOR Lixing Gu, Don Shirey, and Muthusamy V. Swami - // DATE WRITTEN July 2005 - // MODIFIED na - // RE-ENGINEERED na + // DATE WRITTEN Aug. 2003/July 2005 // PURPOSE OF THIS MODULE: // This module is used to simulate airflows and pressures. The module is modified to - // meet requirements of EnergyPLus based on AIRNET, developed by - // National Institute of Standards and Technology (NIST). + // meet requirements of EnergyPLus based on AIRNET, developed by National Institute + // of Standards and Technology (NIST). This module should contain the information + // that is needed to simulate performance of air distribution system, including + // pressure, temperature and moisture levels at each node, and airflow and sensible + // and latent energy losses at each element // METHODOLOGY EMPLOYED: // An airflow network approach is used. It consists of nodes connected by airflow elements. @@ -2093,7 +2092,7 @@ namespace AirflowNetwork { if (!control_defaulted) { bool SimObjectError = false; if (Util::SameString(simulation_control.WPCCntr, "Input")) { - simulation_control.iWPCCnt = iWPCCntr::Input; + simulation_control.iWPCCnt = WindPressureType::Input; if (lAlphaBlanks(4)) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(3) + " = INPUT."); ShowContinueError(m_state, ".." + cAlphaFields(4) + " was not entered."); @@ -2112,7 +2111,7 @@ namespace AirflowNetwork { } } } else if (Util::SameString(simulation_control.WPCCntr, "SurfaceAverageCalculation")) { - simulation_control.iWPCCnt = iWPCCntr::SurfAvg; + simulation_control.iWPCCnt = WindPressureType::SurfAvg; if (!(Util::SameString(simulation_control.BldgType, "LowRise") || Util::SameString(simulation_control.BldgType, "HighRise"))) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(5) + " = " + Alphas(5) + " is invalid."); @@ -2498,7 +2497,7 @@ namespace AirflowNetwork { } // *** Read AirflowNetwork external node - if (simulation_control.iWPCCnt == iWPCCntr::Input) { + if (simulation_control.iWPCCnt == WindPressureType::Input) { // Wind coefficient == Surface-Average does not need inputs of external nodes AirflowNetworkNumOfExtNode = m_state.dataInputProcessing->inputProcessor->getNumObjectsFound(m_state, "AirflowNetwork:MultiZone:ExternalNode"); @@ -2633,154 +2632,137 @@ namespace AirflowNetwork { // *** Read AirflowNetwork element data ErrorsFound = ErrorsFound || !get_element_input(); + auto const &ip = m_state.dataInputProcessing->inputProcessor; // *** Read AirflowNetwork simulation surface data CurrentModuleObject = "AirflowNetwork:MultiZone:Surface"; - AirflowNetworkNumOfSurfaces = m_state.dataInputProcessing->inputProcessor->getNumObjectsFound(m_state, CurrentModuleObject); - if (AirflowNetworkNumOfSurfaces > 0) { - MultizoneSurfaceData.allocate(AirflowNetworkNumOfSurfaces); - for (int i = 1; i <= AirflowNetworkNumOfSurfaces; ++i) { - m_state.dataInputProcessing->inputProcessor->getObjectItem(m_state, - CurrentModuleObject, - i, - Alphas, - NumAlphas, - Numbers, - NumNumbers, - IOStatus, - lNumericBlanks, - lAlphaBlanks, - cAlphaFields, - cNumericFields); - MultizoneSurfaceData(i).SurfName = Alphas(1); // Name of Associated EnergyPlus surface - MultizoneSurfaceData(i).OpeningName = Alphas(2); // Name of crack or opening component, - // either simple or detailed large opening, or crack - MultizoneSurfaceData(i).ExternalNodeName = Alphas(3); // Name of external node, but not used at WPC="INPUT" - if (Util::FindItemInList(Alphas(3), MultizoneExternalNodeData) && - m_state.afn->MultizoneExternalNodeData(Util::FindItemInList(Alphas(3), MultizoneExternalNodeData)).curve == 0) { - ShowSevereError(m_state, format(RoutineName) + "Invalid " + cAlphaFields(3) + "=" + Alphas(3)); + auto instances = m_state.dataInputProcessing->inputProcessor->epJSON.find(CurrentModuleObject); + if (instances != m_state.dataInputProcessing->inputProcessor->epJSON.end()) { + auto &instancesValue = instances.value(); + auto const &props = m_state.dataInputProcessing->inputProcessor->getObjectSchemaProps(m_state, CurrentModuleObject); + for (auto instance = instancesValue.begin(); instance != instancesValue.end(); ++instance) { + auto const &fields = instance.value(); + //auto const &surface_name{instance.key()}; + auto const &surface_name{Util::makeUPPER(fields.at("surface_name").get())}; // Required field + // Check for a valid surface name + int surface_number = Util::FindItemInList(surface_name, m_state.dataSurface->Surface); + if (surface_number == 0) { + ShowSevereError(m_state, + format(RoutineName) + CurrentModuleObject + " object, Invalid Surface Name given = " + surface_name); + ShowFatalError(m_state, format("{}Errors found getting inputs. Previous error(s) cause program termination.", RoutineName)); + } + if (!m_state.dataSurface->Surface(surface_number).HeatTransSurf && + !m_state.dataSurface->Surface(surface_number).IsAirBoundarySurf) { + ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object"); + ShowContinueError(m_state, "..The surface specified must be a heat transfer surface. Invalid Surface Name = " + surface_name); + ErrorsFound = true; + continue; + } + + auto const &opening_name{fields.at("leakage_component_name").get()}; // Required field + auto const external_node_name{ip->getAlphaFieldValue(fields, props, "external_node_name")}; // Not a required field + // Does this really need to get checked here? + if (Util::FindItemInList(external_node_name, MultizoneExternalNodeData) && + m_state.afn->MultizoneExternalNodeData(Util::FindItemInList(external_node_name, MultizoneExternalNodeData)).curve == 0) { + ShowSevereError(m_state, format(RoutineName) + "Invalid External Node Name=" + external_node_name); ShowContinueError(m_state, "A valid wind pressure coefficient curve name is required but not found when Wind Pressure " "Coefficient Type = Input."); ErrorsFound = true; } - MultizoneSurfaceData(i).Factor = Numbers(1); // Crack Actual Value or Window Open Factor for Ventilation - if (MultizoneSurfaceData(i).Factor > 1.0 || MultizoneSurfaceData(i).Factor <= 0.0) { - ShowWarningError(m_state, - format(RoutineName) + CurrentModuleObject + " object=" + MultizoneSurfaceData(i).SurfName + ", " + - cNumericFields(1) + " is out of range (0.0,1.0]"); - ShowContinueError(m_state, format("..Input value = {:.2R}, Value will be set to 1.0", MultizoneSurfaceData(i).Factor)); - MultizoneSurfaceData(i).Factor = 1.0; - } + // Get the factor, no validation any more because that should get handled in validation + Real64 factor{ip->getRealFieldValue(fields, props, "window_door_opening_factor_or_crack_factor")}; + // Get input of ventilation control and associated data - if (NumAlphas >= 4) { - // Ventilation Control Mode: "TEMPERATURE", "ENTHALPY", - // "CONSTANT", "ZONELEVEL", "NOVENT", "ADJACENTTEMPERATURE", - // or "ADJACENTENTHALPY" - if (!lAlphaBlanks(4)) MultizoneSurfaceData(i).VentControl = Alphas(4); - // Name of ventilation temperature control schedule - if (!lAlphaBlanks(5)) MultizoneSurfaceData(i).VentTempControlSchName = Alphas(5); - { - // This SELECT_CASE_var will go on input refactor, no need to fix - auto const SELECT_CASE_var(Util::makeUPPER(MultizoneSurfaceData(i).VentControl)); - if (SELECT_CASE_var == "TEMPERATURE") { - MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::Temp; - MultizoneSurfaceData(i).IndVentControl = true; - } else if (SELECT_CASE_var == "ENTHALPY") { - MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::Enth; - MultizoneSurfaceData(i).IndVentControl = true; - } else if (SELECT_CASE_var == "CONSTANT") { - MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::Const; - MultizoneSurfaceData(i).IndVentControl = true; - } else if (SELECT_CASE_var == "ASHRAE55ADAPTIVE") { - MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::ASH55; - MultizoneSurfaceData(i).IndVentControl = true; - } else if (SELECT_CASE_var == "CEN15251ADAPTIVE") { - MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::CEN15251; - MultizoneSurfaceData(i).IndVentControl = true; - } else if (SELECT_CASE_var == "NOVENT") { - MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::NoVent; - MultizoneSurfaceData(i).IndVentControl = true; - } else if (SELECT_CASE_var == "ZONELEVEL") { - MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::ZoneLevel; - MultizoneSurfaceData(i).IndVentControl = false; - } else if (SELECT_CASE_var == "ADJACENTTEMPERATURE") { - MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::AdjTemp; - MultizoneSurfaceData(i).IndVentControl = true; - } else if (SELECT_CASE_var == "ADJACENTENTHALPY") { - MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::AdjEnth; - MultizoneSurfaceData(i).IndVentControl = true; - } else { - ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, Invalid " + cAlphaFields(4)); - ShowContinueError(m_state, - ".." + cAlphaFields(1) + " = " + MultizoneSurfaceData(i).SurfName + ", Specified " + cAlphaFields(4) + - " = " + Alphas(4)); - ShowContinueError(m_state, - "..The valid choices are \"Temperature\", \"Enthalpy\", \"Constant\", \"NoVent\", \"ZoneLevel\", " - "\"AdjancentTemperature\" or \"AdjacentEnthalpy\""); - ErrorsFound = true; - } - } - } - MultizoneSurfaceData(i).ModulateFactor = Numbers(2); // Limit Value on Multiplier for Modulating Venting Open Factor - MultizoneSurfaceData(i).LowValueTemp = Numbers(3); // Lower temperature value for modulation of temperature control - MultizoneSurfaceData(i).UpValueTemp = Numbers(4); // Upper temperature value for modulation of temperature control - MultizoneSurfaceData(i).LowValueEnth = Numbers(5); // Lower Enthalpy value for modulation of Enthalpy control - MultizoneSurfaceData(i).UpValueEnth = Numbers(6); // Lower Enthalpy value for modulation of Enthalpy control - if (MultizoneSurfaceData(i).VentSurfCtrNum < 4 || MultizoneSurfaceData(i).VentSurfCtrNum == VentControlType::AdjTemp || - MultizoneSurfaceData(i).VentSurfCtrNum == VentControlType::AdjEnth) { - if (!lAlphaBlanks(6)) { - MultizoneSurfaceData(i).VentAvailSchName = Alphas(6); // Name of ventilation availability schedule - } - } - if (!lAlphaBlanks(7)) { - MultizoneSurfaceData(i).OccupantVentilationControlName = Alphas(7); - MultizoneSurfaceData(i).OccupantVentilationControlNum = - Util::FindItemInList(MultizoneSurfaceData(i).OccupantVentilationControlName, OccupantVentilationControl); - if (MultizoneSurfaceData(i).OccupantVentilationControlNum == 0) { + VentControlType ventilation_control_type{VentControlType::ZoneLevel}; + auto const vent_control_iter{fields.find("ventilation_control_mode")}; + if (vent_control_iter != fields.end()) { + // This will succeed, validation checks that the string is one of the keys. + ventilation_control_type = std::map {{"Temperature", VentControlType::Temp}, + {"Enthalpy", VentControlType::Enth}, + {"Constant", VentControlType::Const}, + {"ASHRAE55Adaptive", VentControlType::ASH55}, + {"CEN15251Adaptive", VentControlType::CEN15251}, + {"NoVent", VentControlType::NoVent}, + {"ZoneLevel", VentControlType::ZoneLevel}, + {"AdjacentTemperature", VentControlType::AdjTemp}, + {"AdjacentEnthalpy", VentControlType::AdjEnth}}.find(vent_control_iter->get())->second; + } + + // Ventilation Control Zone Temperature Setpoint Schedule Name + auto const setpoint_schedule_name{ip->getAlphaFieldValue(fields, props, "ventilation_control_zone_temperature_setpoint_schedule_name")}; + // Limit Value on Multiplier for Modulating Venting Open Factor + auto const modulate_factor{ip->getRealFieldValue(fields, props, "minimum_venting_open_factor")}; + // Lower temperature value for modulation of temperature control + auto const low_value_temp{ip->getRealFieldValue(fields, props, "indoor_and_outdoor_temperature_difference_lower_limit_for_maximum_venting_open_factor")}; + // Upper temperature value for modulation of temperature control + auto const up_value_temp{ip->getRealFieldValue(fields, props, "indoor_and_outdoor_temperature_difference_upper_limit_for_minimum_venting_open_factor")}; + // Lower Enthalpy value for modulation of Enthalpy control + auto const low_value_enth{ip->getRealFieldValue(fields, props, "indoor_and_outdoor_enthalpy_difference_lower_limit_for_maximum_venting_open_factor")}; + // Lower Enthalpy value for modulation of Enthalpy control + auto const up_value_enth{ip->getRealFieldValue(fields, props, "indoor_and_outdoor_enthalpy_difference_upper_limit_for_minimum_venting_open_factor")}; + // Venting Availability Schedule Name + std::string availability_schedule_name; + if (!(ventilation_control_type == VentControlType::NoVent || ventilation_control_type == VentControlType::ZoneLevel)) { + availability_schedule_name = ip->getAlphaFieldValue(fields, props, "venting_availability_schedule_name"); + } + + // Occupant Ventilation Control Name + auto const occupant_control_name{ip->getAlphaFieldValue(fields, props, "occupant_ventilation_control_name")}; + int occupant_ventilation_control_num{0}; + if (!occupant_control_name.empty()) { + occupant_ventilation_control_num = Util::FindItemInList(occupant_control_name, OccupantVentilationControl); + if (occupant_ventilation_control_num == 0) { ShowSevereError(m_state, - format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(7) + - " not found = " + MultizoneSurfaceData(i).OccupantVentilationControlName); - ShowContinueError(m_state, "..for specified " + cAlphaFields(1) + " = " + Alphas(1)); + format(RoutineName) + CurrentModuleObject + " object, Occupant Ventilation Control Name not found = " + occupant_control_name); + ShowContinueError(m_state, "..for specified Surface Name = " + surface_name); ErrorsFound = true; } } - // Get data of polygonal surface - if (!lAlphaBlanks(8)) { - if (Alphas(8) == "POLYGONHEIGHT") { - MultizoneSurfaceData(i).EquivRecMethod = EquivRec::Height; - } else if (Alphas(8) == "BASESURFACEASPECTRATIO") { - MultizoneSurfaceData(i).EquivRecMethod = EquivRec::BaseAspectRatio; - } else if (Alphas(8) == "USERDEFINEDASPECTRATIO") { - MultizoneSurfaceData(i).EquivRecMethod = EquivRec::UserAspectRatio; - } else { - ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, Invalid " + cAlphaFields(8)); - ShowContinueError(m_state, - ".." + cAlphaFields(1) + " = " + MultizoneSurfaceData(i).SurfName + ", Specified " + cAlphaFields(8) + - " = " + Alphas(8)); - ShowContinueError(m_state, - "..The valid choices are \"PolygonHeight\", \"BaseSurfaceAspectRatio\", or \"UserDefinedAspectRatio\""); - ErrorsFound = true; - } - } else { - MultizoneSurfaceData(i).EquivRecMethod = EquivRec::Height; + + // Equivalent Rectangle Method + auto const equiv_rect_iter{fields.find("equivalent_rectangle_method")}; + EquivRec equivrec{EquivRec::Height}; + if (equiv_rect_iter != fields.end()) { + // This is guaranteed to work since inputs are validated + equivrec = std::map{{"PolygonHeight", EquivRec::Height}, + {"BaseSurfaceAspectRatio", EquivRec::BaseAspectRatio}, + {"UserDefinedAspectRatio", EquivRec::UserAspectRatio}}.find(equiv_rect_iter->get())->second; } - if (!lNumericBlanks(7)) { - MultizoneSurfaceData(i).EquivRecUserAspectRatio = Numbers(7); - } else { - MultizoneSurfaceData(i).EquivRecUserAspectRatio = 1.0; + // Equivalent Rectangle Aspect Ratio + auto const aspect_ratio{ip->getRealFieldValue(fields, props, "equivalent_rectangle_aspect_ratio")}; + + Real64 height = m_state.dataSurface->Surface(surface_number).Height; + Real64 width = m_state.dataSurface->Surface(surface_number).Width; + Real64 central_height = m_state.dataSurface->Surface(surface_number).Centroid.z; + bool nonrectangular = false; + if (m_state.dataSurface->Surface(surface_number).Sides != 4) { + nonrectangular = true; + handle_nonrectangular_surfaces(equivrec, + m_state.dataSurface->Surface, + surface_name, + surface_number, + height, + width, + aspect_ratio, + m_state.dataGlobal->DisplayExtraWarnings ? &m_state : nullptr); } + + // Control Schedule Name + auto const control_schedule_name{ip->getAlphaFieldValue(fields, props, "venting_availability_schedule_name")}; + + MultizoneSurfaceData.emplace_back(surface_name, surface_number, height, width, central_height, Util::makeUPPER(opening_name), external_node_name, factor, + ventilation_control_type, modulate_factor, low_value_temp, up_value_temp, low_value_enth, up_value_enth, setpoint_schedule_name, + availability_schedule_name, occupant_ventilation_control_num, nonrectangular, equivrec, aspect_ratio, control_schedule_name); } - } else { - ShowSevereError(m_state, format(RoutineName) + "An " + CurrentModuleObject + " object is required but not found."); - ErrorsFound = true; } + AirflowNetworkNumOfSurfaces = MultizoneSurfaceData.isize(); // remove extra OutdoorAir:Node, not assigned to External Node Name if (m_state.dataGlobal->AnyLocalEnvironmentsInModel && AirflowNetworkNumOfOutAirNode > 0) { for (int i = AirflowNetworkNumOfExtNode - AirflowNetworkNumOfOutAirNode + 1; i <= AirflowNetworkNumOfExtNode; ++i) { found = false; for (int j = 1; j <= AirflowNetworkNumOfSurfaces; ++j) { - if (Util::SameString(MultizoneSurfaceData(j).ExternalNodeName, MultizoneExternalNodeData(i).Name)) { + if (Util::SameString(MultizoneSurfaceData(j).external_node_name, MultizoneExternalNodeData(i).Name)) { found = true; } } @@ -2803,49 +2785,32 @@ namespace AirflowNetwork { // ==> Validate AirflowNetwork simulation surface data NumOfExtNodes = 0; - for (int i = 1; i <= AirflowNetworkNumOfSurfaces; ++i) { - // Check a valid surface defined earlier - MultizoneSurfaceData(i).SurfNum = Util::FindItemInList(MultizoneSurfaceData(i).SurfName, m_state.dataSurface->Surface); - if (MultizoneSurfaceData(i).SurfNum == 0) { - ShowSevereError(m_state, - format(RoutineName) + CurrentModuleObject + " object, Invalid " + cAlphaFields(1) + - " given = " + MultizoneSurfaceData(i).SurfName); - ShowFatalError(m_state, format("{}Errors found getting inputs. Previous error(s) cause program termination.", RoutineName)); - } - if (!m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).HeatTransSurf && - !m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).IsAirBoundarySurf) { - ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object"); - ShowContinueError(m_state, - "..The surface specified must be a heat transfer surface. Invalid " + cAlphaFields(1) + " = " + - MultizoneSurfaceData(i).SurfName); - ErrorsFound = true; - continue; - } + for (int i = 1; i <= MultizoneSurfaceData.isize(); ++i) { // Ensure an interior surface does not face itself - if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond >= 1) { + if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond >= 1) { // Check the surface is a subsurface or not - if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).BaseSurf == MultizoneSurfaceData(i).SurfNum) { - if (MultizoneSurfaceData(i).SurfNum == m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond) { + if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).BaseSurf == MultizoneSurfaceData(i).surface_number) { + if (MultizoneSurfaceData(i).surface_number == m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object"); ShowContinueError(m_state, "..The surface facing itself is not allowed. Invalid " + cAlphaFields(1) + " = " + - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); ErrorsFound = true; } } else { - if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).BaseSurf == - m_state.dataSurface->Surface(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).BaseSurf).ExtBoundCond) { + if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).BaseSurf == + m_state.dataSurface->Surface(m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).BaseSurf).ExtBoundCond) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object"); ShowContinueError(m_state, "..The base surface facing itself is not allowed. Invalid " + cAlphaFields(1) + " = " + - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); ErrorsFound = true; } } } // Ensure zones defined in inside and outside environment are used in the object of AIRFLOWNETWORK:MULTIZONE:ZONE found = false; - n = m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Zone; + n = m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).Zone; int j; for (j = 1; j <= AirflowNetworkNumOfZones; ++j) { if (MultizoneZoneData(j).ZoneNum == n) { @@ -2854,151 +2819,37 @@ namespace AirflowNetwork { } } // find a surface geometry - MultizoneSurfaceData(i).Height = m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Height; - MultizoneSurfaceData(i).Width = m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Width; - MultizoneSurfaceData(i).CHeight = m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Centroid.z; + //MultizoneSurfaceData(i).height = m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).Height; + //MultizoneSurfaceData(i).width = m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).Width; + //MultizoneSurfaceData(i).centroid_height = m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).Centroid.z; if (found) { MultizoneSurfaceData(i).NodeNums[0] = j; } else { ShowSevereError(m_state, - format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(1) + " = " + MultizoneSurfaceData(i).SurfName); + format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(1) + " = " + MultizoneSurfaceData(i).surface_name); ShowContinueError(m_state, "..Zone for inside surface must be defined in a AirflowNetwork:MultiZone:Zone object. Could not find Zone = " + - Zone(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Zone).Name); + Zone(m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).Zone).Name); ShowFatalError(m_state, format("{}Errors found getting inputs. Previous error(s) cause program termination.", RoutineName)); } - // Calculate equivalent width and height - if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Sides != 4) { - MultizoneSurfaceData(i).NonRectangular = true; - if (MultizoneSurfaceData(i).EquivRecMethod == EquivRec::Height) { - if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Tilt < 1.0 || - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Tilt > 179.0) { // horizontal surface - // check base surface shape - if (m_state.dataSurface->Surface(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).BaseSurf).Sides == 4) { - baseratio = m_state.dataSurface->Surface(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).BaseSurf).Width / - m_state.dataSurface->Surface(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).BaseSurf).Height; - MultizoneSurfaceData(i).Width = sqrt(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area * baseratio); - MultizoneSurfaceData(i).Height = - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area / MultizoneSurfaceData(i).Width; - if (m_state.dataGlobal->DisplayExtraWarnings) { - ShowWarningError(m_state, - format(RoutineName) + CurrentModuleObject + " object = " + MultizoneSurfaceData(i).SurfName); - ShowContinueError(m_state, - "The entered choice of Equivalent Rectangle Method is PolygonHeight. This choice is not valid for " - "a horizontal surface."); - ShowContinueError(m_state, "The BaseSurfaceAspectRatio choice is used. Simulation continues."); - } - } else { - MultizoneSurfaceData(i).Width = sqrt(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area * - MultizoneSurfaceData(i).EquivRecUserAspectRatio); - MultizoneSurfaceData(i).Height = - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area / MultizoneSurfaceData(i).Width; - // add warning - if (m_state.dataGlobal->DisplayExtraWarnings) { - ShowWarningError(m_state, - format(RoutineName) + CurrentModuleObject + " object = " + MultizoneSurfaceData(i).SurfName); - ShowContinueError(m_state, - "The entered choice of Equivalent Rectangle Method is PolygonHeight. This choice is not valid for " - "a horizontal surface with a polygonal base surface."); - ShowContinueError(m_state, "The default aspect ratio at 1 is used. Simulation continues."); - } - } - } else { - minHeight = min(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(1).z, - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(2).z); - maxHeight = max(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(1).z, - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(2).z); - for (j = 3; j <= m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Sides; ++j) { - minHeight = min(minHeight, - min(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(j - 1).z, - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(j).z)); - maxHeight = max(maxHeight, - max(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(j - 1).z, - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(j).z)); - } - if (maxHeight > minHeight) { - MultizoneSurfaceData(i).Height = maxHeight - minHeight; - MultizoneSurfaceData(i).Width = - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area / (maxHeight - minHeight); - } - } - } - if (MultizoneSurfaceData(i).EquivRecMethod == EquivRec::BaseAspectRatio) { - if (m_state.dataSurface->Surface(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).BaseSurf).Sides == 4) { - baseratio = m_state.dataSurface->Surface(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).BaseSurf).Width / - m_state.dataSurface->Surface(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).BaseSurf).Height; - MultizoneSurfaceData(i).Width = sqrt(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area * baseratio); - MultizoneSurfaceData(i).Height = - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area / MultizoneSurfaceData(i).Width; - } else { - minHeight = min(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(1).z, - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(2).z); - maxHeight = max(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(1).z, - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(2).z); - for (j = 3; j <= m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Sides; ++j) { - minHeight = min(minHeight, - min(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(j - 1).z, - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(j).z)); - maxHeight = max(maxHeight, - max(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(j - 1).z, - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Vertex(j).z)); - } - if (maxHeight > minHeight) { - MultizoneSurfaceData(i).Height = maxHeight - minHeight; - MultizoneSurfaceData(i).Width = - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area / (maxHeight - minHeight); - // add warning - if (m_state.dataGlobal->DisplayExtraWarnings) { - ShowWarningError(m_state, - format(RoutineName) + CurrentModuleObject + " object = " + MultizoneSurfaceData(i).SurfName); - ShowContinueError(m_state, - "The entered choice of Equivalent Rectangle Method is BaseSurfaceAspectRatio. This choice is not " - "valid for a polygonal base surface."); - ShowContinueError(m_state, "The PolygonHeight choice is used. Simulation continues."); - } - } else { - MultizoneSurfaceData(i).Width = sqrt(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area * - MultizoneSurfaceData(i).EquivRecUserAspectRatio); - MultizoneSurfaceData(i).Height = - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area / MultizoneSurfaceData(i).Width; - // add warning - if (m_state.dataGlobal->DisplayExtraWarnings) { - ShowWarningError(m_state, - format(RoutineName) + CurrentModuleObject + " object = " + MultizoneSurfaceData(i).SurfName); - ShowContinueError(m_state, - "The entered choice of Equivalent Rectangle Method is BaseSurfaceAspectRatio. This choice is not " - "valid for a horizontal surface with a polygonal base surface."); - ShowContinueError(m_state, "The default aspect ratio at 1 is used. Simulation continues."); - } - } - } - } - if (MultizoneSurfaceData(i).EquivRecMethod == EquivRec::UserAspectRatio) { - MultizoneSurfaceData(i).Width = - sqrt(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area * MultizoneSurfaceData(i).EquivRecUserAspectRatio); - MultizoneSurfaceData(i).Height = - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Area / MultizoneSurfaceData(i).Width; - } - } - // Get the number of external surfaces - if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond == ExternalEnvironment || - (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt && - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtWind)) { + if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond == ExternalEnvironment || + (m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond == OtherSideCoefNoCalcExt && + m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtWind)) { ++AirflowNetworkNumOfExtSurfaces; } // Outside face environment - if (simulation_control.iWPCCnt == iWPCCntr::Input) { - n = m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond; + if (simulation_control.iWPCCnt == WindPressureType::Input) { + n = m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond; if (n == ExternalEnvironment || - (n == OtherSideCoefNoCalcExt && m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtWind)) { + (n == OtherSideCoefNoCalcExt && m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtWind)) { ++NumOfExtNodes; if (AirflowNetworkNumOfExtNode > 0) { found = false; for (j = 1; j <= AirflowNetworkNumOfExtNode; ++j) { - if (Util::SameString(MultizoneSurfaceData(i).ExternalNodeName, MultizoneExternalNodeData(j).Name)) { + if (Util::SameString(MultizoneSurfaceData(i).external_node_name, MultizoneExternalNodeData(j).Name)) { MultizoneSurfaceData(i).NodeNums[1] = MultizoneExternalNodeData(j).ExtNum; found = true; break; @@ -3007,7 +2858,7 @@ namespace AirflowNetwork { if (!found) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + ": Invalid " + cAlphaFields(3) + " = " + - MultizoneSurfaceData(i).ExternalNodeName); + MultizoneSurfaceData(i).external_node_name); ShowContinueError(m_state, "A valid " + cAlphaFields(3) + " is required when Wind Pressure Coefficient Type = Input"); ErrorsFound = true; } @@ -3018,11 +2869,11 @@ namespace AirflowNetwork { continue; } else { if (n < ExternalEnvironment && - !(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt && - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtWind)) { + !(m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond == OtherSideCoefNoCalcExt && + m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtWind)) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + ": Invalid " + cAlphaFields(1) + " = " + - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); ShowContinueError(m_state, "This type of surface (has ground, etc exposure) cannot be used in the AiflowNetwork model."); ErrorsFound = true; } @@ -3039,17 +2890,17 @@ namespace AirflowNetwork { } else { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(1) + " = " + - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); ShowContinueError( m_state, "..Zone for outside surface must be defined in a AirflowNetwork:MultiZone:Zone object. Could not find Zone = " + - Zone(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Zone).Name); + Zone(m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).Zone).Name); ErrorsFound = true; continue; } } if (Util::SameString(simulation_control.WPCCntr, "SurfaceAverageCalculation")) { - n = m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond; + n = m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond; if (n >= 1) { // exterior boundary condition is a surface found = false; for (j = 1; j <= AirflowNetworkNumOfZones; ++j) { @@ -3061,7 +2912,7 @@ namespace AirflowNetwork { if (found) { MultizoneSurfaceData(i).NodeNums[1] = j; } else { - ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " = " + MultizoneSurfaceData(i).SurfName); + ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " = " + MultizoneSurfaceData(i).surface_name); ShowContinueError(m_state, "An adjacent zone = " + Zone(m_state.dataSurface->Surface(n).Zone).Name + " is not described in AIRFLOWNETWORK:MULTIZONE:ZONE"); @@ -3070,14 +2921,14 @@ namespace AirflowNetwork { } } } - if (!(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond == -2 && - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtWind)) { - if (MultizoneSurfaceData(i).NodeNums[1] == 0 && m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond < 0) { - ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " = " + MultizoneSurfaceData(i).SurfName); + if (!(m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond == -2 && + m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtWind)) { + if (MultizoneSurfaceData(i).NodeNums[1] == 0 && m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond < 0) { + ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " = " + MultizoneSurfaceData(i).surface_name); ShowContinueError(m_state, "Outside boundary condition and object are " + - cExtBoundCondition(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond) + " and " + - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCondName + "."); + cExtBoundCondition(m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond) + " and " + + m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCondName + "."); ShowContinueError(m_state, "The outside boundary condition must be exposed to either the outside or an adjacent zone."); ErrorsFound = true; continue; @@ -3088,7 +2939,7 @@ namespace AirflowNetwork { // write outputs in eio file found = true; for (int i = 1; i <= AirflowNetworkNumOfSurfaces; ++i) { - if (MultizoneSurfaceData(i).NonRectangular) { + if (MultizoneSurfaceData(i).nonrectangular) { if (found) { print(m_state.files.eio, "! , Name, Equivalent Height {{m}}, Equivalent Width {{m}} " @@ -3098,28 +2949,28 @@ namespace AirflowNetwork { } print(m_state.files.eio, "AirflowNetwork Model:Equivalent Rectangle Surface, {}, {:.2R},{:.2R}\n", - MultizoneSurfaceData(i).SurfName, - MultizoneSurfaceData(i).Height, - MultizoneSurfaceData(i).Width); + MultizoneSurfaceData(i).surface_name, + MultizoneSurfaceData(i).height, + MultizoneSurfaceData(i).width); } } // Validate adjacent temperature and Enthalpy control for an interior surface only for (int i = 1; i <= AirflowNetworkNumOfSurfaces; ++i) { - if (MultizoneSurfaceData(i).VentSurfCtrNum == VentControlType::AdjTemp) { - if (!(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond >= 1)) { + if (MultizoneSurfaceData(i).ventilation_control_type == VentControlType::AdjTemp) { + if (!(m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond >= 1)) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(1) + " = " + - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); ShowContinueError(m_state, "..AdjacentTemperature venting control must be defined for an interzone surface."); ErrorsFound = true; } } - if (MultizoneSurfaceData(i).VentSurfCtrNum == VentControlType::AdjEnth) { - if (!(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond >= 1)) { + if (MultizoneSurfaceData(i).ventilation_control_type == VentControlType::AdjEnth) { + if (!(m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond >= 1)) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, " + cAlphaFields(1) + " = " + - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); ShowContinueError(m_state, "..AdjacentEnthalpy venting control must be defined for an interzone surface."); ErrorsFound = true; } @@ -3127,7 +2978,7 @@ namespace AirflowNetwork { } // Ensure the number of external node = the number of external surface with HeightOption choice = OpeningHeight - if (Util::SameString(simulation_control.HeightOption, "OpeningHeight") && simulation_control.iWPCCnt == iWPCCntr::Input) { + if (Util::SameString(simulation_control.HeightOption, "OpeningHeight") && simulation_control.iWPCCnt == WindPressureType::Input) { if (AirflowNetworkNumOfExtSurfaces != AirflowNetworkNumOfExtNode) { ShowSevereError(m_state, format(RoutineName) + @@ -3151,7 +3002,7 @@ namespace AirflowNetwork { for (int i = 1; i <= AirflowNetworkNumOfDetOpenings; ++i) { found = false; for (int j = 1; j <= AirflowNetworkNumOfSurfaces; ++j) { - if (MultizoneCompDetOpeningData(i).name == MultizoneSurfaceData(j).OpeningName) { + if (MultizoneCompDetOpeningData(i).name == MultizoneSurfaceData(j).opening_name) { // MultizoneCompDetOpeningData(i)%Width = // Surface(MultizoneSurfaceData(j)%SurfNum)%Width // MultizoneCompDetOpeningData(i)%Height = @@ -3169,35 +3020,44 @@ namespace AirflowNetwork { // Moved into getAirflowElementInput // Check status of control level for each surface with an opening + // This entire thing needs to be moved up to where the surfaces are read in. Everything here should be known then as well. CurrentModuleObject = "AirflowNetwork:MultiZone:Surface"; for (int i = 1; i <= AirflowNetworkNumOfSurfaces; ++i) { - if (MultizoneSurfaceData(i).SurfNum == 0) continue; - bool has_Opening{false}; // Why use array constructor? + if (MultizoneSurfaceData(i).surface_number == 0) continue; // This should trigger a fatal error above. + bool has_Opening{false}; - ErrorObjectHeader eoh{RoutineName, CurrentModuleObject, MultizoneSurfaceData(i).SurfName}; + ErrorObjectHeader eoh{RoutineName, CurrentModuleObject, MultizoneSurfaceData(i).surface_name}; // This is terrible, should not do it this way - auto afe = elements.find(MultizoneSurfaceData(i).OpeningName); + auto afe = elements.find(MultizoneSurfaceData(i).opening_name); if (afe != elements.end()) { auto type = afe->second->type(); - has_Opening = (type == ComponentType::DOP) || (type == ComponentType::SOP) || (type == ComponentType::HOP); + has_Opening = (type == AirflowElementType::DOP) || (type == AirflowElementType::SOP) || (type == AirflowElementType::HOP); } // Obtain schedule number and check surface shape if (has_Opening) { - if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).Sides == 3) { - ShowWarningError(m_state, format(RoutineName) + CurrentModuleObject + "=\"" + MultizoneSurfaceData(i).SurfName + "\"."); + if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).Sides == 3) { + ShowWarningError(m_state, format(RoutineName) + CurrentModuleObject + "=\"" + MultizoneSurfaceData(i).surface_name + "\"."); ShowContinueError(m_state, "The opening is a Triangular subsurface. A rectangular subsurface will be used with equivalent " "width and height."); } // Venting controls are not allowed for an air boundary surface - if ((m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).IsAirBoundarySurf) && - (MultizoneSurfaceData(i).VentSurfCtrNum != VentControlType::Const)) { + if ((m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).IsAirBoundarySurf) && + (MultizoneSurfaceData(i).ventilation_control_type != VentControlType::Const)) { ShowWarningError(m_state, - format(RoutineName) + CurrentModuleObject + "=\"" + MultizoneSurfaceData(i).SurfName + + format(RoutineName) + CurrentModuleObject + "=\"" + MultizoneSurfaceData(i).surface_name + "\" is an air boundary surface."); - ShowContinueError(m_state, "Ventilation Control Mode = " + Alphas(4) + " is not valid. Resetting to Constant."); - MultizoneSurfaceData(i).VentSurfCtrNum = VentControlType::Const; + ShowContinueError(m_state, "Ventilation Control Mode = " + std::map {{VentControlType::Temp, "TEMPERATURE"}, + {VentControlType::Enth, "ENTHALPY"}, + {VentControlType::Const, "CONSTANT"}, + {VentControlType::ASH55, "ASHRAE55ADAPTIVE",}, + {VentControlType::CEN15251, "CEN15251ADAPTIVE"}, + {VentControlType::NoVent, "NOVENT"}, + {VentControlType::ZoneLevel, "ZONELEVEL"}, + {VentControlType::AdjTemp, "ADJACENTTEMPERATURE"}, + {VentControlType::AdjEnth, "ADJACENTENTHALPY"}}.find(MultizoneSurfaceData(i).ventilation_control_type)->second + " is not valid. Resetting to Constant."); + MultizoneSurfaceData(i).ventilation_control_type = VentControlType::Const; MultizoneSurfaceData(i).IndVentControl = true; } @@ -3207,14 +3067,14 @@ namespace AirflowNetwork { nullptr) { ShowSevereItemNotFound(m_state, eoh, "Venting Schedule", MultizoneSurfaceData(i).VentAvailSchName); ErrorsFound = true; - } else if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).IsAirBoundarySurf) { - ShowWarningNonEmptyField(m_state, eoh, "Venting Availbility Schedule"); + } else if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).IsAirBoundarySurf) { + ShowWarningNonEmptyField(m_state, eoh, "Venting Availability Schedule"); ShowContinueError(m_state, "Venting is always available for air-boundary surfaces."); MultizoneSurfaceData(i).ventAvailSched = Sched::GetScheduleAlwaysOn(m_state); MultizoneSurfaceData(i).VentAvailSchName = ""; } - switch (MultizoneSurfaceData(i).VentSurfCtrNum) { + switch (MultizoneSurfaceData(i).ventilation_control_type) { case VentControlType::Temp: case VentControlType::AdjTemp: { if (MultizoneSurfaceData(i).VentTempControlSchName.empty()) { @@ -3225,26 +3085,26 @@ namespace AirflowNetwork { ShowSevereItemNotFound(m_state, eoh, "Ventilation Schedule", MultizoneSurfaceData(i).VentTempControlSchName); ErrorsFound = true; } - if (MultizoneSurfaceData(i).LowValueTemp < 0.0) { + if (MultizoneSurfaceData(i).temperature_lower_limit < 0.0) { ShowWarningError(m_state, format(RoutineName) + CurrentModuleObject + " object, Low Temperature difference value < 0.0d0"); - ShowContinueError(m_state, format("..Input value={:.1R}, Value will be reset to 0.0.", MultizoneSurfaceData(i).LowValueTemp)); - ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).SurfName + "\""); - MultizoneSurfaceData(i).LowValueTemp = 0.0; + ShowContinueError(m_state, format("..Input value={:.1R}, Value will be reset to 0.0.", MultizoneSurfaceData(i).temperature_lower_limit)); + ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).surface_name + "\""); + MultizoneSurfaceData(i).temperature_lower_limit = 0.0; } - if (MultizoneSurfaceData(i).LowValueTemp >= 100.0) { + if (MultizoneSurfaceData(i).temperature_lower_limit >= 100.0) { ShowWarningError(m_state, format(RoutineName) + CurrentModuleObject + " object, Low Temperature difference value >= 100.0d0"); ShowContinueError(m_state, - format("..Input value = {:.1R}, Value will be reset to 0.0", MultizoneSurfaceData(i).LowValueTemp)); - ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).SurfName + "\""); + format("..Input value = {:.1R}, Value will be reset to 0.0", MultizoneSurfaceData(i).temperature_lower_limit)); + ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).surface_name + "\""); MultizoneZoneData(i).LowValueTemp = 0.0; } - if (MultizoneSurfaceData(i).UpValueTemp <= MultizoneSurfaceData(i).LowValueTemp) { + if (MultizoneSurfaceData(i).temperature_upper_limit <= MultizoneSurfaceData(i).temperature_lower_limit) { ShowWarningError( m_state, format(RoutineName) + CurrentModuleObject + " object, Upper Temperature <= Lower Temperature difference value."); ShowContinueError(m_state, - format("..Input value = {:.1R}, Value will be reset to 100.0", MultizoneSurfaceData(i).UpValueTemp)); - ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).SurfName + "\""); - MultizoneSurfaceData(i).UpValueTemp = 100.0; + format("..Input value = {:.1R}, Value will be reset to 100.0", MultizoneSurfaceData(i).temperature_upper_limit)); + ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).surface_name + "\""); + MultizoneSurfaceData(i).temperature_upper_limit = 100.0; } } break; @@ -3259,27 +3119,27 @@ namespace AirflowNetwork { ShowSevereItemNotFound(m_state, eoh, "Ventilation Schedule", MultizoneSurfaceData(i).VentTempControlSchName); ErrorsFound = true; } - if (MultizoneSurfaceData(i).LowValueEnth < 0.0) { + if (MultizoneSurfaceData(i).enthalpy_lower_limit < 0.0) { ShowWarningError(m_state, format(RoutineName) + CurrentModuleObject + " object, Low Enthalpy difference value < 0.0d0"); ShowContinueError(m_state, - format("..Input value = {:.1R}, Value will be reset to 0.0", MultizoneSurfaceData(i).LowValueEnth)); - ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).SurfName + "\""); - MultizoneSurfaceData(i).LowValueEnth = 0.0; + format("..Input value = {:.1R}, Value will be reset to 0.0", MultizoneSurfaceData(i).enthalpy_lower_limit)); + ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).surface_name + "\""); + MultizoneSurfaceData(i).enthalpy_lower_limit = 0.0; } - if (MultizoneSurfaceData(i).LowValueEnth >= 300000.0) { + if (MultizoneSurfaceData(i).enthalpy_lower_limit >= 300000.0) { ShowWarningError(m_state, format(RoutineName) + CurrentModuleObject + " object, Low Enthalpy difference value >= 300000.0"); ShowContinueError(m_state, - format("..Input value = {:.1R}, Value will be reset to 0.0", MultizoneSurfaceData(i).LowValueEnth)); - ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).SurfName + "\""); + format("..Input value = {:.1R}, Value will be reset to 0.0", MultizoneSurfaceData(i).enthalpy_lower_limit)); + ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).surface_name + "\""); MultizoneZoneData(i).LowValueEnth = 0.0; } - if (MultizoneSurfaceData(i).UpValueEnth <= MultizoneSurfaceData(i).LowValueEnth) { + if (MultizoneSurfaceData(i).enthalpy_upper_limit <= MultizoneSurfaceData(i).enthalpy_lower_limit) { ShowWarningError(m_state, format(RoutineName) + CurrentModuleObject + " object, Upper Enthalpy <= Lower Enthalpy difference value."); ShowContinueError(m_state, - format("..Input value = {:.1R}, Value will be set to 300000.0", MultizoneSurfaceData(i).UpValueEnth)); - ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).SurfName + "\""); - MultizoneSurfaceData(i).UpValueEnth = 300000.0; + format("..Input value = {:.1R}, Value will be set to 300000.0", MultizoneSurfaceData(i).enthalpy_upper_limit)); + ShowContinueError(m_state, "..for Surface = \"" + MultizoneSurfaceData(i).surface_name + "\""); + MultizoneSurfaceData(i).enthalpy_upper_limit = 300000.0; } } break; @@ -3302,7 +3162,7 @@ namespace AirflowNetwork { for (int i = 1; i <= AirflowNetworkNumOfSimOpenings; ++i) { found = false; for (int j = 1; j <= AirflowNetworkNumOfSurfaces; ++j) { - if (MultizoneCompSimpleOpeningData(i).name == MultizoneSurfaceData(j).OpeningName) { + if (MultizoneCompSimpleOpeningData(i).name == MultizoneSurfaceData(j).opening_name) { // MultizoneCompSimpleOpeningData(i)%Width = // Surface(MultizoneSurfaceData(j)%SurfNum)%Width // MultizoneCompSimpleOpeningData(i)%Height = @@ -3356,11 +3216,11 @@ namespace AirflowNetwork { Util::SameString(simulation_control.HeightOption, "OpeningHeight")) { for (int i = 1; i <= AirflowNetworkNumOfExtNode; ++i) { for (int j = 1; j <= AirflowNetworkNumOfSurfaces; ++j) { - if (m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).ExtBoundCond == ExternalEnvironment || - (m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt && - m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).ExtWind)) { - if (Util::SameString(MultizoneSurfaceData(j).ExternalNodeName, MultizoneExternalNodeData(i).Name)) { - MultizoneExternalNodeData(i).height = m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).Centroid.z; + if (m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).ExtBoundCond == ExternalEnvironment || + (m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).ExtBoundCond == OtherSideCoefNoCalcExt && + m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).ExtWind)) { + if (Util::SameString(MultizoneSurfaceData(j).external_node_name, MultizoneExternalNodeData(i).Name)) { + MultizoneExternalNodeData(i).height = m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).Centroid.z; break; } } @@ -3371,11 +3231,11 @@ namespace AirflowNetwork { // Assign external node azimuth, should consider combining this with the above to avoid the repeated search for (int i = 1; i <= AirflowNetworkNumOfExtNode; ++i) { for (int j = 1; j <= AirflowNetworkNumOfSurfaces; ++j) { - if (m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).ExtBoundCond == ExternalEnvironment || - (m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt && - m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).ExtWind)) { - if (Util::SameString(MultizoneSurfaceData(j).ExternalNodeName, MultizoneExternalNodeData(i).Name)) { - MultizoneExternalNodeData(i).azimuth = m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).Azimuth; + if (m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).ExtBoundCond == ExternalEnvironment || + (m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).ExtBoundCond == OtherSideCoefNoCalcExt && + m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).ExtWind)) { + if (Util::SameString(MultizoneSurfaceData(j).external_node_name, MultizoneExternalNodeData(i).Name)) { + MultizoneExternalNodeData(i).azimuth = m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).Azimuth; break; } } @@ -3503,7 +3363,7 @@ namespace AirflowNetwork { ZoneBCCheck.deallocate(); // Validate CP Value number - if (simulation_control.iWPCCnt == iWPCCntr::Input) { // Surface-Average does not need inputs of external nodes + if (simulation_control.iWPCCnt == WindPressureType::Input) { // Surface-Average does not need inputs of external nodes // Ensure different curve is used to avoid a single side boundary condition found = false; bool differentAngle = false; @@ -3529,14 +3389,14 @@ namespace AirflowNetwork { // Assign occupant ventilation control number from zone to surface for (int i = 1; i <= AirflowNetworkNumOfSurfaces; ++i) { - int j = MultizoneSurfaceData(i).SurfNum; + int j = MultizoneSurfaceData(i).surface_number; auto const &surf = m_state.dataSurface->Surface(j); if (surf.OriginalClass == SurfaceClass::Window || surf.OriginalClass == SurfaceClass::Door || surf.OriginalClass == SurfaceClass::GlassDoor) { for (n = 1; n <= AirflowNetworkNumOfZones; ++n) { if (MultizoneZoneData(n).ZoneNum == m_state.dataSurface->Surface(j).Zone) { - if (MultizoneZoneData(n).OccupantVentilationControlNum > 0 && MultizoneSurfaceData(i).OccupantVentilationControlNum == 0) { - MultizoneSurfaceData(i).OccupantVentilationControlNum = MultizoneZoneData(n).OccupantVentilationControlNum; + if (MultizoneZoneData(n).OccupantVentilationControlNum > 0 && MultizoneSurfaceData(i).occupant_control_number == 0) { + MultizoneSurfaceData(i).occupant_control_number = MultizoneZoneData(n).OccupantVentilationControlNum; } } } @@ -3648,7 +3508,7 @@ namespace AirflowNetwork { // Check valid surface name IntraZoneLinkageData(i).SurfaceName = Alphas(5); IntraZoneLinkageData(i).LinkNum = - Util::FindItemInList(Alphas(5), MultizoneSurfaceData, &MultizoneSurfaceProp::SurfName, AirflowNetworkNumOfSurfaces); + Util::FindItemInList(Alphas(5), MultizoneSurfaceData, &MultizoneSurfaceProp::surface_name, AirflowNetworkNumOfSurfaces); if (IntraZoneLinkageData(i).LinkNum == 0) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + "='" + Alphas(1) + "': Invalid " + cAlphaFields(5) + @@ -3687,7 +3547,7 @@ namespace AirflowNetwork { if (IntraZoneLinkageData(i).NodeNums[1] > 0) { IntraZoneLinkageData(i).NodeHeights[1] = Zone(MultizoneZoneData(IntraZoneLinkageData(i).NodeNums[1]).ZoneNum).Centroid.z; } else { - if (simulation_control.iWPCCnt == iWPCCntr::Input) { // Surface-Average does not need inputs of external nodes + if (simulation_control.iWPCCnt == WindPressureType::Input) { // Surface-Average does not need inputs of external nodes IntraZoneLinkageData(i).NodeNums[1] = MultizoneSurfaceData(IntraZoneLinkageData(i).LinkNum).NodeNums[1]; if (IntraZoneLinkageData(i).NodeNums[1] == 0) { ShowSevereError(m_state, @@ -3698,7 +3558,7 @@ namespace AirflowNetwork { ErrorsFound = true; } } - if (simulation_control.iWPCCnt == iWPCCntr::SurfAvg) { + if (simulation_control.iWPCCnt == WindPressureType::SurfAvg) { if (!lAlphaBlanks(3)) { ShowWarningError(m_state, format(RoutineName) + CurrentModuleObject + "='" + Alphas(1) + " The input of " + cAlphaFields(3) + @@ -3757,7 +3617,7 @@ namespace AirflowNetwork { if (j > 0) { // Revise data in multizone object NumOfLinksIntraZone = NumOfLinksIntraZone - 1; - if (m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).ExtBoundCond == 0) { + if (m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).ExtBoundCond == 0) { // Exterior surface NodeNums[1] should be equal if (IntraZoneLinkageData(i).NodeNums[0] > AirflowNetworkNumOfZones + AirflowNetworkNumOfExtNode) { MultizoneSurfaceData(j).RAFNflag = true; @@ -3771,7 +3631,7 @@ namespace AirflowNetwork { ShowSevereError(m_state, format(RoutineName) + "The InterZone link is not found between AirflowNetwork:IntraZone:Linkage =" + IntraZoneLinkageData(i).Name + - " and AirflowNetwork:Multizone:Surface = " + MultizoneSurfaceData(j).SurfName); + " and AirflowNetwork:Multizone:Surface = " + MultizoneSurfaceData(j).surface_name); ErrorsFound = true; } } else { @@ -3802,7 +3662,7 @@ namespace AirflowNetwork { ShowSevereError(m_state, format(RoutineName) + "The InterZone link is not found between AirflowNetwork:IntraZone:Linkage =" + IntraZoneLinkageData(i).Name + - " and AirflowNetwork:Multizone:Surface = " + MultizoneSurfaceData(j).SurfName); + " and AirflowNetwork:Multizone:Surface = " + MultizoneSurfaceData(j).surface_name); ErrorsFound = true; } } else if (IntraZoneLinkageData(i).NodeNums[1] > AirflowNetworkNumOfZones + AirflowNetworkNumOfExtNode) { @@ -3816,7 +3676,7 @@ namespace AirflowNetwork { ShowSevereError(m_state, format(RoutineName) + "The InterZone link is not found between AirflowNetwork:IntraZone:Linkage =" + IntraZoneLinkageData(i).Name + - " and AirflowNetwork:Multizone:Surface = " + MultizoneSurfaceData(j).SurfName); + " and AirflowNetwork:Multizone:Surface = " + MultizoneSurfaceData(j).surface_name); ErrorsFound = true; } } @@ -4084,7 +3944,7 @@ namespace AirflowNetwork { bool is_EXF{false}; auto afe = elements.find(Alphas(4)); if (afe != elements.end()) { - is_EXF = afe->second->type() == ComponentType::EXF; + is_EXF = afe->second->type() == AirflowElementType::EXF; } if (!is_EXF) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, an invalid name is given:"); @@ -4097,7 +3957,7 @@ namespace AirflowNetwork { bool is_REL{false}; auto afe = elements.find(Alphas(4)); if (afe != elements.end()) { - is_REL = afe->second->type() == ComponentType::REL; + is_REL = afe->second->type() == AirflowElementType::REL; } if (!is_REL) { ShowSevereError(m_state, format(RoutineName) + CurrentModuleObject + " object, an invalid name is given:"); @@ -4122,7 +3982,7 @@ namespace AirflowNetwork { // Assign numbers of nodes and linkages if (simulation_control.type != ControlType::NoMultizoneOrDistribution) { - if (simulation_control.iWPCCnt == iWPCCntr::Input) { + if (simulation_control.iWPCCnt == WindPressureType::Input) { NumOfNodesMultiZone = AirflowNetworkNumOfZones + AirflowNetworkNumOfExtNode; } else { NumOfNodesMultiZone = AirflowNetworkNumOfZones + NumOfExtNodes; @@ -4147,7 +4007,7 @@ namespace AirflowNetwork { AirflowNetworkNodeData(i).NodeHeight = MultizoneZoneData(i).Height; } // External node - if (simulation_control.iWPCCnt == iWPCCntr::Input) { + if (simulation_control.iWPCCnt == WindPressureType::Input) { for (int i = AirflowNetworkNumOfZones + 1; i <= NumOfNodesMultiZone; ++i) { AirflowNetworkNodeData(i).Name = MultizoneExternalNodeData(i - AirflowNetworkNumOfZones).Name; AirflowNetworkNodeData(i).NodeTypeNum = 1; @@ -4208,26 +4068,26 @@ namespace AirflowNetwork { AirflowNetworkNodeData(i).EPlusNodeNum = DisSysNodeData(i - NumOfNodesMultiZone).EPlusNodeNum; // Get mixer information if (Util::SameString(DisSysNodeData(i - NumOfNodesMultiZone).EPlusType, "AirLoopHVAC:ZoneMixer")) { - AirflowNetworkNodeData(i).EPlusTypeNum = iEPlusNodeType::MIX; + AirflowNetworkNodeData(i).EPlusTypeNum = EPlusNodeType::MIX; } // Get splitter information if (Util::SameString(DisSysNodeData(i - NumOfNodesMultiZone).EPlusType, "AirLoopHVAC:ZoneSplitter")) { - AirflowNetworkNodeData(i).EPlusTypeNum = iEPlusNodeType::SPL; + AirflowNetworkNodeData(i).EPlusTypeNum = EPlusNodeType::SPL; } // Get outside air system information if (Util::SameString(DisSysNodeData(i - NumOfNodesMultiZone).EPlusType, "AirLoopHVAC:OutdoorAirSystem")) { - AirflowNetworkNodeData(i).EPlusTypeNum = iEPlusNodeType::OAN; + AirflowNetworkNodeData(i).EPlusTypeNum = EPlusNodeType::OAN; } // Get OA system inlet information 'OAMixerOutdoorAirStreamNode' was specified as an outdoor air node implicitly if (Util::SameString(DisSysNodeData(i - NumOfNodesMultiZone).EPlusType, "OAMixerOutdoorAirStreamNode")) { - AirflowNetworkNodeData(i).EPlusTypeNum = iEPlusNodeType::EXT; + AirflowNetworkNodeData(i).EPlusTypeNum = EPlusNodeType::EXT; AirflowNetworkNodeData(i).ExtNodeNum = AirflowNetworkNumOfExtNode + 1; AirflowNetworkNodeData(i).NodeTypeNum = 1; } if (Util::SameString(DisSysNodeData(i - NumOfNodesMultiZone).EPlusType, "OutdoorAir:NodeList") || Util::SameString(DisSysNodeData(i - NumOfNodesMultiZone).EPlusType, "OutdoorAir:Node")) { if (j > 1) { - AirflowNetworkNodeData(i).EPlusTypeNum = iEPlusNodeType::EXT; + AirflowNetworkNodeData(i).EPlusTypeNum = EPlusNodeType::EXT; AirflowNetworkNodeData(i).ExtNodeNum = AirflowNetworkNumOfExtNode + 1; AirflowNetworkNodeData(i).NodeTypeNum = 1; } else { @@ -4253,7 +4113,7 @@ namespace AirflowNetwork { for (int i = 1; i <= AirflowNetworkNumOfDetOpenings; ++i) { // Detailed opening component AirflowNetworkCompData(i).Name = MultizoneCompDetOpeningData(i).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::DOP; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::DOP; AirflowNetworkCompData(i).TypeNum = i; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4266,7 +4126,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = MultizoneCompSimpleOpeningData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::SOP; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::SOP; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4279,7 +4139,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = MultizoneSurfaceCrackData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::SCR; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::SCR; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4292,7 +4152,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = MultizoneSurfaceELAData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::SEL; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::SEL; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4305,7 +4165,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = MultizoneCompExhaustFanData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::EXF; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::EXF; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4318,7 +4178,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = MultizoneCompHorOpeningData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::HOP; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::HOP; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4331,7 +4191,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompLeakData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::PLR; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::PLR; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4344,7 +4204,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompELRData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::ELR; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::ELR; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4357,7 +4217,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompDuctData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::DWC; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::DWC; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4370,7 +4230,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompDamperData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::DMP; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::DMP; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4383,13 +4243,13 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompCVFData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::CVF; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::CVF; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; AirflowNetworkCompData(i).EPlusType = ""; AirflowNetworkCompData(i).CompNum = i; - AirflowNetworkCompData(i).EPlusTypeNum = iEPlusComponentType::FAN; + AirflowNetworkCompData(i).EPlusTypeNum = EPlusComponentType::FAN; } j += DisSysNumOfCVFs; @@ -4397,13 +4257,13 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompDetFanData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::FAN; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::FAN; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; AirflowNetworkCompData(i).EPlusType = ""; AirflowNetworkCompData(i).CompNum = i; - AirflowNetworkCompData(i).EPlusTypeNum = iEPlusComponentType::FAN; + AirflowNetworkCompData(i).EPlusTypeNum = EPlusComponentType::FAN; } j += DisSysNumOfDetFans; @@ -4411,7 +4271,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompCPDData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::CPD; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::CPD; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4424,13 +4284,13 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompCoilData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::COI; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::COI; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; AirflowNetworkCompData(i).EPlusType = ""; AirflowNetworkCompData(i).CompNum = i; - AirflowNetworkCompData(i).EPlusTypeNum = iEPlusComponentType::COI; + AirflowNetworkCompData(i).EPlusTypeNum = EPlusComponentType::COI; } j += DisSysNumOfCoils; @@ -4438,13 +4298,13 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompTermUnitData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::TMU; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::TMU; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; AirflowNetworkCompData(i).EPlusType = ""; AirflowNetworkCompData(i).CompNum = i; - AirflowNetworkCompData(i).EPlusTypeNum = iEPlusComponentType::RHT; + AirflowNetworkCompData(i).EPlusTypeNum = EPlusComponentType::RHT; } j += DisSysNumOfTermUnits; @@ -4452,13 +4312,13 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompHXData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::HEX; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::HEX; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; AirflowNetworkCompData(i).EPlusType = ""; AirflowNetworkCompData(i).CompNum = i; - AirflowNetworkCompData(i).EPlusTypeNum = iEPlusComponentType::HEX; + AirflowNetworkCompData(i).EPlusTypeNum = EPlusComponentType::HEX; } j += DisSysNumOfHXs; @@ -4466,7 +4326,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompOutdoorAirData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::OAF; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::OAF; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4479,7 +4339,7 @@ namespace AirflowNetwork { n = i - j; AirflowNetworkCompData(i).Name = DisSysCompReliefAirData(n).name; compnum[AirflowNetworkCompData(i).Name] = i; - AirflowNetworkCompData(i).CompTypeNum = iComponentTypeNum::REL; + AirflowNetworkCompData(i).CompTypeNum = AirflowElementType::REL; AirflowNetworkCompData(i).TypeNum = n; AirflowNetworkCompData(i).EPlusName = ""; AirflowNetworkCompData(i).EPlusCompName = ""; @@ -4494,7 +4354,7 @@ namespace AirflowNetwork { for (auto const &el : SpecifiedMassFlowData) { AirflowNetworkCompData(ii).Name = el.name; compnum[el.name] = ii; - AirflowNetworkCompData(ii).CompTypeNum = iComponentTypeNum::SMF; + AirflowNetworkCompData(ii).CompTypeNum = AirflowElementType::SMF; AirflowNetworkCompData(ii).TypeNum = type_i; AirflowNetworkCompData(ii).EPlusName = ""; AirflowNetworkCompData(ii).EPlusCompName = ""; @@ -4508,7 +4368,7 @@ namespace AirflowNetwork { for (auto const &el : SpecifiedVolumeFlowData) { AirflowNetworkCompData(ii).Name = el.name; compnum[el.name] = ii; - AirflowNetworkCompData(ii).CompTypeNum = iComponentTypeNum::SVF; + AirflowNetworkCompData(ii).CompTypeNum = AirflowElementType::SVF; AirflowNetworkCompData(ii).TypeNum = type_i; AirflowNetworkCompData(ii).EPlusName = ""; AirflowNetworkCompData(ii).EPlusCompName = ""; @@ -4534,15 +4394,28 @@ namespace AirflowNetwork { // Assign Multizone linkage based on surfaces, by assuming every surface has a crack or opening j = 0; for (count = 1; count <= AirflowNetworkNumOfSurfaces; ++count) { - if (MultizoneSurfaceData(count).SurfNum == 0) continue; - AirflowNetworkLinkageData(count).Name = MultizoneSurfaceData(count).SurfName; + if (MultizoneSurfaceData(count).surface_number == 0) continue; // This should trigger a fatal error above. + + // Handle the control schedule + if (MultizoneSurfaceData(count).control_schedule_name.empty()) { + + AirflowNetworkLinkageData(count).control_schedule = Sched::GetSchedule(m_state, MultizoneSurfaceData(count).control_schedule_name); + if (AirflowNetworkLinkageData(count).control_schedule == nullptr) { + // Severe error here + } + } + if (AirflowNetworkLinkageData(count).control_schedule == nullptr) { + AirflowNetworkLinkageData(count).control_schedule = Sched::GetScheduleAlwaysOn(m_state); + } + // And now the rest + AirflowNetworkLinkageData(count).Name = MultizoneSurfaceData(count).surface_name; AirflowNetworkLinkageData(count).NodeNums[0] = MultizoneSurfaceData(count).NodeNums[0]; AirflowNetworkLinkageData(count).NodeNums[1] = MultizoneSurfaceData(count).NodeNums[1]; - AirflowNetworkLinkageData(count).CompName = MultizoneSurfaceData(count).OpeningName; + AirflowNetworkLinkageData(count).CompName = MultizoneSurfaceData(count).opening_name; AirflowNetworkLinkageData(count).ZoneNum = 0; AirflowNetworkLinkageData(count).LinkNum = count; - AirflowNetworkLinkageData(count).NodeHeights[0] = MultizoneSurfaceData(count).CHeight; - AirflowNetworkLinkageData(count).NodeHeights[1] = MultizoneSurfaceData(count).CHeight; + AirflowNetworkLinkageData(count).NodeHeights[0] = MultizoneSurfaceData(count).centroid_height; + AirflowNetworkLinkageData(count).NodeHeights[1] = MultizoneSurfaceData(count).centroid_height; if (!m_state.dataSurface->WorldCoordSystem) { if (AirflowNetworkNodeData(AirflowNetworkLinkageData(count).NodeNums[0]).EPlusZoneNum > 0) { AirflowNetworkLinkageData(count).NodeHeights[0] -= @@ -4565,21 +4438,16 @@ namespace AirflowNetwork { int compnum = compnum_iter->second; AirflowNetworkLinkageData(count).CompNum = compnum; - auto const &surf = m_state.dataSurface->Surface(MultizoneSurfaceData(count).SurfNum); + auto const &surf = m_state.dataSurface->Surface(MultizoneSurfaceData(count).surface_number); switch (AirflowNetworkLinkageData(count).element->type()) { - case ComponentType::DOP: { - // if (AirflowNetworkLinkageData(count).CompName == - // AirflowNetworkCompData(i).Name) { - // AirflowNetworkLinkageData(count).CompNum = i; - // found = true; - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::DOP) { + case AirflowElementType::DOP: { ++j; AirflowNetworkLinkageData(count).DetOpenNum = j; MultizoneSurfaceData(count).Multiplier = surf.Multiplier; if (surf.Tilt < 10.0 || surf.Tilt > 170.0) { ShowWarningError(m_state, "An AirflowNetwork:Multizone:Surface object has an air-flow opening corresponding to"); - ShowContinueError(m_state, "window or door = " + MultizoneSurfaceData(count).SurfName + ", which is within "); + ShowContinueError(m_state, "window or door = " + MultizoneSurfaceData(count).surface_name + ", which is within "); ShowContinueError(m_state, "10 deg of being horizontal. Airflows through large horizontal openings are poorly"); ShowContinueError(m_state, "modeled in the AirflowNetwork model resulting in only one-way airflow."); } @@ -4603,12 +4471,11 @@ namespace AirflowNetwork { } } } break; - case ComponentType::SOP: { - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::SOP) { + case AirflowElementType::SOP: { MultizoneSurfaceData(count).Multiplier = surf.Multiplier; if (surf.Tilt < 10.0 || surf.Tilt > 170.0) { ShowSevereError(m_state, "An AirflowNetwork:Multizone:Surface object has an air-flow opening corresponding to"); - ShowContinueError(m_state, "window or door = " + MultizoneSurfaceData(count).SurfName + ", which is within"); + ShowContinueError(m_state, "window or door = " + MultizoneSurfaceData(count).surface_name + ", which is within"); ShowContinueError(m_state, "10 deg of being horizontal. Airflows through horizontal openings are not allowed."); ShowContinueError(m_state, "AirflowNetwork:Multizone:Component:SimpleOpening = " + AirflowNetworkCompData(compnum).Name); ErrorsFound = true; @@ -4623,8 +4490,7 @@ namespace AirflowNetwork { ErrorsFound = true; } } break; - case ComponentType::HOP: { - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::HOP) { + case AirflowElementType::HOP: { MultizoneSurfaceData(count).Multiplier = surf.Multiplier; // Get linkage height from upper and lower zones if (MultizoneZoneData(AirflowNetworkLinkageData(count).NodeNums[0]).ZoneNum > 0) { @@ -4656,7 +4522,7 @@ namespace AirflowNetwork { } if (!(surf.Tilt > 170.0 && surf.Tilt < 190.0) && !(surf.Tilt > -10.0 && surf.Tilt < 10.0)) { ShowWarningError(m_state, "An AirflowNetwork:Multizone:Surface object has an air-flow opening corresponding to"); - ShowContinueError(m_state, "window or door = " + MultizoneSurfaceData(count).SurfName + ", which is above"); + ShowContinueError(m_state, "window or door = " + MultizoneSurfaceData(count).surface_name + ", which is above"); ShowContinueError(m_state, "10 deg of being horizontal. Airflows through non-horizontal openings are not modeled"); ShowContinueError(m_state, "with the object of AirflowNetwork:Multizone:Component:HorizontalOpening = " + @@ -4693,6 +4559,7 @@ namespace AirflowNetwork { AirflowNetworkLinkageData(count).LinkNum = count; AirflowNetworkLinkageData(count).NodeHeights[0] = IntraZoneLinkageData(count - AirflowNetworkNumOfSurfaces).NodeHeights[0]; AirflowNetworkLinkageData(count).NodeHeights[1] = IntraZoneLinkageData(count - AirflowNetworkNumOfSurfaces).NodeHeights[1]; + AirflowNetworkLinkageData(count).control_schedule = Sched::GetScheduleAlwaysOn(m_state); // Find component number auto afe = elements.find(AirflowNetworkLinkageData(count).CompName); if (afe != elements.end()) { @@ -4702,8 +4569,8 @@ namespace AirflowNetwork { assert(compnum_iter != compnum.end()); int compnum = compnum_iter->second; AirflowNetworkLinkageData(count).CompNum = compnum; - if (AirflowNetworkLinkageData(count).element->type() != ComponentType::SCR && - AirflowNetworkLinkageData(count).element->type() != ComponentType::SEL) { + if (AirflowNetworkLinkageData(count).element->type() != AirflowElementType::SCR && + AirflowNetworkLinkageData(count).element->type() != AirflowElementType::SEL) { ShowSevereError(m_state, format(RoutineName) + AirflowNetworkLinkageData(count).CompName + ": The component is not allowed in " + @@ -4794,6 +4661,7 @@ namespace AirflowNetwork { AirflowNetworkLinkageData(count).CompName = Alphas(4); AirflowNetworkLinkageData(count).ZoneName = Alphas(5); AirflowNetworkLinkageData(count).LinkNum = count; + AirflowNetworkLinkageData(count).control_schedule = Sched::GetScheduleAlwaysOn(m_state); for (int i = 1; i <= DisSysNumOfDuctViewFactors; ++i) { if (AirflowNetworkLinkageData(count).Name == AirflowNetworkLinkageViewFactorData(i).LinkageName) { @@ -4872,66 +4740,6 @@ namespace AirflowNetwork { } } - // Ensure no duplicated names in AirflowNetwork component objects - // for (i = 1; i <= AirflowNetworkNumOfComps; ++i) { - // for (j = i + 1; j <= AirflowNetworkNumOfComps; ++j) { - // if (Util::SameString(AirflowNetworkCompData(i).Name, - // AirflowNetworkCompData(j).Name)) { - // // SurfaceAirflowLeakageNames - // if (i <= 4 && j <= 4) { - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::DOP) - // CompName(1) = "AirflowNetwork:MultiZone:Component:DetailedOpening"; - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::SOP) - // CompName(1) = "AirflowNetwork:MultiZone:Component:SimpleOpening"; - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::SCR) CompName(1) = - // "AirflowNetwork:MultiZone:Surface:Crack"; if (AirflowNetworkCompData(i).CompTypeNum == - // iComponentTypeNum::SEL) CompName(1) = "AirflowNetwork:MultiZone:Surface:EffectiveLeakageArea"; if - // (AirflowNetworkCompData(j).CompTypeNum == iComponentTypeNum::DOP) CompName(2) = - // "AirflowNetwork:MultiZone:Component:DetailedOpening"; if (AirflowNetworkCompData(j).CompTypeNum == - // iComponentTypeNum::SOP) CompName(2) = "AirflowNetwork:MultiZone:Component:SimpleOpening"; if - // (AirflowNetworkCompData(j).CompTypeNum == iComponentTypeNum::SCR) CompName(2) = - // "AirflowNetwork:MultiZone:Surface:Crack"; if (AirflowNetworkCompData(j).CompTypeNum == - // iComponentTypeNum::SEL) CompName(2) = "AirflowNetwork:MultiZone:Surface:EffectiveLeakageArea"; ShowSevereError(m_state, RoutineName - // + "Duplicated component names are found = " + AirflowNetworkCompData(i).Name); ShowContinueError(m_state, - // "A unique component name is required in both objects " + CompName(1) + " and " + CompName(2)); ErrorsFound = true; - // } - // // Distribution component - // if (i > 4 && j > 4) { - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::PLR) CompName(1) = - // "AirflowNetwork:Distribution:Component:Leak"; if (AirflowNetworkCompData(i).CompTypeNum == - // iComponentTypeNum::DWC) CompName(1) = "AirflowNetwork:Distribution:Component:Duct"; if - // (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::ELR) CompName(1) = - // "AirflowNetwork:Distribution:Component:LeakageRatio"; if (AirflowNetworkCompData(i).CompTypeNum == - // iComponentTypeNum::DMP) CompName(1) = "AIRFLOWNETWORK:DISTRIBUTION:COMPONENT DAMPER"; if - // (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::CVF) CompName(1) = - // "AirflowNetwork:Distribution:Component:Fan"; if (AirflowNetworkCompData(i).CompTypeNum == - // iComponentTypeNum::CPD) CompName(1) = "AirflowNetwork:Distribution:Component:ConstantPressureDrop"; if - // (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::COI) CompName(1) = - // "AirflowNetwork:Distribution:Component:Coil"; if (AirflowNetworkCompData(i).CompTypeNum == - // iComponentTypeNum::TMU) CompName(1) = "AirflowNetwork:Distribution:Component:TerminalUnit"; if - // (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::HEX) CompName(1) = - // "AirflowNetwork:Distribution:Component:HeatExchanger"; if (AirflowNetworkCompData(j).CompTypeNum == - // iComponentTypeNum::PLR) CompName(2) = "AirflowNetwork:Distribution:Component:Leak"; if - // (AirflowNetworkCompData(j).CompTypeNum == iComponentTypeNum::DWC) CompName(2) = - // "AirflowNetwork:Distribution:Component:Duct"; if (AirflowNetworkCompData(j).CompTypeNum == - // iComponentTypeNum::ELR) CompName(2) = "AirflowNetwork:Distribution:Component:LeakageRatio"; if - // (AirflowNetworkCompData(j).CompTypeNum == iComponentTypeNum::DMP) CompName(2) = - // "AIRFLOWNETWORK:DISTRIBUTION:COMPONENT DAMPER"; if (AirflowNetworkCompData(j).CompTypeNum == - // iComponentTypeNum::CVF) CompName(2) = "AirflowNetwork:Distribution:Component:Fan"; if - // (AirflowNetworkCompData(j).CompTypeNum == iComponentTypeNum::CPD) CompName(2) = - // "AirflowNetwork:Distribution:Component:ConstantPressureDrop"; if (AirflowNetworkCompData(j).CompTypeNum - // == iComponentTypeNum::COI) CompName(2) = "AirflowNetwork:Distribution:Component:Coil"; if - // (AirflowNetworkCompData(j).CompTypeNum == iComponentTypeNum::TMU) CompName(2) = - // "AirflowNetwork:Distribution:Component:TerminalUnit"; if (AirflowNetworkCompData(j).CompTypeNum == - // iComponentTypeNum::HEX) CompName(2) = "AirflowNetwork:Distribution:Component:HeatExchanger"; ShowSevereError(m_state, - // format(RoutineName) + "Duplicated component names are found = " + AirflowNetworkCompData(i).Name); - // ShowContinueError(m_state, "A unique component name is required in both objects " + CompName(1) + " and " + CompName(2)); - // ErrorsFound = true; - // } - // } - // } - // } - // Node and component validation for (count = 1; count <= AirflowNetworkNumOfLinks; ++count) { NodeFound = false; @@ -5042,7 +4850,7 @@ namespace AirflowNetwork { ErrorsFound = true; } - if (simulation_control.iWPCCnt == iWPCCntr::Input) { + if (simulation_control.iWPCCnt == WindPressureType::Input) { for (count = 1; count <= AirflowNetworkNumOfSurfaces; ++count) { if (AirflowNetworkLinkageData(count).NodeNums[0] == 0) { ShowSevereError(m_state, @@ -5057,30 +4865,6 @@ namespace AirflowNetwork { } } - // Provide a warning when a door component is assigned as envelope leakage - // if (!ErrorsFound) { - // for (count = 1; count <= AirflowNetworkNumOfSurfaces; ++count) { - // if - // (AirflowNetworkNodeData(AirflowNetworkLinkageData(count).NodeNums[0]).ExtNodeNum - // > 0 && - // AirflowNetworkNodeData(AirflowNetworkLinkageData(count).NodeNums[1]).EPlusZoneNum - // > 0 && AirflowNetworkLinkageData(count).CompNum > 0) { if - // (AirflowNetworkCompData(AirflowNetworkLinkageData(count).CompNum).CompTypeNum - // == iComponentTypeNum::SOP) { - // } - // } - // if - // (AirflowNetworkNodeData(AirflowNetworkLinkageData(count).NodeNums[1]).ExtNodeNum - // > 0 && - // AirflowNetworkNodeData(AirflowNetworkLinkageData(count).NodeNums[0]).EPlusZoneNum - // > 0 && AirflowNetworkLinkageData(count).CompNum > 0) { if - // (AirflowNetworkCompData(AirflowNetworkLinkageData(count).CompNum).CompTypeNum - // == iComponentTypeNum::SOP) { - // } - // } - // } - // } - // Ensure the name of each heat exchanger is shown either once or twice in the field of if (distribution_simulated) { for (int i = 1; i <= DisSysNumOfHXs; ++i) { @@ -5117,11 +4901,11 @@ namespace AirflowNetwork { // Check node assignments using AirflowNetwork:Distribution:Component:OutdoorAirFlow or // AirflowNetwork:Distribution:Component:ReliefAirFlow for (count = AirflowNetworkNumOfSurfaces + 1; count <= AirflowNetworkNumOfLinks; ++count) { - int i = AirflowNetworkLinkageData(count).CompNum; + //int i = AirflowNetworkLinkageData(count).CompNum; j = AirflowNetworkLinkageData(count).NodeNums[0]; k = AirflowNetworkLinkageData(count).NodeNums[1]; - if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::OAF) { + if (AirflowNetworkLinkageData(count).element->type() == AirflowElementType::OAF) { if (!Util::SameString(DisSysNodeData(j - NumOfNodesMultiZone).EPlusType, "OAMixerOutdoorAirStreamNode")) { ShowSevereError(m_state, format(RoutineName) + @@ -5145,7 +4929,7 @@ namespace AirflowNetwork { } } - if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::REL) { + if (AirflowNetworkLinkageData(count).element->type() == AirflowElementType::REL) { if (!Util::SameString(DisSysNodeData(j - NumOfNodesMultiZone).EPlusType, "AirLoopHVAC:OutdoorAirSystem")) { ShowSevereError(m_state, format(RoutineName) + @@ -5170,6 +4954,20 @@ namespace AirflowNetwork { } } + // Final linkage validation + for (auto& linkage : AirflowNetworkLinkageData) + { + if (linkage.control_schedule == nullptr){ + // Nope + ErrorsFound = true; + } + + if (linkage.element == nullptr) { + // NOPE + ErrorsFound = true; + } + } + if (ErrorsFound) { ShowFatalError(m_state, format("{}Errors found getting inputs. Previous error(s) cause program termination.", RoutineName)); } @@ -5337,7 +5135,7 @@ namespace AirflowNetwork { } if (AirflowNetworkNumOfOccuVentCtrls > 0) { for (i = 1; i <= AirflowNetworkNumOfSurfaces; ++i) { - if (MultizoneSurfaceData(i).OccupantVentilationControlNum > 0) { + if (MultizoneSurfaceData(i).occupant_control_number > 0) { MultizoneSurfaceData(i).PrevOpeningstatus = AirflowNetwork::OpenStatus::FreeOperation; MultizoneSurfaceData(i).CloseElapsedTime = 0.0; MultizoneSurfaceData(i).OpenElapsedTime = 0.0; @@ -5432,7 +5230,7 @@ namespace AirflowNetwork { if (CurrentEndTime > CurrentEndTimeLast && TimeStepSys >= TimeStepSysLast) { for (i = 1; i <= AirflowNetworkNumOfSurfaces; ++i) { if (i > AirflowNetworkNumOfSurfaces - NumOfLinksIntraZone) continue; - if (MultizoneSurfaceData(i).OccupantVentilationControlNum > 0) { + if (MultizoneSurfaceData(i).occupant_control_number > 0) { MultizoneSurfaceData(i).PrevOpeningstatus = MultizoneSurfaceData(i).OpeningStatus; MultizoneSurfaceData(i).OpenFactorLast = MultizoneSurfaceData(i).OpenFactor; if (MultizoneSurfaceData(i).OpenFactor > 0.0) { @@ -5442,8 +5240,8 @@ namespace AirflowNetwork { MultizoneSurfaceData(i).OpenElapsedTime = 0.0; MultizoneSurfaceData(i).CloseElapsedTime += (CurrentEndTime - CurrentEndTimeLast) * 60.0; } - int j = MultizoneSurfaceData(i).SurfNum; - OccupantVentilationControl(MultizoneSurfaceData(i).OccupantVentilationControlNum) + int j = MultizoneSurfaceData(i).surface_number; + OccupantVentilationControl(MultizoneSurfaceData(i).occupant_control_number) .calc(m_state, m_state.dataSurface->Surface(j).Zone, MultizoneSurfaceData(i).OpenElapsedTime, @@ -5614,21 +5412,21 @@ namespace AirflowNetwork { // This is not great continue; } - if (AirflowNetworkLinkageData(i).element->type() == ComponentType::DOP || - AirflowNetworkLinkageData(i).element->type() == ComponentType::SOP || - AirflowNetworkLinkageData(i).element->type() == ComponentType::HOP) { - SurfNum = MultizoneSurfaceData(i).SurfNum; + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::DOP || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SOP || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::HOP) { + SurfNum = MultizoneSurfaceData(i).surface_number; SetupOutputVariable(m_state, "AFN Surface Venting Window or Door Opening Factor", Constant::Units::None, MultizoneSurfaceData(i).OpenFactor, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); if (m_state.dataGlobal->AnyEnergyManagementSystemInModel) { SetupEMSActuator(m_state, "AirFlow Network Window/Door Opening", - MultizoneSurfaceData(i).SurfName, + MultizoneSurfaceData(i).surface_name, "Venting Opening Factor", "[Fraction]", MultizoneSurfaceData(i).EMSOpenFactorActuated, @@ -5655,56 +5453,56 @@ namespace AirflowNetwork { OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, m_state.dataSurface->Surface(SurfNum).Name); - if (MultizoneSurfaceData(i).OccupantVentilationControlNum > 0) { + if (MultizoneSurfaceData(i).occupant_control_number > 0) { SetupOutputVariable(m_state, "AFN Surface Venting Window or Door Opening Factor at Previous Time Step", Constant::Units::None, MultizoneSurfaceData(i).OpenFactorLast, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Surface Opening Elapsed Time", Constant::Units::min, MultizoneSurfaceData(i).OpenElapsedTime, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Surface Closing Elapsed Time", Constant::Units::min, MultizoneSurfaceData(i).CloseElapsedTime, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Surface Opening Status at Previous Time Step", Constant::Units::None, MultizoneSurfaceData(i).PrevOpeningstatus, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Surface Opening Status", Constant::Units::None, MultizoneSurfaceData(i).OpeningStatus, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Surface Opening Probability Status", Constant::Units::None, MultizoneSurfaceData(i).OpeningProbStatus, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Surface Closing Probability Status", Constant::Units::None, MultizoneSurfaceData(i).ClosingProbStatus, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); } } } @@ -6193,49 +5991,49 @@ namespace AirflowNetwork { linkReport1(i).FLOW, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Linkage Node 2 to 1 Average Mass Flow Rate", Constant::Units::kg_s, linkReport1(i).FLOW2, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Linkage Node 1 to 2 Average Volume Flow Rate", Constant::Units::m3_s, linkReport1(i).VolFLOW, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Linkage Node 2 to 1 Average Volume Flow Rate", Constant::Units::m3_s, linkReport1(i).VolFLOW2, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Surface Average Pressure Difference", Constant::Units::Pa, linkReport1(i).DP, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Surface On Cycle Pressure Difference", Constant::Units::Pa, linkReport1(i).DPON, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); SetupOutputVariable(m_state, "AFN Surface Off Cycle Pressure Difference", Constant::Units::Pa, linkReport1(i).DPOFF, OutputProcessor::TimeStepType::System, OutputProcessor::StoreType::Average, - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); } } @@ -6359,18 +6157,18 @@ namespace AirflowNetwork { if (i > AirflowNetworkNumOfSurfaces - NumOfLinksIntraZone) { continue; } - if (AirflowNetworkLinkageData(i).element->type() == ComponentType::SCR) { - AirflowNetworkLinkageData(i).control = MultizoneSurfaceData(i).Factor; + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SCR) { + AirflowNetworkLinkageData(i).control_value = MultizoneSurfaceData(i).factor; } - if (MultizoneSurfaceData(i).OccupantVentilationControlNum == 0) MultizoneSurfaceData(i).OpenFactor = 0.0; - j = MultizoneSurfaceData(i).SurfNum; + if (MultizoneSurfaceData(i).occupant_control_number == 0) MultizoneSurfaceData(i).OpenFactor = 0.0; + j = MultizoneSurfaceData(i).surface_number; auto const &surf = m_state.dataSurface->Surface(j); if (surf.OriginalClass == SurfaceClass::Window || surf.OriginalClass == SurfaceClass::Door || surf.OriginalClass == SurfaceClass::GlassDoor || surf.IsAirBoundarySurf) { - if (MultizoneSurfaceData(i).OccupantVentilationControlNum > 0) { + if (MultizoneSurfaceData(i).occupant_control_number > 0) { if (MultizoneSurfaceData(i).OpeningStatus == OpenStatus::FreeOperation) { if (MultizoneSurfaceData(i).OpeningProbStatus == ProbabilityCheck::ForceChange) { - MultizoneSurfaceData(i).OpenFactor = MultizoneSurfaceData(i).Factor; + MultizoneSurfaceData(i).OpenFactor = MultizoneSurfaceData(i).factor; } else if (MultizoneSurfaceData(i).ClosingProbStatus == ProbabilityCheck::ForceChange) { MultizoneSurfaceData(i).OpenFactor = 0.0; } else if (MultizoneSurfaceData(i).ClosingProbStatus == ProbabilityCheck::KeepStatus || @@ -6388,25 +6186,25 @@ namespace AirflowNetwork { MultizoneSurfaceData(i).OpenFactor = 0.0; if (m_state.dataSurface->SurfWinVentingOpenFactorMultRep(j) > 0.0) m_state.dataSurface->SurfWinVentingOpenFactorMultRep(j) = 0.0; } - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::DOP || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SOP || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::HOP) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::DOP || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SOP || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::HOP) { if (AirflowNetworkFanActivated && distribution_simulated && MultizoneSurfaceData(i).OpenFactor > 0.0 && (m_state.dataSurface->Surface(j).ExtBoundCond == ExternalEnvironment || - (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt && - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtWind)) && + (m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond == OtherSideCoefNoCalcExt && + m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtWind)) && !m_state.dataGlobal->WarmupFlag) { // Exterior Large opening only ++MultizoneSurfaceData(i).ExtLargeOpeningErrCount; if (MultizoneSurfaceData(i).ExtLargeOpeningErrCount < 2) { ShowWarningError(m_state, "AirflowNetwork: The window or door is open during HVAC system operation " + - MultizoneSurfaceData(i).SurfName); + MultizoneSurfaceData(i).surface_name); ShowContinueError(m_state, format("The window or door opening factor is {:.2R}", MultizoneSurfaceData(i).OpenFactor)); ShowContinueErrorTimeStamp(m_state, ""); } else { ShowRecurringWarningErrorAtEnd(m_state, - "AirFlowNetwork: " + MultizoneSurfaceData(i).SurfName + + "AirFlowNetwork: " + MultizoneSurfaceData(i).surface_name + " The window or door is open during HVAC system operation error continues...", MultizoneSurfaceData(i).ExtLargeOpeningErrIndex, MultizoneSurfaceData(i).OpenFactor, @@ -6418,11 +6216,11 @@ namespace AirflowNetwork { ++MultizoneSurfaceData(i).OpenFactorErrCount; if (MultizoneSurfaceData(i).OpenFactorErrCount < 2) { ShowWarningError(m_state, - "AirflowNetwork: The window or door opening factor is greater than 1.0 " + MultizoneSurfaceData(i).SurfName); + "AirflowNetwork: The window or door opening factor is greater than 1.0 " + MultizoneSurfaceData(i).surface_name); ShowContinueErrorTimeStamp(m_state, ""); } else { ShowRecurringWarningErrorAtEnd(m_state, - "AirFlowNetwork: " + MultizoneSurfaceData(i).SurfName + + "AirFlowNetwork: " + MultizoneSurfaceData(i).surface_name + " The window or door opening factor is greater than 1.0 error continues...", MultizoneSurfaceData(i).OpenFactorErrIndex, MultizoneSurfaceData(i).OpenFactor, @@ -6444,7 +6242,7 @@ namespace AirflowNetwork { if (GlobalOpenFactor >= 0.0) { for (i = 1; i <= AirflowNetworkNumOfSurfaces; ++i) { if (i > AirflowNetworkNumOfSurfaces - NumOfLinksIntraZone) continue; - j = MultizoneSurfaceData(i).SurfNum; + j = MultizoneSurfaceData(i).surface_number; auto const &surf = m_state.dataSurface->Surface(j); if (surf.OriginalClass == SurfaceClass::Window || surf.OriginalClass == SurfaceClass::Door || surf.OriginalClass == SurfaceClass::GlassDoor) { @@ -6823,7 +6621,7 @@ namespace AirflowNetwork { if (SurfDatNum > AirflowNetworkNumOfSurfaces - NumOfLinksIntraZone) { continue; } - SurfNum = MultizoneSurfaceData(SurfDatNum).SurfNum; + SurfNum = MultizoneSurfaceData(SurfDatNum).surface_number; if (SurfNum == 0) { continue; // Error caught earlier } @@ -6852,7 +6650,7 @@ namespace AirflowNetwork { MultizoneExternalNodeData(ExtNum).facadeNum = 5; } MultizoneSurfaceData(SurfDatNum).NodeNums[1] = MultizoneExternalNodeData(ExtNum).ExtNum; - MultizoneSurfaceData(SurfDatNum).ExternalNodeName = MultizoneExternalNodeData(ExtNum).Name; + MultizoneSurfaceData(SurfDatNum).external_node_name = MultizoneExternalNodeData(ExtNum).Name; } } @@ -7244,13 +7042,12 @@ namespace AirflowNetwork { auto &TimeStepSys = m_state.dataHVACGlobal->TimeStepSys; // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int i; int LF; int LT; int CompNum; int NF; int NT; - iComponentTypeNum CompTypeNum; + AirflowElementType CompTypeNum; int ExtNodeNum; Real64 Ei; Real64 DirSign; @@ -7267,15 +7064,15 @@ namespace AirflowNetwork { MA = 0.0; MV = 0.0; - for (i = 1; i <= AirflowNetworkNumOfLinks; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { CompNum = AirflowNetworkLinkageData(i).CompNum; - CompTypeNum = AirflowNetworkCompData(CompNum).CompTypeNum; + CompTypeNum = AirflowNetworkLinkageData(i).element->type(); std::string CompName = AirflowNetworkCompData(CompNum).EPlusName; CpAir = PsyCpAirFnW((AirflowNetworkNodeSimu(AirflowNetworkLinkageData(i).NodeNums[0]).WZ + AirflowNetworkNodeSimu(AirflowNetworkLinkageData(i).NodeNums[1]).WZ) / 2.0); // Calculate duct conduction loss - if (CompTypeNum == iComponentTypeNum::DWC && CompName == std::string()) { // Duct element only + if (CompTypeNum == AirflowElementType::DWC && CompName == std::string()) { // Duct element only int TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -7486,7 +7283,7 @@ namespace AirflowNetwork { MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * Tsurr * (1.0 - Ei) * CpAir; } } - if (CompTypeNum == iComponentTypeNum::TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT + if (CompTypeNum == AirflowElementType::TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT int TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -7512,7 +7309,7 @@ namespace AirflowNetwork { MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * Tamb * (1.0 - Ei) * CpAir; } } - if (CompTypeNum == iComponentTypeNum::COI) { // heating or cooling coil + if (CompTypeNum == AirflowElementType::COI) { // heating or cooling coil // TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -7525,7 +7322,7 @@ namespace AirflowNetwork { } } // Calculate temp in a constant pressure drop element - if (CompTypeNum == iComponentTypeNum::CPD && CompName == std::string()) { // constant pressure element only + if (CompTypeNum == AirflowElementType::CPD && CompName == std::string()) { // constant pressure element only if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; @@ -7543,7 +7340,7 @@ namespace AirflowNetwork { MV(LT) = 0.0; } // Calculate return leak - if ((CompTypeNum == iComponentTypeNum::PLR || CompTypeNum == iComponentTypeNum::ELR) && CompName == std::string()) { + if ((CompTypeNum == AirflowElementType::PLR || CompTypeNum == AirflowElementType::ELR) && CompName == std::string()) { // Return leak element only if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum > 0) && (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { @@ -7575,7 +7372,7 @@ namespace AirflowNetwork { } } // Check reheat unit or coil - if (AirflowNetworkCompData(CompNum).EPlusTypeNum == iEPlusComponentType::RHT && (!AirflowNetworkLinkageData(i).VAVTermDamper)) { + if (AirflowNetworkCompData(CompNum).EPlusTypeNum == EPlusComponentType::RHT && (!AirflowNetworkLinkageData(i).VAVTermDamper)) { NF = 0; NT = 0; if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusNodeNum > 0) { @@ -7604,45 +7401,45 @@ namespace AirflowNetwork { } // Prescribe temperature for EPlus nodes - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { bool found = false; bool OANode = false; for (int j = 1; j <= AirflowNetworkNumOfLinks; ++j) { if (AirflowNetworkLinkageData(j).NodeNums[0] == i || AirflowNetworkLinkageData(j).NodeNums[1] == i) { CompNum = AirflowNetworkLinkageData(j).CompNum; - if (AirflowNetworkCompData(CompNum).EPlusTypeNum == iEPlusComponentType::RHT && (!AirflowNetworkLinkageData(j).VAVTermDamper)) { + if (AirflowNetworkCompData(CompNum).EPlusTypeNum == EPlusComponentType::RHT && (!AirflowNetworkLinkageData(j).VAVTermDamper)) { found = true; break; } // Overwrite fan outlet node - if (AirflowNetworkCompData(CompNum).EPlusTypeNum == iEPlusComponentType::FAN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { + if (AirflowNetworkCompData(CompNum).EPlusTypeNum == EPlusComponentType::FAN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { found = false; break; } // Overwrite return connection outlet - if (AirflowNetworkLinkageData(j).ConnectionFlag == iEPlusComponentType::RCN) { // Modified on 9/2/09 + if (AirflowNetworkLinkageData(j).ConnectionFlag == EPlusComponentType::RCN) { // Modified on 9/2/09 found = true; break; } - if (AirflowNetworkLinkageData(j).ConnectionFlag == iEPlusComponentType::SCN && + if (AirflowNetworkLinkageData(j).ConnectionFlag == EPlusComponentType::SCN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { // Modified on 9/2/09 found = true; break; } } if (AirflowNetworkLinkageData(j).NodeNums[1] == i && - AirflowNetworkNodeData(AirflowNetworkLinkageData(j).NodeNums[0]).EPlusTypeNum == iEPlusNodeType::OAN) { + AirflowNetworkNodeData(AirflowNetworkLinkageData(j).NodeNums[0]).EPlusTypeNum == EPlusNodeType::OAN) { OANode = true; break; } } if (found) continue; - if (AirflowNetworkNodeData(i).EPlusZoneNum == 0 && AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::ZIN) continue; + if (AirflowNetworkNodeData(i).EPlusZoneNum == 0 && AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::ZIN) continue; int j = AirflowNetworkNodeData(i).EPlusNodeNum; if (j > 0 && - (AirflowNetworkNodeData(i).EPlusZoneNum > 0 || AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::FOU || - AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::COU || AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::HXO)) { + (AirflowNetworkNodeData(i).EPlusZoneNum > 0 || AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::FOU || + AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::COU || AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::HXO)) { MA((i - 1) * AirflowNetworkNumOfNodes + i) = 1.0e10; MV(i) = Node(j).Temp * 1.0e10; } @@ -7673,7 +7470,7 @@ namespace AirflowNetwork { } // Assign node value to distribution nodes with fan off - for (i = 1 + NumOfNodesMultiZone; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1 + NumOfNodesMultiZone; i <= AirflowNetworkNumOfNodes; ++i) { int j = AirflowNetworkNodeData(i).EPlusNodeNum; if (j > 0 && !LoopOnOffFlag(AirflowNetworkNodeData(i).AirLoopNum) && MA((i - 1) * AirflowNetworkNumOfNodes + i) < 1.0e9) { MA((i - 1) * AirflowNetworkNumOfNodes + i) = 1.0e10; @@ -7686,7 +7483,7 @@ namespace AirflowNetwork { } // Check singularity - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { if (MA((i - 1) * AirflowNetworkNumOfNodes + i) < 1.0e-6) { if (i > NumOfNodesMultiZone && !LoopOnOffFlag(AirflowNetworkNodeData(i).AirLoopNum)) { MA((i - 1) * AirflowNetworkNumOfNodes + i) = 1.0e10; @@ -7703,7 +7500,7 @@ namespace AirflowNetwork { mrxinv(AirflowNetworkNumOfNodes); // Calculate node temperatures - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { TZON = 0.0; for (int j = 1; j <= AirflowNetworkNumOfNodes; ++j) { TZON += MA((i - 1) * AirflowNetworkNumOfNodes + j) * MV(j); @@ -7724,14 +7521,12 @@ namespace AirflowNetwork { // This subroutine performs AirflowNetwork moisture simulations. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int i; - int j; int LF; int LT; int CompNum; int NF; int NT; - iComponentTypeNum CompTypeNum; + AirflowElementType CompTypeNum; int TypeNum; Real64 Ei; Real64 DirSign; @@ -7744,12 +7539,12 @@ namespace AirflowNetwork { MA = 0.0; MV = 0.0; - for (i = 1; i <= AirflowNetworkNumOfLinks; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { CompNum = AirflowNetworkLinkageData(i).CompNum; - CompTypeNum = AirflowNetworkCompData(CompNum).CompTypeNum; + CompTypeNum = AirflowNetworkLinkageData(i).element->type(); std::string CompName = AirflowNetworkCompData(CompNum).EPlusName; // Calculate duct moisture diffusion loss - if (CompTypeNum == iComponentTypeNum::DWC && CompName == std::string()) { // Duct component only + if (CompTypeNum == AirflowElementType::DWC && CompName == std::string()) { // Duct component only TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -7783,7 +7578,7 @@ namespace AirflowNetwork { MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * Wamb * (1.0 - Ei); } } - if (CompTypeNum == iComponentTypeNum::TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT + if (CompTypeNum == AirflowElementType::TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -7811,7 +7606,7 @@ namespace AirflowNetwork { MV(LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW) * Wamb * (1.0 - Ei); } } - if (CompTypeNum == iComponentTypeNum::COI) { // heating or cooling coil + if (CompTypeNum == AirflowElementType::COI) { // heating or cooling coil TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -7824,7 +7619,7 @@ namespace AirflowNetwork { } } // Calculate temp in a constant pressure drop component - if (CompTypeNum == iComponentTypeNum::CPD && CompName == std::string()) { // constant pressure element only + if (CompTypeNum == AirflowElementType::CPD && CompName == std::string()) { // constant pressure element only if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; @@ -7842,7 +7637,7 @@ namespace AirflowNetwork { MV(LT) = 0.0; } // Calculate return leak - if ((CompTypeNum == iComponentTypeNum::PLR || CompTypeNum == iComponentTypeNum::ELR) && CompName == std::string()) { + if ((CompTypeNum == AirflowElementType::PLR || CompTypeNum == AirflowElementType::ELR) && CompName == std::string()) { // Return leak component only if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum > 0) && (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { @@ -7874,7 +7669,7 @@ namespace AirflowNetwork { } } // Check reheat unit - if (AirflowNetworkCompData(CompNum).EPlusTypeNum == iEPlusComponentType::RHT && (!AirflowNetworkLinkageData(i).VAVTermDamper)) { + if (AirflowNetworkCompData(CompNum).EPlusTypeNum == EPlusComponentType::RHT && (!AirflowNetworkLinkageData(i).VAVTermDamper)) { NF = 0; NT = 0; if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusNodeNum > 0) { @@ -7902,44 +7697,44 @@ namespace AirflowNetwork { } // Prescribe temperature for EPlus nodes - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { bool found = false; bool OANode = false; - for (j = 1; j <= AirflowNetworkNumOfLinks; ++j) { + for (int j = 1; j <= AirflowNetworkNumOfLinks; ++j) { if (AirflowNetworkLinkageData(j).NodeNums[0] == i || AirflowNetworkLinkageData(j).NodeNums[1] == i) { CompNum = AirflowNetworkLinkageData(j).CompNum; - if (AirflowNetworkCompData(CompNum).EPlusTypeNum == iEPlusComponentType::RHT && (!AirflowNetworkLinkageData(j).VAVTermDamper)) { + if (AirflowNetworkCompData(CompNum).EPlusTypeNum == EPlusComponentType::RHT && (!AirflowNetworkLinkageData(j).VAVTermDamper)) { found = true; break; } // Overwrite fan outlet node - if (AirflowNetworkCompData(CompNum).EPlusTypeNum == iEPlusComponentType::FAN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { + if (AirflowNetworkCompData(CompNum).EPlusTypeNum == EPlusComponentType::FAN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { found = false; break; } // Overwrite return connection outlet - if (AirflowNetworkLinkageData(j).ConnectionFlag == iEPlusComponentType::RCN) { // Modified on 9/2/09 + if (AirflowNetworkLinkageData(j).ConnectionFlag == EPlusComponentType::RCN) { // Modified on 9/2/09 found = true; break; } - if (AirflowNetworkLinkageData(j).ConnectionFlag == iEPlusComponentType::SCN && + if (AirflowNetworkLinkageData(j).ConnectionFlag == EPlusComponentType::SCN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { // Modified on 9/2/09 found = true; break; } } if (AirflowNetworkLinkageData(j).NodeNums[1] == i && - AirflowNetworkNodeData(AirflowNetworkLinkageData(j).NodeNums[0]).EPlusTypeNum == iEPlusNodeType::OAN) { + AirflowNetworkNodeData(AirflowNetworkLinkageData(j).NodeNums[0]).EPlusTypeNum == EPlusNodeType::OAN) { OANode = true; break; } } if (found) continue; - if (AirflowNetworkNodeData(i).EPlusZoneNum == 0 && AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::ZIN) continue; - j = AirflowNetworkNodeData(i).EPlusNodeNum; + if (AirflowNetworkNodeData(i).EPlusZoneNum == 0 && AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::ZIN) continue; + int j = AirflowNetworkNodeData(i).EPlusNodeNum; if (j > 0 && - (AirflowNetworkNodeData(i).EPlusZoneNum > 0 || AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::FOU || - AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::COU || AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::HXO)) { + (AirflowNetworkNodeData(i).EPlusZoneNum > 0 || AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::FOU || + AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::COU || AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::HXO)) { MA((i - 1) * AirflowNetworkNumOfNodes + i) = 1.0e10; MV(i) = Node(j).HumRat * 1.0e10; } @@ -7966,8 +7761,8 @@ namespace AirflowNetwork { } // Assign node value to distribution nodes with fan off - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { - j = AirflowNetworkNodeData(i).EPlusNodeNum; + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + int j = AirflowNetworkNodeData(i).EPlusNodeNum; if (j > 0 && !LoopOnOffFlag(AirflowNetworkNodeData(i).AirLoopNum) && MA((i - 1) * AirflowNetworkNumOfNodes + i) < 1.0e9) { MA((i - 1) * AirflowNetworkNumOfNodes + i) = 1.0e10; MV(i) = Node(j).HumRat * 1.0e10; @@ -7979,7 +7774,7 @@ namespace AirflowNetwork { } // Check singularity - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { if (MA((i - 1) * AirflowNetworkNumOfNodes + i) < 1.0e-8) { ShowFatalError(m_state, "CalcAirflowNetworkMoisBalance: A diagonal entity is zero in AirflowNetwork matrix at node " + @@ -7991,9 +7786,9 @@ namespace AirflowNetwork { mrxinv(AirflowNetworkNumOfNodes); // Calculate node temperatures - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { WZON = 0.0; - for (j = 1; j <= AirflowNetworkNumOfNodes; ++j) { + for (int j = 1; j <= AirflowNetworkNumOfNodes; ++j) { WZON += MA((i - 1) * AirflowNetworkNumOfNodes + j) * MV(j); } AirflowNetworkNodeSimu(i).WZ = WZON; @@ -8012,24 +7807,22 @@ namespace AirflowNetwork { // This subroutine performs AirflowNetwork CO2 simulations. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int i; - int j; int LF; int LT; int CompNum; - iComponentTypeNum CompTypeNum; + AirflowElementType CompTypeNum; Real64 DirSign; Real64 COZN; int ZoneNum; MA = 0.0; MV = 0.0; - for (i = 1; i <= AirflowNetworkNumOfLinks; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { CompNum = AirflowNetworkLinkageData(i).CompNum; - CompTypeNum = AirflowNetworkCompData(CompNum).CompTypeNum; + CompTypeNum = AirflowNetworkLinkageData(i).element->type(); std::string CompName = AirflowNetworkCompData(CompNum).EPlusName; // Calculate duct moisture diffusion loss - if (CompTypeNum == iComponentTypeNum::DWC && CompName == std::string()) { // Duct component only + if (CompTypeNum == AirflowElementType::DWC && CompName == std::string()) { // Duct component only // TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -8043,7 +7836,7 @@ namespace AirflowNetwork { MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); } - if (CompTypeNum == iComponentTypeNum::TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT + if (CompTypeNum == AirflowElementType::TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT // TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -8057,7 +7850,7 @@ namespace AirflowNetwork { MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); } - if (CompTypeNum == iComponentTypeNum::COI) { // heating or cooling coil + if (CompTypeNum == AirflowElementType::COI) { // heating or cooling coil // TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -8070,7 +7863,7 @@ namespace AirflowNetwork { } } // Calculate temp in a constant pressure drop component - if (CompTypeNum == iComponentTypeNum::CPD && CompName == std::string()) { // constant pressure element only + if (CompTypeNum == AirflowElementType::CPD && CompName == std::string()) { // constant pressure element only if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; @@ -8083,7 +7876,7 @@ namespace AirflowNetwork { MV(LT) = 0.0; } // Calculate return leak - if ((CompTypeNum == iComponentTypeNum::PLR || CompTypeNum == iComponentTypeNum::ELR) && CompName == std::string()) { + if ((CompTypeNum == AirflowElementType::PLR || CompTypeNum == AirflowElementType::ELR) && CompName == std::string()) { // Return leak component only if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum > 0) && (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { @@ -8117,44 +7910,44 @@ namespace AirflowNetwork { } // Prescribe temperature for EPlus nodes - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { bool found = false; bool OANode = false; - for (j = 1; j <= AirflowNetworkNumOfLinks; ++j) { + for (int j = 1; j <= AirflowNetworkNumOfLinks; ++j) { if (AirflowNetworkLinkageData(j).NodeNums[0] == i || AirflowNetworkLinkageData(j).NodeNums[1] == i) { CompNum = AirflowNetworkLinkageData(j).CompNum; - if (AirflowNetworkCompData(CompNum).EPlusTypeNum == iEPlusComponentType::RHT && (!AirflowNetworkLinkageData(j).VAVTermDamper)) { + if (AirflowNetworkCompData(CompNum).EPlusTypeNum == EPlusComponentType::RHT && (!AirflowNetworkLinkageData(j).VAVTermDamper)) { found = true; break; } // Overwrite fan outlet node - if (AirflowNetworkCompData(CompNum).EPlusTypeNum == iEPlusComponentType::FAN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { + if (AirflowNetworkCompData(CompNum).EPlusTypeNum == EPlusComponentType::FAN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { found = false; break; } // Overwrite return connection outlet - if (AirflowNetworkLinkageData(j).ConnectionFlag == iEPlusComponentType::RCN) { // Modified on 9/2/09 + if (AirflowNetworkLinkageData(j).ConnectionFlag == EPlusComponentType::RCN) { // Modified on 9/2/09 found = true; break; } - if (AirflowNetworkLinkageData(j).ConnectionFlag == iEPlusComponentType::SCN && + if (AirflowNetworkLinkageData(j).ConnectionFlag == EPlusComponentType::SCN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { // Modified on 9/2/09 found = true; break; } } if (AirflowNetworkLinkageData(j).NodeNums[1] == i && - AirflowNetworkNodeData(AirflowNetworkLinkageData(j).NodeNums[0]).EPlusTypeNum == iEPlusNodeType::OAN) { + AirflowNetworkNodeData(AirflowNetworkLinkageData(j).NodeNums[0]).EPlusTypeNum == EPlusNodeType::OAN) { OANode = true; break; } } if (found) continue; - if (AirflowNetworkNodeData(i).EPlusZoneNum == 0 && AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::ZIN) continue; - j = AirflowNetworkNodeData(i).EPlusNodeNum; + if (AirflowNetworkNodeData(i).EPlusZoneNum == 0 && AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::ZIN) continue; + int j = AirflowNetworkNodeData(i).EPlusNodeNum; if (j > 0 && - (AirflowNetworkNodeData(i).EPlusZoneNum > 0 || AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::FOU || - AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::COU || AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::HXO)) { + (AirflowNetworkNodeData(i).EPlusZoneNum > 0 || AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::FOU || + AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::COU || AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::HXO)) { MA((i - 1) * AirflowNetworkNumOfNodes + i) = 1.0e10; MV(i) = m_state.dataLoopNodes->Node(j).CO2 * 1.0e10; } @@ -8174,8 +7967,8 @@ namespace AirflowNetwork { } // Assign node value to distribution nodes with fan off - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { - j = AirflowNetworkNodeData(i).EPlusNodeNum; + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + int j = AirflowNetworkNodeData(i).EPlusNodeNum; if (j > 0 && !LoopOnOffFlag(AirflowNetworkNodeData(i).AirLoopNum) && MA((i - 1) * AirflowNetworkNumOfNodes + i) < 1.0e9) { MA((i - 1) * AirflowNetworkNumOfNodes + i) = 1.0e10; MV(i) = m_state.dataLoopNodes->Node(j).CO2 * 1.0e10; @@ -8187,7 +7980,7 @@ namespace AirflowNetwork { } // Check singularity - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { if (MA((i - 1) * AirflowNetworkNumOfNodes + i) < 1.0e-6) { ShowFatalError(m_state, "CalcAirflowNetworkCO2Balance: A diagonal entity is zero in AirflowNetwork matrix at node " + @@ -8199,9 +7992,9 @@ namespace AirflowNetwork { mrxinv(AirflowNetworkNumOfNodes); // Calculate node temperatures - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { COZN = 0.0; - for (j = 1; j <= AirflowNetworkNumOfNodes; ++j) { + for (int j = 1; j <= AirflowNetworkNumOfNodes; ++j) { COZN += MA((i - 1) * AirflowNetworkNumOfNodes + j) * MV(j); } AirflowNetworkNodeSimu(i).CO2Z = COZN; @@ -8220,24 +8013,22 @@ namespace AirflowNetwork { // This subroutine performs AirflowNetwork generic contaminant simulations. // SUBROUTINE LOCAL VARIABLE DECLARATIONS: - int i; - int j; int LF; int LT; int CompNum; - iComponentTypeNum CompTypeNum; + AirflowElementType CompTypeNum; Real64 DirSign; Real64 COZN; int ZoneNum; MA = 0.0; MV = 0.0; - for (i = 1; i <= AirflowNetworkNumOfLinks; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { CompNum = AirflowNetworkLinkageData(i).CompNum; - CompTypeNum = AirflowNetworkCompData(CompNum).CompTypeNum; + CompTypeNum = AirflowNetworkLinkageData(i).element->type(); std::string_view CompName = AirflowNetworkCompData(CompNum).EPlusName; // Calculate duct moisture diffusion loss - if (CompTypeNum == iComponentTypeNum::DWC && CompName.empty()) { // Duct component only + if (CompTypeNum == AirflowElementType::DWC && CompName.empty()) { // Duct component only // TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -8251,7 +8042,7 @@ namespace AirflowNetwork { MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); } - if (CompTypeNum == iComponentTypeNum::TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT + if (CompTypeNum == AirflowElementType::TMU) { // Reheat unit: SINGLE DUCT:CONST VOLUME:REHEAT // TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -8265,7 +8056,7 @@ namespace AirflowNetwork { MA((LT - 1) * AirflowNetworkNumOfNodes + LT) += std::abs(AirflowNetworkLinkSimu(i).FLOW); MA((LT - 1) * AirflowNetworkNumOfNodes + LF) = -std::abs(AirflowNetworkLinkSimu(i).FLOW); } - if (CompTypeNum == iComponentTypeNum::COI) { // heating or cooling coil + if (CompTypeNum == AirflowElementType::COI) { // heating or cooling coil // TypeNum = AirflowNetworkCompData(CompNum).TypeNum; if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -8278,7 +8069,7 @@ namespace AirflowNetwork { } } // Calculate temp in a constant pressure drop component - if (CompTypeNum == iComponentTypeNum::CPD && CompName == std::string()) { // constant pressure element only + if (CompTypeNum == AirflowElementType::CPD && CompName == std::string()) { // constant pressure element only if (AirflowNetworkLinkSimu(i).FLOW > 0.0) { // flow direction is the same as input from node 1 to node 2 LF = AirflowNetworkLinkageData(i).NodeNums[0]; LT = AirflowNetworkLinkageData(i).NodeNums[1]; @@ -8291,7 +8082,7 @@ namespace AirflowNetwork { MV(LT) = 0.0; } // Calculate return leak - if ((CompTypeNum == iComponentTypeNum::PLR || CompTypeNum == iComponentTypeNum::ELR) && CompName == std::string()) { + if ((CompTypeNum == AirflowElementType::PLR || CompTypeNum == AirflowElementType::ELR) && CompName == std::string()) { // Return leak component only if ((AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusZoneNum > 0) && (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusZoneNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { @@ -8325,44 +8116,44 @@ namespace AirflowNetwork { } // Prescribe temperature for EPlus nodes - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { bool found = false; bool OANode = false; - for (j = 1; j <= AirflowNetworkNumOfLinks; ++j) { + for (int j = 1; j <= AirflowNetworkNumOfLinks; ++j) { if (AirflowNetworkLinkageData(j).NodeNums[0] == i || AirflowNetworkLinkageData(j).NodeNums[1] == i) { CompNum = AirflowNetworkLinkageData(j).CompNum; - if (AirflowNetworkCompData(CompNum).EPlusTypeNum == iEPlusComponentType::RHT && (!AirflowNetworkLinkageData(j).VAVTermDamper)) { + if (AirflowNetworkCompData(CompNum).EPlusTypeNum == EPlusComponentType::RHT && (!AirflowNetworkLinkageData(j).VAVTermDamper)) { found = true; break; } // Overwrite fan outlet node - if (AirflowNetworkCompData(CompNum).EPlusTypeNum == iEPlusComponentType::FAN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { + if (AirflowNetworkCompData(CompNum).EPlusTypeNum == EPlusComponentType::FAN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { found = false; break; } // Overwrite return connection outlet - if (AirflowNetworkLinkageData(j).ConnectionFlag == iEPlusComponentType::RCN) { // Modified on 9/2/09 + if (AirflowNetworkLinkageData(j).ConnectionFlag == EPlusComponentType::RCN) { // Modified on 9/2/09 found = true; break; } - if (AirflowNetworkLinkageData(j).ConnectionFlag == iEPlusComponentType::SCN && + if (AirflowNetworkLinkageData(j).ConnectionFlag == EPlusComponentType::SCN && AirflowNetworkLinkageData(j).NodeNums[1] == i) { // Modified on 9/2/09 found = true; break; } } if (AirflowNetworkLinkageData(j).NodeNums[1] == i && - AirflowNetworkNodeData(AirflowNetworkLinkageData(j).NodeNums[0]).EPlusTypeNum == iEPlusNodeType::OAN) { + AirflowNetworkNodeData(AirflowNetworkLinkageData(j).NodeNums[0]).EPlusTypeNum == EPlusNodeType::OAN) { OANode = true; break; } } if (found) continue; - if (AirflowNetworkNodeData(i).EPlusZoneNum == 0 && AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::ZIN) continue; - j = AirflowNetworkNodeData(i).EPlusNodeNum; + if (AirflowNetworkNodeData(i).EPlusZoneNum == 0 && AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::ZIN) continue; + int j = AirflowNetworkNodeData(i).EPlusNodeNum; if (j > 0 && - (AirflowNetworkNodeData(i).EPlusZoneNum > 0 || AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::FOU || - AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::COU || AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::HXO)) { + (AirflowNetworkNodeData(i).EPlusZoneNum > 0 || AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::FOU || + AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::COU || AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::HXO)) { MA((i - 1) * AirflowNetworkNumOfNodes + i) = 1.0e10; MV(i) = m_state.dataLoopNodes->Node(j).GenContam * 1.0e10; } @@ -8382,8 +8173,8 @@ namespace AirflowNetwork { } // Assign node value to distribution nodes with fan off - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { - j = AirflowNetworkNodeData(i).EPlusNodeNum; + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + int j = AirflowNetworkNodeData(i).EPlusNodeNum; if (j > 0 && !LoopOnOffFlag(AirflowNetworkNodeData(i).AirLoopNum) && MA((i - 1) * AirflowNetworkNumOfNodes + i) < 1.0e9) { MA((i - 1) * AirflowNetworkNumOfNodes + i) = 1.0e10; MV(i) = m_state.dataLoopNodes->Node(j).GenContam * 1.0e10; @@ -8395,7 +8186,7 @@ namespace AirflowNetwork { } // Check singularity - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { if (MA((i - 1) * AirflowNetworkNumOfNodes + i) < 1.0e-6) { ShowFatalError(m_state, "CalcAirflowNetworkGCBalance: A diagonal entity is zero in AirflowNetwork matrix at node " + @@ -8407,9 +8198,9 @@ namespace AirflowNetwork { mrxinv(AirflowNetworkNumOfNodes); // Calculate node temperatures - for (i = 1; i <= AirflowNetworkNumOfNodes; ++i) { + for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { COZN = 0.0; - for (j = 1; j <= AirflowNetworkNumOfNodes; ++j) { + for (int j = 1; j <= AirflowNetworkNumOfNodes; ++j) { COZN += MA((i - 1) * AirflowNetworkNumOfNodes + j) * MV(j); } AirflowNetworkNodeSimu(i).GCZ = COZN; @@ -8604,11 +8395,11 @@ namespace AirflowNetwork { // Find a linkage from a zone to outdoors if (ZN1 > 0 && ZN2 == 0) { auto &zn1HB = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZN1); - if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).SurfLinkedOutAirNode > 0) { - Tamb = m_state.dataSurface->SurfOutDryBulbTemp(MultizoneSurfaceData(i).SurfNum); + if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).SurfLinkedOutAirNode > 0) { + Tamb = m_state.dataSurface->SurfOutDryBulbTemp(MultizoneSurfaceData(i).surface_number); CpAir = PsyCpAirFnW(Psychrometrics::PsyWFnTdbTwbPb(m_state, Tamb, - m_state.dataSurface->SurfOutWetBulbTemp(MultizoneSurfaceData(i).SurfNum), + m_state.dataSurface->SurfOutWetBulbTemp(MultizoneSurfaceData(i).surface_number), m_state.dataEnvrn->OutBaroPress)); } else { Tamb = Zone(ZN1).OutDryBulbTemp; @@ -8616,8 +8407,8 @@ namespace AirflowNetwork { } hg = Psychrometrics::PsyHgAirFnWTdb(zn1HB.airHumRat, zn1HB.MAT); - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SEL) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SCR || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SEL) { if (Tamb > zn1HB.MAT) { AirflowNetworkReportData(ZN1).MultiZoneInfiSenGainW += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - zn1HB.MAT)); AirflowNetworkReportData(ZN1).MultiZoneInfiSenGainJ += @@ -8663,11 +8454,11 @@ namespace AirflowNetwork { } if (ZN1 == 0 && ZN2 > 0) { auto &zn2HB = m_state.dataZoneTempPredictorCorrector->zoneHeatBalance(ZN2); - if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).SurfLinkedOutAirNode > 0) { - Tamb = m_state.dataSurface->SurfOutDryBulbTemp(MultizoneSurfaceData(i).SurfNum); + if (m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).SurfLinkedOutAirNode > 0) { + Tamb = m_state.dataSurface->SurfOutDryBulbTemp(MultizoneSurfaceData(i).surface_number); CpAir = PsyCpAirFnW(Psychrometrics::PsyWFnTdbTwbPb(m_state, Tamb, - m_state.dataSurface->SurfOutWetBulbTemp(MultizoneSurfaceData(i).SurfNum), + m_state.dataSurface->SurfOutWetBulbTemp(MultizoneSurfaceData(i).surface_number), m_state.dataEnvrn->OutBaroPress)); } else { Tamb = Zone(ZN2).OutDryBulbTemp; @@ -8675,8 +8466,8 @@ namespace AirflowNetwork { } hg = Psychrometrics::PsyHgAirFnWTdb(zn2HB.airHumRat, zn2HB.MAT); - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SEL) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SCR || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SEL) { if (Tamb > zn2HB.MAT) { AirflowNetworkReportData(ZN2).MultiZoneInfiSenGainW += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - zn2HB.MAT)); AirflowNetworkReportData(ZN2).MultiZoneInfiSenGainJ += @@ -8905,8 +8696,8 @@ namespace AirflowNetwork { ReportingFraction = (1.0 - RepOnOffFanRunTimeFraction); Tamb = Zone(ZN1).OutDryBulbTemp; CpAir = PsyCpAirFnW(m_state.dataEnvrn->OutHumRat); - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SEL) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SCR || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SEL) { if (Tamb > zn1HB.MAT) { AirflowNetworkReportData(ZN1).MultiZoneInfiSenGainW += (linkReport1(i).FLOW2OFF * CpAir * (Tamb - zn1HB.MAT)) * (1.0 - RepOnOffFanRunTimeFraction); @@ -8974,8 +8765,8 @@ namespace AirflowNetwork { ReportingFraction = (1.0 - RepOnOffFanRunTimeFraction); Tamb = Zone(ZN2).OutDryBulbTemp; CpAir = PsyCpAirFnW(m_state.dataEnvrn->OutHumRat); - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SEL) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SCR || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SEL) { if (Tamb > zn2HB.MAT) { AirflowNetworkReportData(ZN2).MultiZoneInfiSenGainW += (linkReport1(i).FLOWOFF * CpAir * (Tamb - zn2HB.MAT)) * ReportingFraction; @@ -9274,8 +9065,8 @@ namespace AirflowNetwork { // Find a linkage from outdoors to this zone Tamb = Zone(ZN1).OutDryBulbTemp; CpAir = PsyCpAirFnW(m_state.dataEnvrn->OutHumRat); - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SEL) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SCR || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SEL) { exchangeData(ZN1).SumMCp += AirflowNetworkLinkSimu(i).FLOW2 * CpAir; exchangeData(ZN1).SumMCpT += AirflowNetworkLinkSimu(i).FLOW2 * CpAir * Tamb; } else { @@ -9295,8 +9086,8 @@ namespace AirflowNetwork { // Find a linkage from outdoors to this zone Tamb = Zone(ZN2).OutDryBulbTemp; CpAir = PsyCpAirFnW(m_state.dataEnvrn->OutHumRat); - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SEL) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SCR || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SEL) { exchangeData(ZN2).SumMCp += AirflowNetworkLinkSimu(i).FLOW * CpAir; exchangeData(ZN2).SumMCpT += AirflowNetworkLinkSimu(i).FLOW * CpAir * Tamb; } else { @@ -9543,17 +9334,17 @@ namespace AirflowNetwork { for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { Node1 = AirflowNetworkLinkageData(i).NodeNums[0]; Node2 = AirflowNetworkLinkageData(i).NodeNums[1]; - if (AirflowNetworkNodeData(Node1).EPlusTypeNum == iEPlusNodeType::SPI || - AirflowNetworkNodeData(Node2).EPlusTypeNum == iEPlusNodeType::SPO || - AirflowNetworkNodeData(Node2).EPlusTypeNum == iEPlusNodeType::ZIN) { + if (AirflowNetworkNodeData(Node1).EPlusTypeNum == EPlusNodeType::SPI || + AirflowNetworkNodeData(Node2).EPlusTypeNum == EPlusNodeType::SPO || + AirflowNetworkNodeData(Node2).EPlusTypeNum == EPlusNodeType::ZIN) { int Node3; - if (AirflowNetworkNodeData(Node1).EPlusTypeNum == iEPlusNodeType::SPI) { + if (AirflowNetworkNodeData(Node1).EPlusTypeNum == EPlusNodeType::SPI) { Node3 = Node1; } else { Node3 = Node2; } - if (AirflowNetworkNodeData(Node2).EPlusTypeNum == iEPlusNodeType::ZIN) { - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).EPlusTypeNum == iEPlusComponentType::Invalid) continue; + if (AirflowNetworkNodeData(Node2).EPlusTypeNum == EPlusNodeType::ZIN) { + if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).EPlusTypeNum == EPlusComponentType::Invalid) continue; } NodeMass = Node(AirflowNetworkNodeData(Node3).EPlusNodeNum).MassFlowRate; AFNMass = AirflowNetworkLinkSimu(i).FLOW; @@ -9582,7 +9373,7 @@ namespace AirflowNetwork { // Assign airflows to EPLus nodes for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::DWC || + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::DWC || AirflowNetworkLinkageData(i).VAVTermDamper) { // Exclude envelope leakage Crack element Node1 = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -9592,8 +9383,8 @@ namespace AirflowNetwork { if (j > 0 && AirflowNetworkNodeData(Node1).EPlusZoneNum == 0) { Node(j).MassFlowRate = AirflowNetworkLinkSimu(i).FLOW * LoopPartLoadRatio(AirflowNetworkNodeData(Node1).AirLoopNum); if (!LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum)) Node(j).MassFlowRate = 0.0; - if (!(AirflowNetworkNodeData(Node1).EPlusTypeNum == iEPlusNodeType::DIN || - AirflowNetworkNodeData(Node1).EPlusTypeNum == iEPlusNodeType::DOU)) { + if (!(AirflowNetworkNodeData(Node1).EPlusTypeNum == EPlusNodeType::DIN || + AirflowNetworkNodeData(Node1).EPlusTypeNum == EPlusNodeType::DOU)) { Node(j).MassFlowRateMaxAvail = AirflowNetworkLinkSimu(i).FLOW * LoopPartLoadRatio(AirflowNetworkNodeData(Node1).AirLoopNum); Node(j).MassFlowRateMax = AirflowNetworkLinkSimu(i).FLOW; } @@ -9603,8 +9394,8 @@ namespace AirflowNetwork { if (j > 0) { Node(j).MassFlowRate = AirflowNetworkLinkSimu(i).FLOW * LoopPartLoadRatio(AirflowNetworkNodeData(Node2).AirLoopNum); if (!LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum)) Node(j).MassFlowRate = 0.0; - if (!(AirflowNetworkNodeData(Node2).EPlusTypeNum == iEPlusNodeType::DIN || - AirflowNetworkNodeData(Node2).EPlusTypeNum == iEPlusNodeType::DOU)) { + if (!(AirflowNetworkNodeData(Node2).EPlusTypeNum == EPlusNodeType::DIN || + AirflowNetworkNodeData(Node2).EPlusTypeNum == EPlusNodeType::DOU)) { Node(j).MassFlowRateMaxAvail = AirflowNetworkLinkSimu(i).FLOW * LoopPartLoadRatio(AirflowNetworkNodeData(Node2).AirLoopNum); Node(j).MassFlowRateMax = AirflowNetworkLinkSimu(i).FLOW; } @@ -9635,7 +9426,7 @@ namespace AirflowNetwork { CpAir = PsyCpAirFnW((AirflowNetworkNodeSimu(Node1).WZ + AirflowNetworkNodeSimu(Node2).WZ) / 2.0); // Calculate sensible loads from duct conduction losses and loads from duct radiation if (AirflowNetworkLinkageData(i).ZoneNum > 0 && - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::DWC) { + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::DWC) { Qsen = AirflowNetworkLinkSimu(i).FLOW * CpAir * (AirflowNetworkNodeSimu(Node2).TZ - AirflowNetworkNodeSimu(Node1).TZ); if (AirflowNetworkLinkageData(i).LinkageViewFactorObjectNum != 0) { auto const &DuctRadObj(AirflowNetworkLinkageViewFactorData(AirflowNetworkLinkageData(i).LinkageViewFactorObjectNum)); @@ -9647,8 +9438,8 @@ namespace AirflowNetwork { exchangeData(AirflowNetworkLinkageData(i).ZoneNum).CondSen -= Qsen; } // Calculate sensible leakage losses - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::PLR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::ELR) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::PLR || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::ELR) { // Calculate supply leak sensible losses if ((AirflowNetworkNodeData(Node2).EPlusZoneNum > 0) && (AirflowNetworkNodeData(Node1).EPlusNodeNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { @@ -9673,14 +9464,14 @@ namespace AirflowNetwork { Node2 = AirflowNetworkLinkageData(i).NodeNums[1]; // Calculate latent loads from duct conduction losses if (AirflowNetworkLinkageData(i).ZoneNum > 0 && - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::DWC) { + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::DWC) { Qlat = AirflowNetworkLinkSimu(i).FLOW * (AirflowNetworkNodeSimu(Node2).WZ - AirflowNetworkNodeSimu(Node1).WZ); if (!LoopOnOffFlag(AirflowNetworkLinkageData(i).AirLoopNum)) Qlat = 0.0; exchangeData(AirflowNetworkLinkageData(i).ZoneNum).DiffLat -= Qlat; } // Calculate latent leakage losses - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::PLR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::ELR) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::PLR || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::ELR) { // Calculate supply leak latent losses if ((AirflowNetworkNodeData(Node2).EPlusZoneNum > 0) && (AirflowNetworkNodeData(Node1).EPlusNodeNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { @@ -9858,16 +9649,16 @@ namespace AirflowNetwork { if (MultizoneSurfaceData(i).EMSOpenFactorActuated) { // EMS sets value to use OpenFactor = MultizoneSurfaceData(i).EMSOpenFactor; - SurfNum = MultizoneSurfaceData(i).SurfNum; - if (MultizoneSurfaceData(i).Factor > 0.0) { - m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = OpenFactor / MultizoneSurfaceData(i).Factor; + SurfNum = MultizoneSurfaceData(i).surface_number; + if (MultizoneSurfaceData(i).factor > 0.0) { + m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = OpenFactor / MultizoneSurfaceData(i).factor; } else { m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = OpenFactor; } return; } - SurfNum = MultizoneSurfaceData(i).SurfNum; + SurfNum = MultizoneSurfaceData(i).surface_number; m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = -1.0; @@ -9885,7 +9676,7 @@ namespace AirflowNetwork { // precedence over zone-level control if (MultizoneSurfaceData(i).IndVentControl) { VentTemp = MultizoneSurfaceData(i).ventTempControlSched ? MultizoneSurfaceData(i).ventTempControlSched->getCurrentVal() : 0.0; - VentCtrlNum = MultizoneSurfaceData(i).VentSurfCtrNum; + VentCtrlNum = MultizoneSurfaceData(i).ventilation_control_type; if (MultizoneSurfaceData(i).ventAvailSched != nullptr) { VentingSchVal = MultizoneSurfaceData(i).ventAvailSched->getCurrentVal(); if (VentingSchVal <= 0.0) { @@ -9918,13 +9709,13 @@ namespace AirflowNetwork { Tamb = ANZT(MultizoneZoneData(MultizoneSurfaceData(i).NodeNums[1]).ZoneNum); } if (ANZT(ZoneNum) > Tamb && ANZT(ZoneNum) > VentTemp) { - OpenFactor = MultizoneSurfaceData(i).Factor; + OpenFactor = MultizoneSurfaceData(i).factor; m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = 1.0; // Modulation of OpenFactor if (MultizoneSurfaceData(i).IndVentControl) { - LimValVentOpenFacMult = MultizoneSurfaceData(i).ModulateFactor; - LowerValInOutTempDiff = MultizoneSurfaceData(i).LowValueTemp; - UpperValInOutTempDiff = MultizoneSurfaceData(i).UpValueTemp; + LimValVentOpenFacMult = MultizoneSurfaceData(i).open_factor_limit; + LowerValInOutTempDiff = MultizoneSurfaceData(i).temperature_lower_limit; + UpperValInOutTempDiff = MultizoneSurfaceData(i).temperature_upper_limit; } else { LimValVentOpenFacMult = MultizoneZoneData(IZ).OpenFactor; LowerValInOutTempDiff = MultizoneZoneData(IZ).LowValueTemp; @@ -9960,12 +9751,12 @@ namespace AirflowNetwork { ANZW(MultizoneZoneData(MultizoneSurfaceData(i).NodeNums[1]).ZoneNum)); } if (ZoneAirEnthalpy > m_state.dataEnvrn->OutEnthalpy && ANZT(ZoneNum) > VentTemp) { - OpenFactor = MultizoneSurfaceData(i).Factor; + OpenFactor = MultizoneSurfaceData(i).factor; // Modulation of OpenFactor if (MultizoneSurfaceData(i).IndVentControl) { - LimValVentOpenFacMult = MultizoneSurfaceData(i).ModulateFactor; - LowerValInOutEnthalDiff = MultizoneSurfaceData(i).LowValueEnth; - UpperValInOutEnthalDiff = MultizoneSurfaceData(i).UpValueEnth; + LimValVentOpenFacMult = MultizoneSurfaceData(i).open_factor_limit; + LowerValInOutEnthalDiff = MultizoneSurfaceData(i).enthalpy_lower_limit; + UpperValInOutEnthalDiff = MultizoneSurfaceData(i).enthalpy_upper_limit; } else { LimValVentOpenFacMult = MultizoneZoneData(IZ).OpenFactor; LowerValInOutEnthalDiff = MultizoneZoneData(IZ).LowValueEnth; @@ -9997,7 +9788,7 @@ namespace AirflowNetwork { // subject to venting availability if (VentCtrlNum == VentControlType::Const && VentingAllowed) { // Constant - OpenFactor = MultizoneSurfaceData(i).Factor; + OpenFactor = MultizoneSurfaceData(i).factor; m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = 1.0; } @@ -10007,7 +9798,7 @@ namespace AirflowNetwork { if (PeopleInd > 0 && m_state.dataThermalComforts->ThermalComfortData(PeopleInd).ThermalComfortAdaptiveASH5590 != -1) { if (m_state.dataThermalComforts->ThermalComfortData(PeopleInd).ThermalComfortOpTemp > m_state.dataThermalComforts->ThermalComfortData(PeopleInd).TComfASH55) { - OpenFactor = MultizoneSurfaceData(i).Factor; + OpenFactor = MultizoneSurfaceData(i).factor; m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = 1.0; } else { OpenFactor = 0.0; @@ -10026,7 +9817,7 @@ namespace AirflowNetwork { if (PeopleInd > 0 && m_state.dataThermalComforts->ThermalComfortData(PeopleInd).ThermalComfortAdaptiveCEN15251CatI != -1) { if (m_state.dataThermalComforts->ThermalComfortData(PeopleInd).ThermalComfortOpTemp > m_state.dataThermalComforts->ThermalComfortData(PeopleInd).TComfCEN15251) { - OpenFactor = MultizoneSurfaceData(i).Factor; + OpenFactor = MultizoneSurfaceData(i).factor; m_state.dataSurface->SurfWinVentingOpenFactorMultRep(SurfNum) = 1.0; } else { OpenFactor = 0.0; @@ -10157,7 +9948,7 @@ namespace AirflowNetwork { for (int j = 1; j <= m_state.dataZoneEquip->ZoneEquipConfig(i).NumInletNodes; ++j) { for (int k = 1; k <= AirflowNetworkNumOfNodes; ++k) { if (m_state.dataZoneEquip->ZoneEquipConfig(i).InletNode(j) == AirflowNetworkNodeData(k).EPlusNodeNum) { - AirflowNetworkNodeData(k).EPlusTypeNum = iEPlusNodeType::ZIN; + AirflowNetworkNodeData(k).EPlusTypeNum = EPlusNodeType::ZIN; break; } } @@ -10165,7 +9956,7 @@ namespace AirflowNetwork { for (int j = 1; j <= m_state.dataZoneEquip->ZoneEquipConfig(i).NumReturnNodes; ++j) { for (int k = 1; k <= AirflowNetworkNumOfNodes; ++k) { if (m_state.dataZoneEquip->ZoneEquipConfig(i).ReturnNode(j) == AirflowNetworkNodeData(k).EPlusNodeNum) { - AirflowNetworkNodeData(k).EPlusTypeNum = iEPlusNodeType::ZOU; + AirflowNetworkNodeData(k).EPlusTypeNum = EPlusNodeType::ZOU; break; } } @@ -10440,7 +10231,7 @@ namespace AirflowNetwork { ErrorsFound = true; } // Set AirLoopNum to fans and coils - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).EPlusTypeNum == iEPlusComponentType::FAN) { + if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).EPlusTypeNum == EPlusComponentType::FAN) { n = m_state.afn->DisSysCompCVFData(AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).TypeNum).FanIndex; m_state.afn->DisSysCompCVFData(AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).TypeNum).AirLoopNum = AirflowNetworkLinkageData(i).AirLoopNum; @@ -10458,7 +10249,7 @@ namespace AirflowNetwork { m_state.dataFans->fans(n)->isAFNFan = true; } } - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).EPlusTypeNum == iEPlusComponentType::COI) { + if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).EPlusTypeNum == EPlusComponentType::COI) { m_state.afn->DisSysCompCoilData(AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).TypeNum).AirLoopNum = AirflowNetworkLinkageData(i).AirLoopNum; } @@ -10768,10 +10559,10 @@ namespace AirflowNetwork { } for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { if (AirflowNetworkLinkageData(i).NodeNums[0] == R1 && AirflowNetworkLinkageData(i).NodeNums[1] == R2) { - AirflowNetworkLinkageData(i).ConnectionFlag = iEPlusComponentType::RCN; + AirflowNetworkLinkageData(i).ConnectionFlag = EPlusComponentType::RCN; } if (AirflowNetworkLinkageData(i).NodeNums[0] == S1 && AirflowNetworkLinkageData(i).NodeNums[1] == S2) { - AirflowNetworkLinkageData(i).ConnectionFlag = iEPlusComponentType::SCN; + AirflowNetworkLinkageData(i).ConnectionFlag = EPlusComponentType::SCN; } } } @@ -10779,25 +10570,25 @@ namespace AirflowNetwork { // Assign fan inlet and outlet node, and coil outlet for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { int j = AirflowNetworkLinkageData(i).CompNum; - if (AirflowNetworkCompData(j).CompTypeNum == iComponentTypeNum::CVF) { - if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusTypeNum == iEPlusNodeType::Invalid) - AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusTypeNum = iEPlusNodeType::FIN; - AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum = iEPlusNodeType::FOU; + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::CVF) { + if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusTypeNum == EPlusNodeType::Invalid) + AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusTypeNum = EPlusNodeType::FIN; + AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum = EPlusNodeType::FOU; } - if (AirflowNetworkCompData(j).EPlusTypeNum == iEPlusComponentType::COI) { - AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum = iEPlusNodeType::COU; + if (AirflowNetworkCompData(j).EPlusTypeNum == EPlusComponentType::COI) { + AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum = EPlusNodeType::COU; } - if (AirflowNetworkCompData(j).EPlusTypeNum == iEPlusComponentType::HEX) { - AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum = iEPlusNodeType::HXO; + if (AirflowNetworkCompData(j).EPlusTypeNum == EPlusComponentType::HEX) { + AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum = EPlusNodeType::HXO; } - if (AirflowNetworkCompData(j).CompTypeNum == iComponentTypeNum::TMU) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::TMU) { if (DisSysCompTermUnitData(AirflowNetworkCompData(j).TypeNum).DamperInletNode > 0) { if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusNodeNum == DisSysCompTermUnitData(AirflowNetworkCompData(j).TypeNum).DamperInletNode && AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusNodeNum == DisSysCompTermUnitData(AirflowNetworkCompData(j).TypeNum).DamperOutletNode) { - AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusTypeNum = iEPlusNodeType::DIN; - AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum = iEPlusNodeType::DOU; + AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusTypeNum = EPlusNodeType::DIN; + AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum = EPlusNodeType::DOU; AirflowNetworkLinkageData(i).VAVTermDamper = true; } } @@ -10807,10 +10598,10 @@ namespace AirflowNetwork { // Validate the position of constant pressure drop component CurrentModuleObject = "AirflowNetwork:Distribution:Component:ConstantPressureDrop"; for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::CPD) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::CPD) { for (int j = 1; j <= AirflowNetworkNumOfLinks; ++j) { if (AirflowNetworkLinkageData(i).NodeNums[0] == AirflowNetworkLinkageData(j).NodeNums[1]) { - if (AirflowNetworkCompData(AirflowNetworkLinkageData(j).CompNum).CompTypeNum != iComponentTypeNum::DWC) { + if (AirflowNetworkLinkageData(j).element->type() != AirflowElementType::DWC) { ShowSevereError(m_state, format(RoutineName) + "An " + CurrentModuleObject + " object (" + AirflowNetworkLinkageData(i).CompName + ')'); @@ -10819,7 +10610,7 @@ namespace AirflowNetwork { } } } - if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusTypeNum == iEPlusNodeType::SPL) { + if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusTypeNum == EPlusNodeType::SPL) { ShowSevereError(m_state, format(RoutineName) + "An " + CurrentModuleObject + " object (" + AirflowNetworkLinkageData(i).CompName + ')'); ShowContinueError(m_state, @@ -10827,7 +10618,7 @@ namespace AirflowNetwork { AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).Name); ErrorsFound = true; } - if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum == iEPlusNodeType::SPL) { + if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum == EPlusNodeType::SPL) { ShowSevereError(m_state, format(RoutineName) + "An " + CurrentModuleObject + " object (" + AirflowNetworkLinkageData(i).CompName + ')'); ShowContinueError(m_state, @@ -10835,7 +10626,7 @@ namespace AirflowNetwork { AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).Name); ErrorsFound = true; } - if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusTypeNum == iEPlusNodeType::MIX) { + if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).EPlusTypeNum == EPlusNodeType::MIX) { ShowSevereError(m_state, format(RoutineName) + "An " + CurrentModuleObject + " object (" + AirflowNetworkLinkageData(i).CompName + ')'); ShowContinueError(m_state, @@ -10843,7 +10634,7 @@ namespace AirflowNetwork { AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[0]).Name); ErrorsFound = true; } - if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum == iEPlusNodeType::MIX) { + if (AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum == EPlusNodeType::MIX) { ShowSevereError(m_state, format(RoutineName) + "An " + CurrentModuleObject + " object (" + AirflowNetworkLinkageData(i).CompName + ')'); ShowContinueError(m_state, @@ -10887,7 +10678,7 @@ namespace AirflowNetwork { } for (int i = NumOfNodesMultiZone + 1; i <= AirflowNetworkNumOfNodes; ++i) { - if (AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::SPL) { + if (AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::SPL) { LocalError = false; int j = GetSplitterOutletNumber(m_state, "", 1, LocalError); SplitterNodeNumbers.allocate(j + 2); @@ -10899,12 +10690,12 @@ namespace AirflowNetwork { // Assigning inlet and outlet nodes for a splitter for (int i = 1; i <= AirflowNetworkNumOfNodes; ++i) { if (AirflowNetworkNodeData(i).EPlusNodeNum == SplitterNodeNumbers(1)) { - if (AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::Invalid) AirflowNetworkNodeData(i).EPlusTypeNum = iEPlusNodeType::SPI; + if (AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::Invalid) AirflowNetworkNodeData(i).EPlusTypeNum = EPlusNodeType::SPI; } for (int j = 1; j <= SplitterNodeNumbers(2); ++j) { if (AirflowNetworkNodeData(i).EPlusNodeNum == SplitterNodeNumbers(j + 2)) { - if (AirflowNetworkNodeData(i).EPlusTypeNum == iEPlusNodeType::Invalid) - AirflowNetworkNodeData(i).EPlusTypeNum = iEPlusNodeType::SPO; + if (AirflowNetworkNodeData(i).EPlusTypeNum == EPlusNodeType::Invalid) + AirflowNetworkNodeData(i).EPlusTypeNum = EPlusNodeType::SPO; } } } @@ -11117,17 +10908,17 @@ namespace AirflowNetwork { // Catch a fan flow rate from EPlus input file and add a flag for VAV terminal damper for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { - switch (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum) { - case iComponentTypeNum::CVF: { // 'CVF' + switch (AirflowNetworkLinkageData(i).element->type()) { + case AirflowElementType::CVF: { // 'CVF' int typeNum = AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).TypeNum; if (DisSysCompCVFData(typeNum).fanType == HVAC::FanType::VAV) { DisSysCompCVFData(typeNum).MaxAirMassFlowRate = m_state.dataFans->fans(DisSysCompCVFData(typeNum).FanIndex)->maxAirFlowRate * m_state.dataEnvrn->StdRhoAir; } } break; - case iComponentTypeNum::FAN: - case iComponentTypeNum::SOP: - case iComponentTypeNum::TMU: + case AirflowElementType::FAN: + case AirflowElementType::SOP: + case AirflowElementType::TMU: break; default: break; @@ -11195,16 +10986,16 @@ namespace AirflowNetwork { bool found = false; int j; for (j = 1; j <= AirflowNetworkNumOfSurfaces; ++j) { - if (Util::SameString(MultizoneSurfaceData(j).OpeningName, MultizoneCompExhaustFanData(i).name)) { + if (Util::SameString(MultizoneSurfaceData(j).opening_name, MultizoneCompExhaustFanData(i).name)) { found = true; - if (m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).ExtBoundCond != ExternalEnvironment && - !(m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond == OtherSideCoefNoCalcExt && - m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtWind)) { + if (m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).ExtBoundCond != ExternalEnvironment && + !(m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtBoundCond == OtherSideCoefNoCalcExt && + m_state.dataSurface->Surface(MultizoneSurfaceData(i).surface_number).ExtWind)) { ShowSevereError(m_state, format("{}The surface using {} is not an exterior surface: {}", RoutineName, CurrentModuleObject, - MultizoneSurfaceData(j).SurfName)); + MultizoneSurfaceData(j).surface_name)); ErrorsFound = true; } break; @@ -11214,13 +11005,13 @@ namespace AirflowNetwork { ShowSevereError(m_state, CurrentModuleObject + " = " + MultizoneCompExhaustFanData(i).name + " is defined and never used."); ErrorsFound = true; } else { - if (MultizoneCompExhaustFanData(i).EPlusZoneNum != m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).Zone) { + if (MultizoneCompExhaustFanData(i).EPlusZoneNum != m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).Zone) { ShowSevereError(m_state, format("{}Zone name in {} = {} does not match the zone name", RoutineName, CurrentModuleObject, MultizoneCompExhaustFanData(i).name)); - ShowContinueError(m_state, "the surface is exposed to " + m_state.dataSurface->Surface(MultizoneSurfaceData(j).SurfNum).Name); + ShowContinueError(m_state, "the surface is exposed to " + m_state.dataSurface->Surface(MultizoneSurfaceData(j).surface_number).Name); ErrorsFound = true; } else { AirflowNetworkZoneExhaustFan(MultizoneCompExhaustFanData(i).EPlusZoneNum) = true; @@ -11319,7 +11110,7 @@ namespace AirflowNetwork { } if (ActualZoneNum > 0) { for (ANSurfaceNum = 1; ANSurfaceNum <= AirflowNetworkNumOfSurfaces; ++ANSurfaceNum) { - SurfNum = MultizoneSurfaceData(ANSurfaceNum).SurfNum; + SurfNum = MultizoneSurfaceData(ANSurfaceNum).surface_number; auto const &surf = m_state.dataSurface->Surface(SurfNum); if (surf.Zone == ActualZoneNum) { @@ -11422,7 +11213,7 @@ namespace AirflowNetwork { std::string ZoneName; // EnergyPlus zone name int facadeNum; int curve; // wind pressure coefficient curve index - iComponentTypeNum CompTypeNum; // Opening type (detailed, simple, etc.) + AirflowElementType CompTypeNum; // Opening type (detailed, simple, etc.) Real64 NodeHeight; // Elevation of the opening node Real64 OpeningArea; // Opening area (=Height*Width) Real64 Height; // Opening height = MultizoneSurfaceData()%Height @@ -11431,7 +11222,7 @@ namespace AirflowNetwork { // Default Constructor AFNExtSurfacesProp() - : SurfNum(0), MSDNum(0), ZoneNum(0), MZDZoneNum(0), ExtNodeNum(0), facadeNum(0), curve(0), CompTypeNum(iComponentTypeNum::Invalid), + : SurfNum(0), MSDNum(0), ZoneNum(0), MZDZoneNum(0), ExtNodeNum(0), facadeNum(0), curve(0), CompTypeNum(AirflowElementType::Invalid), NodeHeight(0.0), OpeningArea(0.0), Height(0.0), Width(0.0), DischCoeff(0.0) { } @@ -11446,20 +11237,20 @@ namespace AirflowNetwork { for (AFNZnNum = 1; AFNZnNum <= AirflowNetworkNumOfZones; ++AFNZnNum) { if (MultizoneZoneData(AFNZnNum).SingleSidedCpType == "ADVANCED") { for (SrfNum = 1; SrfNum <= AirflowNetworkNumOfSurfaces; ++SrfNum) { - if (m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).ExtBoundCond == + if (m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).ExtBoundCond == ExternalEnvironment) { // check if outdoor boundary condition - MZDZoneNum = Util::FindItemInList(m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).ZoneName, + MZDZoneNum = Util::FindItemInList(m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).ZoneName, MultizoneZoneData, &MultizoneZoneProp::ZoneName); if (MZDZoneNum == AFNZnNum) { // This is terrible, should not do it this way - auto afe = elements.find(MultizoneSurfaceData(SrfNum).OpeningName); + auto afe = elements.find(MultizoneSurfaceData(SrfNum).opening_name); if (afe != elements.end()) { auto type = afe->second->type(); - if (type == ComponentType::DOP) { + if (type == AirflowElementType::DOP) { ++AFNNumOfExtOpenings; ++NumofExtSurfInZone(AFNZnNum); - } else if (type == ComponentType::SOP) { + } else if (type == AirflowElementType::SOP) { ++AFNNumOfExtOpenings; ++NumofExtSurfInZone(AFNZnNum); } @@ -11521,17 +11312,17 @@ namespace AirflowNetwork { AFNNumOfExtOpenings = 0; for (SrfNum = 1; SrfNum <= AirflowNetworkNumOfSurfaces; ++SrfNum) { MZDZoneNum = Util::FindItemInList( - m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).ZoneName, MultizoneZoneData, &MultizoneZoneProp::ZoneName); + m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).ZoneName, MultizoneZoneData, &MultizoneZoneProp::ZoneName); if (MultizoneZoneData(MZDZoneNum).SingleSidedCpType == "ADVANCED") { - if (m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).ExtBoundCond == + if (m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).ExtBoundCond == ExternalEnvironment) { // check if outdoor boundary condition // This is terrible, should not do it this way - auto afe = elements.find(MultizoneSurfaceData(SrfNum).OpeningName); + auto afe = elements.find(MultizoneSurfaceData(SrfNum).opening_name); if (afe != elements.end()) { auto type = afe->second->type(); - if (type == ComponentType::DOP) { + if (type == AirflowElementType::DOP) { ++AFNNumOfExtOpenings; - } else if (type == ComponentType::SOP) { + } else if (type == AirflowElementType::SOP) { ++AFNNumOfExtOpenings; } } @@ -11542,27 +11333,27 @@ namespace AirflowNetwork { // Create array of properties for all the exterior single sided openings ExtOpenNum = 1; for (SrfNum = 1; SrfNum <= AirflowNetworkNumOfSurfaces; ++SrfNum) { - if (m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).ExtBoundCond == ExternalEnvironment) { + if (m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).ExtBoundCond == ExternalEnvironment) { if (AirflowNetworkNumOfDetOpenings > 0) { DetOpenNum = Util::FindItemInList( - MultizoneSurfaceData(SrfNum).OpeningName, MultizoneCompDetOpeningData, &AirflowNetwork::DetailedOpening::name); + MultizoneSurfaceData(SrfNum).opening_name, MultizoneCompDetOpeningData, &AirflowNetwork::DetailedOpening::name); MZDZoneNum = Util::FindItemInList( - m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).ZoneName, MultizoneZoneData, &MultizoneZoneProp::ZoneName); + m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).ZoneName, MultizoneZoneData, &MultizoneZoneProp::ZoneName); if (MultizoneZoneData(MZDZoneNum).SingleSidedCpType == "ADVANCED") { if (DetOpenNum > 0) { AFNExtSurfaces(ExtOpenNum).MSDNum = SrfNum; - AFNExtSurfaces(ExtOpenNum).SurfNum = MultizoneSurfaceData(SrfNum).SurfNum; + AFNExtSurfaces(ExtOpenNum).SurfNum = MultizoneSurfaceData(SrfNum).surface_number; AFNExtSurfaces(ExtOpenNum).NodeHeight = m_state.dataSurface->Surface(AFNExtSurfaces(ExtOpenNum).SurfNum).Centroid.z; - AFNExtSurfaces(ExtOpenNum).SurfName = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).Name; - AFNExtSurfaces(ExtOpenNum).ZoneNum = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).Zone; - AFNExtSurfaces(ExtOpenNum).ZoneName = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).ZoneName; + AFNExtSurfaces(ExtOpenNum).SurfName = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).Name; + AFNExtSurfaces(ExtOpenNum).ZoneNum = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).Zone; + AFNExtSurfaces(ExtOpenNum).ZoneName = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).ZoneName; AFNExtSurfaces(ExtOpenNum).MZDZoneNum = Util::FindItemInList(AFNExtSurfaces(ExtOpenNum).ZoneName, MultizoneZoneData, &MultizoneZoneProp::ZoneName); - AFNExtSurfaces(ExtOpenNum).CompTypeNum = iComponentTypeNum::DOP; - AFNExtSurfaces(ExtOpenNum).Height = MultizoneSurfaceData(SrfNum).Height; - AFNExtSurfaces(ExtOpenNum).Width = MultizoneSurfaceData(SrfNum).Width; + AFNExtSurfaces(ExtOpenNum).CompTypeNum = AirflowElementType::DOP; + AFNExtSurfaces(ExtOpenNum).Height = MultizoneSurfaceData(SrfNum).height; + AFNExtSurfaces(ExtOpenNum).Width = MultizoneSurfaceData(SrfNum).width; AFNExtSurfaces(ExtOpenNum).OpeningArea = - MultizoneSurfaceData(SrfNum).Width * MultizoneSurfaceData(SrfNum).Height * MultizoneSurfaceData(SrfNum).OpenFactor; + MultizoneSurfaceData(SrfNum).width * MultizoneSurfaceData(SrfNum).height * MultizoneSurfaceData(SrfNum).OpenFactor; AFNExtSurfaces(ExtOpenNum).ExtNodeNum = MultizoneSurfaceData(ExtOpenNum).NodeNums[1]; AFNExtSurfaces(ExtOpenNum).facadeNum = MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - AirflowNetworkNumOfZones).facadeNum; @@ -11574,20 +11365,20 @@ namespace AirflowNetwork { } } else if (AirflowNetworkNumOfSimOpenings > 0) { SimOpenNum = Util::FindItemInList( - MultizoneSurfaceData(SrfNum).OpeningName, MultizoneCompSimpleOpeningData, &AirflowNetwork::SimpleOpening::name); + MultizoneSurfaceData(SrfNum).opening_name, MultizoneCompSimpleOpeningData, &AirflowNetwork::SimpleOpening::name); if (SimOpenNum > 0) { AFNExtSurfaces(ExtOpenNum).MSDNum = SrfNum; - AFNExtSurfaces(ExtOpenNum).SurfNum = MultizoneSurfaceData(SrfNum).SurfNum; - AFNExtSurfaces(ExtOpenNum).SurfName = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).Name; - AFNExtSurfaces(ExtOpenNum).ZoneNum = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).Zone; - AFNExtSurfaces(ExtOpenNum).ZoneName = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).ZoneName; + AFNExtSurfaces(ExtOpenNum).SurfNum = MultizoneSurfaceData(SrfNum).surface_number; + AFNExtSurfaces(ExtOpenNum).SurfName = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).Name; + AFNExtSurfaces(ExtOpenNum).ZoneNum = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).Zone; + AFNExtSurfaces(ExtOpenNum).ZoneName = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).surface_number).ZoneName; AFNExtSurfaces(ExtOpenNum).MZDZoneNum = Util::FindItemInList(AFNExtSurfaces(ExtOpenNum).ZoneName, MultizoneZoneData, &MultizoneZoneProp::ZoneName); - AFNExtSurfaces(ExtOpenNum).CompTypeNum = iComponentTypeNum::SOP; - AFNExtSurfaces(ExtOpenNum).Height = MultizoneSurfaceData(SrfNum).Height; - AFNExtSurfaces(ExtOpenNum).Width = MultizoneSurfaceData(SrfNum).Width; + AFNExtSurfaces(ExtOpenNum).CompTypeNum = AirflowElementType::SOP; + AFNExtSurfaces(ExtOpenNum).Height = MultizoneSurfaceData(SrfNum).height; + AFNExtSurfaces(ExtOpenNum).Width = MultizoneSurfaceData(SrfNum).width; AFNExtSurfaces(ExtOpenNum).OpeningArea = - MultizoneSurfaceData(SrfNum).Width * MultizoneSurfaceData(SrfNum).Height * MultizoneSurfaceData(SrfNum).OpenFactor; + MultizoneSurfaceData(SrfNum).width * MultizoneSurfaceData(SrfNum).height * MultizoneSurfaceData(SrfNum).OpenFactor; AFNExtSurfaces(ExtOpenNum).ExtNodeNum = MultizoneSurfaceData(ExtOpenNum).NodeNums[1]; AFNExtSurfaces(ExtOpenNum).curve = MultizoneExternalNodeData(AFNExtSurfaces(ExtOpenNum).ExtNodeNum - AirflowNetworkNumOfZones).curve; @@ -12113,7 +11904,7 @@ namespace AirflowNetwork { ShowContinueError(m_state, format("The number of controlled zone is {}", NumOfCtrlZones)); ShowContinueError(m_state, "..Duct sizing is not performed"); simulation_control.autosize_ducts = false; - simulation_control.iWPCCnt = iWPCCntr::Input; + simulation_control.iWPCCnt = WindPressureType::Input; simulation_control.allow_unsupported_zone_equipment = false; } Real64 factor = simulation_control.ductSizing.factor; @@ -12121,17 +11912,17 @@ namespace AirflowNetwork { NodeLoopSupply = m_state.dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipSupplyNodeNum(1); NodeLoopReturn = m_state.dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipReturnNodeNum(1); for (AFNNodeNum = 1; AFNNodeNum <= AirflowNetworkNumOfNodes; AFNNodeNum++) { - if (AirflowNetworkNodeData(AFNNodeNum).EPlusTypeNum == iEPlusNodeType::SPL) { + if (AirflowNetworkNodeData(AFNNodeNum).EPlusTypeNum == EPlusNodeType::SPL) { NodeSplitter = AFNNodeNum; - } else if (AirflowNetworkNodeData(AFNNodeNum).EPlusTypeNum == iEPlusNodeType::MIX) { + } else if (AirflowNetworkNodeData(AFNNodeNum).EPlusTypeNum == EPlusNodeType::MIX) { NodeMixer = AFNNodeNum; } else if (AirflowNetworkNodeData(AFNNodeNum).EPlusNodeNum == m_state.dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipSupplyNodeNum(1)) { NodeLoopSupply = AFNNodeNum; } else if (AirflowNetworkNodeData(AFNNodeNum).EPlusNodeNum == m_state.dataAirLoop->AirToZoneNodeInfo(1).ZoneEquipReturnNodeNum(1)) { NodeLoopReturn = AFNNodeNum; - } else if (AirflowNetworkNodeData(AFNNodeNum).EPlusTypeNum == iEPlusNodeType::ZIN) { + } else if (AirflowNetworkNodeData(AFNNodeNum).EPlusTypeNum == EPlusNodeType::ZIN) { NodeZoneIntlet = AFNNodeNum; - } else if (AirflowNetworkNodeData(AFNNodeNum).EPlusTypeNum == iEPlusNodeType::ZOU) { + } else if (AirflowNetworkNodeData(AFNNodeNum).EPlusTypeNum == EPlusNodeType::ZOU) { NodeZoneReturn = AFNNodeNum; } } @@ -12144,7 +11935,7 @@ namespace AirflowNetwork { for (AFNLinkNum = 1; AFNLinkNum <= AirflowNetworkNumOfLinks; AFNLinkNum++) { CompNum = AirflowNetworkLinkageData(AFNLinkNum).CompNum; - iComponentTypeNum CompTypeNum = AirflowNetworkCompData(CompNum).CompTypeNum; + AirflowElementType CompTypeNum = AirflowNetworkLinkageData(AFNLinkNum).element->type(); SumLength = 0.0; DynamicLoss = 0.0; MaxRough = 0.0; @@ -12152,7 +11943,7 @@ namespace AirflowNetwork { if (AirflowNetworkLinkageData(AFNLinkNum).NodeNums[0] == NodeLoopSupply) { if (AirflowNetworkLinkageData(AFNLinkNum).NodeNums[1] == NodeSplitter) { // A single trunk duct - if (CompTypeNum == iComponentTypeNum::DWC && AirflowNetworkLinkageData(AFNLinkNum).ZoneNum > 0) { + if (CompTypeNum == AirflowElementType::DWC && AirflowNetworkLinkageData(AFNLinkNum).ZoneNum > 0) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::SupplyTrunk; TypeNum = AirflowNetworkCompData(CompNum).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12164,10 +11955,10 @@ namespace AirflowNetwork { } else { int NodeNum1 = AirflowNetworkLinkageData(AFNLinkNum).NodeNums[1]; int CompNum1; - iComponentTypeNum CompTypeNum1; + AirflowElementType CompTypeNum1; CompNum1 = AirflowNetworkLinkageData(AFNLinkNum).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum).element->type(); + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::SupplyTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12180,12 +11971,12 @@ namespace AirflowNetwork { while (NodeNum1 != NodeSplitter) { for (AFNLinkNum1 = 1; AFNLinkNum1 <= AirflowNetworkNumOfLinks; AFNLinkNum1++) { if (NodeNum1 != AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[0]) continue; - if (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != iComponentTypeNum::DWC) + if (AirflowNetworkLinkageData(AFNLinkNum1).element->type() != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[0]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum1).element->type(); + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::SupplyTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12271,7 +12062,7 @@ namespace AirflowNetwork { MaxRough = 0.0; if (AirflowNetworkLinkageData(AFNLinkNum).NodeNums[0] == NodeSplitter) { // A single branch duct - if (CompTypeNum == iComponentTypeNum::DWC && AirflowNetworkLinkageData(AFNLinkNum).ZoneNum > 0) { + if (CompTypeNum == AirflowElementType::DWC && AirflowNetworkLinkageData(AFNLinkNum).ZoneNum > 0) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::SupplyTrunk; TypeNum = AirflowNetworkCompData(CompNum).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12283,10 +12074,10 @@ namespace AirflowNetwork { } else { int NodeNum1 = AirflowNetworkLinkageData(AFNLinkNum).NodeNums[0]; int CompNum1; - iComponentTypeNum CompTypeNum1; + AirflowElementType CompTypeNum1; CompNum1 = AirflowNetworkLinkageData(AFNLinkNum).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum).element->type(); + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::SupplyBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12298,12 +12089,12 @@ namespace AirflowNetwork { while (NodeNum1 != NodeSplitter) { for (AFNLinkNum1 = 1; AFNLinkNum1 <= AirflowNetworkNumOfLinks; AFNLinkNum1++) { if (NodeNum1 != AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[1]) continue; - if (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != iComponentTypeNum::DWC) + if (AirflowNetworkLinkageData(AFNLinkNum1).element->type() != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[1]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum1).element->type(); + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::SupplyBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12393,7 +12184,7 @@ namespace AirflowNetwork { MaxRough = 0.0; if (AirflowNetworkLinkageData(AFNLinkNum).NodeNums[0] == NodeMixer) { // A single branch duct - if (CompTypeNum == iComponentTypeNum::DWC && AirflowNetworkLinkageData(AFNLinkNum).ZoneNum > 0) { + if (CompTypeNum == AirflowElementType::DWC && AirflowNetworkLinkageData(AFNLinkNum).ZoneNum > 0) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::ReturnTrunk; TypeNum = AirflowNetworkCompData(CompNum).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12405,10 +12196,10 @@ namespace AirflowNetwork { } else { int NodeNum1 = AirflowNetworkLinkageData(AFNLinkNum).NodeNums[0]; int CompNum1; - iComponentTypeNum CompTypeNum1; + AirflowElementType CompTypeNum1; CompNum1 = AirflowNetworkLinkageData(AFNLinkNum).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum).element->type(); + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::ReturnTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12420,12 +12211,12 @@ namespace AirflowNetwork { while (NodeNum1 != NodeMixer) { for (AFNLinkNum1 = 1; AFNLinkNum1 <= AirflowNetworkNumOfLinks; AFNLinkNum1++) { if (NodeNum1 != AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[1]) continue; - if (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != iComponentTypeNum::DWC) + if (AirflowNetworkLinkageData(AFNLinkNum1).element->type() != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[1]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum1).element->type(); + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::ReturnTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12513,7 +12304,7 @@ namespace AirflowNetwork { MaxRough = 0.0; if (AirflowNetworkLinkageData(AFNLinkNum).NodeNums[1] == NodeMixer) { // A single trunk duct - if (CompTypeNum == iComponentTypeNum::DWC && AirflowNetworkLinkageData(AFNLinkNum).ZoneNum > 0) { + if (CompTypeNum == AirflowElementType::DWC && AirflowNetworkLinkageData(AFNLinkNum).ZoneNum > 0) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::ReturnBranch; TypeNum = AirflowNetworkCompData(CompNum).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12525,10 +12316,10 @@ namespace AirflowNetwork { } else { int NodeNum1 = AirflowNetworkLinkageData(AFNLinkNum).NodeNums[1]; int CompNum1; - iComponentTypeNum CompTypeNum1; + AirflowElementType CompTypeNum1; CompNum1 = AirflowNetworkLinkageData(AFNLinkNum).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum).element->type(); + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::ReturnBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12540,12 +12331,12 @@ namespace AirflowNetwork { while (NodeNum1 != NodeMixer) { for (AFNLinkNum1 = 1; AFNLinkNum1 <= AirflowNetworkNumOfLinks; AFNLinkNum1++) { if (NodeNum1 != AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[0]) continue; - if (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != iComponentTypeNum::DWC) + if (AirflowNetworkLinkageData(AFNLinkNum1).element->type() != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[0]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum1).element->type(); + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::ReturnBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12972,7 +12763,7 @@ namespace AirflowNetwork { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int i; - iComponentTypeNum j; + AirflowElementType j; int n; // Formats @@ -13015,7 +12806,7 @@ namespace AirflowNetwork { n = 0; for (i = 1; i <= AirflowNetworkNumOfLinks; ++i) { j = AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum; - if (j == iComponentTypeNum::DOP) { + if (j == AirflowElementType::DOP) { ++n; } } @@ -13344,7 +13135,7 @@ namespace AirflowNetwork { // if (LIST >= 1) { // gio::write(outputFile, Format_901) << "Flow: " << i << n << m << AirflowNetworkLinkSimu(i).DP << AFLOW(i) << AFLOW2(i); //} - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::HOP) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::HOP) { SUMAF(n) = SUMAF(n) - AFLOW(i); SUMAF(m) += AFLOW(i); } else { @@ -13366,7 +13157,7 @@ namespace AirflowNetwork { AirflowNetworkLinkSimu(i).FLOW = 0.0; AirflowNetworkLinkSimu(i).FLOW2 = -AFLOW(i); } - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::HOP) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::HOP) { if (AFLOW(i) > 0.0) { AirflowNetworkLinkSimu(i).FLOW = AFLOW(i) + AFLOW2(i); AirflowNetworkLinkSimu(i).FLOW2 = AFLOW2(i); @@ -13381,7 +13172,7 @@ namespace AirflowNetwork { AirflowNetworkLinkSimu(i).FLOW2 = AFLOW2(i); } } - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SOP && AFLOW2(i) != 0.0) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SOP && AFLOW2(i) != 0.0) { if (AFLOW(i) >= 0.0) { AirflowNetworkLinkSimu(i).FLOW = AFLOW(i); AirflowNetworkLinkSimu(i).FLOW2 = std::abs(AFLOW2(i)); @@ -13650,7 +13441,6 @@ namespace AirflowNetwork { // DF - partial derivatives: DF/DP. // NF - number of flows, 1 or 2. int i; - int j; int n; int FLAG; int NF; @@ -13700,19 +13490,17 @@ namespace AirflowNetwork { DP = PZ(n) - PZ(m) + dos.DpL(i, 1) + PW(i); } Real64 multiplier = 1.0; - Real64 control = AirflowNetworkLinkageData(i).control; - // if (LIST >= 4) ObjexxFCL::gio::write(outputFile, Format_901) << "PS:" << i << n << M << PS(i) << PW(i) << AirflowNetworkLinkSimu(i).DP; - j = AirflowNetworkLinkageData(i).CompNum; + Real64 control = AirflowNetworkLinkageData(i).control_value * AirflowNetworkLinkageData(i).control_schedule->getCurrentVal(); NF = AirflowNetworkLinkageData(i).element->calculate(m_state, LFLAG, DP, i, multiplier, control, node_states[n], node_states[m], F, DF); - if (AirflowNetworkLinkageData(i).element->type() == ComponentType::CPD && DP != 0.0) { - DP = DisSysCompCPDData(AirflowNetworkCompData(j).TypeNum).DP; + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::CPD && DP != 0.0) { + DP = static_cast (AirflowNetworkLinkageData(i).element)->DP; } AirflowNetworkLinkSimu(i).DP = DP; AFLOW(i) = F[0]; AFLOW2(i) = 0.0; - if (AirflowNetworkCompData(j).CompTypeNum == iComponentTypeNum::DOP) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::DOP) { AFLOW2(i) = F[1]; } // if (LIST >= 3) ObjexxFCL::gio::write(outputFile, Format_901) << " NRi:" << i << n << M << AirflowNetworkLinkSimu(i).DP << F[0] << diff --git a/src/EnergyPlus/CrossVentMgr.cc b/src/EnergyPlus/CrossVentMgr.cc index c870ca9c77c..8bd0cc2da04 100644 --- a/src/EnergyPlus/CrossVentMgr.cc +++ b/src/EnergyPlus/CrossVentMgr.cc @@ -353,7 +353,7 @@ namespace RoomAir { // Identify the dominant aperture: MaxSurf = state.dataRoomAir->AFNSurfaceCrossVent(1, ZoneNum); - int const surfNum = state.afn->MultizoneSurfaceData(MaxSurf).SurfNum; + int const surfNum = state.afn->MultizoneSurfaceData(MaxSurf).surface_number; auto const &thisSurface = state.dataSurface->Surface(surfNum); int afnSurfNum1 = state.dataRoomAir->AFNSurfaceCrossVent(1, ZoneNum); @@ -370,7 +370,7 @@ namespace RoomAir { for (int Ctd2 = 2; Ctd2 <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++Ctd2) { int afnSurfNum = state.dataRoomAir->AFNSurfaceCrossVent(Ctd2, ZoneNum); - if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(afnSurfNum).SurfNum).Zone == ZoneNum) { + if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(afnSurfNum).surface_number).Zone == ZoneNum) { if (state.afn->AirflowNetworkLinkSimu(afnSurfNum).VolFLOW2 > MaxFlux) { MaxFlux = state.afn->AirflowNetworkLinkSimu(afnSurfNum).VolFLOW2; MaxSurf = afnSurfNum; @@ -424,9 +424,9 @@ namespace RoomAir { auto &jetRecFlows = state.dataRoomAir->CrossVentJetRecFlows(Ctd, ZoneNum); auto const &surfParams = state.dataRoomAir->SurfParametersCrossDispVent(Ctd); int cCompNum = state.afn->AirflowNetworkLinkageData(Ctd).CompNum; - if (state.afn->AirflowNetworkCompData(cCompNum).CompTypeNum == AirflowNetwork::iComponentTypeNum::DOP) { + if (state.afn->AirflowNetworkCompData(cCompNum).CompTypeNum == AirflowNetwork::AirflowElementType::DOP) { jetRecFlows.Area = surfParams.Width * surfParams.Height * state.afn->MultizoneSurfaceData(Ctd).OpenFactor; - } else if (state.afn->AirflowNetworkCompData(cCompNum).CompTypeNum == AirflowNetwork::iComponentTypeNum::SCR) { + } else if (state.afn->AirflowNetworkCompData(cCompNum).CompTypeNum == AirflowNetwork::AirflowElementType::SCR) { jetRecFlows.Area = surfParams.Width * surfParams.Height; } else { ShowSevereError( @@ -495,7 +495,7 @@ namespace RoomAir { // Calculate inflow velocity (%Uin) for each aperture in the zone for (int Ctd = 1; Ctd <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++Ctd) { auto &jetRecFlows = state.dataRoomAir->CrossVentJetRecFlows(Ctd, ZoneNum); - if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(Ctd).SurfNum).Zone == ZoneNum) { + if (state.dataSurface->Surface(state.afn->MultizoneSurfaceData(Ctd).surface_number).Zone == ZoneNum) { // this is a direct airflow network aperture jetRecFlows.Fin = state.afn->AirflowNetworkLinkSimu(state.dataRoomAir->AFNSurfaceCrossVent(Ctd, ZoneNum)).VolFLOW2; } else { diff --git a/src/EnergyPlus/DisplacementVentMgr.cc b/src/EnergyPlus/DisplacementVentMgr.cc index a400199b944..d287d745196 100644 --- a/src/EnergyPlus/DisplacementVentMgr.cc +++ b/src/EnergyPlus/DisplacementVentMgr.cc @@ -681,7 +681,7 @@ namespace RoomAir { auto const &surfParams = state.dataRoomAir->SurfParametersCrossDispVent(afnSurfNum); auto const &afnLinkSimu = state.afn->AirflowNetworkLinkSimu(afnSurfNum); auto const &afnMzSurfData = state.afn->MultizoneSurfaceData(afnSurfNum); - auto const &afnMzSurf = state.dataSurface->Surface(afnMzSurfData.SurfNum); + auto const &afnMzSurf = state.dataSurface->Surface(afnMzSurfData.surface_number); if (afnMzSurf.Zone == ZoneNum) { if ((surfParams.Zmax < 0.8 && afnLinkSimu.VolFLOW > 0)) { diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 47d0e27d06d..61dd09c9be2 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -1037,14 +1037,14 @@ namespace RoomAir { auto const &mzSurfaceData = state.afn->MultizoneSurfaceData(iLink); int nodeNum1 = mzSurfaceData.NodeNums[0]; int nodeNum2 = mzSurfaceData.NodeNums[1]; - if (state.dataSurface->Surface(mzSurfaceData.SurfNum).Zone == zoneCV.ZonePtr || + if (state.dataSurface->Surface(mzSurfaceData.surface_number).Zone == zoneCV.ZonePtr || (state.afn->AirflowNetworkNodeData(nodeNum2).EPlusZoneNum == zoneCV.ZonePtr && state.afn->AirflowNetworkNodeData(nodeNum1).EPlusZoneNum > 0) || (state.afn->AirflowNetworkNodeData(nodeNum2).EPlusZoneNum > 0 && state.afn->AirflowNetworkNodeData(nodeNum1).EPlusZoneNum == zoneCV.ZonePtr)) { int compNum = state.afn->AirflowNetworkLinkageData(iLink).CompNum; int typeNum = state.afn->AirflowNetworkCompData(compNum).TypeNum; - if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::iComponentTypeNum::SCR) { + if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::AirflowElementType::SCR) { if (state.afn->MultizoneSurfaceCrackData(typeNum).exponent != 0.50) { state.dataRoomAir->AirModel(zoneCV.ZonePtr).AirModel = RoomAirModel::Mixing; ShowWarningError(state, format("Problem with {} = {}", ipsc->cCurrentModuleObject, ipsc->cAlphaArgs(1))); @@ -1913,11 +1913,11 @@ namespace RoomAir { // calculate maximum number of airflow network surfaces in each zone for (int iMzLink = 1; iMzLink <= state.afn->NumOfLinksMultiZone; ++iMzLink) { - auto const &mzSurf = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(iMzLink).SurfNum); + auto const &mzSurf = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(iMzLink).surface_number); ++AuxSurf(mzSurf.Zone); ++state.dataRoomAir->CrossVentNumAFNSurfaces; // Check if this is an interzone airflow network surface - if (mzSurf.ExtBoundCond > 0 && (state.afn->MultizoneSurfaceData(iMzLink).SurfNum != mzSurf.ExtBoundCond)) { + if (mzSurf.ExtBoundCond > 0 && (state.afn->MultizoneSurfaceData(iMzLink).surface_number != mzSurf.ExtBoundCond)) { ++AuxSurf(state.dataSurface->Surface(mzSurf.ExtBoundCond).Zone); ++state.dataRoomAir->CrossVentNumAFNSurfaces; } @@ -1951,7 +1951,7 @@ namespace RoomAir { int SurfNum = 1; for (int iMzLink = 1; iMzLink <= state.afn->NumOfLinksMultiZone; ++iMzLink) { - auto const &mzSurf = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(iMzLink).SurfNum); + auto const &mzSurf = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(iMzLink).surface_number); auto &surfParams = state.dataRoomAir->SurfParametersCrossDispVent(iMzLink); if (mzSurf.Zone == iZone) { @@ -1960,7 +1960,7 @@ namespace RoomAir { // calculate the surface width and height int compNum = state.afn->AirflowNetworkLinkageData(iMzLink).CompNum; int typeNum = state.afn->AirflowNetworkCompData(compNum).TypeNum; - if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::iComponentTypeNum::DOP) { + if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::AirflowElementType::DOP) { Real64 WidthFactMax = 0.0; Real64 HeightFactMax = 0.0; @@ -1992,7 +1992,7 @@ namespace RoomAir { surfParams.Height = HeightFactMax * mzSurf.Height; } else if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == - AirflowNetwork::iComponentTypeNum::SCR) { // surface type = CRACK + AirflowNetwork::AirflowElementType::SCR) { // surface type = CRACK surfParams.Width = mzSurf.Width / 2; auto const &zoneHeatBal = state.dataZoneTempPredictorCorrector->zoneHeatBalance(iZone); Real64 AinCV = @@ -2003,9 +2003,9 @@ namespace RoomAir { } // calculate the surface Zmin and Zmax - if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::iComponentTypeNum::DOP || + if (state.afn->AirflowNetworkCompData(compNum).CompTypeNum == AirflowNetwork::AirflowElementType::DOP || state.afn->AirflowNetworkCompData(compNum).CompTypeNum == - AirflowNetwork::iComponentTypeNum::SCR) { // surface type = CRACK + AirflowNetwork::AirflowElementType::SCR) { // surface type = CRACK Real64 z_min(std::numeric_limits::max()), z_max(std::numeric_limits::lowest()); for (int i = 1; i <= mzSurf.Sides; ++i) { Real64 const z_i = mzSurf.Vertex(i).z; @@ -2509,14 +2509,14 @@ namespace RoomAir { zone.Name); for (int i = 1; i <= state.dataRoomAir->AFNSurfaceCrossVent(0, ZoneNum); ++i) { int N = state.afn->AirflowNetworkLinkageData(i).CompNum; - if (state.afn->AirflowNetworkCompData(N).CompTypeNum == AirflowNetwork::iComponentTypeNum::DOP) { + if (state.afn->AirflowNetworkCompData(N).CompTypeNum == AirflowNetwork::AirflowElementType::DOP) { SetupOutputVariable(state, "Room Air Window Jet Region Average Air Velocity", Constant::Units::m_s, state.dataRoomAir->CrossVentJetRecFlows(i, iZone).Ujet, OutputProcessor::TimeStepType::Zone, OutputProcessor::StoreType::Average, - state.afn->MultizoneSurfaceData(i).SurfName); + state.afn->MultizoneSurfaceData(i).surface_name); } } } // for (iZone) diff --git a/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc b/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc index a69a91faaf8..825d45054a8 100644 --- a/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc +++ b/src/EnergyPlus/ZoneContaminantPredictorCorrector.cc @@ -341,7 +341,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) contam.Name = AlphaName(1); contam.SurfName = AlphaName(2); - contam.SurfNum = Util::FindItemInList(AlphaName(2), state.afn->MultizoneSurfaceData, &AirflowNetwork::MultizoneSurfaceProp::SurfName); + contam.SurfNum = Util::FindItemInList(AlphaName(2), state.afn->MultizoneSurfaceData, &AirflowNetwork::MultizoneSurfaceProp::surface_name); if (contam.SurfNum == 0) { ShowSevereError(state, format("{}{}=\"{}\", invalid {} entered={}", @@ -355,7 +355,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) } // Ensure external surface if (contam.SurfNum > 0 && - state.dataSurface->Surface(state.afn->MultizoneSurfaceData(contam.SurfNum).SurfNum).ExtBoundCond != DataSurfaces::ExternalEnvironment) { + state.dataSurface->Surface(state.afn->MultizoneSurfaceData(contam.SurfNum).surface_number).ExtBoundCond != DataSurfaces::ExternalEnvironment) { ShowSevereError( state, format( @@ -418,7 +418,7 @@ void GetZoneContaminanInputs(EnergyPlusData &state) contam.Name); if (contam.SurfNum > 0) { - ZonePtr = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(contam.SurfNum).SurfNum).Zone; + ZonePtr = state.dataSurface->Surface(state.afn->MultizoneSurfaceData(contam.SurfNum).surface_number).Zone; } else { ZonePtr = 0; } diff --git a/testfiles/AirflowNetwork3zVent.idf b/testfiles/AirflowNetwork3zVent.idf index a3870418baa..3a4a17c6fe2 100644 --- a/testfiles/AirflowNetwork3zVent.idf +++ b/testfiles/AirflowNetwork3zVent.idf @@ -853,6 +853,17 @@ 0, !- Lower Limit Value 4, !- Upper Limit Value DISCRETE; !- Numeric Type + + Schedule:Compact, + Window2Control, !- Name + Fraction, !- Schedule Type Limits Name + Through: 12/31, !- Field 1 + For: WeekDays, !- Field 2 + Until: 10:00,0.0, !- Field 3 + Until: 14:00,0.5, !- Field 5 + Until: 24:00,0.0, !- Field 7 + For: AllOtherDays, !- Field 9 + Until: 24:00,0.0; !- Field 10 Schedule:Compact, Activity Sch, !- Name @@ -1106,7 +1117,7 @@ AirflowNetwork:MultiZone:Zone, NORTH_ZONE, !- Zone Name - Temperature, !- Ventilation Control Mode + NoVent, !- Ventilation Control Mode WindowVentSched, !- Ventilation Control Zone Temperature Setpoint Schedule Name 1.0, !- Minimum Venting Open Factor {dimensionless} 0.0, !- Indoor and Outdoor Temperature Difference Lower Limit For Maximum Venting Open Factor {deltaC} @@ -1190,7 +1201,19 @@ Window2, !- Surface Name WiOpen1, !- Leakage Component Name NFacade, !- External Node Name - 0.5; !- Window/Door Opening Factor, or Crack Factor {dimensionless} + 0.5, !- Window/Door Opening Factor, or Crack Factor {dimensionless} + , + , + , + , + , + , + , + , + , + , + , + Window2Control; AirflowNetwork:MultiZone:Surface, Surface_16, !- Surface Name diff --git a/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc index e2672b04e87..98f7fce4378 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkComponents.unit.cc @@ -93,8 +93,8 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_SolverTest_HorizontalOpening) state->afn->AirflowNetworkCompData.allocate(j); state->afn->AirflowNetworkCompData(j).TypeNum = 1; state->afn->MultizoneSurfaceData.allocate(i); - state->afn->MultizoneSurfaceData(i).Width = 10.0; - state->afn->MultizoneSurfaceData(i).Height = 5.0; + state->afn->MultizoneSurfaceData(i).width = 10.0; + state->afn->MultizoneSurfaceData(i).height = 5.0; state->afn->MultizoneSurfaceData(i).OpenFactor = 1.0; state->afn->node_states.clear(); @@ -2457,32 +2457,32 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestPolygonalWindows) state->afn->get_input(); // Choice: Height; Base Surface: Vertical Rectangular - EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(1).Width, 0.0001); - EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(1).Height, 0.0001); + EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(1).width, 0.0001); + EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(1).height, 0.0001); // Choice: Height; Base Surface: Vertical Polygon - EXPECT_NEAR(1.666667, state->afn->MultizoneSurfaceData(2).Width, 0.0001); - EXPECT_NEAR(1.5, state->afn->MultizoneSurfaceData(2).Height, 0.0001); + EXPECT_NEAR(1.666667, state->afn->MultizoneSurfaceData(2).width, 0.0001); + EXPECT_NEAR(1.5, state->afn->MultizoneSurfaceData(2).height, 0.0001); // Choice: Base aspect ratio; Base Surface: Vertical Rectangular - EXPECT_NEAR(1.454907, state->afn->MultizoneSurfaceData(3).Width, 0.0001); - EXPECT_NEAR(0.343664, state->afn->MultizoneSurfaceData(3).Height, 0.0001); + EXPECT_NEAR(1.454907, state->afn->MultizoneSurfaceData(3).width, 0.0001); + EXPECT_NEAR(0.343664, state->afn->MultizoneSurfaceData(3).height, 0.0001); // Choice: User aspect ratio; Base Surface: Vertical Rectangular - EXPECT_NEAR(0.70711, state->afn->MultizoneSurfaceData(4).Width, 0.0001); - EXPECT_NEAR(0.70711, state->afn->MultizoneSurfaceData(4).Height, 0.0001); + EXPECT_NEAR(0.70711, state->afn->MultizoneSurfaceData(4).width, 0.0001); + EXPECT_NEAR(0.70711, state->afn->MultizoneSurfaceData(4).height, 0.0001); // Choice: Base aspect ratio --> Height; Base Surface: Vertical Polygon - EXPECT_NEAR(0.5, state->afn->MultizoneSurfaceData(5).Width, 0.0001); - EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(5).Height, 0.0001); + EXPECT_NEAR(0.5, state->afn->MultizoneSurfaceData(5).width, 0.0001); + EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(5).height, 0.0001); // Choice: Height --> Base aspect ratio; Base Surface: Horizontal Rectangular - EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(6).Width, 0.0001); - EXPECT_NEAR(0.5, state->afn->MultizoneSurfaceData(6).Height, 0.0001); + EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(6).width, 0.0001); + EXPECT_NEAR(0.5, state->afn->MultizoneSurfaceData(6).height, 0.0001); // Choice: Base aspect ratio; Base Surface: Horizontal Rectangular - EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(7).Width, 0.0001); - EXPECT_NEAR(0.5, state->afn->MultizoneSurfaceData(7).Height, 0.0001); + EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(7).width, 0.0001); + EXPECT_NEAR(0.5, state->afn->MultizoneSurfaceData(7).height, 0.0001); // Choice: Base aspect ratio --> User Aspect Ratio; Base Surface: Horizontal Polygon - EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(8).Width, 0.0001); - EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(8).Height, 0.0001); + EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(8).width, 0.0001); + EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(8).height, 0.0001); // Choice: Height --> User Aspect Ratio; Base Surface: Horizontal Polygon - EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(9).Width, 0.0001); - EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(9).Height, 0.0001); + EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(9).width, 0.0001); + EXPECT_NEAR(1.0, state->afn->MultizoneSurfaceData(9).height, 0.0001); state->dataHeatBal->Zone.deallocate(); state->dataSurface->Surface.deallocate(); diff --git a/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc index fb020f3bc32..4450e0d3456 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkConditions.unit.cc @@ -6070,8 +6070,8 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestOtherSideCoefficients) state->dataSurface->Surface(1).Azimuth = 0.0; state->dataSurface->Surface(2).Azimuth = 180.0; - state->afn->MultizoneSurfaceData(1).SurfNum = 1; - state->afn->MultizoneSurfaceData(2).SurfNum = 2; + state->afn->MultizoneSurfaceData(1).surface_number = 1; + state->afn->MultizoneSurfaceData(2).surface_number = 2; state->afn->calculate_Cps(); EXPECT_EQ(1, state->afn->MultizoneSurfaceData(1).NodeNums[1]); diff --git a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc index ae8ea7420eb..60f7dc26d5d 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc @@ -6035,9 +6035,22 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneInfiSenLossW, 95.89575, 0.001); EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneInfiLatLossW, 0.969147, 0.001); - state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::iComponentTypeNum::DOP; - state->afn->report(); + for (int i = 1; i <= state->afn->AirflowNetworkLinkageData.isize(); ++i) { + std::cerr << i << ' ' << state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(i).CompNum).CompTypeNum << std::endl; + EXPECT_EQ(state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(i).CompNum).CompTypeNum, + state->afn->AirflowNetworkLinkageData(i).element->type()); + } + // The original test was changing the CompTypeNum, as that goes away it's necessaey to actually + // switch out the elements. This is probably an unwise approach. + auto const ye_olde_element = state->afn->AirflowNetworkLinkageData(2).element; + AirflowNetwork::DetailedOpening dop; + for (auto &link : state->afn->AirflowNetworkLinkageData) { + if (link.element == ye_olde_element) { + link.element = &dop; + } + } + state->afn->report(); EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneVentSenLossW, 95.89575, 0.001); EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneVentLatLossW, 0.969147, 0.001); // #8475 @@ -6053,7 +6066,12 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).VentilAirChangeRate, 0.2438, 0.001); EXPECT_NEAR(state->afn->AirflowNetworkZnRpt(1).VentilMass, 0.85114, 0.001); // Infiltration - state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::iComponentTypeNum::SCR; + // Switch the element back + for (auto &link : state->afn->AirflowNetworkLinkageData) { + if (link.element == &dop) { + link.element = ye_olde_element; + } + } state->afn->update(); state->afn->report(); EXPECT_NEAR(state->afn->exchangeData(1).SumMCp, 2.38012, 0.001); @@ -11068,7 +11086,7 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingAirBoundary) " ** Warning ** AirflowNetwork::Solver::get_input: AirflowNetwork:MultiZone:Surface=\"AIR WALL AULA 2\" is an air boundary surface.", " ** ~~~ ** Ventilation Control Mode = TEMPERATURE is not valid. Resetting to Constant.", " ** Warning ** AirflowNetwork::Solver::get_input: : AirflowNetwork:MultiZone:Surface = AIR WALL AULA 2", - " ** ~~~ ** Venting Availbility Schedule is not empty.", + " ** ~~~ ** Venting Availability Schedule is not empty.", " ** ~~~ ** Venting is always available for air-boundary surfaces."}); EXPECT_TRUE(compare_err_stream(expectedErrString, true)); @@ -11076,12 +11094,12 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_TestZoneVentingAirBoundary) // venting schedule should be non-zero and venting method should be ZoneLevel auto *ventingSched = Sched::GetSchedule(*state, state->afn->MultizoneSurfaceData(1).VentAvailSchName); EXPECT_EQ(ventingSched, state->afn->MultizoneSurfaceData(1).ventAvailSched); - EXPECT_ENUM_EQ(state->afn->MultizoneSurfaceData(1).VentSurfCtrNum, AirflowNetwork::VentControlType::Temp); + EXPECT_ENUM_EQ(state->afn->MultizoneSurfaceData(1).ventilation_control_type, AirflowNetwork::VentControlType::Temp); // MultizoneSurfaceData(2) is connected to an air boundary surface // venting schedule should be zero and venting method should be Constant EXPECT_EQ(state->afn->MultizoneSurfaceData(2).ventAvailSched, Sched::GetScheduleAlwaysOn(*state)); - EXPECT_ENUM_EQ(state->afn->MultizoneSurfaceData(2).VentSurfCtrNum, AirflowNetwork::VentControlType::Const); + EXPECT_ENUM_EQ(state->afn->MultizoneSurfaceData(2).ventilation_control_type, AirflowNetwork::VentControlType::Const); } TEST_F(EnergyPlusFixture, AirflowNetwork_TestNoZoneEqpSupportZoneERV) @@ -16755,8 +16773,8 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_DuctSizingTest) state->afn->AirflowNetworkNodeData(19).EPlusNodeNum = 2; state->afn->AirflowNetworkNodeData(20).EPlusNodeNum = 11; state->afn->AirflowNetworkNodeData(21).EPlusNodeNum = 3; - state->afn->AirflowNetworkNodeData(11).EPlusTypeNum = AirflowNetwork::iEPlusNodeType::ZIN; - state->afn->AirflowNetworkNodeData(12).EPlusTypeNum = AirflowNetwork::iEPlusNodeType::ZOU; + state->afn->AirflowNetworkNodeData(11).EPlusTypeNum = AirflowNetwork::EPlusNodeType::ZIN; + state->afn->AirflowNetworkNodeData(12).EPlusTypeNum = AirflowNetwork::EPlusNodeType::ZOU; state->dataEnvrn->StdRhoAir = 1.2; state->afn->DisSysCompCVFData(1).FlowRate = 1.23; state->afn->SizeDucts(); diff --git a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc index 4a05a8f2b49..f4812e786fb 100644 --- a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc +++ b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc @@ -84,9 +84,9 @@ TEST_F(EnergyPlusFixture, CrossVentMgr_EvolveParaUCSDCV_Test) state->dataRoomAir->AFNSurfaceCrossVent(0, 2) = 2; state->afn->MultizoneSurfaceData.allocate(MaxSurf); - state->afn->MultizoneSurfaceData(1).SurfNum = 6; + state->afn->MultizoneSurfaceData(1).surface_number = 6; state->afn->MultizoneSurfaceData(1).OpenFactor = 1.; - state->afn->MultizoneSurfaceData(2).SurfNum = 9; + state->afn->MultizoneSurfaceData(2).surface_number = 9; state->afn->MultizoneSurfaceData(2).OpenFactor = 1.; state->dataSurface->Surface.allocate(10); @@ -131,11 +131,11 @@ TEST_F(EnergyPlusFixture, CrossVentMgr_EvolveParaUCSDCV_Test) state->afn->AirflowNetworkCompData.allocate(3); state->afn->AirflowNetworkCompData(1).TypeNum = 1; - state->afn->AirflowNetworkCompData(1).CompTypeNum = AirflowNetwork::iComponentTypeNum::DOP; + state->afn->AirflowNetworkCompData(1).CompTypeNum = AirflowNetwork::AirflowElementType::DOP; state->afn->AirflowNetworkCompData(2).TypeNum = 1; - state->afn->AirflowNetworkCompData(2).CompTypeNum = AirflowNetwork::iComponentTypeNum::SCR; + state->afn->AirflowNetworkCompData(2).CompTypeNum = AirflowNetwork::AirflowElementType::SCR; state->afn->AirflowNetworkCompData(3).TypeNum = 2; - state->afn->AirflowNetworkCompData(3).CompTypeNum = AirflowNetwork::iComponentTypeNum::SOP; + state->afn->AirflowNetworkCompData(3).CompTypeNum = AirflowNetwork::AirflowElementType::SOP; state->dataRoomAir->SurfParametersCrossDispVent.allocate(2); state->dataRoomAir->SurfParametersCrossDispVent(1).Width = 22.715219999999999;