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 HeatPumpWaterToWaterSimple_hh_INCLUDED
49 : #define HeatPumpWaterToWaterSimple_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/PlantComponent.hh>
59 :
60 : namespace EnergyPlus {
61 :
62 : // Forward declarations
63 : struct EnergyPlusData;
64 :
65 : namespace HeatPumpWaterToWaterSimple {
66 :
67 : struct GshpSpecs : public PlantComponent
68 : {
69 : // Members
70 : std::string Name; // user identifier
71 : bool checkEquipName; // name check flag
72 : DataPlant::PlantEquipmentType WWHPType; // equipment type num
73 : bool Available; // need an array of logicals--load identifiers of available equipment
74 : bool ON; // simulate the machine at it's operating part load ratio
75 : bool IsOn; // flag that the heat pump is ON during current time step
76 : bool MustRun; // flag that the heat pump is MUST RUN during current time step
77 : Real64 SourceSideDesignMassFlow; // Design flow rate (kg/s)
78 :
79 : Real64 LoadSideDesignMassFlow; // Design flow rate (kg/s)
80 :
81 : Real64 RatedLoadVolFlowCool; // Rated Cooling Load Side Volumetric Flow Rate [m3/s]
82 : bool ratedLoadVolFlowCoolWasAutoSized; // true if RatedSourceVolFlowCool was autosize on input
83 : Real64 RatedSourceVolFlowCool; // Rated Cooling Source Side Volumetric Flow Rate [m3/s]
84 : bool ratedSourceVolFlowCoolWasAutoSized; // true if RatedSourceVolFlowCool was autosize on input
85 : Real64 RatedCapCool; // Rated Cooling Capacity [W]
86 : bool ratedCapCoolWasAutoSized; // true if RatedCapCool was autosize on input
87 : Real64 RatedPowerCool; // Rated Cooling Power Consumption[W]
88 : bool ratedPowerCoolWasAutoSized; // ture if RatedPowerCool was autosize on input
89 : int CoolCapCurveIndex; // Index of the Cooling capacity performance curve
90 : int CoolPowCurveIndex; // Index of the Cooling power consumption curve
91 : int CoolCapNegativeCounter; // Counter for number of times cooling capacity curve is <= 0.0
92 : int CoolCapNegativeIndex; // Index for recurring warning message regarding cooling capacity curve is <= 0.0
93 : int CoolPowerNegativeCounter; // Counter for number of times cooling power curve is <= 0.0
94 : int CoolPowerNegativeIndex; // Index for recurring warning message regarding cooling power curve is <= 0.0
95 : Real64 RatedLoadVolFlowHeat; // Rated Heating Load Side Volumetric Flow Rate [m3/s]
96 : bool ratedLoadVolFlowHeatWasAutoSized; // true if RatedLoadVolFlowHeat was autosize on input
97 : Real64 RatedSourceVolFlowHeat; // Rated Heating Source Side Volumetric Flow Rate [m3/s]
98 : bool ratedSourceVolFlowHeatWasAutoSized; // true if RatedSourceVolFlowHeat was autosize on input
99 : Real64 RatedCapHeat; // Rated Heating Capacity [W]
100 : bool ratedCapHeatWasAutoSized; // true if RatedCapHeat was autosize on input
101 : Real64 RatedPowerHeat; // Rated Heating Compressor Power[W]
102 : bool ratedPowerHeatWasAutoSized; // true if RatedPowerHeat was autosize on input
103 : int HeatCapCurveIndex; // Index of the Heating capacity performance curve
104 : int HeatPowCurveIndex; // Index of the Heating power consumption curve
105 : int LoadSideInletNodeNum; // Load Side Inlet Node
106 : int LoadSideOutletNodeNum; // Load Side Outlet Node
107 : int SourceSideInletNodeNum; // Source Side Inlet Node
108 : int SourceSideOutletNodeNum; // Source Side Outlet Node
109 : int HeatCapNegativeCounter; // Counter for number of times heating capacity curve is <= 0.0
110 : int HeatCapNegativeIndex; // Index for recurring warning message regarding heating capacity curve is <= 0.0
111 : int HeatPowerNegativeCounter; // Counter for number of times heating power curve is <= 0.0
112 : int HeatPowerNegativeIndex; // Index for recurring warning message regarding heating power curve is <= 0.0
113 : // loop topology variables
114 : PlantLocation SourcePlantLoc; // source side plant loop component location
115 : PlantLocation LoadPlantLoc; // load side plant loop component location
116 : int CondMassFlowIndex; // index for criteria in PullCompInterconnectTrigger
117 : Real64 refCOP; // reference COP used for sizing reference power, user input
118 : Real64 sizFac; // component level sizing factor, user input
119 : std::string companionName; // name of companion GSHP
120 : int companionIndex; // index in GSHP structure for companion heat pump
121 : bool companionIdentified; // true if this GSHP has found its companion heat pump
122 :
123 : // Report variables
124 : Real64 reportPower; // Power Consumption [W]
125 : Real64 reportEnergy; // Energy Consumption [J]
126 : Real64 reportQLoad; // Load Side Heat Transfer Rate [W]
127 : Real64 reportQLoadEnergy; // Load Side Heat Transfer [J]
128 : Real64 reportQSource; // Source Side Heat Transfer Rate [W]
129 : Real64 reportQSourceEnergy; // Source Side Heat Transfer [J]
130 : Real64 reportLoadSideMassFlowRate; // Load side volumetric flow rate m3/s
131 : Real64 reportLoadSideInletTemp; // Load Side outlet temperature degC
132 : Real64 reportLoadSideOutletTemp; // Load Side outlet temperature degC
133 : Real64 reportSourceSideMassFlowRate; // Source side volumetric flow rate m3/s
134 : Real64 reportSourceSideInletTemp; // Source Side outlet temperature degC
135 : Real64 reportSourceSideOutletTemp; // Source Side outlet temperature degC
136 :
137 : // init flags
138 : bool MyPlantScanFlag;
139 : bool MyEnvrnFlag;
140 :
141 : bool myCoolingSizesReported;
142 : bool myHeatingSizesReported;
143 :
144 : // Default Constructor
145 2 : GshpSpecs()
146 4 : : checkEquipName(true), WWHPType(DataPlant::PlantEquipmentType::Invalid), Available(false), ON(false), IsOn(false), MustRun(false),
147 2 : SourceSideDesignMassFlow(0.0), LoadSideDesignMassFlow(0.0), RatedLoadVolFlowCool(0.0), ratedLoadVolFlowCoolWasAutoSized(false),
148 2 : RatedSourceVolFlowCool(0.0), ratedSourceVolFlowCoolWasAutoSized(false), RatedCapCool(0.0), ratedCapCoolWasAutoSized(false),
149 2 : RatedPowerCool(0.0), ratedPowerCoolWasAutoSized(false), CoolCapCurveIndex(0), CoolPowCurveIndex(0), CoolCapNegativeCounter(0),
150 2 : CoolCapNegativeIndex(0), CoolPowerNegativeCounter(0), CoolPowerNegativeIndex(0), RatedLoadVolFlowHeat(0.0),
151 2 : ratedLoadVolFlowHeatWasAutoSized(false), RatedSourceVolFlowHeat(0.0), ratedSourceVolFlowHeatWasAutoSized(false), RatedCapHeat(0.0),
152 2 : ratedCapHeatWasAutoSized(false), RatedPowerHeat(0.0), ratedPowerHeatWasAutoSized(false), HeatCapCurveIndex(0), HeatPowCurveIndex(0),
153 2 : LoadSideInletNodeNum(0), LoadSideOutletNodeNum(0), SourceSideInletNodeNum(0), SourceSideOutletNodeNum(0), HeatCapNegativeCounter(0),
154 2 : HeatCapNegativeIndex(0), HeatPowerNegativeCounter(0), HeatPowerNegativeIndex(0), SourcePlantLoc{}, LoadPlantLoc{}, CondMassFlowIndex(0),
155 4 : refCOP(0.0), sizFac(0.0), companionIndex(0), companionIdentified(false), reportPower(0.0), reportEnergy(0.0), reportQLoad(0.0),
156 2 : reportQLoadEnergy(0.0), reportQSource(0.0), reportQSourceEnergy(0.0), reportLoadSideMassFlowRate(0.0), reportLoadSideInletTemp(0.0),
157 2 : reportLoadSideOutletTemp(0.0), reportSourceSideMassFlowRate(0.0), reportSourceSideInletTemp(0.0), reportSourceSideOutletTemp(0.0),
158 4 : MyPlantScanFlag(true), MyEnvrnFlag(true), myCoolingSizesReported(false), myHeatingSizesReported(false)
159 : {
160 2 : }
161 :
162 6 : virtual ~GshpSpecs() = default;
163 :
164 : static GshpSpecs *factory(EnergyPlusData &state, DataPlant::PlantEquipmentType wwhp_type, std::string_view eir_wwhp_name);
165 :
166 : static void GetWatertoWaterHPInput(EnergyPlusData &state);
167 :
168 : void simulate([[maybe_unused]] EnergyPlusData &state,
169 : const PlantLocation &calledFromLocation,
170 : bool FirstHVACIteration,
171 : Real64 &CurLoad,
172 : bool RunFlag) override;
173 :
174 : void getDesignCapacities(
175 : EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
176 :
177 : void getSizingFactor(Real64 &sizingFactor) override;
178 :
179 : void InitWatertoWaterHP(EnergyPlusData &state,
180 : DataPlant::PlantEquipmentType GSHPTypeNum, // Type of GSHP
181 : std::string const &GSHPName, // User Specified Name of GSHP
182 : bool FirstHVACIteration,
183 : Real64 MyLoad // Demand Load
184 : );
185 :
186 : void sizeCoolingWaterToWaterHP(EnergyPlusData &state);
187 :
188 : void sizeHeatingWaterToWaterHP(EnergyPlusData &state);
189 :
190 : void CalcWatertoWaterHPCooling(EnergyPlusData &state, Real64 MyLoad); // Operating Load
191 :
192 : void CalcWatertoWaterHPHeating(EnergyPlusData &state, Real64 MyLoad); // Operating Load
193 :
194 : void UpdateGSHPRecords(EnergyPlusData &state);
195 :
196 : void onInitLoopEquip(EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
197 :
198 : void oneTimeInit(EnergyPlusData &state) override;
199 :
200 : void oneTimeInit_new(EnergyPlusData &state) override;
201 : };
202 :
203 : } // namespace HeatPumpWaterToWaterSimple
204 :
205 : struct HeatPumpWaterToWaterSimpleData : BaseGlobalStruct
206 : {
207 :
208 : int NumGSHPs = 0;
209 : bool GetInputFlag = true;
210 : Array1D<HeatPumpWaterToWaterSimple::GshpSpecs> GSHP;
211 : std::unordered_map<std::string, std::string> HeatPumpWaterUniqueNames;
212 :
213 796 : void init_state([[maybe_unused]] EnergyPlusData &state) override
214 : {
215 796 : }
216 :
217 0 : void clear_state() override
218 : {
219 0 : this->NumGSHPs = 0;
220 0 : this->GetInputFlag = true;
221 0 : this->GSHP.deallocate();
222 0 : this->HeatPumpWaterUniqueNames.clear();
223 0 : }
224 : };
225 :
226 : } // namespace EnergyPlus
227 :
228 : #endif
|