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 HeatPumpWaterToWaterCOOLING_hh_INCLUDED
49 : #define HeatPumpWaterToWaterCOOLING_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/DataPlant.hh>
59 : #include <EnergyPlus/PlantComponent.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : // Forward declarations
64 : struct EnergyPlusData;
65 :
66 : namespace HeatPumpWaterToWaterCOOLING {
67 :
68 3 : struct GshpPeCoolingSpecs : PlantComponent // Needs Some Modifications talk with Dr.Fisher and decide....
69 : {
70 : // Members
71 : std::string Name; // user identifier
72 : DataPlant::PlantEquipmentType WWHPPlantTypeOfNum;
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 : Real64 COP; // Coefficient of Performance of the machine
76 : Real64 NomCap; // Nominal Capacity of the HeatPump
77 : Real64 MinPartLoadRat; // Minimum operating Part Load Ratio
78 : Real64 MaxPartLoadRat; // Maximum operating Part Load Ratio
79 : Real64 OptPartLoadRat; // Optimal operating Part Load Ratio
80 : Real64 LoadSideVolFlowRate; // Design Flow Rate on the Load side
81 : Real64 LoadSideDesignMassFlow; // Design flow rate (kg/s)
82 : Real64 SourceSideVolFlowRate; // Design Flow Rate on th Source Side
83 : Real64 SourceSideDesignMassFlow; // Design flow rate (kg/s)
84 : int SourceSideInletNodeNum; // Node number on the inlet side of the plant
85 : int SourceSideOutletNodeNum; // Node number on the outlet side of the plant
86 : int LoadSideInletNodeNum; // Node number on the inlet side of the Load Side
87 : int LoadSideOutletNodeNum; // Node number on the outlet side of the Load Side
88 : Real64 SourceSideUACoeff; // Source Side heat transfer coeff
89 : Real64 LoadSideUACoeff; // Load Side heat transfer coeff
90 : Real64 CompPistonDisp; // compressor piston displacement
91 : Real64 CompClearanceFactor; // compressor clearance factor
92 : Real64 CompSucPressDrop; // deltap , compressor suction and discharge pressure drop
93 : Real64 SuperheatTemp; // deltatsh , super heating
94 : Real64 PowerLosses; // constant part of electro mechanical power losses
95 : Real64 LossFactor; // loss factor used ot define the electro mechanical loss
96 : // that is supposed to be proportional to the theoretical power
97 : Real64 HighPressCutoff; // Maximum Design Pressure on the Load Side
98 : Real64 LowPressCutoff; // Minimum Design Pressure on the Source Side
99 : bool IsOn;
100 : bool MustRun;
101 : // loop topology variables
102 : PlantLocation SourcePlantLoc; // source side plant loop component location
103 : PlantLocation LoadPlantLoc; // load side plant loop component location
104 : int CondMassFlowIndex; // index for criteria in PullCompInterconnectTrigger
105 :
106 : // Members
107 : Real64 Power; // Power Consumption Watts
108 : Real64 Energy; // Energy Consumption Joules
109 : Real64 QLoad; // Load Side heat transfer rate Watts
110 : Real64 QLoadEnergy; // Load Side heat transfer Joules
111 : Real64 QSource; // Source Side heat transfer rate Watts
112 : Real64 QSourceEnergy; // Source Side heat transfer Joules
113 : Real64 LoadSideWaterInletTemp; // Load Side outlet temperature °C
114 : Real64 SourceSideWaterInletTemp; // Source Side outlet temperature °C
115 : Real64 LoadSideWaterOutletTemp; // Load Side outlet temperature °C
116 : Real64 SourceSideWaterOutletTemp; // Source Side outlet temperature °C
117 : int Running; // On reporting Flag
118 :
119 : Real64 LoadSideWaterMassFlowRate;
120 : Real64 SourceSideWaterMassFlowRate;
121 :
122 : bool plantScanFlag;
123 : bool beginEnvironFlag;
124 :
125 : // Default Constructor
126 3 : GshpPeCoolingSpecs()
127 3 : : WWHPPlantTypeOfNum(DataPlant::PlantEquipmentType::Invalid), Available(false), ON(false), COP(0.0), NomCap(0.0), MinPartLoadRat(0.0),
128 : MaxPartLoadRat(0.0), OptPartLoadRat(0.0), LoadSideVolFlowRate(0.0), LoadSideDesignMassFlow(0.0), SourceSideVolFlowRate(0.0),
129 : SourceSideDesignMassFlow(0.0), SourceSideInletNodeNum(0), SourceSideOutletNodeNum(0), LoadSideInletNodeNum(0), LoadSideOutletNodeNum(0),
130 : SourceSideUACoeff(0.0), LoadSideUACoeff(0.0), CompPistonDisp(0.0), CompClearanceFactor(0.0), CompSucPressDrop(0.0), SuperheatTemp(0.0),
131 : PowerLosses(0.0), LossFactor(0.0), HighPressCutoff(0.0), LowPressCutoff(0.0), IsOn(false),
132 : MustRun(false), SourcePlantLoc{}, LoadPlantLoc{}, CondMassFlowIndex(0), Power(0.0), Energy(0.0), QLoad(0.0), QLoadEnergy(0.0),
133 : QSource(0.0), QSourceEnergy(0.0), LoadSideWaterInletTemp(0.0), SourceSideWaterInletTemp(0.0), LoadSideWaterOutletTemp(0.0),
134 : SourceSideWaterOutletTemp(0.0), Running(0), LoadSideWaterMassFlowRate(0.0), SourceSideWaterMassFlowRate(0.0), plantScanFlag(true),
135 3 : beginEnvironFlag(true)
136 : {
137 3 : }
138 :
139 6 : virtual ~GshpPeCoolingSpecs() = default;
140 :
141 : static PlantComponent *factory(EnergyPlusData &state, const std::string &objectName);
142 :
143 : void simulate([[maybe_unused]] EnergyPlusData &state,
144 : const PlantLocation &calledFromLocation,
145 : bool FirstHVACIteration,
146 : Real64 &CurLoad,
147 : bool RunFlag) override;
148 :
149 : void getDesignCapacities(
150 : EnergyPlusData &state, const PlantLocation &calledFromLocation, Real64 &MaxLoad, Real64 &MinLoad, Real64 &OptLoad) override;
151 :
152 : void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, [[maybe_unused]] const PlantLocation &calledFromLocation) override;
153 :
154 : void initialize(EnergyPlusData &state);
155 :
156 : void calculate(EnergyPlusData &state, Real64 &MyLoad);
157 :
158 : void update(EnergyPlusData &state);
159 :
160 : void oneTimeInit(EnergyPlusData &state) override;
161 :
162 : void oneTimeInit_new(EnergyPlusData &state) override;
163 : };
164 :
165 : void GetGshpInput(EnergyPlusData &state);
166 :
167 : } // namespace HeatPumpWaterToWaterCOOLING
168 :
169 1542 : struct HeatPumpWaterToWaterCOOLINGData : BaseGlobalStruct
170 : {
171 :
172 : int NumGSHPs = 0;
173 : int GSHPRefrigIndex = 0;
174 : bool GetWWHPCoolingInput = true;
175 : Array1D<HeatPumpWaterToWaterCOOLING::GshpPeCoolingSpecs> GSHP;
176 : Real64 CurrentSimTime = 0.0;
177 : Real64 PrevSimTime = 0.0;
178 :
179 0 : void clear_state() override
180 : {
181 0 : this->NumGSHPs = 0;
182 0 : this->GSHPRefrigIndex = 0;
183 0 : this->GetWWHPCoolingInput = true;
184 0 : this->GSHP.deallocate();
185 0 : this->CurrentSimTime = 0.0;
186 0 : this->PrevSimTime = 0.0;
187 0 : }
188 : };
189 :
190 : } // namespace EnergyPlus
191 :
192 : #endif
|