Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2023, 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 DataConvergParams_hh_INCLUDED
49 : #define DataConvergParams_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataGlobals.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 :
59 : namespace EnergyPlus {
60 :
61 : namespace DataConvergParams {
62 :
63 : // Note: Unless otherwise noted, the tolerance parameters listed below were chosen
64 : // to represent educated guesses at what the tolerances for individual physical
65 : // parameters should be.
66 : constexpr Real64 HVACEnthalpyToler(260.0); // Tolerance for enthalpy comparisons (in kJ/kgK)
67 : constexpr Real64 HVACFlowRateToler(0.01); // Tolerance for mass flow rate convergence (in kg/s) [~20 CFM]
68 : constexpr Real64 HVACFlowRateSlopeToler(0.001); // Slope tolerance for mass flow, kg/s/iteration
69 : constexpr Real64 HVACFlowRateOscillationToler(0.0000001); // tolerance for detecting duplicate flow rate in stack
70 : constexpr Real64 HVACHumRatToler(0.0001); // Tolerance for humidity ratio comparisons (kg water/kg dryair)
71 : constexpr Real64 HVACHumRatSlopeToler(0.00001); // Slope tolerance for humidity ratio, kg water/kg-dryair/iteration
72 : constexpr Real64 HVACHumRatOscillationToler(0.00000001); // tolerance for detecting duplicate humidity ratio in stack
73 : constexpr Real64 HVACPressToler(10.0); // Tolerance for pressure comparisons (in Pascals)
74 : constexpr Real64 HVACTemperatureToler(0.01); // Tolerance for temperature comparisons (in degrees C or K)
75 : constexpr Real64 HVACTemperatureSlopeToler(0.001); // Slope tolerance for Temperature, Deg C/iteration
76 : constexpr Real64 HVACTemperatureOscillationToler(0.000001); // tolerance for detecting duplicate temps in stack
77 : constexpr Real64 HVACEnergyToler(10.0); // Tolerance for Energy comparisons (in Watts W)
78 : // to be consistent, should be 20.d0 (BG Aug 2012)
79 :
80 : constexpr Real64 HVACCpApprox(1004.844); // Air Cp (20C,0.0Kg/Kg) Only for energy Tolerance Calculation
81 : // Only used to scale the answer for a more intuitive answer for comparison
82 :
83 : constexpr Real64 PlantFlowRateToler(0.001); // Tolerance for mass flow rate convergence (in kg/s) [~2 CFM]
84 : constexpr Real64 PlantFlowRateOscillationToler(0.0000001);
85 : constexpr Real64 PlantFlowRateSlopeToler(0.0001); // Slope tolerance for mass flow, kg/s/iteration
86 :
87 : constexpr Real64 PlantPressToler(10.0); // Tolerance for pressure comparisons (in Pascals)
88 : constexpr Real64 PlantTemperatureToler(0.01); // Tolerance for temperature comparisons (in degrees C or K)
89 : constexpr Real64 PlantTemperatureSlopeToler(0.001); // Slope tolerance for Temperature, Deg C/iteration
90 : constexpr Real64 PlantTemperatureOscillationToler(0.000001); // tolerance for detecting duplicate temps in stack
91 :
92 : constexpr Real64 PlantEnergyToler(10.0); // Tolerance for Energy comparisons (in Watts W)
93 :
94 : // Energy Tolerance Calculation, used to scale the answer for a more intuitive answer for comparison
95 : constexpr Real64 PlantFlowFlowRateToler(0.01); // Tolerance for mass flow rate convergence (in kg/s)
96 : constexpr Real64 PlantLowFlowRateToler(0.000001); // Tolerance for low flow rate used for determining when plant pumps can be shut down
97 :
98 : constexpr int ConvergLogStackDepth(10);
99 :
100 : enum class CalledFrom
101 : {
102 : Invalid = -1,
103 : AirSystemDemandSide,
104 : AirSystemSupplySideDeck1,
105 : AirSystemSupplySideDeck2,
106 : Num
107 : };
108 :
109 4017 : struct HVACNodeConvergLogStruct
110 : {
111 : int NodeNum = 0;
112 : std::array<Real64, ConvergLogStackDepth> HumidityRatio;
113 : std::array<Real64, ConvergLogStackDepth> MassFlowRate;
114 : std::array<Real64, ConvergLogStackDepth> Temperature;
115 : };
116 :
117 11156 : struct HVACZoneInletConvergenceStruct
118 : {
119 : std::string ZoneName;
120 : int NumInletNodes = 0; // number of inlet nodes for zone
121 : Array1D<HVACNodeConvergLogStruct> InletNode;
122 : };
123 :
124 770 : struct HVACAirLoopIterationConvergenceStruct
125 : {
126 : std::array<bool, 3> HVACMassFlowNotConverged = {false}; // Flag to show mass flow convergence
127 : std::array<Real64, ConvergLogStackDepth> HVACFlowDemandToSupplyTolValue = {0.0}; // Queue of convergence "results"
128 : std::array<Real64, ConvergLogStackDepth> HVACFlowSupplyDeck1ToDemandTolValue = {0.0}; // Queue of convergence "results"
129 : std::array<Real64, ConvergLogStackDepth> HVACFlowSupplyDeck2ToDemandTolValue = {0.0}; // Queue of convergence "results"
130 : std::array<bool, 3> HVACHumRatNotConverged = {false}; // Flag to show humidity ratio convergence or failure
131 : std::array<Real64, ConvergLogStackDepth> HVACHumDemandToSupplyTolValue = {0.0}; // Queue of convergence "results"
132 : std::array<Real64, ConvergLogStackDepth> HVACHumSupplyDeck1ToDemandTolValue = {0.0}; // Queue of convergence "results"
133 : std::array<Real64, ConvergLogStackDepth> HVACHumSupplyDeck2ToDemandTolValue = {0.0}; // Queue of convergence "results"
134 : std::array<bool, 3> HVACTempNotConverged = {false}; // Flag to show temperature convergence or failure
135 : std::array<Real64, ConvergLogStackDepth> HVACTempDemandToSupplyTolValue = {0.0}; // Queue of convergence "results"
136 : std::array<Real64, ConvergLogStackDepth> HVACTempSupplyDeck1ToDemandTolValue = {0.0}; // Queue of convergence "results"
137 : std::array<Real64, ConvergLogStackDepth> HVACTempSupplyDeck2ToDemandTolValue = {0.0}; // Queue of convergence "results"
138 : std::array<bool, 3> HVACEnergyNotConverged = {false}; // Flag to show energy convergence or failure
139 : std::array<Real64, ConvergLogStackDepth> HVACEnergyDemandToSupplyTolValue = {0.0}; // Queue of convergence "results"
140 : std::array<Real64, ConvergLogStackDepth> HVACEnergySupplyDeck1ToDemandTolValue = {0.0}; // Queue of convergence "results"
141 : std::array<Real64, ConvergLogStackDepth> HVACEnergySupplyDeck2ToDemandTolValue = {0.0}; // Queue of convergence "results"
142 : std::array<Real64, ConvergLogStackDepth> HVACEnthalpyDemandToSupplyTolValue = {0.0}; // Queue of convergence "results"
143 : std::array<Real64, ConvergLogStackDepth> HVACEnthalpySupplyDeck1ToDemandTolValue = {0.0}; // Queue of convergence "results"
144 : std::array<Real64, ConvergLogStackDepth> HVACEnthalpySupplyDeck2ToDemandTolValue = {0.0}; // Queue of convergence "results"
145 : std::array<Real64, ConvergLogStackDepth> HVACPressureDemandToSupplyTolValue = {0.0}; // Queue of convergence "results"
146 : std::array<Real64, ConvergLogStackDepth> HVACPressureSupplyDeck1ToDemandTolValue = {0.0}; // Queue of convergence "results"
147 : std::array<Real64, ConvergLogStackDepth> HVACPressueSupplyDeck2ToDemandTolValue = {0.0}; // Queue of convergence "results"
148 : };
149 :
150 444 : struct PlantIterationConvergenceStruct
151 : {
152 : // Members
153 : bool PlantMassFlowNotConverged = false; // Flag to show mass flow convergence
154 : std::array<Real64, ConvergLogStackDepth> PlantFlowDemandToSupplyTolValue = {0.0}; // Queue of convergence "results"
155 : std::array<Real64, ConvergLogStackDepth> PlantFlowSupplyToDemandTolValue; // Queue of convergence "results"
156 : bool PlantTempNotConverged = false; // Flag to show temperature convergence (0) or failure (1)
157 : std::array<Real64, ConvergLogStackDepth> PlantTempDemandToSupplyTolValue; // Queue of convergence "results"
158 : std::array<Real64, ConvergLogStackDepth> PlantTempSupplyToDemandTolValue; // Queue of convergence "results"
159 : };
160 :
161 : } // namespace DataConvergParams
162 :
163 1542 : struct ConvergParamsData : BaseGlobalStruct
164 : {
165 :
166 : Real64 MinTimeStepSys = (1.0 / 60.0); // =1 minute
167 : Real64 MinTimeStepTol = 1.0e-4; // = min allowable for ABS(1.-TimeStepSys/(MinTimeStepSys))
168 : Real64 MaxZoneTempDiff = 0.3; // 0.3 C = (1% OF 300 C) = max allowable difference between
169 : int MaxIter = 20; // maximum number of iterations allowed
170 : int MaxPlantSubIterations = 8; // Iteration Max for Plant Simulation sub iterations
171 : int MinPlantSubIterations = 2; // Iteration Min for Plant Simulation sub iterations
172 :
173 : Array1D<DataConvergParams::HVACZoneInletConvergenceStruct> ZoneInletConvergence;
174 : Array1D<DataConvergParams::HVACAirLoopIterationConvergenceStruct> AirLoopConvergence;
175 : Array1D<DataConvergParams::PlantIterationConvergenceStruct> PlantConvergence;
176 :
177 0 : void clear_state() override
178 : {
179 0 : *this = ConvergParamsData();
180 0 : }
181 : };
182 :
183 : } // namespace EnergyPlus
184 :
185 : #endif
|