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/DataEnvironment.hh>
51 : #include <EnergyPlus/DataIPShortCuts.hh>
52 : #include <EnergyPlus/EMSManager.hh>
53 : #include <EnergyPlus/ExteriorEnergyUse.hh>
54 : #include <EnergyPlus/GlobalNames.hh>
55 : #include <EnergyPlus/InputProcessing/InputProcessor.hh>
56 : #include <EnergyPlus/OutputProcessor.hh>
57 : #include <EnergyPlus/OutputReportPredefined.hh>
58 : #include <EnergyPlus/ScheduleManager.hh>
59 : #include <EnergyPlus/UtilityRoutines.hh>
60 :
61 : namespace EnergyPlus {
62 :
63 : namespace ExteriorEnergyUse {
64 :
65 : // MODULE INFORMATION:
66 : // AUTHOR Linda Lawrie
67 : // DATE WRITTEN January 2001
68 : // MODIFIED na
69 : // RE-ENGINEERED na
70 :
71 : // PURPOSE OF THIS MODULE:
72 : // This module provides the reporting for exterior energy usage. This usage does not directly
73 : // affect simulation results for the energy usage in a building but may affect the "metered"
74 : // usage of a facility.
75 :
76 1785085 : void ManageExteriorEnergyUse(EnergyPlusData &state)
77 : {
78 :
79 : // SUBROUTINE INFORMATION:
80 : // AUTHOR Linda Lawrie
81 : // DATE WRITTEN January 2001
82 : // MODIFIED na
83 : // RE-ENGINEERED na
84 :
85 : // PURPOSE OF THIS SUBROUTINE:
86 : // This subroutine provides the usual call for the Simulation Manager.
87 :
88 1785085 : if (state.dataExteriorEnergyUse->GetExteriorEnergyInputFlag) {
89 769 : ExteriorEnergyUse::GetExteriorEnergyUseInput(state);
90 769 : state.dataExteriorEnergyUse->GetExteriorEnergyInputFlag = false;
91 : }
92 :
93 1785085 : ExteriorEnergyUse::ReportExteriorEnergyUse(state);
94 1785085 : }
95 :
96 769 : void GetExteriorEnergyUseInput(EnergyPlusData &state)
97 : {
98 :
99 : // SUBROUTINE INFORMATION:
100 : // AUTHOR Linda Lawrie
101 : // DATE WRITTEN January 2001
102 : // MODIFIED na
103 : // RE-ENGINEERED na
104 :
105 : // PURPOSE OF THIS SUBROUTINE:
106 : // This subroutine gets the input for the Exterior Lights and Equipment.
107 :
108 : // Using/Aliasing
109 :
110 : using ScheduleManager::GetScheduleIndex;
111 : using ScheduleManager::GetScheduleMaxValue;
112 : using ScheduleManager::GetScheduleMinValue;
113 : using ScheduleManager::GetScheduleName;
114 : using namespace OutputReportPredefined;
115 : // SUBROUTINE PARAMETER DEFINITIONS:
116 769 : auto constexpr RoutineName("GetExteriorEnergyUseInput: ");
117 :
118 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
119 : int Item; // Item to be "gotten"
120 : int NumAlphas; // Number of Alphas for each GetObjectItem call
121 : int NumNumbers; // Number of Numbers for each GetObjectItem call
122 : int IOStatus; // Used in GetObjectItem
123 769 : bool ErrorsFound(false); // Set to true if errors in input, fatal at end of routine
124 : int NumFuelEq; // Temporary -- number of ExteriorFuelEquipment statements
125 : int NumWtrEq; // Temporary -- number of ExteriorWaterEquipment statements
126 1538 : std::string TypeString; // Fuel Type string (returned from Validation)
127 1538 : std::string EndUseSubcategoryName;
128 : Real64 SchMax; // Max value of schedule for item
129 : Real64 SchMin; // Min value of schedule for item
130 :
131 769 : state.dataExteriorEnergyUse->NumExteriorLights = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Exterior:Lights");
132 769 : state.dataExteriorEnergyUse->ExteriorLights.allocate(state.dataExteriorEnergyUse->NumExteriorLights);
133 :
134 769 : NumFuelEq = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Exterior:FuelEquipment");
135 769 : NumWtrEq = state.dataInputProcessing->inputProcessor->getNumObjectsFound(state, "Exterior:WaterEquipment");
136 769 : state.dataExteriorEnergyUse->ExteriorEquipment.allocate(NumFuelEq + NumWtrEq);
137 769 : state.dataExteriorEnergyUse->UniqueExteriorEquipNames.reserve(NumFuelEq + NumWtrEq);
138 :
139 769 : state.dataExteriorEnergyUse->GetExteriorEnergyInputFlag = false;
140 769 : state.dataExteriorEnergyUse->NumExteriorEqs = 0;
141 :
142 : // ================================= Get Exterior Lights
143 769 : auto &cCurrentModuleObject = state.dataIPShortCut->cCurrentModuleObject;
144 769 : cCurrentModuleObject = "Exterior:Lights";
145 951 : for (Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorLights; ++Item) {
146 1274 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
147 : cCurrentModuleObject,
148 : Item,
149 182 : state.dataIPShortCut->cAlphaArgs,
150 : NumAlphas,
151 182 : state.dataIPShortCut->rNumericArgs,
152 : NumNumbers,
153 : IOStatus,
154 182 : state.dataIPShortCut->lNumericFieldBlanks,
155 182 : state.dataIPShortCut->lAlphaFieldBlanks,
156 182 : state.dataIPShortCut->cAlphaFieldNames,
157 182 : state.dataIPShortCut->cNumericFieldNames);
158 182 : if (UtilityRoutines::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound)) continue;
159 :
160 182 : state.dataExteriorEnergyUse->ExteriorLights(Item).Name = state.dataIPShortCut->cAlphaArgs(1);
161 182 : state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr = GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(2));
162 182 : if (state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr == 0) {
163 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(2)) {
164 0 : ShowSevereError(state,
165 0 : std::string{RoutineName} + cCurrentModuleObject + ": " + state.dataIPShortCut->cAlphaFieldNames(2) +
166 0 : " is required, missing for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
167 0 : state.dataIPShortCut->cAlphaArgs(1));
168 : } else {
169 0 : ShowSevereError(state,
170 0 : std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(2) +
171 0 : " entered=" + state.dataIPShortCut->cAlphaArgs(2) + " for " + state.dataIPShortCut->cAlphaFieldNames(1) +
172 0 : '=' + state.dataIPShortCut->cAlphaArgs(1));
173 : }
174 0 : ErrorsFound = true;
175 : } else { // check min/max on schedule
176 182 : SchMin = GetScheduleMinValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr);
177 182 : SchMax = GetScheduleMaxValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr);
178 182 : if (SchMin < 0.0 || SchMax < 0.0) {
179 0 : if (SchMin < 0.0) {
180 0 : ShowSevereError(state,
181 0 : std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(2) +
182 0 : " minimum, is < 0.0 for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
183 0 : state.dataIPShortCut->cAlphaArgs(1));
184 0 : ShowContinueError(state,
185 0 : format("{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(2), SchMin));
186 0 : ErrorsFound = true;
187 : }
188 0 : if (SchMax < 0.0) {
189 0 : ShowSevereError(state,
190 0 : std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(2) +
191 0 : " maximum, is < 0.0 for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
192 0 : state.dataIPShortCut->cAlphaArgs(1));
193 0 : ShowContinueError(state,
194 0 : format("{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(2), SchMax));
195 0 : ErrorsFound = true;
196 : }
197 : }
198 : }
199 182 : if (state.dataIPShortCut->lAlphaFieldBlanks(3)) {
200 5 : state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::ScheduleOnly;
201 177 : } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(3), "ScheduleNameOnly")) {
202 12 : state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::ScheduleOnly;
203 165 : } else if (UtilityRoutines::SameString(state.dataIPShortCut->cAlphaArgs(3), "AstronomicalClock")) {
204 165 : state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode = ExteriorEnergyUse::LightControlType::AstroClockOverride;
205 : } else {
206 0 : ShowSevereError(state,
207 0 : std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(3) + '=' +
208 0 : state.dataIPShortCut->cAlphaArgs(3) + " for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
209 0 : state.dataIPShortCut->cAlphaArgs(1));
210 : }
211 :
212 182 : if (NumAlphas > 3) {
213 169 : EndUseSubcategoryName = state.dataIPShortCut->cAlphaArgs(4);
214 : } else {
215 13 : EndUseSubcategoryName = "General";
216 : }
217 :
218 182 : state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel = state.dataIPShortCut->rNumericArgs(1);
219 182 : if (state.dataGlobal->AnyEnergyManagementSystemInModel) {
220 280 : SetupEMSActuator(state,
221 : "ExteriorLights",
222 70 : state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
223 : "Electricity Rate",
224 : "W",
225 70 : state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorOn,
226 210 : state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorValue);
227 : }
228 :
229 728 : SetupOutputVariable(state,
230 : "Exterior Lights Electricity Rate",
231 : OutputProcessor::Unit::W,
232 182 : state.dataExteriorEnergyUse->ExteriorLights(Item).Power,
233 : OutputProcessor::SOVTimeStepType::Zone,
234 : OutputProcessor::SOVStoreType::Average,
235 364 : state.dataExteriorEnergyUse->ExteriorLights(Item).Name);
236 :
237 728 : SetupOutputVariable(state,
238 : "Exterior Lights Electricity Energy",
239 : OutputProcessor::Unit::J,
240 182 : state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse,
241 : OutputProcessor::SOVTimeStepType::Zone,
242 : OutputProcessor::SOVStoreType::Summed,
243 182 : state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
244 : _,
245 : "Electricity",
246 : "Exterior Lights",
247 182 : EndUseSubcategoryName);
248 :
249 : // entries for predefined tables
250 728 : PreDefTableEntry(state,
251 182 : state.dataOutRptPredefined->pdchExLtPower,
252 182 : state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
253 182 : state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel);
254 182 : state.dataExteriorEnergyUse->sumDesignLevel += state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel;
255 182 : if (state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode ==
256 : ExteriorEnergyUse::LightControlType::AstroClockOverride) { // photocell/schedule
257 330 : PreDefTableEntry(
258 330 : state, state.dataOutRptPredefined->pdchExLtClock, state.dataExteriorEnergyUse->ExteriorLights(Item).Name, "AstronomicalClock");
259 165 : PreDefTableEntry(state, state.dataOutRptPredefined->pdchExLtSchd, state.dataExteriorEnergyUse->ExteriorLights(Item).Name, "-");
260 : } else {
261 34 : PreDefTableEntry(
262 34 : state, state.dataOutRptPredefined->pdchExLtClock, state.dataExteriorEnergyUse->ExteriorLights(Item).Name, "Schedule");
263 51 : PreDefTableEntry(state,
264 17 : state.dataOutRptPredefined->pdchExLtSchd,
265 17 : state.dataExteriorEnergyUse->ExteriorLights(Item).Name,
266 34 : GetScheduleName(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr));
267 : }
268 : }
269 769 : PreDefTableEntry(state, state.dataOutRptPredefined->pdchExLtPower, "Exterior Lighting Total", state.dataExteriorEnergyUse->sumDesignLevel);
270 :
271 : // ================================= Get Exterior Fuel Equipment
272 :
273 769 : cCurrentModuleObject = "Exterior:FuelEquipment";
274 826 : for (Item = 1; Item <= NumFuelEq; ++Item) {
275 399 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
276 : cCurrentModuleObject,
277 : Item,
278 57 : state.dataIPShortCut->cAlphaArgs,
279 : NumAlphas,
280 57 : state.dataIPShortCut->rNumericArgs,
281 : NumNumbers,
282 : IOStatus,
283 57 : state.dataIPShortCut->lNumericFieldBlanks,
284 57 : state.dataIPShortCut->lAlphaFieldBlanks,
285 57 : state.dataIPShortCut->cAlphaFieldNames,
286 57 : state.dataIPShortCut->cNumericFieldNames);
287 57 : if (UtilityRoutines::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound)) continue;
288 114 : GlobalNames::VerifyUniqueInterObjectName(state,
289 57 : state.dataExteriorEnergyUse->UniqueExteriorEquipNames,
290 57 : state.dataIPShortCut->cAlphaArgs(1),
291 : cCurrentModuleObject,
292 57 : state.dataIPShortCut->cAlphaFieldNames(1),
293 : ErrorsFound);
294 :
295 57 : ++state.dataExteriorEnergyUse->NumExteriorEqs;
296 57 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Name = state.dataIPShortCut->cAlphaArgs(1);
297 :
298 57 : if (NumAlphas > 3) {
299 42 : EndUseSubcategoryName = state.dataIPShortCut->cAlphaArgs(4);
300 : } else {
301 15 : EndUseSubcategoryName = "General";
302 : }
303 :
304 57 : ExteriorEnergyUse::ValidateFuelType(state,
305 57 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).FuelType,
306 57 : state.dataIPShortCut->cAlphaArgs(2),
307 : TypeString,
308 : cCurrentModuleObject,
309 57 : state.dataIPShortCut->cAlphaFieldNames(2),
310 57 : state.dataIPShortCut->cAlphaArgs(2));
311 57 : if (state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).FuelType ==
312 : ExteriorEnergyUse::ExteriorFuelUsage::Invalid) {
313 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(2)) {
314 0 : ShowSevereError(state,
315 0 : std::string{RoutineName} + cCurrentModuleObject + ": " + state.dataIPShortCut->cAlphaFieldNames(2) +
316 0 : " is required, missing for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
317 0 : state.dataIPShortCut->cAlphaArgs(1));
318 : } else {
319 0 : ShowSevereError(state,
320 0 : std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(2) +
321 0 : " entered=" + state.dataIPShortCut->cAlphaArgs(2) + " for " + state.dataIPShortCut->cAlphaFieldNames(1) +
322 0 : '=' + state.dataIPShortCut->cAlphaArgs(1));
323 : }
324 0 : ErrorsFound = true;
325 : } else {
326 57 : if (state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).FuelType !=
327 : ExteriorEnergyUse::ExteriorFuelUsage::WaterUse) {
328 224 : SetupOutputVariable(state,
329 : "Exterior Equipment Fuel Rate",
330 : OutputProcessor::Unit::W,
331 56 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Power,
332 : OutputProcessor::SOVTimeStepType::Zone,
333 : OutputProcessor::SOVStoreType::Average,
334 112 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Name);
335 280 : SetupOutputVariable(state,
336 112 : "Exterior Equipment " + TypeString + " Energy",
337 : OutputProcessor::Unit::J,
338 56 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).CurrentUse,
339 : OutputProcessor::SOVTimeStepType::Zone,
340 : OutputProcessor::SOVStoreType::Summed,
341 56 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Name,
342 : _,
343 : TypeString,
344 : "ExteriorEquipment",
345 : EndUseSubcategoryName);
346 : } else {
347 4 : SetupOutputVariable(state,
348 : "Exterior Equipment Water Volume Flow Rate",
349 : OutputProcessor::Unit::m3_s,
350 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Power,
351 : OutputProcessor::SOVTimeStepType::Zone,
352 : OutputProcessor::SOVStoreType::Average,
353 2 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Name);
354 5 : SetupOutputVariable(state,
355 2 : "Exterior Equipment " + TypeString + " Volume",
356 : OutputProcessor::Unit::m3,
357 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).CurrentUse,
358 : OutputProcessor::SOVTimeStepType::Zone,
359 : OutputProcessor::SOVStoreType::Summed,
360 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Name,
361 : _,
362 : TypeString,
363 : "ExteriorEquipment",
364 : EndUseSubcategoryName);
365 : }
366 : }
367 57 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).SchedPtr =
368 57 : GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3));
369 57 : if (state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).SchedPtr == 0) {
370 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(3)) {
371 0 : ShowSevereError(state,
372 0 : std::string{RoutineName} + cCurrentModuleObject + ": " + state.dataIPShortCut->cAlphaFieldNames(3) +
373 0 : " is required, missing for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
374 0 : state.dataIPShortCut->cAlphaArgs(1));
375 : } else {
376 0 : ShowSevereError(state,
377 0 : std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(3) +
378 0 : " entered=" + state.dataIPShortCut->cAlphaArgs(3) + " for " + state.dataIPShortCut->cAlphaFieldNames(1) +
379 0 : '=' + state.dataIPShortCut->cAlphaArgs(1));
380 : }
381 0 : ErrorsFound = true;
382 : } else { // check min/max on schedule
383 57 : SchMin =
384 57 : GetScheduleMinValue(state, state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).SchedPtr);
385 57 : SchMax =
386 57 : GetScheduleMaxValue(state, state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).SchedPtr);
387 57 : if (SchMin < 0.0 || SchMax < 0.0) {
388 0 : if (SchMin < 0.0) {
389 0 : ShowSevereError(state,
390 0 : std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(3) +
391 0 : " minimum, is < 0.0 for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
392 0 : state.dataIPShortCut->cAlphaArgs(1));
393 0 : ShowContinueError(state,
394 0 : format("{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(3), SchMin));
395 0 : ErrorsFound = true;
396 : }
397 0 : if (SchMax < 0.0) {
398 0 : ShowSevereError(state,
399 0 : std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(3) +
400 0 : " maximum, is < 0.0 for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
401 0 : state.dataIPShortCut->cAlphaArgs(1));
402 0 : ShowContinueError(state,
403 0 : format("{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(3), SchMax));
404 0 : ErrorsFound = true;
405 : }
406 : }
407 : }
408 57 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).DesignLevel =
409 57 : state.dataIPShortCut->rNumericArgs(1);
410 : }
411 :
412 : // ================================= Get Exterior Water Equipment
413 :
414 769 : cCurrentModuleObject = "Exterior:WaterEquipment";
415 770 : for (Item = 1; Item <= NumWtrEq; ++Item) {
416 7 : state.dataInputProcessing->inputProcessor->getObjectItem(state,
417 : cCurrentModuleObject,
418 : Item,
419 1 : state.dataIPShortCut->cAlphaArgs,
420 : NumAlphas,
421 1 : state.dataIPShortCut->rNumericArgs,
422 : NumNumbers,
423 : IOStatus,
424 1 : state.dataIPShortCut->lNumericFieldBlanks,
425 1 : state.dataIPShortCut->lAlphaFieldBlanks,
426 1 : state.dataIPShortCut->cAlphaFieldNames,
427 1 : state.dataIPShortCut->cNumericFieldNames);
428 1 : if (UtilityRoutines::IsNameEmpty(state, state.dataIPShortCut->cAlphaArgs(1), cCurrentModuleObject, ErrorsFound)) continue;
429 2 : GlobalNames::VerifyUniqueInterObjectName(state,
430 1 : state.dataExteriorEnergyUse->UniqueExteriorEquipNames,
431 1 : state.dataIPShortCut->cAlphaArgs(1),
432 : cCurrentModuleObject,
433 1 : state.dataIPShortCut->cAlphaFieldNames(1),
434 : ErrorsFound);
435 :
436 1 : ++state.dataExteriorEnergyUse->NumExteriorEqs;
437 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Name = state.dataIPShortCut->cAlphaArgs(1);
438 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).FuelType =
439 : ExteriorEnergyUse::ExteriorFuelUsage::WaterUse;
440 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).SchedPtr =
441 1 : GetScheduleIndex(state, state.dataIPShortCut->cAlphaArgs(3));
442 1 : if (state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).SchedPtr == 0) {
443 0 : if (state.dataIPShortCut->lAlphaFieldBlanks(3)) {
444 0 : ShowSevereError(state,
445 0 : std::string{RoutineName} + cCurrentModuleObject + ": " + state.dataIPShortCut->cAlphaFieldNames(3) +
446 0 : " is required, missing for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
447 0 : state.dataIPShortCut->cAlphaArgs(1));
448 : } else {
449 0 : ShowSevereError(state,
450 0 : std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(3) +
451 0 : " entered=" + state.dataIPShortCut->cAlphaArgs(3) + " for " + state.dataIPShortCut->cAlphaFieldNames(1) +
452 0 : '=' + state.dataIPShortCut->cAlphaArgs(1));
453 : }
454 0 : ErrorsFound = true;
455 : } else { // check min/max on schedule
456 1 : SchMin =
457 1 : GetScheduleMinValue(state, state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).SchedPtr);
458 1 : SchMax =
459 1 : GetScheduleMaxValue(state, state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).SchedPtr);
460 1 : if (SchMin < 0.0 || SchMax < 0.0) {
461 0 : if (SchMin < 0.0) {
462 0 : ShowSevereError(state,
463 0 : std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(3) +
464 0 : " minimum, is < 0.0 for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
465 0 : state.dataIPShortCut->cAlphaArgs(1));
466 0 : ShowContinueError(state,
467 0 : format("{}\". Minimum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(3), SchMin));
468 0 : ErrorsFound = true;
469 : }
470 0 : if (SchMax < 0.0) {
471 0 : ShowSevereError(state,
472 0 : std::string{RoutineName} + cCurrentModuleObject + ": invalid " + state.dataIPShortCut->cAlphaFieldNames(3) +
473 0 : " maximum, is < 0.0 for " + state.dataIPShortCut->cAlphaFieldNames(1) + '=' +
474 0 : state.dataIPShortCut->cAlphaArgs(1));
475 0 : ShowContinueError(state,
476 0 : format("{}\". Maximum is [{:.1R}]. Values must be >= 0.0.", state.dataIPShortCut->cAlphaArgs(3), SchMax));
477 0 : ErrorsFound = true;
478 : }
479 : }
480 : }
481 :
482 1 : if (NumAlphas > 3) {
483 0 : EndUseSubcategoryName = state.dataIPShortCut->cAlphaArgs(4);
484 : } else {
485 1 : EndUseSubcategoryName = "General";
486 : }
487 :
488 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).DesignLevel =
489 1 : state.dataIPShortCut->rNumericArgs(1);
490 :
491 4 : SetupOutputVariable(state,
492 : "Exterior Equipment Water Volume Flow Rate",
493 : OutputProcessor::Unit::m3_s,
494 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Power,
495 : OutputProcessor::SOVTimeStepType::Zone,
496 : OutputProcessor::SOVStoreType::Average,
497 2 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Name);
498 :
499 4 : SetupOutputVariable(state,
500 : "Exterior Equipment Water Volume",
501 : OutputProcessor::Unit::m3,
502 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).CurrentUse,
503 : OutputProcessor::SOVTimeStepType::Zone,
504 : OutputProcessor::SOVStoreType::Summed,
505 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Name,
506 : _,
507 : "Water",
508 : "ExteriorEquipment",
509 1 : EndUseSubcategoryName);
510 4 : SetupOutputVariable(state,
511 : "Exterior Equipment Mains Water Volume",
512 : OutputProcessor::Unit::m3,
513 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).CurrentUse,
514 : OutputProcessor::SOVTimeStepType::Zone,
515 : OutputProcessor::SOVStoreType::Summed,
516 1 : state.dataExteriorEnergyUse->ExteriorEquipment(state.dataExteriorEnergyUse->NumExteriorEqs).Name,
517 : _,
518 : "MainsWater",
519 : "ExteriorEquipment",
520 1 : EndUseSubcategoryName);
521 : }
522 :
523 769 : if (ErrorsFound) {
524 0 : ShowFatalError(state, format("{}Errors found in input. Program terminates.", RoutineName));
525 : }
526 769 : }
527 :
528 59 : void ValidateFuelType(EnergyPlusData &state,
529 : ExteriorEnergyUse::ExteriorFuelUsage &FuelTypeNumber, // Fuel Type to be set in structure.
530 : std::string const &FuelTypeAlpha, // Fuel Type String
531 : std::string &FuelTypeString, // Standardized Fuel Type String (for variable naming)
532 : std::string const &CurrentModuleObject, // object being parsed
533 : std::string const &CurrentField, // current field being parsed
534 : std::string const &CurrentName // current object name being parsed
535 : )
536 : {
537 :
538 : // SUBROUTINE INFORMATION:
539 : // AUTHOR Linda K. Lawrie
540 : // DATE WRITTEN January 2001
541 : // MODIFIED na
542 : // RE-ENGINEERED na
543 :
544 : // PURPOSE OF THIS SUBROUTINE:
545 : // This subroutine compares the input Fuel Type value against the
546 : // valid values and sets the correct in the returned FuelTypeNumber.
547 :
548 : // SUBROUTINE PARAMETER DEFINITIONS:
549 : static constexpr std::string_view RoutineName("ValidateFuelType: ");
550 :
551 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
552 :
553 59 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::Invalid;
554 59 : FuelTypeString = "";
555 :
556 : // Select the correct Number for the associated ascii name for the fuel type
557 59 : if (UtilityRoutines::SameString(FuelTypeAlpha, "Electricity")) {
558 45 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::ElecUse;
559 45 : FuelTypeString = "Electricity";
560 14 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "NaturalGas")) {
561 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::GasUse;
562 1 : FuelTypeString = "NaturalGas";
563 13 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "Coal")) {
564 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::CoalUse;
565 1 : FuelTypeString = "Coal";
566 12 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "FuelOilNo1")) {
567 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::FuelOil1Use;
568 1 : FuelTypeString = "FuelOilNo1";
569 11 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "Propane")) {
570 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::PropaneUse;
571 1 : FuelTypeString = "Propane";
572 10 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "Gasoline")) {
573 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::GasolineUse;
574 1 : FuelTypeString = "Gasoline";
575 9 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "Diesel")) {
576 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::DieselUse;
577 1 : FuelTypeString = "Diesel";
578 8 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "FuelOilNo2")) {
579 2 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::FuelOil2Use;
580 2 : FuelTypeString = "FuelOilNo2";
581 6 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "OtherFuel1")) {
582 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::OtherFuel1Use;
583 1 : FuelTypeString = "OtherFuel1";
584 5 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "OtherFuel2")) {
585 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::OtherFuel1Use;
586 1 : FuelTypeString = "OtherFuel2";
587 4 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "Water")) {
588 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::WaterUse;
589 1 : FuelTypeString = "Water";
590 3 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "Steam")) {
591 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::SteamUse;
592 1 : FuelTypeString = "Steam";
593 2 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "DistrictCooling")) {
594 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::DistrictCoolUse;
595 1 : FuelTypeString = "DistrictCooling";
596 1 : } else if (UtilityRoutines::SameString(FuelTypeAlpha, "DistrictHeating")) {
597 1 : FuelTypeNumber = ExteriorEnergyUse::ExteriorFuelUsage::DistrictHeatUse;
598 1 : FuelTypeString = "DistrictHeating";
599 : } else {
600 0 : ShowSevereError(state, std::string{RoutineName} + CurrentModuleObject + "=\"" + CurrentName + "\".");
601 0 : ShowFatalError(state, "Heating source/fuel type not recognized. Check input field " + CurrentField + "=\"" + FuelTypeAlpha);
602 : }
603 59 : }
604 :
605 1785085 : void ReportExteriorEnergyUse(EnergyPlusData &state)
606 : {
607 :
608 : // SUBROUTINE INFORMATION:
609 : // AUTHOR Linda Lawrie
610 : // DATE WRITTEN January 2001
611 : // MODIFIED na
612 : // RE-ENGINEERED na
613 :
614 : // PURPOSE OF THIS SUBROUTINE:
615 : // This subroutine performs the calculations necessary to report
616 : // the exterior energy use types.
617 :
618 : // METHODOLOGY EMPLOYED:
619 : // na
620 :
621 : // REFERENCES:
622 : // na
623 :
624 : // Using/Aliasing
625 : using ScheduleManager::GetCurrentScheduleValue;
626 :
627 : // Locals
628 : // SUBROUTINE ARGUMENT DEFINITIONS:
629 : // na
630 :
631 : // SUBROUTINE PARAMETER DEFINITIONS:
632 : // na
633 :
634 : // INTERFACE BLOCK SPECIFICATIONS:
635 : // na
636 :
637 : // DERIVED TYPE DEFINITIONS:
638 : // na
639 :
640 : // SUBROUTINE LOCAL VARIABLE DECLARATIONS:
641 : int Item; // Loop Control
642 :
643 2260505 : for (Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorLights; ++Item) {
644 475420 : switch (state.dataExteriorEnergyUse->ExteriorLights(Item).ControlMode) {
645 35077 : case ExteriorEnergyUse::LightControlType::ScheduleOnly:
646 35077 : state.dataExteriorEnergyUse->ExteriorLights(Item).Power =
647 70154 : state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel *
648 35077 : GetCurrentScheduleValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr);
649 35077 : state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
650 35077 : state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
651 35077 : break;
652 440343 : case ExteriorEnergyUse::LightControlType::AstroClockOverride:
653 440343 : if (state.dataEnvrn->SunIsUp) {
654 215225 : state.dataExteriorEnergyUse->ExteriorLights(Item).Power = 0.0;
655 215225 : state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse = 0.0;
656 : } else {
657 225118 : state.dataExteriorEnergyUse->ExteriorLights(Item).Power =
658 450236 : state.dataExteriorEnergyUse->ExteriorLights(Item).DesignLevel *
659 225118 : GetCurrentScheduleValue(state, state.dataExteriorEnergyUse->ExteriorLights(Item).SchedPtr);
660 225118 : state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
661 225118 : state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
662 : }
663 440343 : break;
664 0 : default:
665 : // should not happen
666 0 : break;
667 : }
668 :
669 : // Reduce lighting power due to demand limiting
670 475640 : if (state.dataExteriorEnergyUse->ExteriorLights(Item).ManageDemand &&
671 220 : (state.dataExteriorEnergyUse->ExteriorLights(Item).Power > state.dataExteriorEnergyUse->ExteriorLights(Item).DemandLimit)) {
672 220 : state.dataExteriorEnergyUse->ExteriorLights(Item).Power = state.dataExteriorEnergyUse->ExteriorLights(Item).DemandLimit;
673 220 : state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
674 220 : state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
675 : }
676 : // EMS controls
677 475420 : if (state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorOn)
678 0 : state.dataExteriorEnergyUse->ExteriorLights(Item).Power = state.dataExteriorEnergyUse->ExteriorLights(Item).PowerActuatorValue;
679 :
680 475420 : state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse =
681 475420 : state.dataExteriorEnergyUse->ExteriorLights(Item).Power * state.dataGlobal->TimeStepZoneSec;
682 :
683 : // gather for tabular reports
684 475420 : if (!state.dataGlobal->WarmupFlag) {
685 : // IF (DoOutputReporting .AND. WriteTabularFiles .and. (KindOfSim == ksRunPeriodWeather)) THEN !for weather simulations only
686 111086 : if (state.dataGlobal->DoOutputReporting &&
687 55543 : (state.dataGlobal->KindOfSim == DataGlobalConstants::KindOfSim::RunPeriodWeather)) { // for weather simulations only
688 : // for tabular report, accumua the total electricity used for each ExteriorLights object
689 0 : state.dataExteriorEnergyUse->ExteriorLights(Item).SumConsumption += state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse;
690 : // for tabular report, accumulate the time when each ExteriorLights has consumption
691 : //(using a very small threshold instead of zero)
692 0 : if (state.dataExteriorEnergyUse->ExteriorLights(Item).CurrentUse > 0.01) {
693 0 : state.dataExteriorEnergyUse->ExteriorLights(Item).SumTimeNotZeroCons += state.dataGlobal->TimeStepZone;
694 : }
695 : }
696 : }
697 : }
698 :
699 1897831 : for (Item = 1; Item <= state.dataExteriorEnergyUse->NumExteriorEqs; ++Item) {
700 112746 : state.dataExteriorEnergyUse->ExteriorEquipment(Item).Power =
701 225492 : state.dataExteriorEnergyUse->ExteriorEquipment(Item).DesignLevel *
702 112746 : GetCurrentScheduleValue(state, state.dataExteriorEnergyUse->ExteriorEquipment(Item).SchedPtr);
703 112746 : state.dataExteriorEnergyUse->ExteriorEquipment(Item).CurrentUse =
704 112746 : state.dataExteriorEnergyUse->ExteriorEquipment(Item).Power * state.dataGlobal->TimeStepZoneSec;
705 : }
706 1785085 : }
707 :
708 : } // namespace ExteriorEnergyUse
709 :
710 2313 : } // namespace EnergyPlus
|