Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2024, The Board of Trustees of the University of Illinois,
2 : // The Regents of the University of California, through Lawrence Berkeley National Laboratory
3 : // (subject to receipt of any required approvals from the U.S. Dept. of Energy), Oak Ridge
4 : // National Laboratory, managed by UT-Battelle, Alliance for Sustainable Energy, LLC, and other
5 : // contributors. All rights reserved.
6 : //
7 : // NOTICE: This Software was developed under funding from the U.S. Department of Energy and the
8 : // U.S. Government consequently retains certain rights. As such, the U.S. Government has been
9 : // granted for itself and others acting on its behalf a paid-up, nonexclusive, irrevocable,
10 : // worldwide license in the Software to reproduce, distribute copies to the public, prepare
11 : // derivative works, and perform publicly and display publicly, and to permit others to do so.
12 : //
13 : // Redistribution and use in source and binary forms, with or without modification, are permitted
14 : // provided that the following conditions are met:
15 : //
16 : // (1) Redistributions of source code must retain the above copyright notice, this list of
17 : // conditions and the following disclaimer.
18 : //
19 : // (2) Redistributions in binary form must reproduce the above copyright notice, this list of
20 : // conditions and the following disclaimer in the documentation and/or other materials
21 : // provided with the distribution.
22 : //
23 : // (3) Neither the name of the University of California, Lawrence Berkeley National Laboratory,
24 : // the University of Illinois, U.S. Dept. of Energy nor the names of its contributors may be
25 : // used to endorse or promote products derived from this software without specific prior
26 : // written permission.
27 : //
28 : // (4) Use of EnergyPlus(TM) Name. If Licensee (i) distributes the software in stand-alone form
29 : // without changes from the version obtained under this License, or (ii) Licensee makes a
30 : // reference solely to the software portion of its product, Licensee must refer to the
31 : // software as "EnergyPlus version X" software, where "X" is the version number Licensee
32 : // obtained under this License and may not use a different name for the software. Except as
33 : // specifically required in this Section (4), Licensee shall not use in a company name, a
34 : // product name, in advertising, publicity, or other promotional activities any name, trade
35 : // name, trademark, logo, or other designation of "EnergyPlus", "E+", "e+" or confusingly
36 : // similar designation, without the U.S. Department of Energy's prior written consent.
37 : //
38 : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
39 : // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
40 : // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
41 : // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42 : // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
43 : // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
45 : // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46 : // POSSIBILITY OF SUCH DAMAGE.
47 :
48 : #ifndef DualDuct_hh_INCLUDED
49 : #define DualDuct_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 : #include <ObjexxFCL/Optional.hh>
54 :
55 : // EnergyPlus Headers
56 : #include <EnergyPlus/Data/BaseData.hh>
57 : #include <EnergyPlus/DataGlobals.hh>
58 : #include <EnergyPlus/EnergyPlus.hh>
59 :
60 : namespace EnergyPlus {
61 :
62 : // Forward declarations
63 : struct EnergyPlusData;
64 :
65 : namespace DualDuct {
66 :
67 : enum class DualDuctDamper
68 : {
69 : Invalid = -1,
70 : ConstantVolume,
71 : VariableVolume,
72 : OutdoorAir,
73 : Num
74 : };
75 :
76 : static constexpr std::array<std::string_view, static_cast<int>(DualDuctDamper::Num)> dualDuctDamperNames = {
77 : "ConstantVolume", "VariableVolume", "OutdoorAir"};
78 :
79 : enum class PerPersonMode
80 : {
81 : Invalid = -1,
82 : ModeNotSet,
83 : DCVByCurrentLevel,
84 : ByDesignLevel,
85 : Num
86 : };
87 :
88 : struct DualDuctAirTerminalFlowConditions
89 : {
90 : Real64 AirMassFlowRate = 0.0; // MassFlow through the Damper being Simulated [kg/Sec]
91 : Real64 AirMassFlowRateMaxAvail = 0.0; // MassFlow through the Damper being Simulated [kg/Sec]
92 : Real64 AirMassFlowRateMinAvail = 0.0; // MassFlow through the Damper being Simulated [kg/Sec]
93 : Real64 AirMassFlowRateMax = 0.0; // Max Mass Flow Rate or the Design Mass Flow Rate
94 : Real64 AirTemp = 0.0;
95 : Real64 AirHumRat = 0.0;
96 : Real64 AirEnthalpy = 0.0;
97 : Real64 AirMassFlowRateHist1 = 0.0; // flow history back 1 iteration kg/s
98 : Real64 AirMassFlowRateHist2 = 0.0; // flow history back 2 iteration kg/s
99 : Real64 AirMassFlowRateHist3 = 0.0; // flow history back 3 iteration kg/s
100 : Real64 AirMassFlowDiffMag = 0.0; // flow difference scale, kg/s
101 : };
102 :
103 : struct DualDuctAirTerminal
104 : {
105 : std::string Name; // Name of the Damper
106 : DualDuctDamper DamperType = DualDuctDamper::Invalid; // Type of Damper ie. VAV, Mixing, Inducing, etc.
107 : int SchedPtr = 0; // Pointer to the correct schedule
108 : Real64 MaxAirVolFlowRate = 0.0; // Max Specified Volume Flow Rate of Damper [m3/sec]
109 : Real64 MaxAirMassFlowRate = 0.0; // Max Specified MAss Flow Rate of Damper [kg/s]
110 : int HotAirInletNodeNum = 0;
111 : int ColdAirInletNodeNum = 0;
112 : int OutletNodeNum = 0;
113 : Real64 ZoneMinAirFracDes = 0.0; // Fraction of supply air used as design minimum flow
114 : Real64 ZoneMinAirFrac = 0.0; // Fraction of supply air used as current minimum flow
115 : Real64 ColdAirDamperPosition = 0.0;
116 : Real64 HotAirDamperPosition = 0.0;
117 : int OAInletNodeNum = 0; // Alternate Node for VAV:OutdoorAir for Outdoor Air
118 : int RecircAirInletNodeNum = 0; // Alternate Node for VAV:OutdoorAir for Recirc Air
119 : bool RecircIsUsed = true; // if true. then not using recirc duct, which is okay
120 : Real64 DesignOAFlowRate = 0.0; // Terminal Outdoor Air Design Flow Rate for VAV:OutdoorAir, m3/s
121 : Real64 DesignRecircFlowRate = 0.0; // Terminal Recirc Air Design Flow Rate for VAV:OutdoorAir, m3/s
122 : Real64 RecircAirDamperPosition = 0.0; // Alternate Damper Pos Output for VAV:OutdoorAir for Recirc Air
123 : Real64 OADamperPosition = 0.0; // Alternate Damper Pos Output for VAV:OutdoorAir for Recirc Air
124 : Real64 OAFraction = 0.0; // Outdoor Air Fraction for VAV:OutdoorAir
125 : int ADUNum = 0; // index of corresponding air distribution unit ZoneHVAC:AirdistributionUnit
126 : int CtrlZoneNum = 0; // Pointer to CtrlZone data structure
127 : int CtrlZoneInNodeIndex = 0; // which controlled zone inlet node number corresponds with this unit
128 : Real64 OutdoorAirFlowRate = 0.0; // report variable for TU outdoor air flow rate
129 : bool NoOAFlowInputFromUser = true; // avoids OA calculation if no input specified by user
130 : int OARequirementsPtr = 0; // - Index to DesignSpecification:OutdoorAir object
131 : PerPersonMode OAPerPersonMode = PerPersonMode::ModeNotSet; // mode for how per person rates are determined, DCV or design.
132 : int AirLoopNum = 0; // index to airloop that this terminal unit is connected to
133 : int ZoneTurndownMinAirFracSchPtr = 0; // pointer to the schedule for turndown minimum airflow fraction
134 : Real64 ZoneTurndownMinAirFrac = 1.0; // turndown minimum airflow fraction value, multiplier of zone design minimum air flow
135 : bool ZoneTurndownMinAirFracSchExist = false; // if true, if zone turndown min air frac schedule exist
136 : bool MyEnvrnFlag = true; // environment flag
137 : bool MySizeFlag = true; // sizing flag
138 : bool MyAirLoopFlag = true; // airloop flag
139 : bool CheckEquipName = true;
140 : DualDuctAirTerminalFlowConditions dd_airterminalHotAirInlet;
141 : DualDuctAirTerminalFlowConditions dd_airterminalColdAirInlet;
142 : DualDuctAirTerminalFlowConditions dd_airterminalOutlet;
143 : DualDuctAirTerminalFlowConditions dd_airterminalOAInlet;
144 : DualDuctAirTerminalFlowConditions dd_airterminalRecircAirInlet;
145 :
146 : void InitDualDuct(EnergyPlusData &state, bool FirstHVACIteration);
147 :
148 : void SizeDualDuct(EnergyPlusData &state);
149 :
150 : void SimDualDuctConstVol(EnergyPlusData &state, int ZoneNum, int ZoneNodeNum);
151 :
152 : void SimDualDuctVarVol(EnergyPlusData &state, int ZoneNum, int ZoneNodeNum);
153 :
154 : void SimDualDuctVAVOutdoorAir(EnergyPlusData &state, int ZoneNum, int ZoneNodeNum);
155 :
156 : void CalcOAMassFlow(EnergyPlusData &state,
157 : Real64 &SAMassFlow, // outside air based on optional user input
158 : Real64 &AirLoopOAFrac // outside air based on optional user input
159 : );
160 :
161 : void CalcOAOnlyMassFlow(EnergyPlusData &state,
162 : Real64 &OAMassFlow, // outside air flow from user input kg/s
163 : ObjexxFCL::Optional<Real64> MaxOAVolFlow = _ // design level for outside air m3/s
164 : );
165 :
166 : void CalcOutdoorAirVolumeFlowRate(EnergyPlusData &state);
167 :
168 : void UpdateDualDuct(EnergyPlusData &state);
169 :
170 : void reportTerminalUnit(EnergyPlusData &state);
171 : };
172 :
173 : void SimulateDualDuct(EnergyPlusData &state, std::string_view CompName, bool FirstHVACIteration, int ZoneNum, int ZoneNodeNum, int &CompIndex);
174 :
175 : void GetDualDuctInput(EnergyPlusData &state);
176 :
177 : void ReportDualDuctConnections(EnergyPlusData &state);
178 :
179 : void GetDualDuctOutdoorAirRecircUse(EnergyPlusData &state, std::string const &CompTypeName, std::string_view CompName, bool &RecircIsUsed);
180 :
181 : } // namespace DualDuct
182 :
183 : struct DualDuctData : BaseGlobalStruct
184 : {
185 : int NumDDAirTerminal = 0; // The Number of Dampers found in the Input //Autodesk Poss used uninitialized in ReportDualDuctConnections
186 : int NumDualDuctVarVolOA = 0;
187 : bool GetDualDuctInputFlag = true; // Flag set to make sure you get input once
188 : Array1D<DualDuct::DualDuctAirTerminal> dd_airterminal;
189 : std::unordered_map<std::string, std::string> UniqueDualDuctAirTerminalNames;
190 : bool ZoneEquipmentListChecked = false; // True after the Zone Equipment List has been checked for items
191 : bool GetDualDuctOutdoorAirRecircUseFirstTimeOnly = true;
192 : Array1D_bool RecircIsUsedARR;
193 : Array1D_string DamperNamesARR;
194 :
195 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
196 : {
197 796 : }
198 :
199 0 : void clear_state() override
200 : {
201 0 : new (this) DualDuctData();
202 0 : }
203 : };
204 :
205 : } // namespace EnergyPlus
206 :
207 : #endif
|