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 PlantHeatExchangerFluidToFluid_hh_INCLUDED
49 : #define PlantHeatExchangerFluidToFluid_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 : #include <EnergyPlus/Plant/PlantLocation.hh>
59 : #include <EnergyPlus/PlantComponent.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : // Forward declarations
64 : struct EnergyPlusData;
65 :
66 : namespace PlantHeatExchangerFluidToFluid {
67 :
68 : enum class FluidHXType
69 : {
70 : Invalid = -1,
71 : CrossFlowBothUnMixed,
72 : CrossFlowBothMixed,
73 : CrossFlowSupplyLoopMixedDemandLoopUnMixed,
74 : CrossFlowSupplyLoopUnMixedDemandLoopMixed,
75 : CounterFlow,
76 : ParallelFlow,
77 : Ideal,
78 : Num
79 : };
80 :
81 : enum class ControlType
82 : {
83 : Invalid = -1,
84 : UncontrolledOn,
85 : OperationSchemeModulated,
86 : OperationSchemeOnOff,
87 : HeatingSetPointModulated,
88 : HeatingSetPointOnOff,
89 : CoolingSetPointModulated,
90 : CoolingSetPointOnOff,
91 : DualDeadBandSetPointModulated,
92 : DualDeadBandSetPointOnOff,
93 : CoolingDifferentialOnOff,
94 : CoolingSetPointOnOffWithComponentOverride,
95 : TrackComponentOnOff,
96 : Num
97 : };
98 :
99 : enum class CtrlTempType
100 : {
101 : Invalid = -1,
102 : WetBulbTemperature,
103 : DryBulbTemperature,
104 : LoopTemperature,
105 : Num
106 : };
107 :
108 : enum class HXAction
109 : {
110 : Invalid = -1,
111 : HeatingSupplySideLoop,
112 : CoolingSupplySideLoop,
113 : Num
114 : };
115 :
116 : struct PlantConnectionStruct : PlantLocation
117 : {
118 : // Members
119 : int inletNodeNum; // plant loop inlet node index
120 : int outletNodeNum; // plant loop outlet node index
121 : Real64 MassFlowRateMin; // minimum (hardware) flow rate for component [kg/s]
122 : Real64 MassFlowRateMax; // maximum (hardware) flow rate for component [kg/s]
123 : Real64 DesignVolumeFlowRate; // design flow rate [m3/s]
124 : bool DesignVolumeFlowRateWasAutoSized; // true if design flow rate was autosize on input
125 : Real64 MyLoad; // current load request of supply equip for op scheme control[W]
126 : Real64 MinLoad; // reports back size for load dispatch routines [W]
127 : Real64 MaxLoad; // reports back size for load dispatch [W]
128 : Real64 OptLoad; // reports back size for load dispatch [W]
129 : Real64 InletTemp; // current inlet fluid temperature [C]
130 : Real64 InletMassFlowRate; // current inlet mass flow rate [kg/s]
131 : Real64 OutletTemp; // component outlet temperature [C]
132 :
133 : // Default Constructor
134 82 : PlantConnectionStruct()
135 82 : : inletNodeNum(0), outletNodeNum(0), MassFlowRateMin(0.0), MassFlowRateMax(0.0), DesignVolumeFlowRate(0.0),
136 : DesignVolumeFlowRateWasAutoSized(false), MyLoad(0.0), MinLoad(0.0), MaxLoad(0.0), OptLoad(0.0), InletTemp(0.0), InletMassFlowRate(0.0),
137 82 : OutletTemp(0.0)
138 : {
139 82 : }
140 : };
141 :
142 : struct PlantLocatorStruct : PlantLocation
143 : {
144 : // Members
145 : int inletNodeNum; // plant loop inlet node index
146 :
147 : // Default Constructor
148 82 : PlantLocatorStruct() : inletNodeNum(0)
149 : {
150 82 : }
151 : };
152 :
153 66 : struct HeatExchangerStruct : PlantComponent
154 : {
155 : // Members
156 : std::string Name;
157 : int AvailSchedNum;
158 : FluidHXType HeatExchangeModelType;
159 : Real64 UA;
160 : bool UAWasAutoSized; // true is UA was autosized on input
161 : ControlType controlMode;
162 : int SetPointNodeNum;
163 : Real64 TempControlTol;
164 : CtrlTempType ControlSignalTemp;
165 : Real64 MinOperationTemp;
166 : Real64 MaxOperationTemp;
167 : PlantConnectionStruct DemandSideLoop; // plant connections and data for the side of HX connected to demand side
168 : PlantConnectionStruct SupplySideLoop;
169 : std::string HeatTransferMeteringEndUse;
170 : std::string ComponentUserName; // user name for control-associated component
171 : DataPlant::PlantEquipmentType ComponentType;
172 : PlantLocatorStruct OtherCompSupplySideLoop;
173 : PlantLocatorStruct OtherCompDemandSideLoop;
174 : Real64 SizingFactor;
175 : Real64 HeatTransferRate;
176 : Real64 HeatTransferEnergy;
177 : Real64 Effectiveness;
178 : Real64 OperationStatus;
179 : int DmdSideModulatSolvNoConvergeErrorCount;
180 : int DmdSideModulatSolvNoConvergeErrorIndex;
181 : int DmdSideModulatSolvFailErrorCount;
182 : int DmdSideModulatSolvFailErrorIndex;
183 : bool MyOneTimeFlag;
184 : bool MyFlag;
185 : bool MyEnvrnFlag;
186 :
187 : // Default Constructor
188 41 : HeatExchangerStruct()
189 41 : : AvailSchedNum(0), HeatExchangeModelType(FluidHXType::Invalid), UA(0.0), UAWasAutoSized(false), controlMode(ControlType::Invalid),
190 : SetPointNodeNum(0), TempControlTol(0.0), ControlSignalTemp(CtrlTempType::Invalid), MinOperationTemp(-99999.0),
191 : MaxOperationTemp(99999.0), ComponentType(DataPlant::PlantEquipmentType::Invalid), SizingFactor(1.0), HeatTransferRate(0.0),
192 : HeatTransferEnergy(0.0), Effectiveness(0.0), OperationStatus(0.0), DmdSideModulatSolvNoConvergeErrorCount(0),
193 : DmdSideModulatSolvNoConvergeErrorIndex(0), DmdSideModulatSolvFailErrorCount(0), DmdSideModulatSolvFailErrorIndex(0),
194 41 : MyOneTimeFlag(true), MyFlag(true), MyEnvrnFlag(true)
195 : {
196 41 : }
197 :
198 : static PlantComponent *factory(EnergyPlusData &state, std::string const &objectName);
199 :
200 : void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
201 :
202 : void getDesignCapacities(
203 : EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
204 :
205 : void simulate([[maybe_unused]] EnergyPlusData &state,
206 : const PlantLocation &calledFromLocation,
207 : bool FirstHVACIteration,
208 : Real64 &CurLoad,
209 : bool RunFlag) override;
210 :
211 : void setupOutputVars(EnergyPlusData &state);
212 :
213 : void initialize(EnergyPlusData &state);
214 :
215 : void size(EnergyPlusData &state);
216 :
217 : void calculate(EnergyPlusData &state, Real64 SupSideMdot, Real64 DmdSideMdot);
218 :
219 : void control(EnergyPlusData &state, Real64 MyLoad, bool FirstHVACIteration);
220 :
221 : void findDemandSideLoopFlow(EnergyPlusData &state, Real64 TargetSupplySideLoopLeavingTemp, HXAction HXActionMode);
222 :
223 : void oneTimeInit(EnergyPlusData &state) override;
224 : };
225 :
226 : void GetFluidHeatExchangerInput(EnergyPlusData &state);
227 :
228 : } // namespace PlantHeatExchangerFluidToFluid
229 :
230 1542 : struct PlantHeatExchangerFluidToFluidData : BaseGlobalStruct
231 : {
232 :
233 : int NumberOfPlantFluidHXs = 0;
234 : bool GetInput = true;
235 : EPVector<PlantHeatExchangerFluidToFluid::HeatExchangerStruct> FluidHX;
236 :
237 0 : void clear_state() override
238 : {
239 0 : this->NumberOfPlantFluidHXs = 0;
240 0 : this->GetInput = true;
241 0 : this->FluidHX.deallocate();
242 0 : }
243 : };
244 :
245 : } // namespace EnergyPlus
246 :
247 : #endif
|