Line data Source code
1 : // EnergyPlus, Copyright (c) 1996-2025, 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 ENERGYPLUS_COILS_COILCOOLINGDX
49 : #define ENERGYPLUS_COILS_COILCOOLINGDX
50 :
51 : #include <string>
52 : #include <vector>
53 :
54 : #include <EnergyPlus/Coils/CoilCoolingDXPerformanceBase.hh>
55 : #include <EnergyPlus/Data/BaseData.hh>
56 : #include <EnergyPlus/DataHeatBalance.hh>
57 : #include <EnergyPlus/EnergyPlus.hh>
58 : #include <EnergyPlus/ScheduleManager.hh>
59 :
60 : namespace EnergyPlus {
61 :
62 : // Forward declarations
63 : struct EnergyPlusData;
64 :
65 : struct CoilCoolingDXInputSpecification
66 : {
67 : std::string name;
68 : std::string evaporator_inlet_node_name;
69 : std::string evaporator_outlet_node_name;
70 : std::string availability_schedule_name;
71 : std::string condenser_zone_name;
72 : std::string condenser_inlet_node_name;
73 : std::string condenser_outlet_node_name;
74 : std::string performance_object_name;
75 : std::string condensate_collection_water_storage_tank_name;
76 : std::string evaporative_condenser_supply_water_storage_tank_name;
77 : };
78 :
79 : struct CoilCoolingDX
80 : {
81 165 : CoilCoolingDX() = default;
82 : static std::shared_ptr<CoilCoolingDXPerformanceBase> makePerformanceSubclass(EnergyPlus::EnergyPlusData &state,
83 : const std::string &performance_object_name);
84 : static int factory(EnergyPlusData &state, std::string const &coilName);
85 : static void getInput(EnergyPlusData &state);
86 : static void clear_state();
87 : static void reportAllStandardRatings(EnergyPlusData &state);
88 : void instantiateFromInputSpec(EnergyPlusData &state, const CoilCoolingDXInputSpecification &input_data);
89 : void oneTimeInit(EnergyPlusData &state);
90 : void simulate(EnergyPlusData &state,
91 : HVAC::CoilMode coilMode,
92 : int speedNum,
93 : Real64 speedRatio,
94 : HVAC::FanOp const fanOp,
95 : bool singleMode,
96 : Real64 LoadSHR = -1.0);
97 : void setData(int fanIndex, HVAC::FanType fanType, std::string const &fanName, int airLoopNum);
98 : void getFixedData(int &evapInletNodeIndex,
99 : int &evapOutletNodeIndex,
100 : int &condInletNodeIndex,
101 : int &normalModeNumSpeeds,
102 : CoilCoolingDXPerformanceBase::CapControlMethod &capacityControlMethod,
103 : Real64 &minOutdoorDryBulb);
104 : void getDataAfterSizing(EnergyPlusData &state,
105 : Real64 &normalModeRatedEvapAirFlowRate,
106 : Real64 &normalModeRatedCapacity,
107 : std::vector<Real64> &normalModeFlowRates,
108 : std::vector<Real64> &normalModeRatedCapacities);
109 : static void inline passThroughNodeData(DataLoopNode::NodeData &in, DataLoopNode::NodeData &out);
110 : void size(EnergyPlusData &state);
111 :
112 : int getNumModes();
113 : int getOpModeCapFTIndex(HVAC::CoilMode mode = HVAC::CoilMode::Normal);
114 : Real64 condMassFlowRate(EnergyPlusData &state, HVAC::CoilMode mode);
115 :
116 : CoilCoolingDXInputSpecification original_input_specs;
117 : std::string name;
118 : bool myOneTimeInitFlag = true;
119 : int evapInletNodeIndex = 0;
120 : int evapOutletNodeIndex = 0;
121 : Sched::Schedule *availSched = nullptr;
122 : int condInletNodeIndex = 0;
123 : int condOutletNodeIndex = 0;
124 : std::shared_ptr<CoilCoolingDXPerformanceBase> performance; // TODO: unique_ptr and explicit copy ctor
125 : int condensateTankIndex = 0;
126 : int condensateTankSupplyARRID = 0;
127 : Real64 condensateVolumeFlow = 0.0;
128 : Real64 condensateVolumeConsumption = 0.0;
129 : int evaporativeCondSupplyTankIndex = 0;
130 : int evaporativeCondSupplyTankARRID = 0;
131 : Real64 evaporativeCondSupplyTankVolumeFlow = 0.0;
132 : Real64 evaporativeCondSupplyTankConsump = 0.0;
133 : Real64 evapCondPumpElecPower = 0.0;
134 : Real64 evapCondPumpElecConsumption = 0.0;
135 : int airLoopNum = 0; // Add for AFN compatibility, revisit at a later date
136 : int supplyFanIndex = 0;
137 : HVAC::FanType supplyFanType = HVAC::FanType::Invalid;
138 : std::string supplyFanName = "";
139 : bool subcoolReheatFlag = false; // Subcool reheat coil control
140 :
141 : // CoilCoolingDXCurveFitSpeed &normModeNomSpeed();
142 : // CoilCoolingDXCurveFitSpeed &altModeNomSpeed();
143 :
144 : // report variables
145 : Real64 totalCoolingEnergyRate = 0.0;
146 : Real64 totalCoolingEnergy = 0.0;
147 : Real64 sensCoolingEnergyRate = 0.0;
148 : Real64 sensCoolingEnergy = 0.0;
149 : Real64 latCoolingEnergyRate = 0.0;
150 : Real64 latCoolingEnergy = 0.0;
151 :
152 : Real64 coolingCoilRuntimeFraction = 0.0;
153 : Real64 elecCoolingPower = 0.0;
154 : Real64 elecCoolingConsumption = 0.0;
155 :
156 : Real64 airMassFlowRate = 0.0;
157 : Real64 inletAirDryBulbTemp = 0.0;
158 : Real64 inletAirHumRat = 0.0;
159 : Real64 outletAirDryBulbTemp = 0.0;
160 : Real64 outletAirHumRat = 0.0;
161 : Real64 partLoadRatioReport = 0.0;
162 : Real64 runTimeFraction = 0.0;
163 : int speedNumReport = 0;
164 : Real64 speedRatioReport = 0.0;
165 : Real64 wasteHeatEnergyRate = 0.0;
166 : Real64 wasteHeatEnergy = 0.0;
167 : Real64 recoveredHeatEnergy = 0.0;
168 : Real64 recoveredHeatEnergyRate = 0.0;
169 : Real64 condenserInletTemperature = 0.0;
170 : HVAC::CoilMode dehumidificationMode = HVAC::CoilMode::Normal;
171 : bool reportCoilFinalSizes = true;
172 : bool isSecondaryDXCoilInZone = false;
173 : Real64 secCoilSensHeatRejEnergyRate = 0.0;
174 : Real64 secCoilSensHeatRejEnergy = 0.0;
175 : EnergyPlus::DataHeatBalance::HeatReclaimDataBase reclaimHeat;
176 :
177 : void setToHundredPercentDOAS();
178 : bool isHundredPercentDOAS = false;
179 :
180 : private:
181 : static bool
182 : findPerformanceSubclass(EnergyPlus::EnergyPlusData &state, const std::string_view object_to_find, const std::string &idd_performance_name);
183 : };
184 :
185 : struct CoilCoolingDXData : BaseGlobalStruct
186 : {
187 : std::vector<CoilCoolingDX> coilCoolingDXs;
188 : bool coilCoolingDXGetInputFlag = true;
189 : std::string const coilCoolingDXObjectName = "Coil:Cooling:DX";
190 : bool stillNeedToReportStandardRatings = true; // standard ratings flag for all coils to report at the same time
191 :
192 803 : void init_constant_state([[maybe_unused]] EnergyPlusData &state) override
193 : {
194 803 : }
195 :
196 803 : void init_state([[maybe_unused]] EnergyPlusData &state) override
197 : {
198 803 : }
199 :
200 0 : void clear_state() override
201 : {
202 0 : coilCoolingDXs.clear();
203 0 : coilCoolingDXGetInputFlag = true;
204 0 : stillNeedToReportStandardRatings = true;
205 0 : }
206 : };
207 :
208 : } // namespace EnergyPlus
209 :
210 : #endif // ENERGYPLUS_COILS_COILCOOLINGDX
|