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