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 HVACDXHeatPumpSystem_hh_INCLUDED
49 : #define HVACDXHeatPumpSystem_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 HVACDXHeatPumpSystem {
66 :
67 : // MODULE PARAMETER DEFINITIONS
68 : constexpr Real64 MinAirMassFlow(0.001);
69 :
70 : // Types
71 : struct DXHeatPumpSystemStruct
72 : {
73 : // Members
74 : std::string DXHeatPumpSystemType; // Type of DXHeatingSystem
75 : std::string Name; // Name of the DXHeatingSystem
76 : int SchedPtr;
77 : std::string HeatPumpCoilType;
78 : int HeatPumpCoilType_Num;
79 : std::string HeatPumpCoilName;
80 : int HeatPumpCoilIndex;
81 : int DXHeatPumpCoilInletNodeNum;
82 : int DXHeatPumpCoilOutletNodeNum;
83 : int DXSystemControlNodeNum; // the node number of the node with the set point
84 : Real64 DesiredOutletTemp; // the temperature at the unit outlet node needed
85 : // to meet the supply air set point.
86 : Real64 PartLoadFrac; // part load fraction for current time step (single speed)
87 : Real64 SpeedRatio; // current compressor speed ratio (variable speed)
88 : Real64 CycRatio; // cycling part load ratio (variable speed)
89 : HVAC::FanOp fanOp = HVAC::FanOp::Invalid; // Fan operating mode (see parameter above)
90 : // Warning message variables
91 : int DXCoilSensPLRIter; // used in DXCoil calculations
92 : int DXCoilSensPLRIterIndex; // used in DXCoil calculations
93 : int DXCoilSensPLRFail; // used in DXCoil calculations
94 : int DXCoilSensPLRFailIndex; // used in DXCoil calculations
95 : // When the Dx system is a part of Outdoor Air Unit
96 : Real64 OAUnitSetTemp; // set
97 : // variable-speed coil
98 : int SpeedNum; // select speed number for variable-speed coil
99 : // Fault model of coil SAT sensor
100 : bool FaultyCoilSATFlag; // True if the coil has SAT sensor fault
101 : int FaultyCoilSATIndex; // Index of the fault object corresponding to the coil
102 : Real64 FaultyCoilSATOffset; // Coil SAT sensor offset
103 :
104 : // Default Constructor
105 3 : DXHeatPumpSystemStruct()
106 12 : : SchedPtr(0), HeatPumpCoilType_Num(0), HeatPumpCoilIndex(0), DXHeatPumpCoilInletNodeNum(0), DXHeatPumpCoilOutletNodeNum(0),
107 3 : DXSystemControlNodeNum(0), DesiredOutletTemp(0.0), PartLoadFrac(0.0), SpeedRatio(0.0), CycRatio(0.0), DXCoilSensPLRIter(0),
108 3 : DXCoilSensPLRIterIndex(0), DXCoilSensPLRFail(0), DXCoilSensPLRFailIndex(0), OAUnitSetTemp(0.0), SpeedNum(0), FaultyCoilSATFlag(false),
109 3 : FaultyCoilSATIndex(0), FaultyCoilSATOffset(0.0)
110 : {
111 3 : }
112 : };
113 :
114 : void SimDXHeatPumpSystem(EnergyPlusData &state,
115 : std::string_view DXHeatPumpSystemName, // Name of DXSystem:Airloop object
116 : bool const FirstHVACIteration, // True when first HVAC iteration
117 : int const AirLoopNum, // Primary air loop number
118 : int &CompIndex, // Index to CoilSystem:Heating:DX object
119 : ObjexxFCL::Optional_int_const OAUnitNum = _, // If the system is an equipment of OutdoorAirUnit
120 : ObjexxFCL::Optional<Real64 const> OAUCoilOutTemp = _, // the coil inlet temperature of OutdoorAirUnit
121 : ObjexxFCL::Optional<Real64> QTotOut = _ // the total cooling output of unit
122 : );
123 :
124 : // Get Input Section of the Module
125 : //******************************************************************************
126 :
127 : void GetDXHeatPumpSystemInput(EnergyPlusData &state);
128 :
129 : // End of Get Input subroutines for the Module
130 : //******************************************************************************
131 :
132 : // Beginning of Initialization subroutines for the Module
133 : // *****************************************************************************
134 :
135 : void InitDXHeatPumpSystem(EnergyPlusData &state,
136 : int const DXSystemNum, // number of the current DX Sys being simulated
137 : int const AirLoopNum, // number of the current air loop being simulated
138 : ObjexxFCL::Optional_int_const OAUnitNum = _, // number of the current outdoor air unit being simulated
139 : ObjexxFCL::Optional<Real64 const> OAUCoilOutTemp = _ // the coil inlet temperature of OutdoorAirUnit
140 : );
141 :
142 : // End of Initialization subroutines for the Module
143 : // *****************************************************************************
144 :
145 : // Beginning of Calculation subroutines for the DXCoolingSystem Module
146 : // *****************************************************************************
147 :
148 : void ControlDXHeatingSystem(EnergyPlusData &state,
149 : int const DXSystemNum, // index to DXSystem
150 : bool const FirstHVACIteration // First HVAC iteration flag
151 : );
152 :
153 : Real64 VSCoilCyclingResidual(EnergyPlusData &state,
154 : Real64 PartLoadRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
155 : int CoilIndex,
156 : Real64 desiredTemp,
157 : HVAC::FanOp const fanOp);
158 :
159 : //******************************************************************************
160 :
161 : Real64 VSCoilSpeedResidual(EnergyPlusData &state,
162 : Real64 SpeedRatio, // compressor cycling ratio (1.0 is continuous, 0.0 is off)
163 : int CoilIndex,
164 : Real64 desiredTemp,
165 : int speedNumber,
166 : HVAC::FanOp const fanOp);
167 :
168 : int GetHeatingCoilInletNodeNum(EnergyPlusData &state, std::string const &DXCoilSysName, bool &InletNodeErrFlag);
169 :
170 : int GetHeatingCoilOutletNodeNum(EnergyPlusData &state, std::string const &DXCoilSysName, bool &OutletNodeErrFlag);
171 :
172 : } // namespace HVACDXHeatPumpSystem
173 :
174 : struct HVACDXHeatPumpSystemData : BaseGlobalStruct
175 : {
176 :
177 : int NumDXHeatPumpSystems = 0; // The Number of DXHeatPumpSystems found in the Input
178 : bool EconomizerFlag = false; // holds air loop economizer status
179 : bool GetInputFlag = true; // Flag to get input only once
180 : Array1D_bool CheckEquipName;
181 : Array1D<HVACDXHeatPumpSystem::DXHeatPumpSystemStruct> DXHeatPumpSystem;
182 :
183 : Real64 QZnReq = 0.001; // Zone load (W), input to variable-speed DX coil
184 : Real64 QLatReq = 0.0; // Zone latent load, input to variable-speed DX coil
185 : Real64 OnOffAirFlowRatio = 1.0; // ratio of compressor on flow to average flow over time step
186 : bool ErrorsFound = false; // If errors detected in input
187 : int TotalArgs = 0; // Total number of alpha and numeric arguments (max) for a certain object in the input file
188 : bool MySetPointCheckFlag = true;
189 : int SpeedNum = 1; // speed number of variable speed DX cooling coil
190 : Real64 QZnReqr = 0.001; // Zone load (W), input to variable-speed DX coil
191 : Real64 QLatReqr = 0.0; // Zone latent load, input to variable-speed DX coil
192 : Real64 OnandOffAirFlowRatio = 1.0; // ratio of compressor on flow to average flow over time step
193 : Real64 SpeedRatio = 0.0; // SpeedRatio varies between 1.0 (higher speed) and 0.0 (lower speed)
194 : int SpeedNumber = 1; // speed number of variable speed DX cooling coil
195 : Real64 QZoneReq = 0.001; // Zone load (W), input to variable-speed DX coil
196 : Real64 QLatentReq = 0.0; // Zone latent load, input to variable-speed DX coil
197 : Real64 AirFlowOnOffRatio = 1.0; // ratio of compressor on flow to average flow over time step
198 : Real64 SpeedPartLoadRatio = 1.0; // SpeedRatio varies between 1.0 (higher speed) and 0.0 (lower speed)
199 :
200 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
201 : {
202 796 : }
203 :
204 0 : void clear_state() override
205 : {
206 0 : this->GetInputFlag = true;
207 0 : this->NumDXHeatPumpSystems = 0;
208 0 : this->EconomizerFlag = false;
209 0 : this->CheckEquipName.deallocate();
210 0 : this->DXHeatPumpSystem.deallocate();
211 0 : this->QZnReq = 0.001;
212 0 : this->QLatReq = 0.0;
213 0 : this->OnOffAirFlowRatio = 1.0;
214 0 : this->ErrorsFound = false;
215 0 : this->TotalArgs = 0;
216 0 : this->MySetPointCheckFlag = true;
217 0 : this->SpeedNum = 1;
218 0 : this->QZnReq = 0.001;
219 0 : this->QLatReq = 0.0;
220 0 : this->OnOffAirFlowRatio = 1.0;
221 0 : this->SpeedRatio = 0.0;
222 0 : this->SpeedNumber = 1;
223 0 : this->QZoneReq = 0.001;
224 0 : this->QLatentReq = 0.0;
225 0 : this->AirFlowOnOffRatio = 1.0;
226 0 : this->SpeedPartLoadRatio = 1.0;
227 0 : }
228 : };
229 :
230 : } // namespace EnergyPlus
231 :
232 : #endif
|