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 : // EnergyPlus Headers
49 : #include <EnergyPlus/Data/EnergyPlusData.hh>
50 : #include <EnergyPlus/DataHeatBalFanSys.hh>
51 : #include <EnergyPlus/DataHeatBalance.hh>
52 : #include <EnergyPlus/DataZoneEnergyDemands.hh>
53 : #include <EnergyPlus/OutputProcessor.hh>
54 :
55 : namespace EnergyPlus::DataZoneEnergyDemands {
56 :
57 46333 : void ZoneSystemSensibleDemand::beginEnvironmentInit()
58 : {
59 46333 : this->RemainingOutputRequired = 0.0;
60 46333 : this->TotalOutputRequired = 0.0;
61 46333 : if (allocated(this->SequencedOutputRequired)) {
62 76967 : for (int equipNum = 1; equipNum <= this->NumZoneEquipment; ++equipNum) {
63 40971 : this->SequencedOutputRequired(equipNum) = 0.0;
64 40971 : this->SequencedOutputRequiredToHeatingSP(equipNum) = 0.0;
65 40971 : this->SequencedOutputRequiredToCoolingSP(equipNum) = 0.0;
66 : }
67 : }
68 46333 : this->ZoneSNLoadHeatEnergy = 0.0;
69 46333 : this->ZoneSNLoadCoolEnergy = 0.0;
70 46333 : this->ZoneSNLoadHeatRate = 0.0;
71 46333 : this->ZoneSNLoadCoolRate = 0.0;
72 46333 : this->ZoneSNLoadPredictedRate = 0.0;
73 46333 : this->ZoneSNLoadPredictedHSPRate = 0.0;
74 46333 : this->ZoneSNLoadPredictedCSPRate = 0.0;
75 46333 : }
76 :
77 46333 : void ZoneSystemMoistureDemand::beginEnvironmentInit()
78 : {
79 46333 : this->RemainingOutputRequired = 0.0;
80 46333 : this->TotalOutputRequired = 0.0;
81 46333 : if (allocated(this->SequencedOutputRequired)) {
82 76967 : for (int equipNum = 1; equipNum <= this->NumZoneEquipment; ++equipNum) {
83 40971 : this->SequencedOutputRequired(equipNum) = 0.0;
84 40971 : this->SequencedOutputRequiredToHumidSP(equipNum) = 0.0;
85 40971 : this->SequencedOutputRequiredToDehumidSP(equipNum) = 0.0;
86 : }
87 : }
88 46333 : this->ZoneLTLoadHeatEnergy = 0.0;
89 46333 : this->ZoneLTLoadCoolEnergy = 0.0;
90 46333 : this->ZoneLTLoadHeatRate = 0.0;
91 46333 : this->ZoneLTLoadCoolRate = 0.0;
92 46333 : this->ZoneSensibleHeatRatio = 0.0;
93 46333 : this->ZoneVaporPressureDifference = 0.0;
94 46333 : this->ZoneMoisturePredictedRate = 0.0;
95 46333 : this->ZoneMoisturePredictedHumSPRate = 0.0;
96 46333 : this->ZoneMoisturePredictedDehumSPRate = 0.0;
97 46333 : }
98 4820 : void ZoneSystemSensibleDemand::setUpOutputVars(EnergyPlusData &state,
99 : std::string_view prefix,
100 : std::string_view name,
101 : bool const staged,
102 : bool const attachMeters,
103 : int const zoneMult,
104 : int const listMult)
105 : {
106 4820 : if (attachMeters) {
107 14442 : SetupOutputVariable(state,
108 9628 : format("{} Air System Sensible Heating Energy", prefix),
109 : OutputProcessor::Unit::J,
110 : this->ZoneSNLoadHeatEnergy,
111 : OutputProcessor::SOVTimeStepType::System,
112 : OutputProcessor::SOVStoreType::Summed,
113 : name,
114 : _,
115 : "ENERGYTRANSFER",
116 : "Heating",
117 : _,
118 : "Building",
119 : name,
120 : zoneMult,
121 : listMult);
122 14442 : SetupOutputVariable(state,
123 9628 : format("{} Air System Sensible Cooling Energy", prefix),
124 : OutputProcessor::Unit::J,
125 : this->ZoneSNLoadCoolEnergy,
126 : OutputProcessor::SOVTimeStepType::System,
127 : OutputProcessor::SOVStoreType::Summed,
128 : name,
129 : _,
130 : "ENERGYTRANSFER",
131 : "Cooling",
132 : _,
133 : "Building",
134 : name,
135 : zoneMult,
136 : listMult);
137 : } else {
138 18 : SetupOutputVariable(state,
139 12 : format("{} Air System Sensible Heating Energy", prefix),
140 : OutputProcessor::Unit::J,
141 : this->ZoneSNLoadHeatEnergy,
142 : OutputProcessor::SOVTimeStepType::System,
143 : OutputProcessor::SOVStoreType::Summed,
144 : name);
145 18 : SetupOutputVariable(state,
146 12 : format("{} Air System Sensible Cooling Energy", prefix),
147 : OutputProcessor::Unit::J,
148 : this->ZoneSNLoadCoolEnergy,
149 : OutputProcessor::SOVTimeStepType::System,
150 : OutputProcessor::SOVStoreType::Summed,
151 : name);
152 : }
153 14460 : SetupOutputVariable(state,
154 9640 : format("{} Air System Sensible Heating Rate", prefix),
155 : OutputProcessor::Unit::W,
156 : this->ZoneSNLoadHeatRate,
157 : OutputProcessor::SOVTimeStepType::System,
158 : OutputProcessor::SOVStoreType::Average,
159 : name);
160 14460 : SetupOutputVariable(state,
161 9640 : format("{} Air System Sensible Cooling Rate", prefix),
162 : OutputProcessor::Unit::W,
163 : this->ZoneSNLoadCoolRate,
164 : OutputProcessor::SOVTimeStepType::System,
165 : OutputProcessor::SOVStoreType::Average,
166 : name);
167 : // The following output variables are for the predicted Heating/Cooling load for the zone which can be compared to actual load.
168 : // There are two sets of data available: one where zone and group multipliers have been applied and another where the multipliers have
169 : // not. First, these report variables are NOT multiplied by zone and group multipliers
170 14460 : SetupOutputVariable(state,
171 9640 : format("{} Predicted Sensible Load to Setpoint Heat Transfer Rate", prefix),
172 : OutputProcessor::Unit::W,
173 : this->ZoneSNLoadPredictedRate,
174 : OutputProcessor::SOVTimeStepType::System,
175 : OutputProcessor::SOVStoreType::Average,
176 : name);
177 14460 : SetupOutputVariable(state,
178 9640 : format("{} Predicted Sensible Load to Heating Setpoint Heat Transfer Rate", prefix),
179 : OutputProcessor::Unit::W,
180 : this->ZoneSNLoadPredictedHSPRate,
181 : OutputProcessor::SOVTimeStepType::System,
182 : OutputProcessor::SOVStoreType::Average,
183 : name);
184 14460 : SetupOutputVariable(state,
185 9640 : format("{} Predicted Sensible Load to Cooling Setpoint Heat Transfer Rate", prefix),
186 : OutputProcessor::Unit::W,
187 : this->ZoneSNLoadPredictedCSPRate,
188 : OutputProcessor::SOVTimeStepType::System,
189 : OutputProcessor::SOVStoreType::Average,
190 : name);
191 : // Second, these report variable ARE multiplied by zone and group multipliers
192 14460 : SetupOutputVariable(state,
193 9640 : format("{} System Predicted Sensible Load to Setpoint Heat Transfer Rate", prefix),
194 : OutputProcessor::Unit::W,
195 : this->TotalOutputRequired,
196 : OutputProcessor::SOVTimeStepType::System,
197 : OutputProcessor::SOVStoreType::Average,
198 : name);
199 14460 : SetupOutputVariable(state,
200 9640 : format("{} System Predicted Sensible Load to Heating Setpoint Heat Transfer Rate", prefix),
201 : OutputProcessor::Unit::W,
202 : this->OutputRequiredToHeatingSP,
203 : OutputProcessor::SOVTimeStepType::System,
204 : OutputProcessor::SOVStoreType::Average,
205 : name);
206 14460 : SetupOutputVariable(state,
207 9640 : format("{} System Predicted Sensible Load to Cooling Setpoint Heat Transfer Rate", prefix),
208 : OutputProcessor::Unit::W,
209 : this->OutputRequiredToCoolingSP,
210 : OutputProcessor::SOVTimeStepType::System,
211 : OutputProcessor::SOVStoreType::Average,
212 : name);
213 4820 : if (staged) {
214 21 : SetupOutputVariable(state,
215 14 : format("{} Thermostat Staged Number", prefix),
216 : OutputProcessor::Unit::None,
217 : this->StageNum,
218 : OutputProcessor::SOVTimeStepType::System,
219 : OutputProcessor::SOVStoreType::Average,
220 : name);
221 : }
222 4820 : }
223 :
224 4820 : void ZoneSystemMoistureDemand::setUpOutputVars(EnergyPlusData &state,
225 : std::string_view prefix,
226 : std::string_view name,
227 : [[maybe_unused]] bool const staged,
228 : [[maybe_unused]] bool const attachMeters,
229 : [[maybe_unused]] int const zoneMult,
230 : [[maybe_unused]] int const listMult)
231 : {
232 4820 : if (state.dataHeatBal->DoLatentSizing) {
233 27 : SetupOutputVariable(state,
234 18 : format("{} Air System Latent Heating Energy", prefix),
235 : OutputProcessor::Unit::J,
236 : this->ZoneLTLoadHeatEnergy,
237 : OutputProcessor::SOVTimeStepType::System,
238 : OutputProcessor::SOVStoreType::Summed,
239 : name);
240 27 : SetupOutputVariable(state,
241 18 : format("{} Air System Latent Cooling Energy", prefix),
242 : OutputProcessor::Unit::J,
243 : this->ZoneLTLoadCoolEnergy,
244 : OutputProcessor::SOVTimeStepType::System,
245 : OutputProcessor::SOVStoreType::Summed,
246 : name);
247 27 : SetupOutputVariable(state,
248 18 : format("{} Air System Latent Heating Rate", prefix),
249 : OutputProcessor::Unit::W,
250 : this->ZoneLTLoadHeatRate,
251 : OutputProcessor::SOVTimeStepType::System,
252 : OutputProcessor::SOVStoreType::Average,
253 : name);
254 27 : SetupOutputVariable(state,
255 18 : format("{} Air System Latent Cooling Rate", prefix),
256 : OutputProcessor::Unit::W,
257 : this->ZoneLTLoadCoolRate,
258 : OutputProcessor::SOVTimeStepType::System,
259 : OutputProcessor::SOVStoreType::Average,
260 : name);
261 : // temporarily hide these behind DoLatentSizing flag
262 27 : SetupOutputVariable(state,
263 18 : format("{} Air System Sensible Heat Ratio", prefix),
264 : OutputProcessor::Unit::None,
265 : this->ZoneSensibleHeatRatio,
266 : OutputProcessor::SOVTimeStepType::System,
267 : OutputProcessor::SOVStoreType::Average,
268 : name);
269 27 : SetupOutputVariable(state,
270 18 : format("{} Air Vapor Pressure Difference", prefix),
271 : OutputProcessor::Unit::Pa,
272 : this->ZoneVaporPressureDifference,
273 : OutputProcessor::SOVTimeStepType::System,
274 : OutputProcessor::SOVStoreType::Average,
275 : name);
276 : }
277 : // The following output variables are for the predicted moisture load for the zone with humidity controlled specified.
278 : // There are two sets of data available: one where zone and group multipliers have been applied and another where the multipliers have
279 : // not. First, these report variables are NOT multiplied by zone and group multipliers
280 14460 : SetupOutputVariable(state,
281 9640 : format("{} Predicted Moisture Load Moisture Transfer Rate", prefix),
282 : OutputProcessor::Unit::kgWater_s,
283 : this->ZoneMoisturePredictedRate,
284 : OutputProcessor::SOVTimeStepType::System,
285 : OutputProcessor::SOVStoreType::Average,
286 : name);
287 14460 : SetupOutputVariable(state,
288 9640 : format("{} Predicted Moisture Load to Humidifying Setpoint Moisture Transfer Rate", prefix),
289 : OutputProcessor::Unit::kgWater_s,
290 : this->ZoneMoisturePredictedHumSPRate,
291 : OutputProcessor::SOVTimeStepType::System,
292 : OutputProcessor::SOVStoreType::Average,
293 : name);
294 14460 : SetupOutputVariable(state,
295 9640 : format("{} Predicted Moisture Load to Dehumidifying Setpoint Moisture Transfer Rate", prefix),
296 : OutputProcessor::Unit::kgWater_s,
297 : this->ZoneMoisturePredictedDehumSPRate,
298 : OutputProcessor::SOVTimeStepType::System,
299 : OutputProcessor::SOVStoreType::Average,
300 : name);
301 : // Second, these report variable ARE multiplied by zone and group multipliers
302 14460 : SetupOutputVariable(state,
303 9640 : format("{} System Predicted Moisture Load Moisture Transfer Rate", prefix),
304 : OutputProcessor::Unit::kgWater_s,
305 : this->TotalOutputRequired,
306 : OutputProcessor::SOVTimeStepType::System,
307 : OutputProcessor::SOVStoreType::Average,
308 : name);
309 14460 : SetupOutputVariable(state,
310 9640 : format("{} System Predicted Moisture Load to Humidifying Setpoint Moisture Transfer Rate", prefix),
311 : OutputProcessor::Unit::kgWater_s,
312 : this->OutputRequiredToHumidifyingSP,
313 : OutputProcessor::SOVTimeStepType::System,
314 : OutputProcessor::SOVStoreType::Average,
315 : name);
316 14460 : SetupOutputVariable(state,
317 9640 : format("{} System Predicted Moisture Load to Dehumidifying Setpoint Moisture Transfer Rate", prefix),
318 : OutputProcessor::Unit::kgWater_s,
319 : this->OutputRequiredToDehumidifyingSP,
320 : OutputProcessor::SOVTimeStepType::System,
321 : OutputProcessor::SOVStoreType::Average,
322 : name);
323 4820 : }
324 :
325 27958103 : void ZoneSystemSensibleDemand::reportZoneAirSystemSensibleLoads(EnergyPlusData &state, Real64 const SNLoad)
326 : {
327 27958103 : this->ZoneSNLoadHeatRate = max(SNLoad, 0.0);
328 27958103 : this->ZoneSNLoadCoolRate = std::abs(min(SNLoad, 0.0));
329 27958103 : this->ZoneSNLoadHeatEnergy = this->ZoneSNLoadHeatRate * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
330 27958103 : this->ZoneSNLoadCoolEnergy = this->ZoneSNLoadCoolRate * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
331 27958103 : }
332 27959531 : void ZoneSystemSensibleDemand::reportSensibleLoadsZoneMultiplier(
333 : EnergyPlusData &state, int const zoneNum, Real64 const totalLoad, Real64 const loadToHeatingSetPoint, Real64 const loadToCoolingSetPoint)
334 : {
335 27959531 : Real64 loadCorrFactor = state.dataHeatBalFanSys->LoadCorrectionFactor(zoneNum);
336 :
337 27959531 : this->ZoneSNLoadPredictedRate = totalLoad * loadCorrFactor;
338 27959531 : this->ZoneSNLoadPredictedHSPRate = loadToHeatingSetPoint * loadCorrFactor;
339 27959531 : this->ZoneSNLoadPredictedCSPRate = loadToCoolingSetPoint * loadCorrFactor;
340 :
341 27959531 : Real64 ZoneMultFac = state.dataHeatBal->Zone(zoneNum).Multiplier * state.dataHeatBal->Zone(zoneNum).ListMultiplier;
342 27959531 : this->TotalOutputRequired = this->ZoneSNLoadPredictedRate * ZoneMultFac;
343 27959531 : this->OutputRequiredToHeatingSP = this->ZoneSNLoadPredictedHSPRate * ZoneMultFac;
344 27959531 : this->OutputRequiredToCoolingSP = this->ZoneSNLoadPredictedCSPRate * ZoneMultFac;
345 :
346 : // init each sequenced demand to the full output
347 27959531 : if (state.dataHeatBal->Zone(zoneNum).IsControlled && this->NumZoneEquipment > 0) {
348 50379565 : for (int equipNum = 1; equipNum <= this->NumZoneEquipment; ++equipNum) {
349 26521386 : this->SequencedOutputRequired(equipNum) = this->TotalOutputRequired;
350 26521386 : this->SequencedOutputRequiredToHeatingSP(equipNum) = this->OutputRequiredToHeatingSP;
351 26521386 : this->SequencedOutputRequiredToCoolingSP(equipNum) = this->OutputRequiredToCoolingSP;
352 : }
353 : }
354 27959531 : }
355 :
356 38484 : void ZoneSystemMoistureDemand::reportZoneAirSystemMoistureLoads(EnergyPlusData &state,
357 : Real64 const latentGain,
358 : Real64 const sensibleLoad,
359 : Real64 const vaporPressureDiff)
360 : {
361 38484 : this->ZoneLTLoadHeatRate = std::abs(min(latentGain, 0.0));
362 38484 : this->ZoneLTLoadCoolRate = max(latentGain, 0.0);
363 38484 : this->ZoneLTLoadHeatEnergy = this->ZoneLTLoadHeatRate * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
364 38484 : this->ZoneLTLoadCoolEnergy = this->ZoneLTLoadCoolRate * state.dataHVACGlobal->TimeStepSys * DataGlobalConstants::SecInHour;
365 38484 : if ((sensibleLoad + latentGain) != 0.0) {
366 35177 : this->ZoneSensibleHeatRatio = sensibleLoad / (sensibleLoad + latentGain);
367 3307 : } else if (sensibleLoad != 0.0) {
368 0 : this->ZoneSensibleHeatRatio = 1.0;
369 : } else {
370 3307 : this->ZoneSensibleHeatRatio = 0.0;
371 : }
372 38484 : this->ZoneVaporPressureDifference = vaporPressureDiff;
373 38484 : }
374 :
375 1028208 : void ZoneSystemMoistureDemand::reportMoistLoadsZoneMultiplier(
376 : EnergyPlusData &state, int const zoneNum, Real64 const totalLoad, Real64 const loadToHumidifySetPoint, Real64 const loadToDehumidifySetPoint)
377 : {
378 1028208 : this->ZoneMoisturePredictedRate = totalLoad;
379 1028208 : this->ZoneMoisturePredictedHumSPRate = loadToHumidifySetPoint;
380 1028208 : this->ZoneMoisturePredictedDehumSPRate = loadToDehumidifySetPoint;
381 :
382 1028208 : Real64 zoneMultFac = state.dataHeatBal->Zone(zoneNum).Multiplier * state.dataHeatBal->Zone(zoneNum).ListMultiplier;
383 :
384 1028208 : this->TotalOutputRequired = totalLoad * zoneMultFac;
385 1028208 : this->OutputRequiredToHumidifyingSP = loadToHumidifySetPoint * zoneMultFac;
386 1028208 : this->OutputRequiredToDehumidifyingSP = loadToDehumidifySetPoint * zoneMultFac;
387 :
388 : // init each sequenced demand to the full output
389 1028208 : if (state.dataHeatBal->Zone(zoneNum).IsControlled && this->NumZoneEquipment > 0) {
390 2283346 : for (int equipNum = 1; equipNum <= this->NumZoneEquipment; ++equipNum) {
391 1258588 : this->SequencedOutputRequired(equipNum) = this->TotalOutputRequired;
392 1258588 : this->SequencedOutputRequiredToHumidSP(equipNum) = this->OutputRequiredToHumidifyingSP;
393 1258588 : this->SequencedOutputRequiredToDehumidSP(equipNum) = this->OutputRequiredToDehumidifyingSP;
394 : }
395 : }
396 1028208 : }
397 2313 : } // namespace EnergyPlus::DataZoneEnergyDemands
|