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 PhotovoltaicThermalCollectors_hh_INCLUDED
49 : #define PhotovoltaicThermalCollectors_hh_INCLUDED
50 :
51 : // ObjexxFCL Headers
52 : #include <ObjexxFCL/Array1D.hh>
53 :
54 : // EnergyPlus Headers
55 : #include <EnergyPlus/ConvectionCoefficients.hh>
56 : #include <EnergyPlus/Data/BaseData.hh>
57 : #include <EnergyPlus/Plant/Enums.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 PhotovoltaicThermalCollectors {
67 :
68 : enum struct WorkingFluidEnum
69 : {
70 : LIQUID,
71 : AIR
72 : };
73 :
74 : enum struct ThermEfficEnum
75 : {
76 : SCHEDULED,
77 : FIXED
78 : };
79 :
80 36 : struct SimplePVTModelStruct
81 : {
82 : // Members
83 : std::string Name;
84 : Real64 ThermalActiveFract; // fraction of surface area with active thermal collection
85 : ThermEfficEnum ThermEfficMode; // setting for how therm effic is determined
86 : Real64 ThermEffic; // fixed or current Therm efficiency
87 : int ThermEffSchedNum; // pointer to schedule for therm effic (if any)
88 : Real64 SurfEmissivity; // surface emittance in long wave IR
89 : Real64 LastCollectorTemp; // store previous temperature
90 : Real64 CollectorTemp; // average solar collector temp.
91 :
92 : // Default Constructor
93 2 : SimplePVTModelStruct()
94 2 : : ThermalActiveFract(0.0), ThermEfficMode(ThermEfficEnum::FIXED), ThermEffic(0.0), ThermEffSchedNum(0), SurfEmissivity(0.0),
95 2 : LastCollectorTemp(0.0), CollectorTemp(0.0)
96 : {
97 2 : }
98 : };
99 :
100 : struct PVTReportStruct
101 : {
102 : // Members
103 : Real64 ThermEfficiency; // Thermal efficiency of solar energy conversion
104 : Real64 ThermPower; // Heat gain or loss to collector fluid (W)
105 : Real64 ThermHeatGain; // Heat gain to collector fluid (W)
106 : Real64 ThermHeatLoss; // Heat loss from collector fluid (W)
107 : Real64 ThermEnergy; // Energy gained (or lost) to collector fluid (J)
108 : Real64 MdotWorkFluid; // working fluid mass flow rate (kg/s)
109 : Real64 TinletWorkFluid; // working fluid inlet temp (C)
110 : Real64 ToutletWorkFluid; // working fluid outlet temp (C)
111 : Real64 BypassStatus; // 0 = no bypass, 1=full bypass
112 :
113 : // Default Constructor
114 1 : PVTReportStruct()
115 1 : : ThermEfficiency(0.0), ThermPower(0.0), ThermHeatGain(0.0), ThermHeatLoss(0.0), ThermEnergy(0.0), MdotWorkFluid(0.0),
116 1 : TinletWorkFluid(0.0), ToutletWorkFluid(0.0), BypassStatus(0.0)
117 : {
118 1 : }
119 : };
120 :
121 21 : struct PVTCollectorStruct : PlantComponent
122 : {
123 : // Members
124 : std::string Name; // Name of PVT collector
125 : DataPlant::PlantEquipmentType Type; // Plant Side Connection: 'Type' assigned in DataPlant
126 : PlantLocation WPlantLoc; // Water plant loop component location
127 : bool EnvrnInit; // manage begin environment inits
128 : bool SizingInit; // manage when sizing is complete
129 : std::string PVTModelName; // Name of PVT performance object
130 : int PVTModelType; // model type indicator, only simple avail now
131 : int SurfNum; // surface index
132 : std::string PVname; // named Generator:Photovoltaic object
133 : int PVnum; // PV index
134 : bool PVfound; // init, need to delay get input until PV gotten
135 : SimplePVTModelStruct Simple; // performance data structure.
136 : WorkingFluidEnum WorkingFluidType;
137 : int PlantInletNodeNum;
138 : int PlantOutletNodeNum;
139 : int HVACInletNodeNum;
140 : int HVACOutletNodeNum;
141 : Real64 DesignVolFlowRate;
142 : bool DesignVolFlowRateWasAutoSized; // true if design volume flow rate was autosize on input
143 : Real64 MaxMassFlowRate;
144 : Real64 MassFlowRate;
145 : Real64 AreaCol;
146 : bool BypassDamperOff;
147 : bool CoolingUseful;
148 : bool HeatingUseful;
149 : PVTReportStruct Report;
150 : bool MySetPointCheckFlag;
151 : bool MyOneTimeFlag;
152 : bool SetLoopIndexFlag;
153 :
154 : // Default Constructor
155 1 : PVTCollectorStruct()
156 1 : : Type(DataPlant::PlantEquipmentType::Invalid), WPlantLoc{}, EnvrnInit(true), SizingInit(true), PVTModelType(0), SurfNum(0), PVnum(0),
157 : PVfound(false), WorkingFluidType(WorkingFluidEnum::LIQUID), PlantInletNodeNum(0), PlantOutletNodeNum(0), HVACInletNodeNum(0),
158 : HVACOutletNodeNum(0), DesignVolFlowRate(0.0), DesignVolFlowRateWasAutoSized(false), MaxMassFlowRate(0.0), MassFlowRate(0.0),
159 : AreaCol(0.0), BypassDamperOff(true), CoolingUseful(false), HeatingUseful(false), MySetPointCheckFlag(true), MyOneTimeFlag(true),
160 1 : SetLoopIndexFlag(true)
161 : {
162 1 : }
163 :
164 : static PlantComponent *factory(EnergyPlusData &state, std::string_view objectName);
165 :
166 : void onInitLoopEquip([[maybe_unused]] EnergyPlusData &state, const PlantLocation &calledFromLocation) override;
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 setupReportVars(EnergyPlusData &state);
175 :
176 : void initialize(EnergyPlusData &state, bool FirstHVACIteration);
177 :
178 : void size(EnergyPlusData &state);
179 :
180 : void control(EnergyPlusData &state);
181 :
182 : void calculate(EnergyPlusData &state);
183 :
184 : void update(EnergyPlusData &state);
185 :
186 : void oneTimeInit(EnergyPlusData &state) override;
187 : };
188 :
189 : void GetPVTcollectorsInput(EnergyPlusData &state);
190 :
191 : void simPVTfromOASys(EnergyPlusData &state, int index, bool FirstHVACIteration);
192 :
193 : int getPVTindexFromName(EnergyPlusData &state, std::string_view name);
194 :
195 : void GetPVTThermalPowerProduction(EnergyPlusData &state, int PVindex, Real64 &ThermalPower, Real64 &ThermalEnergy);
196 :
197 : int GetAirInletNodeNum(EnergyPlusData &state, std::string_view PVTName, bool &ErrorsFound);
198 :
199 : int GetAirOutletNodeNum(EnergyPlusData &state, std::string_view PVTName, bool &ErrorsFound);
200 :
201 : } // namespace PhotovoltaicThermalCollectors
202 :
203 1542 : struct PhotovoltaicThermalCollectorsData : BaseGlobalStruct
204 : {
205 :
206 : bool GetInputFlag = true; // First time, input is "gotten"
207 :
208 : int NumPVT = 0; // count of all types of PVT in input file
209 :
210 : Array1D<PhotovoltaicThermalCollectors::PVTCollectorStruct> PVT;
211 :
212 0 : void clear_state() override
213 : {
214 0 : GetInputFlag = true;
215 0 : NumPVT = 0;
216 0 : PVT.deallocate();
217 0 : }
218 : };
219 :
220 : } // namespace EnergyPlus
221 :
222 : #endif
|