From 1d91a7d7386ac7263ea54d55d01f5fd3c877fc08 Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Wed, 19 Mar 2025 22:12:36 -0400 Subject: [PATCH 01/10] Some long-overdue reorg of the files --- src/EnergyPlus/AirflowNetwork/CMakeLists.txt | 4 +- .../include/AirflowNetwork/Elements.hpp | 368 +----------------- .../include/AirflowNetwork/Linkages.hpp | 277 +++++++++++++ .../include/AirflowNetwork/Nodes.hpp | 220 +++++++++++ .../include/AirflowNetwork/Solver.hpp | 1 + .../include/AirflowNetwork/Types.hpp | 204 ++++++++++ .../AirflowNetwork/src/Elements.cpp | 12 - .../AirflowNetwork/src/Linkages.cpp | 56 +++ src/EnergyPlus/AirflowNetwork/src/Nodes.cpp | 56 +++ src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 11 +- 10 files changed, 823 insertions(+), 386 deletions(-) create mode 100644 src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp create mode 100644 src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Nodes.hpp create mode 100644 src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Types.hpp create mode 100644 src/EnergyPlus/AirflowNetwork/src/Linkages.cpp create mode 100644 src/EnergyPlus/AirflowNetwork/src/Nodes.cpp 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..75039c0e0a9 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() @@ -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 @@ -1309,18 +1045,6 @@ namespace AirflowNetwork { } }; - 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 AirflowNetworkNodeProp // AirflowNetwork nodal data { // Members @@ -1367,26 +1091,6 @@ namespace AirflowNetwork { } }; - 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) - { - } - }; - struct PressureControllerProp { // Members @@ -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..7f48e4a8a13 --- /dev/null +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp @@ -0,0 +1,277 @@ +// 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 +#include +#include + +namespace EnergyPlus { + +// Forward declarations +struct EnergyPlusData; +struct AirflowNetworkData; + +namespace AirflowNetwork { + + // Forward declaration + struct AirflowElement; + + 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 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 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 + 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) + { + } + }; + + 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) + { + } + }; + +} // 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..b1abd5a387d --- /dev/null +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Nodes.hpp @@ -0,0 +1,220 @@ +// 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; + iEPlusNodeType 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(iEPlusNodeType::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..586caa0f8fe 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 diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Types.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Types.hpp new file mode 100644 index 00000000000..b4bfbaf4731 --- /dev/null +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Types.hpp @@ -0,0 +1,204 @@ +// 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 // 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 + }; + + 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 + }; + + 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 + }; + + 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; + +} // namespace AirflowNetwork + +} // namespace EnergyPlus + +#endif diff --git a/src/EnergyPlus/AirflowNetwork/src/Elements.cpp b/src/EnergyPlus/AirflowNetwork/src/Elements.cpp index c68f5e27b66..8966c184181 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; diff --git a/src/EnergyPlus/AirflowNetwork/src/Linkages.cpp b/src/EnergyPlus/AirflowNetwork/src/Linkages.cpp new file mode 100644 index 00000000000..3137c0f6712 --- /dev/null +++ b/src/EnergyPlus/AirflowNetwork/src/Linkages.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/Linkages.hpp" + +namespace EnergyPlus { + +namespace AirflowNetwork { + +} // 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/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index b8208dde3f0..3c71dac3643 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -114,14 +114,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. From cc5bca82f5ca007163ee2c217b3d088b5f85590f Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Thu, 20 Mar 2025 11:52:11 -0400 Subject: [PATCH 02/10] Refactor prep and clean up --- .../include/AirflowNetwork/Elements.hpp | 92 +-- .../include/AirflowNetwork/Linkages.hpp | 16 +- .../include/AirflowNetwork/Nodes.hpp | 7 +- .../include/AirflowNetwork/Solver.hpp | 2 +- .../include/AirflowNetwork/Types.hpp | 108 ++-- .../AirflowNetwork/src/Elements.cpp | 8 +- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 569 +++++++++--------- src/EnergyPlus/CrossVentMgr.cc | 4 +- src/EnergyPlus/RoomAirModelManager.cc | 12 +- .../unit/AirflowNetworkHVAC.unit.cc | 8 +- tst/EnergyPlus/unit/CrossVentMgr.unit.cc | 6 +- 11 files changed, 392 insertions(+), 440 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp index 75039c0e0a9..f54e0080cb8 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Elements.hpp @@ -163,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 @@ -289,9 +289,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::DOP; + return AirflowElementType::DOP; } }; @@ -321,9 +321,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::SOP; + return AirflowElementType::SOP; } }; @@ -352,9 +352,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::HOP; + return AirflowElementType::HOP; } }; @@ -380,9 +380,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::SMF; + return AirflowElementType::SMF; } }; @@ -408,9 +408,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::SVF; + return AirflowElementType::SVF; } }; @@ -470,9 +470,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::SCR; + return AirflowElementType::SCR; } }; @@ -513,9 +513,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::SEL; + return AirflowElementType::SEL; } }; @@ -563,9 +563,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::EXF; + return AirflowElementType::EXF; } }; @@ -665,9 +665,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::PLR; + return AirflowElementType::PLR; } }; @@ -706,9 +706,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::ELR; + return AirflowElementType::ELR; } }; @@ -764,9 +764,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::DWC; + return AirflowElementType::DWC; } }; @@ -811,9 +811,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::DMP; + return AirflowElementType::DMP; } }; @@ -849,9 +849,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::CVF; + return AirflowElementType::CVF; } }; @@ -895,9 +895,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::FAN; + return AirflowElementType::FAN; } }; @@ -936,9 +936,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::COI; + return AirflowElementType::COI; } }; @@ -977,9 +977,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::HEX; + return AirflowElementType::HEX; } }; @@ -1010,9 +1010,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::TMU; + return AirflowElementType::TMU; } }; @@ -1039,9 +1039,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::CPD; + return AirflowElementType::CPD; } }; @@ -1060,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 @@ -1068,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) { } }; @@ -1077,16 +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) + AirflowNetworkCompProp() : CompTypeNum(AirflowElementType::Invalid), TypeNum(0), CompNum(0), EPlusTypeNum(EPlusComponentType::Invalid) { } }; @@ -1151,9 +1151,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::OAF; + return AirflowElementType::OAF; } }; @@ -1177,9 +1177,9 @@ namespace AirflowNetwork { std::array &DF // Partial derivative: DF/DP ); - virtual ComponentType type() + virtual AirflowElementType type() { - return ComponentType::REL; + return AirflowElementType::REL; } }; diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp index 7f48e4a8a13..7506fb3478b 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp @@ -83,14 +83,10 @@ namespace AirflowNetwork { 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 + 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" @@ -186,7 +182,7 @@ namespace AirflowNetwork { std::string ZoneName; // Name of zone int ZoneNum; // Zone Number int DetOpenNum; // Large Opening number - iEPlusComponentType ConnectionFlag; // Return and supply connection flag + 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 @@ -194,7 +190,7 @@ namespace AirflowNetwork { // Default Constructor AirflowNetworkLinkageProp() - : AirflowNetworkLinkage(), ZoneNum(0), DetOpenNum(0), ConnectionFlag(iEPlusComponentType::Invalid), VAVTermDamper(false), + : AirflowNetworkLinkage(), ZoneNum(0), DetOpenNum(0), ConnectionFlag(EPlusComponentType::Invalid), VAVTermDamper(false), LinkageViewFactorObjectNum(0), AirLoopNum(0), ductLineType(DuctLineType::Invalid) { } diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Nodes.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Nodes.hpp index b1abd5a387d..d16b38a05df 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Nodes.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Nodes.hpp @@ -161,14 +161,13 @@ namespace AirflowNetwork { 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; + 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; - iEPlusNodeType EPlusTypeNum; + EPlusNodeType EPlusTypeNum; int RAFNNodeNum; // RoomAir model node number int NumOfLinks; // Number of links for RoomAir model int AirLoopNum; // AirLoop number @@ -176,7 +175,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) { } }; diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp index 586caa0f8fe..623fc5ad1c4 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Solver.hpp @@ -201,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 index b4bfbaf4731..4ebc3ecc0c9 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Types.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Types.hpp @@ -52,7 +52,7 @@ namespace EnergyPlus { namespace AirflowNetwork { - enum VentControlType // TODO: make enum class + enum VentControlType { None = 0, // Wrong input Temp = 1, // Temperature venting control @@ -66,67 +66,38 @@ namespace AirflowNetwork { AdjEnth = 9 // Enthalpy venting control based on adjacent zone conditions }; - enum OpenStatus // TODO: make enum class + 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 // TODO: make enum class + 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 + 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 + enum class DuctLineType : int { Invalid = -1, SupplyTrunk, // Supply trunk - SupplyBranch, // SupplyBrnach + SupplyBranch, // Supply branch ReturnTrunk, // Return trunk - ReturnBranch, // ReturnBrnach + ReturnBranch, // Return branch }; - enum class iComponentTypeNum : int + enum class AirflowElementType : 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 @@ -149,49 +120,44 @@ namespace AirflowNetwork { OAF, // Distribution system OA REL, // Distribution system relief air SMF, // Specified mass flow component - SVF, // Specified volume flow component - Num + SVF // Specified volume flow component }; - enum class iEPlusComponentType : int + enum class EPlusComponentType : 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 + 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 iEPlusNodeType : int + enum class EPlusNodeType : 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 + 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 iWPCCntr : int + enum class WindPressureType : int { - Invalid = 0, - Input = 1, - SurfAvg = 2, - Num + Input, + SurfAvg }; int constexpr PressureCtrlExhaust = 1; diff --git a/src/EnergyPlus/AirflowNetwork/src/Elements.cpp b/src/EnergyPlus/AirflowNetwork/src/Elements.cpp index 8966c184181..69a6532e34b 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Elements.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Elements.cpp @@ -736,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]; @@ -3931,7 +3931,7 @@ namespace AirflowNetwork { Real64 RhoStd; int Fromz; int Toz; - iComponentTypeNum Ltyp; + AirflowElementType Ltyp; int i; int ll; int Pprof; @@ -3973,7 +3973,7 @@ namespace AirflowNetwork { } Ltyp = state.afn->AirflowNetworkCompData(state.afn->AirflowNetworkLinkageData(i).CompNum).CompTypeNum; - if (Ltyp == iComponentTypeNum::DOP) { + if (Ltyp == AirflowElementType::DOP) { ActLh = state.afn->MultizoneSurfaceData(i).Height; ActLOwnh = ActLh * 1.0; } else { @@ -4155,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/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 3c71dac3643..b9ed8c3c210 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 @@ -2094,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."); @@ -2113,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."); @@ -2499,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"); @@ -2991,7 +2989,7 @@ namespace AirflowNetwork { } // Outside face environment - if (simulation_control.iWPCCnt == iWPCCntr::Input) { + if (simulation_control.iWPCCnt == WindPressureType::Input) { n = m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond; if (n == ExternalEnvironment || (n == OtherSideCoefNoCalcExt && m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtWind)) { @@ -3128,7 +3126,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) + @@ -3181,7 +3179,7 @@ namespace AirflowNetwork { auto afe = elements.find(MultizoneSurfaceData(i).OpeningName); 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) { @@ -3504,7 +3502,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; @@ -3688,7 +3686,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, @@ -3699,7 +3697,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) + @@ -4085,7 +4083,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:"); @@ -4098,7 +4096,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:"); @@ -4123,7 +4121,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; @@ -4148,7 +4146,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; @@ -4209,26 +4207,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 { @@ -4254,7 +4252,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 = ""; @@ -4267,7 +4265,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 = ""; @@ -4280,7 +4278,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 = ""; @@ -4293,7 +4291,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 = ""; @@ -4306,7 +4304,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 = ""; @@ -4319,7 +4317,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 = ""; @@ -4332,7 +4330,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 = ""; @@ -4345,7 +4343,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 = ""; @@ -4358,7 +4356,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 = ""; @@ -4371,7 +4369,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 = ""; @@ -4384,13 +4382,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; @@ -4398,13 +4396,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; @@ -4412,7 +4410,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 = ""; @@ -4425,13 +4423,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; @@ -4439,13 +4437,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; @@ -4453,13 +4451,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; @@ -4467,7 +4465,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 = ""; @@ -4480,7 +4478,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 = ""; @@ -4495,7 +4493,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 = ""; @@ -4509,7 +4507,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 = ""; @@ -4569,12 +4567,12 @@ namespace AirflowNetwork { auto const &surf = m_state.dataSurface->Surface(MultizoneSurfaceData(count).SurfNum); switch (AirflowNetworkLinkageData(count).element->type()) { - case ComponentType::DOP: { + case AirflowElementType::DOP: { // if (AirflowNetworkLinkageData(count).CompName == // AirflowNetworkCompData(i).Name) { // AirflowNetworkLinkageData(count).CompNum = i; // found = true; - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::DOP) { + // if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::DOP) { ++j; AirflowNetworkLinkageData(count).DetOpenNum = j; MultizoneSurfaceData(count).Multiplier = surf.Multiplier; @@ -4604,8 +4602,8 @@ namespace AirflowNetwork { } } } break; - case ComponentType::SOP: { - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::SOP) { + case AirflowElementType::SOP: { + // if (AirflowNetworkCompData(i).CompTypeNum == 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"); @@ -4624,8 +4622,8 @@ namespace AirflowNetwork { ErrorsFound = true; } } break; - case ComponentType::HOP: { - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::HOP) { + case AirflowElementType::HOP: { + // if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::HOP) { MultizoneSurfaceData(count).Multiplier = surf.Multiplier; // Get linkage height from upper and lower zones if (MultizoneZoneData(AirflowNetworkLinkageData(count).NodeNums[0]).ZoneNum > 0) { @@ -4703,8 +4701,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 " + @@ -4880,51 +4878,51 @@ namespace AirflowNetwork { // AirflowNetworkCompData(j).Name)) { // // SurfaceAirflowLeakageNames // if (i <= 4 && j <= 4) { - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::DOP) + // if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::DOP) // CompName(1) = "AirflowNetwork:MultiZone:Component:DetailedOpening"; - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::SOP) + // if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::SOP) // CompName(1) = "AirflowNetwork:MultiZone:Component:SimpleOpening"; - // if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::SCR) CompName(1) = + // if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::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) = + // AirflowElementType::SEL) CompName(1) = "AirflowNetwork:MultiZone:Surface:EffectiveLeakageArea"; if + // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::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) = + // AirflowElementType::SOP) CompName(2) = "AirflowNetwork:MultiZone:Component:SimpleOpening"; if + // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::SCR) CompName(2) = // "AirflowNetwork:MultiZone:Surface:Crack"; if (AirflowNetworkCompData(j).CompTypeNum == - // iComponentTypeNum::SEL) CompName(2) = "AirflowNetwork:MultiZone:Surface:EffectiveLeakageArea"; ShowSevereError(m_state, RoutineName + // AirflowElementType::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) = + // if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::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) = + // AirflowElementType::DWC) CompName(1) = "AirflowNetwork:Distribution:Component:Duct"; if + // (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::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) = + // AirflowElementType::DMP) CompName(1) = "AIRFLOWNETWORK:DISTRIBUTION:COMPONENT DAMPER"; if + // (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::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) = + // AirflowElementType::CPD) CompName(1) = "AirflowNetwork:Distribution:Component:ConstantPressureDrop"; if + // (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::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) = + // AirflowElementType::TMU) CompName(1) = "AirflowNetwork:Distribution:Component:TerminalUnit"; if + // (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::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) = + // AirflowElementType::PLR) CompName(2) = "AirflowNetwork:Distribution:Component:Leak"; if + // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::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) = + // AirflowElementType::ELR) CompName(2) = "AirflowNetwork:Distribution:Component:LeakageRatio"; if + // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::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) = + // AirflowElementType::CVF) CompName(2) = "AirflowNetwork:Distribution:Component:Fan"; if + // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::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) = + // == AirflowElementType::COI) CompName(2) = "AirflowNetwork:Distribution:Component:Coil"; if + // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::TMU) CompName(2) = // "AirflowNetwork:Distribution:Component:TerminalUnit"; if (AirflowNetworkCompData(j).CompTypeNum == - // iComponentTypeNum::HEX) CompName(2) = "AirflowNetwork:Distribution:Component:HeatExchanger"; ShowSevereError(m_state, + // AirflowElementType::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; @@ -5043,7 +5041,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, @@ -5067,7 +5065,7 @@ namespace AirflowNetwork { // AirflowNetworkNodeData(AirflowNetworkLinkageData(count).NodeNums[1]).EPlusZoneNum // > 0 && AirflowNetworkLinkageData(count).CompNum > 0) { if // (AirflowNetworkCompData(AirflowNetworkLinkageData(count).CompNum).CompTypeNum - // == iComponentTypeNum::SOP) { + // == AirflowElementType::SOP) { // } // } // if @@ -5076,7 +5074,7 @@ namespace AirflowNetwork { // AirflowNetworkNodeData(AirflowNetworkLinkageData(count).NodeNums[0]).EPlusZoneNum // > 0 && AirflowNetworkLinkageData(count).CompNum > 0) { if // (AirflowNetworkCompData(AirflowNetworkLinkageData(count).CompNum).CompTypeNum - // == iComponentTypeNum::SOP) { + // == AirflowElementType::SOP) { // } // } // } @@ -5122,7 +5120,7 @@ namespace AirflowNetwork { j = AirflowNetworkLinkageData(count).NodeNums[0]; k = AirflowNetworkLinkageData(count).NodeNums[1]; - if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::OAF) { + if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::OAF) { if (!Util::SameString(DisSysNodeData(j - NumOfNodesMultiZone).EPlusType, "OAMixerOutdoorAirStreamNode")) { ShowSevereError(m_state, format(RoutineName) + @@ -5146,7 +5144,7 @@ namespace AirflowNetwork { } } - if (AirflowNetworkCompData(i).CompTypeNum == iComponentTypeNum::REL) { + if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::REL) { if (!Util::SameString(DisSysNodeData(j - NumOfNodesMultiZone).EPlusType, "AirLoopHVAC:OutdoorAirSystem")) { ShowSevereError(m_state, format(RoutineName) + @@ -5615,9 +5613,9 @@ 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) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::DOP || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SOP || + AirflowNetworkLinkageData(i).element->type() == AirflowElementType::HOP) { SurfNum = MultizoneSurfaceData(i).SurfNum; SetupOutputVariable(m_state, "AFN Surface Venting Window or Door Opening Factor", @@ -6360,7 +6358,7 @@ namespace AirflowNetwork { if (i > AirflowNetworkNumOfSurfaces - NumOfLinksIntraZone) { continue; } - if (AirflowNetworkLinkageData(i).element->type() == ComponentType::SCR) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SCR) { AirflowNetworkLinkageData(i).control = MultizoneSurfaceData(i).Factor; } if (MultizoneSurfaceData(i).OccupantVentilationControlNum == 0) MultizoneSurfaceData(i).OpenFactor = 0.0; @@ -6389,9 +6387,9 @@ 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 (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::DOP || + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SOP || + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == 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 && @@ -7245,13 +7243,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; @@ -7268,7 +7265,7 @@ 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; std::string CompName = AirflowNetworkCompData(CompNum).EPlusName; @@ -7276,7 +7273,7 @@ namespace AirflowNetwork { 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]; @@ -7487,7 +7484,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]; @@ -7513,7 +7510,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]; @@ -7526,7 +7523,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]; @@ -7544,7 +7541,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)) { @@ -7576,7 +7573,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) { @@ -7605,45 +7602,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; } @@ -7674,7 +7671,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; @@ -7687,7 +7684,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; @@ -7704,7 +7701,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); @@ -7725,14 +7722,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; @@ -7745,12 +7740,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; 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]; @@ -7784,7 +7779,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]; @@ -7812,7 +7807,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]; @@ -7825,7 +7820,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]; @@ -7843,7 +7838,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)) { @@ -7875,7 +7870,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) { @@ -7903,44 +7898,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; } @@ -7967,8 +7962,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; @@ -7980,7 +7975,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 " + @@ -7992,9 +7987,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; @@ -8013,24 +8008,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; 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]; @@ -8044,7 +8037,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]; @@ -8058,7 +8051,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]; @@ -8071,7 +8064,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]; @@ -8084,7 +8077,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)) { @@ -8118,44 +8111,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; } @@ -8175,8 +8168,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; @@ -8188,7 +8181,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 " + @@ -8200,9 +8193,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; @@ -8221,24 +8214,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; 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]; @@ -8252,7 +8243,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]; @@ -8266,7 +8257,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]; @@ -8279,7 +8270,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]; @@ -8292,7 +8283,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)) { @@ -8326,44 +8317,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; } @@ -8383,8 +8374,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; @@ -8396,7 +8387,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 " + @@ -8408,9 +8399,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; @@ -8617,8 +8608,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SCR || + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SEL) { if (Tamb > zn1HB.MAT) { AirflowNetworkReportData(ZN1).MultiZoneInfiSenGainW += (AirflowNetworkLinkSimu(i).FLOW2 * CpAir * (Tamb - zn1HB.MAT)); AirflowNetworkReportData(ZN1).MultiZoneInfiSenGainJ += @@ -8676,8 +8667,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SCR || + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SEL) { if (Tamb > zn2HB.MAT) { AirflowNetworkReportData(ZN2).MultiZoneInfiSenGainW += (AirflowNetworkLinkSimu(i).FLOW * CpAir * (Tamb - zn2HB.MAT)); AirflowNetworkReportData(ZN2).MultiZoneInfiSenGainJ += @@ -8906,8 +8897,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SCR || + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SEL) { if (Tamb > zn1HB.MAT) { AirflowNetworkReportData(ZN1).MultiZoneInfiSenGainW += (linkReport1(i).FLOW2OFF * CpAir * (Tamb - zn1HB.MAT)) * (1.0 - RepOnOffFanRunTimeFraction); @@ -8975,8 +8966,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SCR || + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SEL) { if (Tamb > zn2HB.MAT) { AirflowNetworkReportData(ZN2).MultiZoneInfiSenGainW += (linkReport1(i).FLOWOFF * CpAir * (Tamb - zn2HB.MAT)) * ReportingFraction; @@ -9275,8 +9266,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SCR || + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SEL) { exchangeData(ZN1).SumMCp += AirflowNetworkLinkSimu(i).FLOW2 * CpAir; exchangeData(ZN1).SumMCpT += AirflowNetworkLinkSimu(i).FLOW2 * CpAir * Tamb; } else { @@ -9296,8 +9287,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SCR || + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SEL) { exchangeData(ZN2).SumMCp += AirflowNetworkLinkSimu(i).FLOW * CpAir; exchangeData(ZN2).SumMCpT += AirflowNetworkLinkSimu(i).FLOW * CpAir * Tamb; } else { @@ -9544,17 +9535,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; @@ -9583,7 +9574,7 @@ namespace AirflowNetwork { // Assign airflows to EPLus nodes for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::DWC || + if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::DWC || AirflowNetworkLinkageData(i).VAVTermDamper) { // Exclude envelope leakage Crack element Node1 = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -9593,8 +9584,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; } @@ -9604,8 +9595,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; } @@ -9636,7 +9627,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) { + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == 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)); @@ -9648,8 +9639,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::PLR || + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::ELR) { // Calculate supply leak sensible losses if ((AirflowNetworkNodeData(Node2).EPlusZoneNum > 0) && (AirflowNetworkNodeData(Node1).EPlusNodeNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { @@ -9674,14 +9665,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) { + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == 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 (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::PLR || + AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::ELR) { // Calculate supply leak latent losses if ((AirflowNetworkNodeData(Node2).EPlusZoneNum > 0) && (AirflowNetworkNodeData(Node1).EPlusNodeNum == 0) && (AirflowNetworkLinkSimu(i).FLOW > 0.0)) { @@ -10158,7 +10149,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; } } @@ -10166,7 +10157,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; } } @@ -10441,7 +10432,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; @@ -10459,7 +10450,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; } @@ -10769,10 +10760,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; } } } @@ -10780,25 +10771,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 (AirflowNetworkCompData(j).CompTypeNum == 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 (AirflowNetworkCompData(j).CompTypeNum == 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; } } @@ -10808,10 +10799,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == 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 (AirflowNetworkCompData(AirflowNetworkLinkageData(j).CompNum).CompTypeNum != AirflowElementType::DWC) { ShowSevereError(m_state, format(RoutineName) + "An " + CurrentModuleObject + " object (" + AirflowNetworkLinkageData(i).CompName + ')'); @@ -10820,7 +10811,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, @@ -10828,7 +10819,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, @@ -10836,7 +10827,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, @@ -10844,7 +10835,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, @@ -10888,7 +10879,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); @@ -10900,12 +10891,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; } } } @@ -11119,16 +11110,16 @@ 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' + 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; @@ -11423,7 +11414,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 @@ -11432,7 +11423,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) { } @@ -11457,10 +11448,10 @@ namespace AirflowNetwork { auto afe = elements.find(MultizoneSurfaceData(SrfNum).OpeningName); 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); } @@ -11530,9 +11521,9 @@ namespace AirflowNetwork { auto afe = elements.find(MultizoneSurfaceData(SrfNum).OpeningName); 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; } } @@ -11559,7 +11550,7 @@ namespace AirflowNetwork { AFNExtSurfaces(ExtOpenNum).ZoneName = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).ZoneName; AFNExtSurfaces(ExtOpenNum).MZDZoneNum = Util::FindItemInList(AFNExtSurfaces(ExtOpenNum).ZoneName, MultizoneZoneData, &MultizoneZoneProp::ZoneName); - AFNExtSurfaces(ExtOpenNum).CompTypeNum = iComponentTypeNum::DOP; + AFNExtSurfaces(ExtOpenNum).CompTypeNum = AirflowElementType::DOP; AFNExtSurfaces(ExtOpenNum).Height = MultizoneSurfaceData(SrfNum).Height; AFNExtSurfaces(ExtOpenNum).Width = MultizoneSurfaceData(SrfNum).Width; AFNExtSurfaces(ExtOpenNum).OpeningArea = @@ -11584,7 +11575,7 @@ namespace AirflowNetwork { AFNExtSurfaces(ExtOpenNum).ZoneName = m_state.dataSurface->Surface(MultizoneSurfaceData(SrfNum).SurfNum).ZoneName; AFNExtSurfaces(ExtOpenNum).MZDZoneNum = Util::FindItemInList(AFNExtSurfaces(ExtOpenNum).ZoneName, MultizoneZoneData, &MultizoneZoneProp::ZoneName); - AFNExtSurfaces(ExtOpenNum).CompTypeNum = iComponentTypeNum::SOP; + AFNExtSurfaces(ExtOpenNum).CompTypeNum = AirflowElementType::SOP; AFNExtSurfaces(ExtOpenNum).Height = MultizoneSurfaceData(SrfNum).Height; AFNExtSurfaces(ExtOpenNum).Width = MultizoneSurfaceData(SrfNum).Width; AFNExtSurfaces(ExtOpenNum).OpeningArea = @@ -12114,7 +12105,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; @@ -12122,17 +12113,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; } } @@ -12145,7 +12136,7 @@ namespace AirflowNetwork { for (AFNLinkNum = 1; AFNLinkNum <= AirflowNetworkNumOfLinks; AFNLinkNum++) { CompNum = AirflowNetworkLinkageData(AFNLinkNum).CompNum; - iComponentTypeNum CompTypeNum = AirflowNetworkCompData(CompNum).CompTypeNum; + AirflowElementType CompTypeNum = AirflowNetworkCompData(CompNum).CompTypeNum; SumLength = 0.0; DynamicLoss = 0.0; MaxRough = 0.0; @@ -12153,7 +12144,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); @@ -12165,10 +12156,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) { + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::SupplyTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12181,12 +12172,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[0]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::SupplyTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12272,7 +12263,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); @@ -12284,10 +12275,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) { + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::SupplyBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12299,12 +12290,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[1]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::SupplyBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12394,7 +12385,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); @@ -12406,10 +12397,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) { + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::ReturnTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12421,12 +12412,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[1]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::ReturnTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12514,7 +12505,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); @@ -12526,10 +12517,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) { + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::ReturnBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12541,12 +12532,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[0]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; - if (CompTypeNum1 == iComponentTypeNum::DWC) { + if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::ReturnBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; auto const &disSysCompDuct = DisSysCompDuctData(TypeNum); @@ -12973,7 +12964,7 @@ namespace AirflowNetwork { // SUBROUTINE LOCAL VARIABLE DECLARATIONS: int i; - iComponentTypeNum j; + AirflowElementType j; int n; // Formats @@ -13016,7 +13007,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; } } @@ -13345,7 +13336,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 (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::HOP) { SUMAF(n) = SUMAF(n) - AFLOW(i); SUMAF(m) += AFLOW(i); } else { @@ -13367,7 +13358,7 @@ namespace AirflowNetwork { AirflowNetworkLinkSimu(i).FLOW = 0.0; AirflowNetworkLinkSimu(i).FLOW2 = -AFLOW(i); } - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::HOP) { + if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::HOP) { if (AFLOW(i) > 0.0) { AirflowNetworkLinkSimu(i).FLOW = AFLOW(i) + AFLOW2(i); AirflowNetworkLinkSimu(i).FLOW2 = AFLOW2(i); @@ -13382,7 +13373,7 @@ namespace AirflowNetwork { AirflowNetworkLinkSimu(i).FLOW2 = AFLOW2(i); } } - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == iComponentTypeNum::SOP && AFLOW2(i) != 0.0) { + if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SOP && AFLOW2(i) != 0.0) { if (AFLOW(i) >= 0.0) { AirflowNetworkLinkSimu(i).FLOW = AFLOW(i); AirflowNetworkLinkSimu(i).FLOW2 = std::abs(AFLOW2(i)); @@ -13706,14 +13697,14 @@ namespace AirflowNetwork { j = AirflowNetworkLinkageData(i).CompNum; 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) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::CPD && DP != 0.0) { DP = DisSysCompCPDData(AirflowNetworkCompData(j).TypeNum).DP; } AirflowNetworkLinkSimu(i).DP = DP; AFLOW(i) = F[0]; AFLOW2(i) = 0.0; - if (AirflowNetworkCompData(j).CompTypeNum == iComponentTypeNum::DOP) { + if (AirflowNetworkCompData(j).CompTypeNum == 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..fb6b460707f 100644 --- a/src/EnergyPlus/CrossVentMgr.cc +++ b/src/EnergyPlus/CrossVentMgr.cc @@ -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( diff --git a/src/EnergyPlus/RoomAirModelManager.cc b/src/EnergyPlus/RoomAirModelManager.cc index 47d0e27d06d..4a9df35b6b5 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -1044,7 +1044,7 @@ namespace RoomAir { 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))); @@ -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,7 +2509,7 @@ 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, diff --git a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc index ae8ea7420eb..6be3f83b1e9 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc @@ -6035,7 +6035,7 @@ 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->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::AirflowElementType::DOP; state->afn->report(); EXPECT_NEAR(state->afn->AirflowNetworkReportData(1).MultiZoneVentSenLossW, 95.89575, 0.001); @@ -6053,7 +6053,7 @@ 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; + state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::AirflowElementType::SCR; state->afn->update(); state->afn->report(); EXPECT_NEAR(state->afn->exchangeData(1).SumMCp, 2.38012, 0.001); @@ -16755,8 +16755,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..4cc3598c034 100644 --- a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc +++ b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc @@ -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; From 0fee08aaa4212bd1ad057075d4c60a1b42f895a2 Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Tue, 25 Mar 2025 23:34:00 -0400 Subject: [PATCH 03/10] Unit tests all work again --- .../include/AirflowNetwork/Linkages.hpp | 132 +-- .../AirflowNetwork/src/Elements.cpp | 36 +- .../AirflowNetwork/src/Linkages.cpp | 94 +++ src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 770 +++++++----------- src/EnergyPlus/CrossVentMgr.cc | 6 +- src/EnergyPlus/DisplacementVentMgr.cc | 2 +- src/EnergyPlus/RoomAirModelManager.cc | 10 +- .../ZoneContaminantPredictorCorrector.cc | 6 +- .../unit/AirflowNetworkComponents.unit.cc | 40 +- .../unit/AirflowNetworkConditions.unit.cc | 4 +- .../unit/AirflowNetworkHVAC.unit.cc | 6 +- tst/EnergyPlus/unit/CrossVentMgr.unit.cc | 4 +- 12 files changed, 544 insertions(+), 566 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp index 7506fb3478b..83f53c106b0 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp @@ -50,9 +50,11 @@ #include "AirflowNetwork/Properties.hpp" #include "AirflowNetwork/Types.hpp" -#include -#include -#include +#include "EnergyPlus/DataHVACGlobals.hh" +#include "EnergyPlus/EPVector.hh" +#include "EnergyPlus/ScheduleManager.hh" +#include "EnergyPlus/DataSurfaces.hh" +#include namespace EnergyPlus { @@ -68,66 +70,87 @@ 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 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 - 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 + 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 + + 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 - // 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), + : 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), OccupantVentilationControlNum(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), - EquivRecMethod(EquivRec::Height), EquivRecUserAspectRatio(1.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) : 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) + + {} }; struct AirflowNetworkLinkage // AirflowNetwork linkage data base class @@ -266,6 +289,9 @@ 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 = nullptr); + } // namespace AirflowNetwork } // namespace EnergyPlus diff --git a/src/EnergyPlus/AirflowNetwork/src/Elements.cpp b/src/EnergyPlus/AirflowNetwork/src/Elements.cpp index 69a6532e34b..ad6d54ea315 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Elements.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Elements.cpp @@ -1379,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; @@ -1444,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; } @@ -1462,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 @@ -1778,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; } } @@ -2863,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; @@ -3089,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; @@ -3957,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 @@ -3974,7 +3974,7 @@ namespace AirflowNetwork { Ltyp = state.afn->AirflowNetworkCompData(state.afn->AirflowNetworkLinkageData(i).CompNum).CompTypeNum; if (Ltyp == AirflowElementType::DOP) { - ActLh = state.afn->MultizoneSurfaceData(i).Height; + ActLh = state.afn->MultizoneSurfaceData(i).height; ActLOwnh = ActLh * 1.0; } else { ActLh = 0.0; diff --git a/src/EnergyPlus/AirflowNetwork/src/Linkages.cpp b/src/EnergyPlus/AirflowNetwork/src/Linkages.cpp index 3137c0f6712..3e474083c0a 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Linkages.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Linkages.cpp @@ -51,6 +51,100 @@ 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/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index b9ed8c3c210..69ddb5082da 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -2632,154 +2632,134 @@ 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); } + + 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); } - } 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; } } @@ -2802,49 +2782,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) { @@ -2853,151 +2816,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 == WindPressureType::Input) { - n = m_state.dataSurface->Surface(MultizoneSurfaceData(i).SurfNum).ExtBoundCond; + 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; @@ -3006,7 +2855,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; } @@ -3017,11 +2866,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; } @@ -3038,17 +2887,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) { @@ -3060,7 +2909,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"); @@ -3069,14 +2918,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; @@ -3087,7 +2936,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}} " @@ -3097,28 +2946,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; } @@ -3150,7 +2999,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 = @@ -3168,35 +3017,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; + 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 == 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; } @@ -3206,14 +3064,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()) { @@ -3224,26 +3082,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; @@ -3258,27 +3116,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; @@ -3301,7 +3159,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 = @@ -3355,11 +3213,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; } } @@ -3370,11 +3228,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; } } @@ -3528,14 +3386,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; } } } @@ -3647,7 +3505,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) + @@ -3756,7 +3614,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; @@ -3770,7 +3628,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 { @@ -3801,7 +3659,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) { @@ -3815,7 +3673,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; } } @@ -4533,15 +4391,15 @@ 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; + 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] -= @@ -4564,7 +4422,7 @@ 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 AirflowElementType::DOP: { @@ -4578,7 +4436,7 @@ namespace AirflowNetwork { 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."); } @@ -4607,7 +4465,7 @@ namespace AirflowNetwork { 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; @@ -4655,7 +4513,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 = " + @@ -5336,7 +5194,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; @@ -5431,7 +5289,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) { @@ -5441,8 +5299,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, @@ -5616,18 +5474,18 @@ namespace AirflowNetwork { if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::DOP || AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SOP || AirflowNetworkLinkageData(i).element->type() == AirflowElementType::HOP) { - SurfNum = MultizoneSurfaceData(i).SurfNum; + 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, @@ -5654,56 +5512,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); } } } @@ -6192,49 +6050,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,17 +6217,17 @@ namespace AirflowNetwork { continue; } if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SCR) { - AirflowNetworkLinkageData(i).control = MultizoneSurfaceData(i).Factor; + AirflowNetworkLinkageData(i).control = 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 || @@ -6392,20 +6250,20 @@ namespace AirflowNetwork { AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == 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, @@ -6417,11 +6275,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, @@ -6443,7 +6301,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) { @@ -6822,7 +6680,7 @@ namespace AirflowNetwork { if (SurfDatNum > AirflowNetworkNumOfSurfaces - NumOfLinksIntraZone) { continue; } - SurfNum = MultizoneSurfaceData(SurfDatNum).SurfNum; + SurfNum = MultizoneSurfaceData(SurfDatNum).surface_number; if (SurfNum == 0) { continue; // Error caught earlier } @@ -6851,7 +6709,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; } } @@ -8596,11 +8454,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; @@ -8655,11 +8513,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; @@ -9850,16 +9708,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; @@ -9877,7 +9735,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) { @@ -9910,13 +9768,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; @@ -9952,12 +9810,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; @@ -9989,7 +9847,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; } @@ -9999,7 +9857,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; @@ -10018,7 +9876,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; @@ -11187,16 +11045,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; @@ -11206,13 +11064,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; @@ -11311,7 +11169,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) { @@ -11438,14 +11296,14 @@ 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 == AirflowElementType::DOP) { @@ -11513,12 +11371,12 @@ 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 == AirflowElementType::DOP) { @@ -11534,27 +11392,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 = AirflowElementType::DOP; - AFNExtSurfaces(ExtOpenNum).Height = MultizoneSurfaceData(SrfNum).Height; - AFNExtSurfaces(ExtOpenNum).Width = MultizoneSurfaceData(SrfNum).Width; + 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; @@ -11566,20 +11424,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 = AirflowElementType::SOP; - AFNExtSurfaces(ExtOpenNum).Height = MultizoneSurfaceData(SrfNum).Height; - AFNExtSurfaces(ExtOpenNum).Width = MultizoneSurfaceData(SrfNum).Width; + 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; diff --git a/src/EnergyPlus/CrossVentMgr.cc b/src/EnergyPlus/CrossVentMgr.cc index fb6b460707f..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; @@ -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 4a9df35b6b5..61dd09c9be2 100644 --- a/src/EnergyPlus/RoomAirModelManager.cc +++ b/src/EnergyPlus/RoomAirModelManager.cc @@ -1037,7 +1037,7 @@ 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 && @@ -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) { @@ -2516,7 +2516,7 @@ namespace RoomAir { 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/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 6be3f83b1e9..25e627b6782 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc @@ -11068,7 +11068,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 +11076,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) diff --git a/tst/EnergyPlus/unit/CrossVentMgr.unit.cc b/tst/EnergyPlus/unit/CrossVentMgr.unit.cc index 4cc3598c034..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); From 6ef99e359e0d7e2635778652fdf1f6af5dcc3517 Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Wed, 26 Mar 2025 00:31:15 -0400 Subject: [PATCH 04/10] Add control schedule name --- idd/Energy+.idd.in | 7 ++++++- .../AirflowNetwork/include/AirflowNetwork/Linkages.hpp | 8 ++++++-- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 5 ++++- 3 files changed, 16 insertions(+), 4 deletions(-) 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/include/AirflowNetwork/Linkages.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp index 83f53c106b0..3d799e00a54 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp @@ -114,6 +114,9 @@ namespace AirflowNetwork { 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 @@ -144,11 +147,12 @@ namespace AirflowNetwork { 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) : surface_name(SurfName), surface_number(SurfNum), + 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) + VentAvailSchName(VentAvailSchName), occupant_control_number(OccupantVentilationControlNum), nonrectangular(NonRectangular), equivalent_rectangle_method(EquivRectMethod), + user_aspect_ratio(UserAspectRatio), control_schedule_name(control_schedule_name) {} }; diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 69ddb5082da..c222e20e0ce 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -2747,9 +2747,12 @@ namespace AirflowNetwork { 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); + availability_schedule_name, occupant_ventilation_control_num, nonrectangular, equivrec, aspect_ratio, control_schedule_name); } } AirflowNetworkNumOfSurfaces = MultizoneSurfaceData.isize(); From 9ff6a50ac345dfe8fb0efd41a65791005d205770 Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Wed, 26 Mar 2025 18:20:36 -0400 Subject: [PATCH 05/10] Implement filling in the schedule --- .../include/AirflowNetwork/Linkages.hpp | 5 ++- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 44 +++++++++++++++---- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp index 3d799e00a54..460bb797e4d 100644 --- a/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp +++ b/src/EnergyPlus/AirflowNetwork/include/AirflowNetwork/Linkages.hpp @@ -168,10 +168,11 @@ namespace AirflowNetwork { std::array NodeNums; // Node numbers int LinkNum; // Linkage number AirflowElement *element; // Pointer to airflow element - Real64 control; // Control value + 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(1.0) + AirflowNetworkLinkage() : NodeHeights{{0.0, 0.0}}, CompNum(0), NodeNums{{0, 0}}, LinkNum(0), element(nullptr), control_value(1.0), control_schedule(nullptr) { } diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index c222e20e0ce..551096bccfa 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -3023,7 +3023,7 @@ namespace AirflowNetwork { // 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).surface_number == 0) continue; + if (MultizoneSurfaceData(i).surface_number == 0) continue; // This should trigger a fatal error above. bool has_Opening{false}; ErrorObjectHeader eoh{RoutineName, CurrentModuleObject, MultizoneSurfaceData(i).surface_name}; @@ -4394,7 +4394,20 @@ 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).surface_number == 0) continue; + 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]; @@ -4553,6 +4566,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()) { @@ -4654,6 +4668,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) { @@ -5030,6 +5045,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)); } @@ -6220,7 +6249,7 @@ namespace AirflowNetwork { continue; } if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::SCR) { - AirflowNetworkLinkageData(i).control = MultizoneSurfaceData(i).factor; + AirflowNetworkLinkageData(i).control_value = MultizoneSurfaceData(i).factor; } if (MultizoneSurfaceData(i).occupant_control_number == 0) MultizoneSurfaceData(i).OpenFactor = 0.0; j = MultizoneSurfaceData(i).surface_number; @@ -13503,7 +13532,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; @@ -13553,19 +13581,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() == AirflowElementType::CPD && DP != 0.0) { - DP = DisSysCompCPDData(AirflowNetworkCompData(j).TypeNum).DP; + DP = static_cast (AirflowNetworkLinkageData(i).element)->DP; } AirflowNetworkLinkSimu(i).DP = DP; AFLOW(i) = F[0]; AFLOW2(i) = 0.0; - if (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::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] << From 325754b06a6209e9c736bab11919f6ad724d1c39 Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Wed, 26 Mar 2025 22:59:57 -0400 Subject: [PATCH 06/10] Clean out some old commented out code --- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 91 -------------------- 1 file changed, 91 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index 551096bccfa..b3e966c0573 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -4442,11 +4442,6 @@ namespace AirflowNetwork { switch (AirflowNetworkLinkageData(count).element->type()) { case AirflowElementType::DOP: { - // if (AirflowNetworkLinkageData(count).CompName == - // AirflowNetworkCompData(i).Name) { - // AirflowNetworkLinkageData(count).CompNum = i; - // found = true; - // if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::DOP) { ++j; AirflowNetworkLinkageData(count).DetOpenNum = j; MultizoneSurfaceData(count).Multiplier = surf.Multiplier; @@ -4477,7 +4472,6 @@ namespace AirflowNetwork { } } break; case AirflowElementType::SOP: { - // if (AirflowNetworkCompData(i).CompTypeNum == 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"); @@ -4497,7 +4491,6 @@ namespace AirflowNetwork { } } break; case AirflowElementType::HOP: { - // if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::HOP) { MultizoneSurfaceData(count).Multiplier = surf.Multiplier; // Get linkage height from upper and lower zones if (MultizoneZoneData(AirflowNetworkLinkageData(count).NodeNums[0]).ZoneNum > 0) { @@ -4747,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 == AirflowElementType::DOP) - // CompName(1) = "AirflowNetwork:MultiZone:Component:DetailedOpening"; - // if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::SOP) - // CompName(1) = "AirflowNetwork:MultiZone:Component:SimpleOpening"; - // if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::SCR) CompName(1) = - // "AirflowNetwork:MultiZone:Surface:Crack"; if (AirflowNetworkCompData(i).CompTypeNum == - // AirflowElementType::SEL) CompName(1) = "AirflowNetwork:MultiZone:Surface:EffectiveLeakageArea"; if - // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::DOP) CompName(2) = - // "AirflowNetwork:MultiZone:Component:DetailedOpening"; if (AirflowNetworkCompData(j).CompTypeNum == - // AirflowElementType::SOP) CompName(2) = "AirflowNetwork:MultiZone:Component:SimpleOpening"; if - // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::SCR) CompName(2) = - // "AirflowNetwork:MultiZone:Surface:Crack"; if (AirflowNetworkCompData(j).CompTypeNum == - // AirflowElementType::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 == AirflowElementType::PLR) CompName(1) = - // "AirflowNetwork:Distribution:Component:Leak"; if (AirflowNetworkCompData(i).CompTypeNum == - // AirflowElementType::DWC) CompName(1) = "AirflowNetwork:Distribution:Component:Duct"; if - // (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::ELR) CompName(1) = - // "AirflowNetwork:Distribution:Component:LeakageRatio"; if (AirflowNetworkCompData(i).CompTypeNum == - // AirflowElementType::DMP) CompName(1) = "AIRFLOWNETWORK:DISTRIBUTION:COMPONENT DAMPER"; if - // (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::CVF) CompName(1) = - // "AirflowNetwork:Distribution:Component:Fan"; if (AirflowNetworkCompData(i).CompTypeNum == - // AirflowElementType::CPD) CompName(1) = "AirflowNetwork:Distribution:Component:ConstantPressureDrop"; if - // (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::COI) CompName(1) = - // "AirflowNetwork:Distribution:Component:Coil"; if (AirflowNetworkCompData(i).CompTypeNum == - // AirflowElementType::TMU) CompName(1) = "AirflowNetwork:Distribution:Component:TerminalUnit"; if - // (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::HEX) CompName(1) = - // "AirflowNetwork:Distribution:Component:HeatExchanger"; if (AirflowNetworkCompData(j).CompTypeNum == - // AirflowElementType::PLR) CompName(2) = "AirflowNetwork:Distribution:Component:Leak"; if - // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::DWC) CompName(2) = - // "AirflowNetwork:Distribution:Component:Duct"; if (AirflowNetworkCompData(j).CompTypeNum == - // AirflowElementType::ELR) CompName(2) = "AirflowNetwork:Distribution:Component:LeakageRatio"; if - // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::DMP) CompName(2) = - // "AIRFLOWNETWORK:DISTRIBUTION:COMPONENT DAMPER"; if (AirflowNetworkCompData(j).CompTypeNum == - // AirflowElementType::CVF) CompName(2) = "AirflowNetwork:Distribution:Component:Fan"; if - // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::CPD) CompName(2) = - // "AirflowNetwork:Distribution:Component:ConstantPressureDrop"; if (AirflowNetworkCompData(j).CompTypeNum - // == AirflowElementType::COI) CompName(2) = "AirflowNetwork:Distribution:Component:Coil"; if - // (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::TMU) CompName(2) = - // "AirflowNetwork:Distribution:Component:TerminalUnit"; if (AirflowNetworkCompData(j).CompTypeNum == - // AirflowElementType::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; @@ -4932,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 - // == AirflowElementType::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 - // == AirflowElementType::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) { From b81c95ff095900771fc989f5d48679a1fffe318b Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Thu, 27 Mar 2025 13:38:04 -0400 Subject: [PATCH 07/10] Remove more CompTypeNum, repair unit test --- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 54 +++++++++---------- .../unit/AirflowNetworkHVAC.unit.cc | 22 +++++++- 2 files changed, 48 insertions(+), 28 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index b3e966c0573..b7491f72722 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -4901,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 == AirflowElementType::OAF) { + if (AirflowNetworkLinkageData(count).element->type() == AirflowElementType::OAF) { if (!Util::SameString(DisSysNodeData(j - NumOfNodesMultiZone).EPlusType, "OAMixerOutdoorAirStreamNode")) { ShowSevereError(m_state, format(RoutineName) + @@ -4929,7 +4929,7 @@ namespace AirflowNetwork { } } - if (AirflowNetworkCompData(i).CompTypeNum == AirflowElementType::REL) { + if (AirflowNetworkLinkageData(count).element->type() == AirflowElementType::REL) { if (!Util::SameString(DisSysNodeData(j - NumOfNodesMultiZone).EPlusType, "AirLoopHVAC:OutdoorAirSystem")) { ShowSevereError(m_state, format(RoutineName) + @@ -6186,9 +6186,9 @@ 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 == AirflowElementType::DOP || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SOP || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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).surface_number).ExtBoundCond == OtherSideCoefNoCalcExt && @@ -7066,7 +7066,7 @@ namespace AirflowNetwork { 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) / @@ -7541,7 +7541,7 @@ namespace AirflowNetwork { MV = 0.0; 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 == AirflowElementType::DWC && CompName == std::string()) { // Duct component only @@ -7819,7 +7819,7 @@ namespace AirflowNetwork { MV = 0.0; 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 == AirflowElementType::DWC && CompName == std::string()) { // Duct component only @@ -8025,7 +8025,7 @@ namespace AirflowNetwork { MV = 0.0; 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 == AirflowElementType::DWC && CompName.empty()) { // Duct component only @@ -8407,8 +8407,8 @@ namespace AirflowNetwork { } hg = Psychrometrics::PsyHgAirFnWTdb(zn1HB.airHumRat, zn1HB.MAT); - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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 += @@ -8466,8 +8466,8 @@ namespace AirflowNetwork { } hg = Psychrometrics::PsyHgAirFnWTdb(zn2HB.airHumRat, zn2HB.MAT); - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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 += @@ -8696,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 == AirflowElementType::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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); @@ -8765,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 == AirflowElementType::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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; @@ -9065,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 == AirflowElementType::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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 { @@ -9086,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 == AirflowElementType::SCR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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 { @@ -9373,7 +9373,7 @@ namespace AirflowNetwork { // Assign airflows to EPLus nodes for (int i = 1; i <= AirflowNetworkNumOfLinks; ++i) { - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::DWC || + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::DWC || AirflowNetworkLinkageData(i).VAVTermDamper) { // Exclude envelope leakage Crack element Node1 = AirflowNetworkLinkageData(i).NodeNums[0]; @@ -9438,8 +9438,8 @@ namespace AirflowNetwork { exchangeData(AirflowNetworkLinkageData(i).ZoneNum).CondSen -= Qsen; } // Calculate sensible leakage losses - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::PLR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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)) { @@ -9470,8 +9470,8 @@ namespace AirflowNetwork { exchangeData(AirflowNetworkLinkageData(i).ZoneNum).DiffLat -= Qlat; } // Calculate latent leakage losses - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::PLR || - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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)) { diff --git a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc index 25e627b6782..c770bc6bb0f 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc @@ -6035,9 +6035,23 @@ 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); + 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. state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::AirflowElementType::DOP; + 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,6 +6067,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 + // Switch the element back + for (auto &link : state->afn->AirflowNetworkLinkageData) { + if (link.element == &dop) { + link.element = ye_olde_element; + } + } state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::AirflowElementType::SCR; state->afn->update(); state->afn->report(); From 3cdf9ddc5099b5d8fd467e37b73958796fd265d2 Mon Sep 17 00:00:00 2001 From: Jason DeGraw Date: Mon, 31 Mar 2025 17:44:19 -0400 Subject: [PATCH 08/10] Update Properties.cpp --- src/EnergyPlus/AirflowNetwork/src/Properties.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 { From fd0264dbd1c6faa8a5d59831842160d8bacb4c8a Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Mon, 31 Mar 2025 20:03:05 -0400 Subject: [PATCH 09/10] Checkpoint commit, example file up next --- src/EnergyPlus/AirflowNetwork/src/Solver.cpp | 46 +++++++++---------- .../unit/AirflowNetworkHVAC.unit.cc | 2 - 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp index b7491f72722..0ce602a05f7 100644 --- a/src/EnergyPlus/AirflowNetwork/src/Solver.cpp +++ b/src/EnergyPlus/AirflowNetwork/src/Solver.cpp @@ -9426,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 == AirflowElementType::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)); @@ -9464,7 +9464,7 @@ namespace AirflowNetwork { Node2 = AirflowNetworkLinkageData(i).NodeNums[1]; // Calculate latent loads from duct conduction losses if (AirflowNetworkLinkageData(i).ZoneNum > 0 && - AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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; @@ -10570,7 +10570,7 @@ 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 == AirflowElementType::CVF) { + 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; @@ -10581,7 +10581,7 @@ namespace AirflowNetwork { if (AirflowNetworkCompData(j).EPlusTypeNum == EPlusComponentType::HEX) { AirflowNetworkNodeData(AirflowNetworkLinkageData(i).NodeNums[1]).EPlusTypeNum = EPlusNodeType::HXO; } - if (AirflowNetworkCompData(j).CompTypeNum == AirflowElementType::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 && @@ -10598,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 == AirflowElementType::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 != AirflowElementType::DWC) { + if (AirflowNetworkLinkageData(j).element->type() != AirflowElementType::DWC) { ShowSevereError(m_state, format(RoutineName) + "An " + CurrentModuleObject + " object (" + AirflowNetworkLinkageData(i).CompName + ')'); @@ -10908,7 +10908,7 @@ 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) { + switch (AirflowNetworkLinkageData(i).element->type()) { case AirflowElementType::CVF: { // 'CVF' int typeNum = AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).TypeNum; if (DisSysCompCVFData(typeNum).fanType == HVAC::FanType::VAV) { @@ -11935,7 +11935,7 @@ namespace AirflowNetwork { for (AFNLinkNum = 1; AFNLinkNum <= AirflowNetworkNumOfLinks; AFNLinkNum++) { CompNum = AirflowNetworkLinkageData(AFNLinkNum).CompNum; - AirflowElementType CompTypeNum = AirflowNetworkCompData(CompNum).CompTypeNum; + AirflowElementType CompTypeNum = AirflowNetworkLinkageData(AFNLinkNum).element->type(); SumLength = 0.0; DynamicLoss = 0.0; MaxRough = 0.0; @@ -11957,7 +11957,7 @@ namespace AirflowNetwork { int CompNum1; AirflowElementType CompTypeNum1; CompNum1 = AirflowNetworkLinkageData(AFNLinkNum).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum).element->type(); if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::SupplyTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; @@ -11971,11 +11971,11 @@ namespace AirflowNetwork { while (NodeNum1 != NodeSplitter) { for (AFNLinkNum1 = 1; AFNLinkNum1 <= AirflowNetworkNumOfLinks; AFNLinkNum1++) { if (NodeNum1 != AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[0]) continue; - if (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != AirflowElementType::DWC) + if (AirflowNetworkLinkageData(AFNLinkNum1).element->type() != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[0]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum1).element->type(); if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::SupplyTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; @@ -12076,7 +12076,7 @@ namespace AirflowNetwork { int CompNum1; AirflowElementType CompTypeNum1; CompNum1 = AirflowNetworkLinkageData(AFNLinkNum).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum).element->type(); if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::SupplyBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; @@ -12089,11 +12089,11 @@ namespace AirflowNetwork { while (NodeNum1 != NodeSplitter) { for (AFNLinkNum1 = 1; AFNLinkNum1 <= AirflowNetworkNumOfLinks; AFNLinkNum1++) { if (NodeNum1 != AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[1]) continue; - if (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != AirflowElementType::DWC) + if (AirflowNetworkLinkageData(AFNLinkNum1).element->type() != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[1]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum1).element->type(); if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::SupplyBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; @@ -12198,7 +12198,7 @@ namespace AirflowNetwork { int CompNum1; AirflowElementType CompTypeNum1; CompNum1 = AirflowNetworkLinkageData(AFNLinkNum).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum).element->type(); if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::ReturnTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; @@ -12211,11 +12211,11 @@ namespace AirflowNetwork { while (NodeNum1 != NodeMixer) { for (AFNLinkNum1 = 1; AFNLinkNum1 <= AirflowNetworkNumOfLinks; AFNLinkNum1++) { if (NodeNum1 != AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[1]) continue; - if (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != AirflowElementType::DWC) + if (AirflowNetworkLinkageData(AFNLinkNum1).element->type() != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[1]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum1).element->type(); if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::ReturnTrunk; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; @@ -12318,7 +12318,7 @@ namespace AirflowNetwork { int CompNum1; AirflowElementType CompTypeNum1; CompNum1 = AirflowNetworkLinkageData(AFNLinkNum).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum).element->type(); if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum).ductLineType = DuctLineType::ReturnBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; @@ -12331,11 +12331,11 @@ namespace AirflowNetwork { while (NodeNum1 != NodeMixer) { for (AFNLinkNum1 = 1; AFNLinkNum1 <= AirflowNetworkNumOfLinks; AFNLinkNum1++) { if (NodeNum1 != AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[0]) continue; - if (AirflowNetworkCompData(AirflowNetworkLinkageData(AFNLinkNum1).CompNum).CompTypeNum != AirflowElementType::DWC) + if (AirflowNetworkLinkageData(AFNLinkNum1).element->type() != AirflowElementType::DWC) continue; if (NodeNum1 == AirflowNetworkLinkageData(AFNLinkNum1).NodeNums[0]) { CompNum1 = AirflowNetworkLinkageData(AFNLinkNum1).CompNum; - CompTypeNum1 = AirflowNetworkCompData(CompNum1).CompTypeNum; + CompTypeNum1 = AirflowNetworkLinkageData(AFNLinkNum1).element->type(); if (CompTypeNum1 == AirflowElementType::DWC) { AirflowNetworkLinkageData(AFNLinkNum1).ductLineType = DuctLineType::ReturnBranch; TypeNum = AirflowNetworkCompData(CompNum1).TypeNum; @@ -13135,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 == AirflowElementType::HOP) { + if (AirflowNetworkLinkageData(i).element->type() == AirflowElementType::HOP) { SUMAF(n) = SUMAF(n) - AFLOW(i); SUMAF(m) += AFLOW(i); } else { @@ -13157,7 +13157,7 @@ namespace AirflowNetwork { AirflowNetworkLinkSimu(i).FLOW = 0.0; AirflowNetworkLinkSimu(i).FLOW2 = -AFLOW(i); } - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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); @@ -13172,7 +13172,7 @@ namespace AirflowNetwork { AirflowNetworkLinkSimu(i).FLOW2 = AFLOW2(i); } } - if (AirflowNetworkCompData(AirflowNetworkLinkageData(i).CompNum).CompTypeNum == AirflowElementType::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)); diff --git a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc index c770bc6bb0f..60f7dc26d5d 100644 --- a/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc +++ b/tst/EnergyPlus/unit/AirflowNetworkHVAC.unit.cc @@ -6043,7 +6043,6 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) // 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. - state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::AirflowElementType::DOP; auto const ye_olde_element = state->afn->AirflowNetworkLinkageData(2).element; AirflowNetwork::DetailedOpening dop; for (auto &link : state->afn->AirflowNetworkLinkageData) { @@ -6073,7 +6072,6 @@ TEST_F(EnergyPlusFixture, AirflowNetwork_MultiAirLoopTest) link.element = ye_olde_element; } } - state->afn->AirflowNetworkCompData(state->afn->AirflowNetworkLinkageData(2).CompNum).CompTypeNum = AirflowNetwork::AirflowElementType::SCR; state->afn->update(); state->afn->report(); EXPECT_NEAR(state->afn->exchangeData(1).SumMCp, 2.38012, 0.001); From 4517d738d1bde8115024f515c5ddf3fe326a0928 Mon Sep 17 00:00:00 2001 From: "Jason W. DeGraw" Date: Mon, 31 Mar 2025 23:55:33 -0400 Subject: [PATCH 10/10] Modify an example file to use the control May need to go back in here and adjust the schedule further to get closer to the original result, this is changing the results quite a bit. Maybe a Schedule:File that mimics the original behavior? --- testfiles/AirflowNetwork3zVent.idf | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) 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